orasaurus 0.0.5 → 0.0.6.rc1

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -2,4 +2,7 @@
2
2
  .bundle
3
3
  Gemfile.lock
4
4
  pkg/*
5
- .DS_Store
5
+ .DS_Store
6
+ ._*
7
+ .vagrant
8
+ Vagrantfile
@@ -1,12 +1,17 @@
1
1
  require 'orasaurus/configuration'
2
2
  require 'orasaurus/generator'
3
+ require 'orasaurus/db'
3
4
 
4
5
  module Orasaurus
5
6
 
6
7
  class Application
7
8
 
8
- attr_accessor :config,:name,:base_dir, :build_dirs
9
-
9
+ include Orasaurus::DB
10
+
11
+ attr_accessor :config,:name,:base_dir, :build_dirs, :connection
12
+
13
+ @connection = Object.new
14
+
10
15
  def initialize(name,base_dir)
11
16
  @name = name
12
17
  if File.directory? base_dir
@@ -16,25 +21,29 @@ module Orasaurus
16
21
  end
17
22
  @config = Orasaurus::Configuration.default
18
23
  @build_dirs = fill_build_dirs
19
- @builders = []
20
24
  puts "Orasaurus has been awakened."
21
25
  puts "Build Dirs: #{@build_dirs.to_s}"
22
26
  end
23
27
 
28
+ #Connects to the database. Use oci8 args to connect
29
+ def connect(*args)
30
+ @connection = Connection.new(*args)
31
+ end
32
+
24
33
  def ignore_filenames
25
34
  files = %w{ @config.build_file_name @config.build_log_file_name @config.teardown_file_name @config.teardown_log_file_name }
26
35
  end
27
36
 
28
- def generate(type)
37
+ def generate(type,sortOpts={})
29
38
  if [:build_scripts,:teardown_scripts].include? type.to_sym
30
39
  puts "generating #{type}"
31
- generate_scripts(type)
40
+ generate_scripts(type,sortOpts)
32
41
  else
33
42
  puts "Don't know how to generate " + type.to_s
34
43
  end
35
44
  end
36
-
37
- def get_build_items(dir)
45
+
46
+ def get_build_items(dir,sortOpts={})
38
47
  buildable_items = Array.new
39
48
  search_list = Dir.glob(dir + "/*.*" )
40
49
  search_list.each do |f|
@@ -47,17 +56,18 @@ module Orasaurus
47
56
  end
48
57
  end
49
58
  puts "#{dir} build_items: #{buildable_items.to_s}"
50
- return buildable_items
59
+ sortOpts[:db_connection] = @connection
60
+ return Builder.sort(buildable_items,sortOpts)
51
61
  end
52
62
 
53
- def generate_scripts(type)
63
+ def generate_scripts(type,sortOpts={})
54
64
  if @build_dirs.length > 0 then
55
65
  @build_dirs.each do |dir|
56
66
  case type
57
67
  when :build_scripts
58
- Orasaurus::SqlBuildGenerator.new(dir,dir,config.build_file_name,get_build_items(dir)).generate
68
+ Orasaurus::SqlBuildGenerator.new(dir,dir,config.build_file_name,get_build_items(dir,sortOpts)).generate
59
69
  when :teardown_scripts
60
- Orasaurus::SqlTeardownGenerator.new(dir,dir,config.teardown_file_name,get_build_items(dir)).generate
70
+ Orasaurus::SqlTeardownGenerator.new(dir,dir,config.teardown_file_name,get_build_items(dir,sortOpts)).generate
61
71
  end
62
72
  end
63
73
  else
data/lib/orasaurus/cli.rb CHANGED
@@ -27,18 +27,30 @@ module Orasaurus
27
27
 
28
28
  desc "generate [SCRIPT_TYPE]", "Generate scripts. SCRIPT_TYPE is optional. Valid values are build_scripts, teardown_scripts and all."
29
29
  method_option :base_dir, :type => :string, :default => ".", :desc => "Base Directory for your code. Defaults to your current location.", :optional => true
30
+ method_option :sort_method, :type => :string, :default => :none, :desc => "The method used for ordering the scripts. The only available option other than the default is SQL, which will order the scripts by dependency in the database (assuming the file name is a database object name.", :optional => true
31
+ method_option :db_name, :type => :string, :desc => "Only needed if order_method is sql.", :optional => true
32
+ method_option :db_username, :type => :string, :desc => "Only needed if order_method is sql.", :optional => true
33
+ method_option :db_password, :type => :string, :desc => "Only needed if order_method is sql.", :optional => true
30
34
  def generate(script_type=:all)
31
- puts "generate " + script_type.to_s + " #{options.base_dir}"
35
+ puts "generate " + script_type.to_s + " #{options.to_s}"
32
36
  a = Orasaurus::Application.new("cli",options.base_dir)
33
37
 
38
+ if options.sort_method.upcase == "SQL" then
39
+ puts "connecting for sql sorting."
40
+ a.connect(options.db_username, options.db_password,options.db_name)
41
+ sort_options = { :method => :SQL, :db_connection => a.connection }
42
+ else
43
+ sort_options = {}
44
+ end
45
+
34
46
  if [:build_scripts,:all].include? script_type.to_sym then
35
47
  puts "generating build scrtipts"
36
- a.generate(:build_scripts)
48
+ a.generate(:build_scripts, sort_options)
37
49
  end
38
50
 
39
51
  if [:teardown_scripts,:all].include? script_type.to_sym then
40
52
  puts "generating teardown scripts"
41
- a.generate(:teardown_scripts)
53
+ a.generate(:teardown_scripts, sort_options)
42
54
  end
43
55
 
44
56
  end
@@ -42,6 +42,7 @@ module Orasaurus
42
42
  config.teardown_file_name = 'teardown.sql'
43
43
  config.teardown_log_file_name = 'teardown.log'
44
44
  config.buildable_file_extensions = %w( .pkg .pks .pkb .sql .trg .prc. fnc .vw )
45
+ config.object_type_build_order = [:tables, :sequences, :types, :functions, :procedures, :packages, :triggers]
45
46
  return config
46
47
  end
47
48
 
@@ -0,0 +1,142 @@
1
+ require 'oci8'
2
+
3
+ module Orasaurus
4
+
5
+ #
6
+ # A collection of utilities for interacting with Oracle databases
7
+ #
8
+
9
+ module DB
10
+
11
+ # Extends oci8 for more info on oci8 read this: http://ruby-oci8.rubyforge.org/en/index.html
12
+
13
+ class Connection < OCI8
14
+
15
+ # returns either the object type or nilif the object can't be found
16
+ def determine_object_type(object_owner,object_name)
17
+ cursor = self.exec("SELECT object_type FROM ALL_OBJECTS WHERE UPPER(owner) = UPPER(:the_owner) AND UPPER(object_name) = UPPER(:the_object_name)", object_owner, object_name)
18
+ return cursor.fetch().first
19
+ rescue
20
+ return nil
21
+ end
22
+
23
+ # gets a valid dependency list
24
+ # works for any object type
25
+ # for tables, it also searches for foreign key refernces as well as plsql references.
26
+ def get_dependencies(object_owner,object_name)
27
+ tbl_dependency_sql = %q{ select UNIQUE b.table_name dependent_table
28
+ from all_constraints a
29
+ join all_constraints b
30
+ on a.r_constraint_name = b.constraint_name
31
+ where a.constraint_type = 'R'
32
+ and a.owner = upper(:object_owner)
33
+ and a.table_name = upper(:object_name)
34
+ order by b.table_name
35
+ }
36
+
37
+ plsql_dependency_sql = %q{ select
38
+ referenced_name,
39
+ referenced_type
40
+ from all_dependencies
41
+ where owner = upper(:object_owner)
42
+ and name = upper(:object_name)
43
+ and substr(name,1,4) != 'BIN$'
44
+ and substr(referenced_name,1,4) != 'BIN$'
45
+ and referenced_type != 'NON-EXISTENT'
46
+ order by referenced_name
47
+ }
48
+
49
+ object_type = determine_object_type(object_owner,object_name)
50
+
51
+ final_sql = object_type == 'TABLE' ? tbl_dependency_sql : plsql_dependency_sql
52
+
53
+ dependency_list = []
54
+
55
+ self.exec(tbl_dependency_sql,object_owner,object_name) do |row|
56
+ dependency_list.push({ :object_name => row[0], :object_type => row[1]||='TABLE'})
57
+ end
58
+
59
+ return dependency_list
60
+
61
+ end
62
+
63
+ end
64
+
65
+ module Builder
66
+
67
+ def self.strip_item(item)
68
+ return item.gsub(/\..*$/,'')
69
+ end
70
+
71
+ def self.sort(arr,opts={})
72
+ firsts = Array.new
73
+ if tmp = Array.try_convert(opts[:first])
74
+ firsts = opts[:first].to_ary
75
+ elsif tmp = String.try_convert(opts[:first])
76
+ firsts = Array.new.push(opts[:first])
77
+ end
78
+
79
+ if opts[:method] == :SQL then
80
+ return self.sort_by_sql(arr, opts[:db_connection])
81
+ else
82
+ return ( firsts + ( arr - firsts ).sort ).compact
83
+ end
84
+
85
+ end
86
+
87
+ def self.sort_by_sql(arr,dbconnection)
88
+ puts("*********SORT BY SQL")
89
+ ordered_list = Array.new
90
+ done_collecting = false
91
+ loop_idx = 0
92
+ stripped_items = {}
93
+
94
+ while not done_collecting
95
+
96
+ loop_idx += 1
97
+
98
+ arr.each{ |object|
99
+
100
+ if not ordered_list.include?(object) then
101
+
102
+ dependency_list = dbconnection.get_dependencies(dbconnection.username,strip_item(object))
103
+ dependencies = Array.new
104
+ dependency_list.each{ |i| dependencies.push(i.fetch(:object_name).downcase) }
105
+ if dependencies.length == 0 then
106
+ ordered_list.push(object)
107
+ else
108
+ matches = ordered_list.select do |match|
109
+ dependencies.include?(strip_item(match))
110
+ end
111
+ matches = matches.sort
112
+ if matches.collect{ |m| strip_item(m)}.eql?(dependencies)
113
+ ordered_list.push(object)
114
+ end
115
+ end
116
+
117
+ end
118
+ }
119
+
120
+ if ordered_list.sort.eql?(arr.sort) then
121
+ done_collecting = true
122
+ puts "done colecting dependency matches. all objects have been collected and matched."
123
+ end
124
+
125
+ if loop_idx > 30
126
+ done_collecting = true
127
+ puts "giving up on finishing collection"
128
+ puts "difference (missing ones): "
129
+ puts arr - ordered_list
130
+ end
131
+
132
+ end
133
+
134
+ return ordered_list
135
+
136
+ end
137
+
138
+ end
139
+
140
+ end
141
+
142
+ end
@@ -71,6 +71,7 @@ EXIT
71
71
  script_file = File.new( full_output_file_name, "w" )
72
72
  script_file.print( script_contents )
73
73
  puts "creating " + full_output_file_name
74
+ script_file.close
74
75
  end
75
76
  end
76
77
 
@@ -134,6 +135,7 @@ EXIT
134
135
  script_file = File.new( full_output_file_name, "w" )
135
136
  script_file.print( script_contents )
136
137
  puts "creating " + full_output_file_name
138
+ script_file.close
137
139
  end
138
140
  end
139
141
 
@@ -1,3 +1,3 @@
1
1
  module Orasaurus
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6.rc1"
3
3
  end
data/lib/orasaurus.rb CHANGED
@@ -3,6 +3,7 @@ require 'orasaurus/version'
3
3
  require 'orasaurus/cli'
4
4
  require 'orasaurus/configuration'
5
5
  require 'orasaurus/application'
6
+ require 'orasaurus/db'
6
7
 
7
8
  module Orasaurus
8
9
 
data/orasaurus.gemspec CHANGED
@@ -23,4 +23,5 @@ Gem::Specification.new do |s|
23
23
  s.add_development_dependency "rspec"
24
24
  s.add_runtime_dependency "thor"
25
25
  s.add_runtime_dependency "highline"
26
+ s.add_runtime_dependency "ruby-oci8"
26
27
  end
@@ -0,0 +1,68 @@
1
+ require 'spec_helper'
2
+
3
+ describe Orasaurus::Application do
4
+
5
+ before(:all) do
6
+ cleanup
7
+ end
8
+
9
+ before(:each) do
10
+ @sampleApp = Orasaurus::Application.new("SampleApp",File.dirname(__FILE__) + '/sampleApp')
11
+ end
12
+
13
+ describe "#configuration" do
14
+
15
+ it "should have a default configuration" do
16
+ @sampleApp.config.should_not be_nil
17
+ end
18
+
19
+ it "should be able to override default configuration" do
20
+ @sampleApp.config.custom = true
21
+ @sampleApp.config.custom.should be_true
22
+ @sampleApp.config.custom = false
23
+ @sampleApp.config.custom.should be_false
24
+ end
25
+
26
+ end
27
+
28
+ describe "#application" do
29
+
30
+ it "should be able to discover the buildable directories" do
31
+ @sampleApp.build_dirs.grep(/Notes\/Packages/).should_not be_empty
32
+ @sampleApp.build_dirs.grep(/Notes\/Tables/).should_not be_empty
33
+ @sampleApp.build_dirs.grep(/Notes\/Sequences/).should_not be_empty
34
+ end
35
+
36
+ it "should be able to connect to a database." do
37
+ @sampleApp.connect("ben","franklin")
38
+ @sampleApp.connection.username.downcase.should == "ben"
39
+ end
40
+
41
+ it "should be able to sort items in a directory" do
42
+ @sampleApp.connect("ben","franklin")
43
+ build_items = @sampleApp.get_build_items(@sampleApp.build_dirs.grep(/Notes\/Tables/).first, { :method => :SQL } )
44
+ build_items.length.should == 4
45
+ build_items.should == ["notebooks.sql", "notes.sql","note_tags.sql", "note_comments.sql"]
46
+ end
47
+
48
+ end
49
+
50
+ describe "#generate" do
51
+
52
+ it "should be abl'e to generate build scripts" do
53
+ @sampleApp.generate(:build_scripts)
54
+ File.exists?(@sampleApp.base_dir+'/Notes/Packages/build.sql').should be_true
55
+ end
56
+
57
+ it "should be able to generate teardown scripts" do
58
+ @sampleApp.generate(:teardown_scripts)
59
+ File.exists?(@sampleApp.base_dir+'/Notes/Packages/teardown.sql').should be_true
60
+ end
61
+
62
+ end
63
+
64
+ after(:all) do
65
+ cleanup
66
+ end
67
+
68
+ end
data/spec/cli_spec.rb CHANGED
@@ -7,7 +7,7 @@ describe Orasaurus::CLI do
7
7
  before(:each) do
8
8
  cleanup
9
9
  end
10
-
10
+
11
11
  it "should be able to generate build scripts" do
12
12
  File.exist?(File.dirname(__FILE__)+'/sampleApp/Notes/Packages/build.sql').should be_false
13
13
  capture(:stdout){ Orasaurus::CLI.start(["generate","build_scripts", "--base_dir=#{File.dirname(__FILE__) + '/sampleApp'}"]) }
@@ -35,6 +35,16 @@ describe Orasaurus::CLI do
35
35
  File.exist?(File.dirname(__FILE__)+'/sampleApp/Notes/Packages/build.sql').should be_true
36
36
  File.exist?(File.dirname(__FILE__)+'/sampleApp/Notes/Packages/teardown.sql').should be_true
37
37
  end
38
+
39
+ it "should be able to generate build scripts ordered by sql." do
40
+ File.exist?(File.dirname(__FILE__)+'/sampleApp/Notes/Packages/build.sql').should be_false
41
+ capture(:stdout){ Orasaurus::CLI.start(["generate","build_scripts", "--base_dir=#{File.dirname(__FILE__) + '/sampleApp'}", "--sort_method=SQL", "--db_name=XE", "--db_username=ben", "--db_password=franklin"]) }
42
+ File.exist?(File.dirname(__FILE__)+'/sampleApp/Notes/Tables/build.sql').should be_true
43
+ File.exist?(File.dirname(__FILE__)+'/sampleApp/Notes/Tables/teardown.sql').should be_false
44
+ tblBuild = File.open(File.dirname(__FILE__)+'/sampleApp/Notes/Tables/build.sql', 'rb') { |f| f.read }
45
+ tblBuild.should match(/.*@notebooks\.sql.*@notes\.sql.*@note_tags\.sql.*/xm)
46
+ tblBuild.should_not match(/.*@notes\.sql.*@notebooks\.sql.*@note_tags\.sql.*/xm)
47
+ end
38
48
 
