Skip to content
Browse files

Commoting before refactoring.

  • Loading branch information...
1 parent b3ab198 commit 7b496a91ef448e143e55d279696f6be1638a5079 @andycamp committed
Showing with 57 additions and 36 deletions.
  1. +1 −1 README.md
  2. +1 −26 bin/orasaurus
  3. +55 −9 lib/orasaurus/cli.rb
View
2 README.md
@@ -19,7 +19,7 @@ Install the gem
From the command-line, navigate to the directory that contains your application, then run the following command.
-`orasaurus generate_build_scripts`
+`orasaurus generate --build_scripts`
When you run the generator, Orasaurus, examines all directories looking for files with the following extensions: `.pkg, .pks, .pkb, .sql, .trg`. Each of the buildable files is added to a build script that is placed in each directory. These scripts can be generated over and over as you develop.
View
27 bin/orasaurus
@@ -2,29 +2,4 @@
require 'thor'
require File.dirname(__FILE__) + '/../lib/orasaurus.rb'
-class OraThauruth < Thor
-
- include Thor::Actions
-
- map "-v" => :version
- map "-h" => :help
-
- desc "generate_build_scripts", "generate sqlplus build scripts for the current directory."
- method_options :build_script_name => :string, :teardown_script_name => :string
- def generate_build_scripts
- build_script_name = options[:build_script_name]||"build.sql"
- teardown_script_name = options[:teardown_script_name]||"teardown.sql"
-
- say "generating build scripts"
- s = Orasaurus::ScriptBuilder.new( '.' )
- s.build_all_scripts( build_script_name, teardown_script_name )
- end
-
- desc "version", "Currently installed version of Orasaurus."
- def version
- puts "Orasarus v"+Orasaurus::VERSION
- end
-
-end
-
-OraThauruth.start
+Orasaurus::CLI.start
View
64 lib/orasaurus/cli.rb
@@ -1,16 +1,62 @@
require 'highline'
-
+require 'thor'
+require 'version'
+
class Orasaurus
- module Cli
-
- def process_db_connect_params(db_name, db_user, db_password)
- params = Hash.new
- params[:db_name] = db_name||ask("Database Name? ") { |q| q.echo = true }
- params[:db_user] = db_user||ask("Database User? ") { |q| q.echo = true }
- params[:db_password] = db_password||ask("Database Password? ") { |q| q.echo = true }
- return params
+ class CLI < Thor
+
+ module Helpers
+
+ def process_db_connect_params(db_name, db_user, db_password)
+ params = Hash.new
+ params[:db_name] = db_name||ask("Database Name? ") { |q| q.echo = true }
+ params[:db_user] = db_user||ask("Database User? ") { |q| q.echo = true }
+ params[:db_password] = db_password||ask("Database Password? ") { |q| q.echo = true }
+ return params
+ end
+
+ end
+
+ include Thor::Actions
+
+ map "-v" => :version
+ map "-h" => :help
+ map "-g" => :generate
+
+ desc "version", "Currently installed version of Orasaurus."
+ def version
+ puts "Orasarus v"+Orasaurus::VERSION
end
+
+ class Generate < Thor::Group
+ argument :script_type, :type => :string, :desc => "Use build, teardown, or all."
+ desc "generate scripts", "generate sqlplus scripts."
+
+ def generate(script_type)
+
+
+
+ build_script_name = options[:build_script_name]||"build.sql"
+ teardown_script_name = options[:teardown_script_name]||"teardown.sql"
+
+ say "generating build scripts"
+ s = Orasaurus.new( '.' )
+ s.build_all_scripts( build_script_name, teardown_script_name )
+ end
+
+ desc "generate_build_scripts", "generate sqlplus build scripts for the current directory."
+ method_options :build_script_name => :string, :teardown_script_name => :string
+ def teardown_scripts
+ build_script_name = options[:build_script_name]||"build.sql"
+ teardown_script_name = options[:teardown_script_name]||"teardown.sql"
+
+ say "generating build scripts"
+ s = Orasaurus::ScriptBuilder.new( '.' )
+ s.build_all_scripts( build_script_name, teardown_script_name )
+ end
+
+ end
end

0 comments on commit 7b496a9

Please sign in to comment.
Something went wrong with that request. Please try again.