-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor into more modular code and add specs
- Loading branch information
nikola
committed
Jan 30, 2017
1 parent
75fbfa7
commit 7246362
Showing
47 changed files
with
1,072 additions
and
925 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,58 @@ | ||
#!/usr/bin/env ruby | ||
|
||
# require 'dumbo' | ||
require File.join(File.dirname(__FILE__), '..', 'lib', 'dumbo.rb') | ||
# $LOAD_PATH.unshift File.expand_path(File.join('..', 'lib'), __FILE__) | ||
require 'dumbo' | ||
|
||
module Dumbo | ||
class Cli < Thor | ||
desc 'new <name> [initial_version] [extension_comment]', 'Create a new PostgreSQL extension skeleton' | ||
def new(name, initial_version = '0.0.1', extension_comment = 'My awesome extension') | ||
# TODO validate initial_version if passed | ||
|
||
Dumbo::Commands::New.exec(name, initial_version, extension_comment, &print) | ||
say("Now building the extension SQL file.") | ||
Dir.chdir(name) | ||
Dumbo::Commands::Build.exec(&print) | ||
Dir.chdir('..') | ||
end | ||
|
||
desc 'build', 'Concatinate SQL files into the extension\' SQL file in format `extname--1.0.1.sql`' | ||
def build | ||
Dumbo::Commands::Build.exec(&print) | ||
end | ||
|
||
desc 'bump [major|minor|patch]', 'Bump the version level on the extension\'s extname.control file' | ||
def bump(level = 'patch') | ||
level = level.downcase | ||
|
||
error unless ['major', 'minor', 'patch'].include?(level) | ||
|
||
Dumbo::Commands::Bump.exec(level, &print) | ||
|
||
say("Updated #{Extension.control_file} to version #{Extension.version}") | ||
end | ||
|
||
desc 'migrations', 'Compare the last two versions of the extension and build migration files' | ||
def migrations | ||
if !Dumbo.boot('development') | ||
return | ||
end | ||
|
||
Dumbo::Commands::Migrations.exec(&print) | ||
end | ||
|
||
no_commands do | ||
def print | ||
Proc.new do |status, path, colour| | ||
if colour.nil? | ||
say_status(status, path) | ||
else | ||
say_status(status, path, colour) | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end | ||
|
||
Dumbo::Cli.start(ARGV) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ Gem::Specification.new do |spec| | |
spec.version = Dumbo::VERSION | ||
spec.authors = ['Manuel Kniep'] | ||
spec.email = ['[email protected]'] | ||
spec.summary = %q{postgres extension with fun} | ||
spec.summary = %q{PostgreSQL extensions with fun} | ||
spec.homepage = 'https://github.com/adjust/dumbo' | ||
spec.license = 'MIT' | ||
|
||
|
@@ -18,6 +18,8 @@ Gem::Specification.new do |spec| | |
spec.require_paths = ['lib'] | ||
|
||
spec.add_dependency 'erubis', '~> 2.7' | ||
spec.add_dependency 'pg', '~> 0.17' | ||
spec.add_dependency 'pg', '~> 0.19' | ||
spec.add_dependency 'thor', '~> 0.19' | ||
|
||
spec.required_ruby_version = '>= 2.0.0' | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.