39
49
  end
40
50
 
data/spec/db_spec.rb ADDED
@@ -0,0 +1,75 @@
1
+ require 'spec_helper'
2
+ require'oci8'
3
+
4
+ describe Orasaurus::DB do
5
+
6
+ before(:all) do
7
+ @sampleDB = Orasaurus::DB::Connection.new("ben","franklin")
8
+ end
9
+
10
+ describe "#connect" do
11
+
12
+ it "should be able to connect to the db." do
13
+ Orasaurus::DB::Connection.new("ben","franklin").should_not be_nil
14
+ end
15
+
16
+ it "should refuse bad credentials" do
17
+ expect{ Orasaurus::DB::Connection.new("ben","adams") }.to raise_error
18
+ end
19
+
20
+ end
21
+
22
+ describe "#determine_object_type" do
23
+
24
+ it "should return the appropriate object type." do
25
+ @sampleDB.determine_object_type('ben','notes').should == 'TABLE'
26
+ @sampleDB.determine_object_type('ben','junk').should be_nil
27
+ end
28
+
29
+ end
30
+
31
+ describe "#get_dependencies" do
32
+
33
+ it "should return the correct depency list for a table" do
34
+ @sampleDB.get_dependencies('ben','notes').first[:object_name].should == 'NOTEBOOKS'
35
+ end
36
+
37
+ end
38
+
39
+ describe Orasaurus::DB::Builder do
40
+
41
+ describe "#strip_item" do
42
+
43
+ it "should be able to strip unwanted chars from the item name" do
44
+ Orasaurus::DB::Builder.strip_item("test.sql").should == "test"
45
+ Orasaurus::DB::Builder.strip_item("test.pkg.sql.test").should == "test"
46
+ Orasaurus::DB::Builder.strip_item("test").should == "test"
47
+ end
48
+
49
+ end
50
+
51
+ describe "#sort" do
52
+
53
+ it "should default to alphabetic." do
54
+ Orasaurus::DB::Builder.sort(["z","y","x"]).should eql ["x","y","z"]
55
+ end
56
+
57
+ it "should be able to always put something first" do
58
+ Orasaurus::DB::Builder.sort([3,2,1], :first => 3).should eql [1,2,3]
59
+ Orasaurus::DB::Builder.sort([4,3,2,1], :first => [4,2] ).should eql [4,2,1,3]
60
+ end
61
+
62
+ it "should be able to sort by sql dependencies." do
63
+ Orasaurus::DB::Builder.sort(["note_comments", "notebooks", "notes"], {:method => :SQL, :db_connection => @sampleDB } ).should == [ "notebooks","notes","note_comments"]
64
+ Orasaurus::DB::Builder.sort(["note_comments.trash", "notebooks.trash", "notes.trash"], {:method => :SQL, :db_connection => @sampleDB } ).should == [ "notebooks.trash","notes.trash","note_comments.trash"]
65
+ end
66
+
67
+ end
68
+
69
+ end
70
+
71
+ after(:all) do
72
+ @sampleDB.logoff
73
+ end
74
+
75
+ end
@@ -9,13 +9,10 @@ CREATE TABLE NOTE_COMMENTS
9
9
  UPDATED_BY VARCHAR2( 40 BYTE) NOT NULL,
