orasaurus 0.0.4 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/.gitignore CHANGED
@@ -2,3 +2,4 @@
2
2
  .bundle
3
3
  Gemfile.lock
4
4
  pkg/*
5
+ .DS_Store
data/.rvmrc ADDED
@@ -0,0 +1,55 @@
1
+ #!/usr/bin/env bash
2
+
3
+ # This is an RVM Project .rvmrc file, used to automatically load the ruby
4
+ # development environment upon cd'ing into the directory
5
+
6
+ # First we specify our desired <ruby>[@<gemset>], the @gemset name is optional.
7
+ environment_id="ruby-1.9.2-p290@orasaurus"
8
+
9
+ #
10
+ # Uncomment following line if you want options to be set only for given project.
11
+ #
12
+ # PROJECT_JRUBY_OPTS=( --1.9 )
13
+
14
+ #
15
+ # First we attempt to load the desired environment directly from the environment
16
+ # file. This is very fast and efficient compared to running through the entire
17
+ # CLI and selector. If you want feedback on which environment was used then
18
+ # insert the word 'use' after --create as this triggers verbose mode.
19
+ #
20
+ if [[ -d "${rvm_path:-$HOME/.rvm}/environments" \
21
+ && -s "${rvm_path:-$HOME/.rvm}/environments/$environment_id" ]]
22
+ then
23
+ \. "${rvm_path:-$HOME/.rvm}/environments/$environment_id"
24
+
25
+ if [[ -s "${rvm_path:-$HOME/.rvm}/hooks/after_use" ]]
26
+ then
27
+ . "${rvm_path:-$HOME/.rvm}/hooks/after_use"
28
+ fi
29
+ else
30
+ # If the environment file has not yet been created, use the RVM CLI to select.
31
+ if ! rvm --create "$environment_id"
32
+ then
33
+ echo "Failed to create RVM environment '${environment_id}'."
34
+ exit 1
35
+ fi
36
+ fi
37
+
38
+ #
39
+ # If you use an RVM gemset file to install a list of gems (*.gems), you can have
40
+ # it be automatically loaded. Uncomment the following and adjust the filename if
41
+ # necessary.
42
+ #
43
+ # filename=".gems"
44
+ # if [[ -s "$filename" ]]
45
+ # then
46
+ # rvm gemset import "$filename" | grep -v already | grep -v listed | grep -v complete | sed '/^$/d'
47
+ # fi
48
+
49
+ # If you use bundler, this might be useful to you:
50
+ # if command -v bundle && [[ -s Gemfile ]]
51
+ # then
52
+ # bundle install
53
+ # fi
54
+
55
+
data/.vagrant ADDED
@@ -0,0 +1 @@
1
+ {"active":{"default":"50a274be-4503-4f20-87c9-9ec489041bb2"}}
data/README.md ADDED
@@ -0,0 +1,33 @@
1
+ Orasaurus
2
+ =========
3
+ A super simple framework for building Oracle databases.
4
+ -------------------------------------------------------
5
+
6
+ Orasaurus is a powerful SQL*Plus script generator.
7
+
8
+ Requirements
9
+ ------------
10
+
11
+ To get the most out of the generated scripts, you should have SQL*plus installed and configured for the command-line. [Instructions](http://download.oracle.com/docs/cd/B10501_01/server.920/a90842/ch4.htm).
12
+
13
+ Usage
14
+ -----
15
+
16
+ Install the gem
17
+
18
+ `gem install orasaurus`
19
+
20
+ From the command-line, navigate to the directory that contains your application, then run the following command.
21
+
22
+ `orasaurus generate path_to_your_code`
23
+
24
+ When you run the generator, Orasaurus, examines all directories looking for files with the following extensions: `.pkg .pks .pkb .sql .trg .prc. fnc .vw`. 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.
25
+
26
+ You can also use the underlying code,as you see fit. The ruby docs are [here](http://rubydoc.info/gems/orasaurus/0.0.4/frames).
27
+
28
+ There is command-line help, as well: `orasaurus help`.
29
+
30
+ Coming Soon
31
+ -----------
32
+
33
+ I will be adding features that will allow Orasaurus to generate the build scripts in the proper order, and automation for executing the build and evaluating the results (i.e. were there errors).
data/Vagrantfile ADDED
@@ -0,0 +1,88 @@
1
+ Vagrant::Config.run do |config|
2
+ # All Vagrant configuration is done here. The most common configuration
3
+ # options are documented and commented below. For a complete reference,
4
+ # please see the online documentation at vagrantup.com.
5
+
6
+ # Every Vagrant virtual environment requires a box to build off of.
7
+ config.vm.box = "lucid32ora"
8
+
9
+ # The url from where the 'config.vm.box' box will be fetched if it
10
+ # doesn't already exist on the user's system.
11
+ # config.vm.box_url = "http://domain.com/path/to/above.box"
12
+
13
+ # Boot with a GUI so you can see the screen. (Default is headless)
14
+ # config.vm.boot_mode = :gui
15
+
16
+ # Assign this VM to a host only network IP, allowing you to access it
17
+ # via the IP.
18
+ config.vm.network "33.33.33.99"
19
+
20
+ # Forward a port from the guest to the host, which allows for outside
21
+ # computers to access the VM, whereas host only networking does not.
22
+ # config.vm.forward_port "http", 80, 8080
23
+ config.vm.forward_port "apex", 8888, 8888
24
+ config.vm.forward_port "xe", 1521, 1521
25
+
26
+ # Share an additional folder to the guest VM. The first argument is
27
+ # an identifier, the second is the path on the guest to mount the
28
+ # folder, and the third is the path on the host to the actual folder.
29
+ # config.vm.share_folder "v-data", "/vagrant_data", "../data"
30
+
31
+ # Enable provisioning with Puppet stand alone. Puppet manifests
32
+ # are contained in a directory path relative to this Vagrantfile.
33
+ # You will need to create the manifests directory and a manifest in
34
+ # the file base.pp in the manifests_path directory.
35
+ #
36
+ # An example Puppet manifest to provision the message of the day:
37
+ #
38
+ # # group { "puppet":
39
+ # # ensure => "present",
40
+ # # }
41
+ # #
42
+ # # File { owner => 0, group => 0, mode => 0644 }
43
+ # #
44
+ # # file { '/etc/motd':
45
+ # # content => "Welcome to your Vagrant-built virtual machine!
46
+ # # Managed by Puppet.\n"
47
+ # # }
48
+ #
49
+ # config.vm.provision :puppet do |puppet|
50
+ # puppet.manifests_path = "manifests"
51
+ # puppet.manifest_file = "base.pp"
52
+ # end
53
+
54
+ # Enable provisioning with chef solo, specifying a cookbooks path (relative
55
+ # to this Vagrantfile), and adding some recipes and/or roles.
56
+ #
57
+ # config.vm.provision :chef_solo do |chef|
58
+ # chef.cookbooks_path = "cookbooks"
59
+ # chef.add_recipe "mysql"
60
+ # chef.add_role "web"
61
+ #
62
+ # # You may also specify custom JSON attributes:
63
+ # chef.json = { :mysql_password => "foo" }
64
+ # end
65
+
66
+ # Enable provisioning with chef server, specifying the chef server URL,
67
+ # and the path to the validation key (relative to this Vagrantfile).
68
+ #
69
+ # The Opscode Platform uses HTTPS. Substitute your organization for
70
+ # ORGNAME in the URL and validation key.
71
+ #
72
+ # If you have your own Chef Server, use the appropriate URL, which may be
73
+ # HTTP instead of HTTPS depending on your configuration. Also change the
74
+ # validation key to validation.pem.
75
+ #
76
+ # config.vm.provision :chef_client do |chef|
77
+ # chef.chef_server_url = "https://api.opscode.com/organizations/ORGNAME"
78
+ # chef.validation_key_path = "ORGNAME-validator.pem"
79
+ # end
80
+ #
81
+ # If you're using the Opscode platform, your validator client is
82
+ # ORGNAME-validator, replacing ORGNAME with your organization name.
83
+ #
84
+ # IF you have your own Chef Server, the default validation client name is
85
+ # chef-validator, unless you changed the configuration.
86
+ #
87
+ # chef.validation_client_name = "ORGNAME-validator"
88
+ end
data/bin/orasaurus CHANGED
@@ -2,29 +2,4 @@
2
2
  require 'thor'
3
3
  require File.dirname(__FILE__) + '/../lib/orasaurus.rb'
4
4
 
5
- class OraThauruth < Thor
6
-
7
- include Thor::Actions
8
-
9
- map "-v" => :version
10
- map "-h" => :help
11
-
12
- desc "generate_build_scripts", "generate sqlplus build scripts for the current directory."
13
- method_options :build_script_name => :string, :teardown_script_name => :string
14
- def generate_build_scripts
15
- build_script_name = options[:build_script_name]||"build.sql"
16
- teardown_script_name = options[:teardown_script_name]||"teardown.sql"
17
-
18
- say "generating build scripts"
19
- s = Orasaurus::ScriptBuilder.new( '.' )
20
- s.build_all_scripts( build_script_name, teardown_script_name )
21
- end
22
-
23
- desc "version", "Currently installed version of Orasaurus."
24
- def version
25
- puts "Orasarus v"+Orasaurus::VERSION
26
- end
27
-
28
- end
29
-
30
- OraThauruth.start
5
+ Orasaurus::CLI.start
data/config/default.rb ADDED
@@ -0,0 +1,11 @@
1
+
2
+ Orasaurus.configure do |config|
3
+
4
+ config.ignore_directories = %w( )
5
+ config.build_file_name = 'build.sql'
6
+ config.build_log_file_name = 'build.log'
7
+ config.teardown_file_name = 'teardown.sql'
8
+ config.teardown_log_file_name = 'teardown.log'
9
+ config.buildable_file_extensions = %w( .pkg .pks .pkb .sql .trg .prc. fnc .vw )
10
+
11
+ end
@@ -0,0 +1,82 @@
1
+ require 'orasaurus/configuration'
2
+ require 'orasaurus/generator'
3
+
4
+ module Orasaurus
5
+
6
+ class Application
7
+
8
+ attr_accessor :config,:name,:base_dir, :build_dirs
9
+
10
+ def initialize(name,base_dir)
11
+ @name = name
12
+ if File.directory? base_dir
13
+ @base_dir = base_dir
14
+ else
15
+ raise "Directory not found."
16
+ end
17
+ @config = Orasaurus::Configuration.default
18
+ @build_dirs = fill_build_dirs
19
+ @builders = []
20
+ puts "Orasaurus has been awakened."
21
+ puts "Build Dirs: #{@build_dirs.to_s}"
22
+ end
23
+
24
+ def ignore_filenames
25
+ files = %w{ @config.build_file_name @config.build_log_file_name @config.teardown_file_name @config.teardown_log_file_name }
26
+ end
27
+
28
+ def generate(type)
29
+ if [:build_scripts,:teardown_scripts].include? type.to_sym
30
+ puts "generating #{type}"
31
+ generate_scripts(type)
32
+ else
33
+ puts "Don't know how to generate " + type.to_s
34
+ end
35
+ end
36
+
37
+ def get_build_items(dir)
38
+ buildable_items = Array.new
39
+ search_list = Dir.glob(dir + "/*.*" )
40
+ search_list.each do |f|
41
+ #TODO refactor to regex
42
+ if File.file?( f ) \
43
+ and not ignore_filenames.include?(File.basename(f)) \
44
+ and @config.buildable_file_extensions.include?(File.extname(f)) \
45
+ then
46
+ buildable_items.push(File.basename(f))
47
+ end
48
+ end
49
+ puts "#{dir} build_items: #{buildable_items.to_s}"
50
+ return buildable_items
51
+ end
52
+
53
+ def generate_scripts(type)
54
+ if @build_dirs.length > 0 then
55
+ @build_dirs.each do |dir|
56
+ case type
57
+ when :build_scripts
58
+ Orasaurus::SqlBuildGenerator.new(dir,dir,config.build_file_name,get_build_items(dir)).generate
59
+ when :teardown_scripts
60
+ Orasaurus::SqlTeardownGenerator.new(dir,dir,config.teardown_file_name,get_build_items(dir)).generate
61
+ end
62
+ end
63
+ else
64
+ puts "nothing found to work on."
65
+ end
66
+ end
67
+
68
+ protected
69
+
70
+ def fill_build_dirs
71
+ buildable_dirs = Array.new
72
+ Find.find(@base_dir) do |f|
73
+ if File.directory?(f)
74
+ buildable_dirs.push(f) unless @config.ignore_directories.include?(f.split("/").pop)
75
+ end
76
+ end
77
+ return buildable_dirs
78
+ end
79
+
80
+ end
81
+
82
+ end
data/lib/orasaurus/cli.rb CHANGED
@@ -1,17 +1,83 @@
1
1
  require 'highline'
2
-
2
+ require 'thor'
3
+ require 'orasaurus/version'
4
+ require 'orasaurus/application'
5
+
3
6
  module Orasaurus
4
7
 
5
- module Cli
6
-
7
- def process_db_connect_params(db_name, db_user, db_password)
8
- params = Hash.new
9
- params[:db_name] = db_name||ask("Database Name? ") { |q| q.echo = true }
10
- params[:db_user] = db_user||ask("Database User? ") { |q| q.echo = true }
11
- params[:db_password] = db_password||ask("Database Password? ") { |q| q.echo = true }
12
- return params
8
+ class CLI < Thor
9
+
10
+ module Helpers
11
+
12
+ def process_db_connect_params(db_name, db_user, db_password)
13
+ params = Hash.new
14
+ params[:db_name] = db_name||ask("Database Name? ") { |q| q.echo = true }
15
+ params[:db_user] = db_user||ask("Database User? ") { |q| q.echo = true }
16
+ params[:db_password] = db_password||ask("Database Password? ") { |q| q.echo = true }
17
+ return params
18
+ end
19
+
13
20
  end
14
-
21
+
22
+ include Thor::Actions
23
+
24
+ map "-v" => :version
25
+ map "-h" => :help
26
+ map "-g" => :generate
27
+
28
+ desc "generate [SCRIPT_TYPE]", "Generate scripts. SCRIPT_TYPE is optional. Valid values are build_scripts, teardown_scripts and all."
29
+ method_option :base_dir, :type => :string, :default => ".", :desc => "Base Directory for your code. Defaults to your current location.", :optional => true
30
+ def generate(script_type=:all)
31
+ puts "generate " + script_type.to_s + " #{options.base_dir}"
32
+ a = Orasaurus::Application.new("cli",options.base_dir)
33
+
34
+ if [:build_scripts,:all].include? script_type.to_sym then
35
+ puts "generating build scrtipts"
36
+ a.generate(:build_scripts)
37
+ end
38
+
39
+ if [:teardown_scripts,:all].include? script_type.to_sym then
40
+ puts "generating teardown scripts"
41
+ a.generate(:teardown_scripts)
42
+ end
43
+
44
+ end
45
+
46
+ desc "version", "Currently running version of Orasaurus."
47
+ def version
48
+ puts "Orasarus v"+Orasaurus::VERSION
49
+ end
50
+
15
51
  end
52
+ =begin
53
+ class Generate < Thor::Group
54
+ argument :script_type, :type => :string, :desc => "Use build, teardown, or all."
55
+ desc "generate scripts", "generate sqlplus scripts."
16
56
 
57
+ def generate(script_type)
58
+
59
+
60
+
61
+ build_script_name = options[:build_script_name]||"build.sql"
62
+ teardown_script_name = options[:teardown_script_name]||"teardown.sql"
63
+
64
+ say "generating build scripts"
65
+ s = Orasaurus.new( '.' )
66
+ s.build_all_scripts( build_script_name, teardown_script_name )
67
+ end
68
+
69
+ desc "generate_build_scripts", "generate sqlplus build scripts for the current directory."
70
+ method_options :build_script_name => :string, :teardown_script_name => :string
71
+ def teardown_scripts
72
+ build_script_name = options[:build_script_name]||"build.sql"
73
+ teardown_script_name = options[:teardown_script_name]||"teardown.sql"
74
+
75
+ say "generating build scripts"
76
+ s = Orasaurus::ScriptBuilder.new( '.' )
77
+ s.build_all_scripts( build_script_name, teardown_script_name )
78
+ end
79
+
80
+ end
81
+ =end
82
+
17
83
  end
@@ -0,0 +1,50 @@
1
+
2
+ module Orasaurus
3
+
4
+ class Configuration
5
+
6
+ def initialize(data={})
7
+ @data = {}
8
+ update!(data)
9
+ end
10
+
11
+ def update!(data)
12
+ data.each do |key, value|
13
+ self[key] = value
14
+ end
15
+ end
16
+
17
+ def [](key)
18
+ @data[key.to_sym]
19
+ end
20
+
21
+ def []=(key, value)
22
+ if value.class == Hash
23
+ @data[key.to_sym] = Configuration.new(value)
24
+ else
25
+ @data[key.to_sym] = value
26
+ end
27
+ end
28
+
29
+ def method_missing(sym, *args)
30
+ if sym.to_s =~ /(.+)=$/
31
+ self[$1] = args.first
32
+ else
33
+ self[sym]
34
+ end
35
+ end
36
+
37
+ def self.default
38
+ config = Configuration.new
39
+ config.ignore_directories = %w( )
40
+ config.build_file_name = 'build.sql'
41
+ config.build_log_file_name = 'build.log'
42
+ config.teardown_file_name = 'teardown.sql'
43
+ config.teardown_log_file_name = 'teardown.log'
44
+ config.buildable_file_extensions = %w( .pkg .pks .pkb .sql .trg .prc. fnc .vw )
45
+ return config
46
+ end
47
+
48
+ end
49
+
50
+ end
@@ -0,0 +1,142 @@
1
+ require 'find'
2
+ require 'erb'
3
+
4
+ module Orasaurus
5
+
6
+ # === A basic class used for generating files.
7
+
8
+ class Generator
9
+
10
+ attr_reader :name, :build_list
11
+ attr_accessor :output_path, :output_file_name
12
+
13
+ def initialize(name,output_path,output_file_name,build_list)
14
+ @name = name
15
+ @output_path = output_path
16
+ @output_file_name = output_file_name
17
+ @build_list = build_list
18
+ end
19
+
20
+ def generate
21
+ puts "undefined"
22
+ end
23
+
24
+ def full_output_file_name
25
+ @output_path + '/' + @output_file_name
26
+ end
27
+
28
+ end
29
+
30
+ class SqlBuildGenerator < Generator
31
+
32
+ def generate
33
+
34
+ if @build_list.empty? then
35
+ puts "nothing in build list. no need for build file."
36
+ else
37
+
38
+ puts "processing erb for #{@build_list}"
39
+
40
+ build_template = %q{
41
+ SET SERVEROUTPUT ON
42
+ SET DEFINE OFF
43
+ SPOOL <%=@output_file_name%>.log
44
+
45
+ PROMPT
46
+ PROMPT *****************************GETTING STARTED************************
47
+ PROMPT
48
+ /
49
+ BEGIN DBMS_OUTPUT.PUT_LINE( 'BEGIN TIME: '||TO_CHAR( SYSDATE, 'MM/DD/YYYY HH:MI:SS' ) ); END;
50
+ /
51
+
52
+ <% @build_list.each do |item| %>
53
+ PROMPT ***** <%= item %> *****
54
+ @<%= item %>;
55
+ SHOW ERRORS
56
+ <% end %>
57
+
58
+ BEGIN DBMS_OUTPUT.PUT_LINE( 'END TIME: '||TO_CHAR( SYSDATE, 'MM/DD/YYYY HH:MI:SS' ) ); END;
59
+ /
60
+ PROMPT
61
+ PROMPT *******************************FINISHED*******************************
62
+ PROMPT
63
+
64
+
65
+ EXIT
66
+ /
67
+ }
68
+
69
+
70
+ script_contents = ERB.new( build_template, nil, ">" ).result(binding)
71
+ script_file = File.new( full_output_file_name, "w" )
72
+ script_file.print( script_contents )
73
+ puts "creating " + full_output_file_name
74
+ end
75
+ end
76
+
77
+ end
78
+
79
+ class SqlTeardownGenerator < Generator
80
+
81
+ def generate
82
+
83
+ if @build_list.empty? then
84
+ puts "nothing in build list. no need for build file."
85
+ else
86
+
87
+ teardown_template = %q{
88
+ SET SERVEROUTPUT ON
89
+ SET DEFINE OFF
90
+ SPOOL teardown.log
91
+
92
+ DECLARE
93
+ CURSOR cur_drop_list
94
+ IS
95
+ SELECT *
96
+ FROM USER_OBJECTS
97
+ WHERE OBJECT_NAME IN ( <%=@sql_in_clause%> )
98
+ AND OBJECT_TYPE != 'PACKAGE BODY';
99
+ x BOOLEAN := FALSE;
100
+ BEGIN
101
+ DBMS_OUTPUT.PUT_LINE( 'starting work' );
102
+ FOR i IN cur_drop_list LOOP
103
+ x := TRUE;
104
+ BEGIN
105
+ EXECUTE IMMEDIATE 'DROP '||i.object_type||' '||i.object_name||' CASCADE CONSTRAINTS';
106
+ DBMS_OUTPUT.PUT_LINE( 'DROPPED '||i.object_name );
107
+ EXCEPTION
108
+ WHEN OTHERS THEN
109
+ DBMS_OUTPUT.PUT_LINE( 'WHILE DROPPING '||i.object_type||' '||i.object_name );
110
+ DBMS_OUTPUT.PUT_LINE( SUBSTR( SQLERRM, 1, 255 ) );
111
+ END;
112
+ END LOOP;
113
+ IF NOT x THEN
114
+ DBMS_OUTPUT.PUT_LINE( 'NOTHING FOUND TO DROP' );
115
+ END IF;
116
+ DBMS_OUTPUT.PUT_LINE( 'completed successfully' );
117
+ END;
118
+ /
119
+
120
+ EXIT
121
+ /
122
+ }
123
+
124
+ sql_in_clause = ""
125
+ @build_list.each do |i|
126
+ if i == build_list.first then
127
+ sql_in_clause.concat( "'" + i.chomp( File.extname( i ) ).upcase + "'" )
128
+ else
129
+ sql_in_clause.concat( ", '" + i.chomp( File.extname( i ) ).upcase + "'" )
130
+ end
131
+ end
132
+
133
+ script_contents = ERB.new( teardown_template, nil, ">" ).result(binding)
134
+ script_file = File.new( full_output_file_name, "w" )
135
+ script_file.print( script_contents )
136
+ puts "creating " + full_output_file_name
137
+ end
138
+ end
139
+
140
+ end
141
+
142
+ end
@@ -1,3 +1,3 @@
1
1
  module Orasaurus
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
data/lib/orasaurus.rb CHANGED
@@ -1,14 +1,11 @@
1
+ require 'orasaurus/generator'
2
+ require 'orasaurus/version'
3
+ require 'orasaurus/cli'
4
+ require 'orasaurus/configuration'
5
+ require 'orasaurus/application'
1
6
 
2
7
  module Orasaurus
3
-
4
- def self.sync_build_scripts(*args)
5
- args = args
6
- p args
7
- end
8
-
9
-
8
+
10
9
  end
11
10
 
12
- require 'orasaurus/sql_script_builder'
13
- require 'orasaurus/version'
14
- require 'orasaurus/cli'
11
+
data/spec/cli_spec.rb ADDED
@@ -0,0 +1,45 @@
1
+ require 'spec_helper'
2
+
3
+ describe Orasaurus::CLI do
4
+
5
+ describe "#generate" do
6
+
7
+ before(:each) do
8
+ cleanup
9
+ end
10
+
11
+ it "should be able to generate build scripts" do
12
+ File.exist?(File.dirname(__FILE__)+'/sampleApp/Notes/Packages/build.sql').should be_false
13
+ capture(:stdout){ Orasaurus::CLI.start(["generate","build_scripts", "--base_dir=#{File.dirname(__FILE__) + '/sampleApp'}"]) }
14
+ File.exist?(File.dirname(__FILE__)+'/sampleApp/Notes/Packages/build.sql').should be_true
15
+ File.exist?(File.dirname(__FILE__)+'/sampleApp/Notes/Packages/teardown.sql').should be_false
16
+ end
17
+
18
+ it "should be able to generate teardown scripts" do
19
+ File.exist?(File.dirname(__FILE__)+'/sampleApp/Notes/Packages/teardown.sql').should be_false
20
+ capture(:stdout){ Orasaurus::CLI.start(["generate","teardown_scripts", "--base_dir=#{File.dirname(__FILE__) + '/sampleApp'}"]) }
21
+ File.exist?(File.dirname(__FILE__)+'/sampleApp/Notes/Packages/build.sql').should be_false
22
+ File.exist?(File.dirname(__FILE__)+'/sampleApp/Notes/Packages/teardown.sql').should be_true
23
+ end
24
+
25
+ it "should be able to generate all scripts" do
26
+ File.exist?(File.dirname(__FILE__)+'/sampleApp/Notes/Packages/build.sql').should be_false
27
+ capture(:stdout){ Orasaurus::CLI.start(["generate","all", "--base_dir=#{File.dirname(__FILE__) + '/sampleApp'}"]) }
28
+ File.exist?(File.dirname(__FILE__)+'/sampleApp/Notes/Packages/build.sql').should be_true
29
+ File.exist?(File.dirname(__FILE__)+'/sampleApp/Notes/Packages/teardown.sql').should be_true
30
+ end
31
+
32
+ it "should have default functionality" do
33
+ File.exist?(File.dirname(__FILE__)+'/sampleApp/Notes/Packages/build.sql').should be_false
34
+ capture(:stdout){ Orasaurus::CLI.start(["generate","all", "--base_dir=#{File.dirname(__FILE__) + '/sampleApp'}"]) }
35
+ File.exist?(File.dirname(__FILE__)+'/sampleApp/Notes/Packages/build.sql').should be_true
36
+ File.exist?(File.dirname(__FILE__)+'/sampleApp/Notes/Packages/teardown.sql').should be_true
37
+ end
38
+
39
+ end
40
+
41
+ after(:all) do
42
+ cleanup
43
+ end
44
+
45
+ end