10
10
  CONSTRAINT NOTE_COMMENTS_PK
11
11
  PRIMARY KEY
12
- (ID)
13
- USING INDEX
14
- TABLESPACE LARGE_TABLES,
12
+ (ID),
15
13
  CONSTRAINT NOTE_COMMENTS_NOTE_FK
16
14
  FOREIGN KEY (NOTE_ID) REFERENCES NOTES(ID) ON DELETE CASCADE
17
15
  )
18
- TABLESPACE LARGE_TABLES
19
16
  LOGGING
20
17
  NOCOMPRESS
21
18
  NOCACHE
@@ -5,15 +5,12 @@ CREATE TABLE NOTE_TAGS
5
5
  TAG VARCHAR2(255 BYTE) NOT NULL,
6
6
  CONSTRAINT NOTES_TAGS_PK
7
7
  PRIMARY KEY
8
- (ID)
9
- USING INDEX
10
- TABLESPACE LARGE_TABLES,
8
+ (ID),
11
9
  CONSTRAINT FK_NOTE_TAGS_NOTE
12
10
  FOREIGN KEY (NOTE_ID)
13
11
  REFERENCES NOTES (ID)
14
12
  ON DELETE CASCADE
15
13
  )
16
- TABLESPACE LARGE_TABLES
17
14
  LOGGING
18
15
  NOCOMPRESS
19
16
  NOCACHE
@@ -4,15 +4,10 @@ CREATE TABLE NOTEBOOKS
4
4
  TITLE VARCHAR2(255 BYTE) NOT NULL,
5
5
  CONSTRAINT NOTEBOOKS_PK
6
6
  PRIMARY KEY
7
- (ID)
8
- USING INDEX
9
- TABLESPACE LARGE_TABLES,
7
+ (ID),
10
8
  CONSTRAINT UNIQ_NOTEBOOK_TITLE
11
9
  UNIQUE (TITLE)
12
- USING INDEX
13
- TABLESPACE LARGE_TABLES
14
10
  )
15
- TABLESPACE LARGE_TABLES
16
11
  LOGGING
17
12
  NOCOMPRESS
18
13
  NOCACHE
@@ -10,15 +10,12 @@ CREATE TABLE NOTES
10
10
  UPDATED_BY VARCHAR2( 40 ) NOT NULL,
11
11
  CONSTRAINT NOTES_PK
12
12
  PRIMARY KEY
13
- (ID)
14
- USING INDEX
15
- TABLESPACE LARGE_TABLES,
13
+ (ID),
16
14
  CONSTRAINT FK_NOTES_NOTEBOOK_ID
17
15
  FOREIGN KEY
18
16
  (NOTEBOOK_ID) REFERENCES NOTEBOOKS(ID)
19
17
  ON DELETE CASCADE
20
18
  )
21
- TABLESPACE LARGE_TABLES
22
19
  LOGGING
23
20
  NOCOMPRESS
24
21
  NOCACHE
@@ -1,3 +1,5 @@
1
- CREATE USER "ben" IDENTIFIED BY "FRANKLIN";
2
- GRANT CONNECT TO "BEN";
3
- GRANT DBA TO "BEN";
1
+ DROP USER ben;
2
+ CREATE USER ben IDENTIFIED BY franklin;
3
+ GRANT CONNECT TO ben;
4
+ GRANT DBA TO ben;
5
+ GRANT RESOURCE TO ben;
metadata CHANGED
@@ -1,19 +1,19 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: orasaurus
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
5
- prerelease:
4
+ version: 0.0.6.rc1
5
+ prerelease: 6
6
6
  platform: ruby
7
7
  authors:
8
8
  - Andy Campbell
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-11-14 00:00:00.000000000Z
12
+ date: 2011-11-20 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
16
- requirement: &70290442239200 !ruby/object:Gem::Requirement
16
+ requirement: &77344800 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *70290442239200
24
+ version_requirements: *77344800
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: thor
27
- requirement: &70290442238780 !ruby/object:Gem::Requirement
27
+ requirement: &77344590 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70290442238780
35
+ version_requirements: *77344590
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: highline
38
- requirement: &70290442238360 !ruby/object:Gem::Requirement
38
+ requirement: &77344380 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,7 +43,18 @@ dependencies:
43
43
  version: '0'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *70290442238360
46
+ version_requirements: *77344380
47
+ - !ruby/object:Gem::Dependency
48
+ name: ruby-oci8
49
+ requirement: &77344170 !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ type: :runtime
56
+ prerelease: false
57
+ version_requirements: *77344170
47
58
  description: A simple toolset for making it easier to build Oracle databases.
48
59
  email:
49
60
  - andrewthomascampbell@gmail.com
@@ -65,11 +76,13 @@ files:
65
76
  - lib/orasaurus/application.rb
66
77
  - lib/orasaurus/cli.rb
67
78
  - lib/orasaurus/configuration.rb
79
+ - lib/orasaurus/db.rb
68
80
  - lib/orasaurus/generator.rb
69
81
  - lib/orasaurus/version.rb
70
82
  - orasaurus.gemspec
83
+ - spec/application_spec.rb
71
84
  - spec/cli_spec.rb
72
- - spec/orasaurus_spec.rb
85
+ - spec/db_spec.rb
73
86
  - spec/sampleApp/Notes/Packages/pkg_note_comments.pkg
74
87
  - spec/sampleApp/Notes/Packages/pkg_note_tags.pkg
75
88
  - spec/sampleApp/Notes/Packages/pkg_notebooks.pkg
@@ -100,30 +113,13 @@ required_ruby_version: !ruby/object:Gem::Requirement
100
113
  required_rubygems_version: !ruby/object:Gem::Requirement
101
114
  none: false
102
115
  requirements:
103
- - - ! '>='
116
+ - - ! '>'
104
117
  - !ruby/object:Gem::Version
105
- version: '0'
118
+ version: 1.3.1
106
119
  requirements: []
107
120
  rubyforge_project: orasaurus
108
121
  rubygems_version: 1.8.10
109
122
  signing_key:
110
123
  specification_version: 3
111
124
  summary: Tools for building Oracle Applications
112
- test_files:
113
- - spec/cli_spec.rb
114
- - spec/orasaurus_spec.rb
115
- - spec/sampleApp/Notes/Packages/pkg_note_comments.pkg
116
- - spec/sampleApp/Notes/Packages/pkg_note_tags.pkg
117
- - spec/sampleApp/Notes/Packages/pkg_notebooks.pkg
118
- - spec/sampleApp/Notes/Packages/pkg_notes.pkg
119
- - spec/sampleApp/Notes/Sequences/note_comments_seq.sql
120
- - spec/sampleApp/Notes/Sequences/note_tags_seq.sql
121
- - spec/sampleApp/Notes/Sequences/notebooks_seq.sql
122
- - spec/sampleApp/Notes/Sequences/notes_seq.sql
123
- - spec/sampleApp/Notes/Tables/note_comments.sql
124
- - spec/sampleApp/Notes/Tables/note_tags.sql
125
- - spec/sampleApp/Notes/Tables/notebooks.sql
126
- - spec/sampleApp/Notes/Tables/notes.sql
127
- - spec/sampleApp/Rakefile
128
- - spec/sampleApp/create_test_user.sql
129
- - spec/spec_helper.rb
125
+ test_files: []
@@ -1,44 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe "Orasaurus" do
4
-
5
- before(:all) do
6
- cleanup
7
- end
8
-
9
- before(:each) do
10
- @sampleApp = Orasaurus::Application.new("SampleApp",File.dirname(__FILE__) + '/sampleApp')
11
- end
12
-
13
- it "should have a default configuration" do
14
- @sampleApp.config.should_not be_nil
15
- end
16
-
17
- it "should be able to override default configuration" do
18
- @sampleApp.config.custom = true
19
- @sampleApp.config.custom.should be_true
20
- @sampleApp.config.custom = false
21
- @sampleApp.config.custom.should be_false
22
- end
23
-
24
- it "should be able to discover the buildable directories" do
25
- @sampleApp.build_dirs.grep(/Notes\/Packages/).should_not be_empty
26
- @sampleApp.build_dirs.grep(/Notes\/Tables/).should_not be_empty
27
- @sampleApp.build_dirs.grep(/Notes\/Sequences/).should_not be_empty
28
- end
29
-
30
- it "should be able to generate build scripts" do
31
- @sampleApp.generate(:build_scripts)
32
- File.exists?(@sampleApp.base_dir+'/Notes/Packages/build.sql').should be_true
33
- end
34
-
35
- it "should be able to generate teardown scripts" do
36
- @sampleApp.generate(:teardown_scripts)
37
- File.exists?(@sampleApp.base_dir+'/Notes/Packages/teardown.sql').should be_true
38
- end
39
-
40
- after(:all) do
41
- cleanup
42
- end
43
-
44
- end