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 +1 -0
- data/.rvmrc +55 -0
- data/.vagrant +1 -0
- data/README.md +33 -0
- data/Vagrantfile +88 -0
- data/bin/orasaurus +1 -26
- data/config/default.rb +11 -0
- data/lib/orasaurus/application.rb +82 -0
- data/lib/orasaurus/cli.rb +76 -10
- data/lib/orasaurus/configuration.rb +50 -0
- data/lib/orasaurus/generator.rb +142 -0
- data/lib/orasaurus/version.rb +1 -1
- data/lib/orasaurus.rb +7 -10
- data/spec/cli_spec.rb +45 -0
- data/spec/orasaurus_spec.rb +37 -5
- data/spec/sampleApp/Notes/Packages/pkg_note_comments.pkg +164 -0
- data/spec/sampleApp/Notes/Packages/pkg_note_tags.pkg +146 -0
- data/spec/sampleApp/Notes/Packages/pkg_notebooks.pkg +135 -0
- data/spec/sampleApp/Notes/Packages/pkg_notes.pkg +418 -0
- data/spec/sampleApp/Notes/Sequences/note_comments_seq.sql +1 -0
- data/spec/sampleApp/Notes/Sequences/note_tags_seq.sql +1 -0
- data/spec/sampleApp/Notes/Sequences/notebooks_seq.sql +1 -0
- data/spec/sampleApp/Notes/Sequences/notes_seq.sql +1 -0
- data/spec/sampleApp/Notes/Tables/note_comments.sql +27 -0
- data/spec/sampleApp/Notes/Tables/note_tags.sql +25 -0
- data/spec/sampleApp/Notes/Tables/notebooks.sql +26 -0
- data/spec/sampleApp/Notes/Tables/notes.sql +30 -0
- data/spec/sampleApp/Rakefile +75 -0
- data/spec/sampleApp/create_test_user.sql +3 -0
- data/spec/spec_helper.rb +20 -2
- metadata +50 -12
- data/README.textile +0 -7
- data/lib/orasaurus/sql_script_builder.rb +0 -162
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: orasaurus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-
|
12
|
+
date: 2011-11-14 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
16
|
-
requirement: &
|
16
|
+
requirement: &70290442239200 !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: *
|
24
|
+
version_requirements: *70290442239200
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: thor
|
27
|
-
requirement: &
|
27
|
+
requirement: &70290442238780 !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: *
|
35
|
+
version_requirements: *70290442238780
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: highline
|
38
|
-
requirement: &
|
38
|
+
requirement: &70290442238360 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,7 +43,7 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70290442238360
|
47
47
|
description: A simple toolset for making it easier to build Oracle databases.
|
48
48
|
email:
|
49
49
|
- andrewthomascampbell@gmail.com
|
@@ -53,16 +53,37 @@ extensions: []
|
|
53
53
|
extra_rdoc_files: []
|
54
54
|
files:
|
55
55
|
- .gitignore
|
56
|
+
- .rvmrc
|
57
|
+
- .vagrant
|
56
58
|
- Gemfile
|
57
|
-
- README.
|
59
|
+
- README.md
|
58
60
|
- Rakefile
|
61
|
+
- Vagrantfile
|
59
62
|
- bin/orasaurus
|
63
|
+
- config/default.rb
|
60
64
|
- lib/orasaurus.rb
|
65
|
+
- lib/orasaurus/application.rb
|
61
66
|
- lib/orasaurus/cli.rb
|
62
|
-
- lib/orasaurus/
|
67
|
+
- lib/orasaurus/configuration.rb
|
68
|
+
- lib/orasaurus/generator.rb
|
63
69
|
- lib/orasaurus/version.rb
|
64
70
|
- orasaurus.gemspec
|
71
|
+
- spec/cli_spec.rb
|
65
72
|
- spec/orasaurus_spec.rb
|
73
|
+
- spec/sampleApp/Notes/Packages/pkg_note_comments.pkg
|
74
|
+
- spec/sampleApp/Notes/Packages/pkg_note_tags.pkg
|
75
|
+
- spec/sampleApp/Notes/Packages/pkg_notebooks.pkg
|
76
|
+
- spec/sampleApp/Notes/Packages/pkg_notes.pkg
|
77
|
+
- spec/sampleApp/Notes/Sequences/note_comments_seq.sql
|
78
|
+
- spec/sampleApp/Notes/Sequences/note_tags_seq.sql
|
79
|
+
- spec/sampleApp/Notes/Sequences/notebooks_seq.sql
|
80
|
+
- spec/sampleApp/Notes/Sequences/notes_seq.sql
|
81
|
+
- spec/sampleApp/Notes/Tables/note_comments.sql
|
82
|
+
- spec/sampleApp/Notes/Tables/note_tags.sql
|
83
|
+
- spec/sampleApp/Notes/Tables/notebooks.sql
|
84
|
+
- spec/sampleApp/Notes/Tables/notes.sql
|
85
|
+
- spec/sampleApp/Rakefile
|
86
|
+
- spec/sampleApp/create_test_user.sql
|
66
87
|
- spec/spec_helper.rb
|
67
88
|
homepage: https://github.com/andycamp/orasaurus
|
68
89
|
licenses: []
|
@@ -84,8 +105,25 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
84
105
|
version: '0'
|
85
106
|
requirements: []
|
86
107
|
rubyforge_project: orasaurus
|
87
|
-
rubygems_version: 1.
|
108
|
+
rubygems_version: 1.8.10
|
88
109
|
signing_key:
|
89
110
|
specification_version: 3
|
90
111
|
summary: Tools for building Oracle Applications
|
91
|
-
test_files:
|
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
|
data/README.textile
DELETED
@@ -1,162 +0,0 @@
|
|
1
|
-
require 'find'
|
2
|
-
require 'erb'
|
3
|
-
|
4
|
-
module Orasaurus
|
5
|
-
|
6
|
-
class ScriptBuilder
|
7
|
-
|
8
|
-
def initialize( base_directory )
|
9
|
-
|
10
|
-
@base_directory = base_directory
|
11
|
-
@ignore_directories = %w( )
|
12
|
-
@ignore_filenames = %w( build.sql teardown.sql build.log teardown.log )
|
13
|
-
@buildable_file_extensions = %w( .pkg .pks .pkb .sql .trg )
|
14
|
-
@build_directories = Array.new
|
15
|
-
@buildable_items = Array.new
|
16
|
-
|
17
|
-
@build_directories = fill_build_directories
|
18
|
-
|
19
|
-
end
|
20
|
-
|
21
|
-
def fill_build_directories
|
22
|
-
return_array = Array.new
|
23
|
-
Find.find(@base_directory) do |f|
|
24
|
-
if File.directory?( f )
|
25
|
-
if not @ignore_directories.include?( f.split("/").pop )
|
26
|
-
return_array.push( f )
|
27
|
-
else
|
28
|
-
puts "pruning " + f
|
29
|
-
Find.prune
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
return return_array
|
34
|
-
end
|
35
|
-
|
36
|
-
def build_all_scripts(build_file_name, teardown_file_name)
|
37
|
-
@build_directories.each do |d|
|
38
|
-
@buildable_items = get_buildable_items(d)
|
39
|
-
if @buildable_items.length >0 then
|
40
|
-
generate_build_script( d + "/" + build_file_name )
|
41
|
-
generate_teardown_script( d + "/" + teardown_file_name ) unless d == "DBSeeds"
|
42
|
-
#puts "completed working with " + d
|
43
|
-
else
|
44
|
-
#puts "directory ignored: " + d
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
def get_buildable_items(dir)
|
50
|
-
buildable_items = Array.new
|
51
|
-
#puts Dir.glob(dir + "/*.*" )
|
52
|
-
if dir.match( /Packages/ )
|
53
|
-
search_list = Dir.glob( dir + "/*.pks" ) + Dir.glob( dir + "/*.pkb" ) + Dir.glob( dir + "/*.pkg" )
|
54
|
-
else
|
55
|
-
search_list = Dir.glob(dir + "/*.*" )
|
56
|
-
end
|
57
|
-
search_list.each do |f|
|
58
|
-
if not File.directory?( f ) \
|
59
|
-
and not @ignore_filenames.include?(File.basename( f )) \
|
60
|
-
and @buildable_file_extensions.include?(File.extname( f )) \
|
61
|
-
then
|
62
|
-
buildable_items.push(File.basename( f ))
|
63
|
-
end
|
64
|
-
end
|
65
|
-
return buildable_items
|
66
|
-
end
|
67
|
-
|
68
|
-
def generate_build_script( output_file_name )
|
69
|
-
buildables = @buildable_items
|
70
|
-
#puts @buildable_items.inspect
|
71
|
-
@build_template = %q{
|
72
|
-
SET SERVEROUTPUT ON
|
73
|
-
SET DEFINE OFF
|
74
|
-
SPOOL build.log
|
75
|
-
|
76
|
-
PROMPT
|
77
|
-
PROMPT *****************************GETTING STARTED************************
|
78
|
-
PROMPT
|
79
|
-
/
|
80
|
-
BEGIN DBMS_OUTPUT.PUT_LINE( 'BEGIN TIME: '||TO_CHAR( SYSDATE, 'MM/DD/YYYY HH:MI:SS' ) ); END;
|
81
|
-
/
|
82
|
-
|
83
|
-
<% buildables.each do |item| %>
|
84
|
-
PROMPT ***** <%= item %> *****
|
85
|
-
@<%= item %>;
|
86
|
-
SHOW ERRORS
|
87
|
-
<% end %>
|
88
|
-
|
89
|
-
BEGIN DBMS_OUTPUT.PUT_LINE( 'END TIME: '||TO_CHAR( SYSDATE, 'MM/DD/YYYY HH:MI:SS' ) ); END;
|
90
|
-
/
|
91
|
-
PROMPT
|
92
|
-
PROMPT *******************************FINISHED*******************************
|
93
|
-
PROMPT
|
94
|
-
|
95
|
-
|
96
|
-
EXIT
|
97
|
-
/
|
98
|
-
}
|
99
|
-
|
100
|
-
|
101
|
-
script_contents = ERB.new( @build_template, nil, ">" ).result(binding)
|
102
|
-
script_file = File.new( output_file_name, "w" )
|
103
|
-
script_file.print( script_contents )
|
104
|
-
|
105
|
-
end
|
106
|
-
|
107
|
-
def generate_teardown_script( output_file_name )
|
108
|
-
|
109
|
-
@teardown_template = %q{
|
110
|
-
SET SERVEROUTPUT ON
|
111
|
-
SET DEFINE OFF
|
112
|
-
SPOOL teardown.log
|
113
|
-
|
114
|
-
DECLARE
|
115
|
-
CURSOR cur_drop_list
|
116
|
-
IS
|
117
|
-
SELECT *
|
118
|
-
FROM USER_OBJECTS
|
119
|
-
WHERE OBJECT_NAME IN ( <%=@sql_in_clause%> )
|
120
|
-
AND OBJECT_TYPE != 'PACKAGE BODY';
|
121
|
-
x BOOLEAN := FALSE;
|
122
|
-
BEGIN
|
123
|
-
DBMS_OUTPUT.PUT_LINE( 'starting work' );
|
124
|
-
FOR i IN cur_drop_list LOOP
|
125
|
-
x := TRUE;
|
126
|
-
BEGIN
|
127
|
-
EXECUTE IMMEDIATE 'DROP '||i.object_type||' '||i.object_name||' CASCADE CONSTRAINTS';
|
128
|
-
DBMS_OUTPUT.PUT_LINE( 'DROPPED '||i.object_name );
|
129
|
-
EXCEPTION
|
130
|
-
WHEN OTHERS THEN
|
131
|
-
DBMS_OUTPUT.PUT_LINE( 'WHILE DROPPING '||i.object_type||' '||i.object_name );
|
132
|
-
DBMS_OUTPUT.PUT_LINE( SUBSTR( SQLERRM, 1, 255 ) );
|
133
|
-
END;
|
134
|
-
END LOOP;
|
135
|
-
IF NOT x THEN
|
136
|
-
DBMS_OUTPUT.PUT_LINE( 'NOTHING FOUND TO DROP' );
|
137
|
-
END IF;
|
138
|
-
DBMS_OUTPUT.PUT_LINE( 'completed successfully' );
|
139
|
-
END;
|
140
|
-
/
|
141
|
-
|
142
|
-
EXIT
|
143
|
-
/
|
144
|
-
}
|
145
|
-
|
146
|
-
@sql_in_clause = ""
|
147
|
-
@buildable_items.each do |i|
|
148
|
-
if i == @buildable_items.first then
|
149
|
-
@sql_in_clause.concat( "'" + i.chomp( File.extname( i ) ).upcase + "'" )
|
150
|
-
else
|
151
|
-
@sql_in_clause.concat( ", '" + i.chomp( File.extname( i ) ).upcase + "'" )
|
152
|
-
end
|
153
|
-
end
|
154
|
-
|
155
|
-
script_contents = ERB.new( @teardown_template, nil, ">" ).result(binding)
|
156
|
-
script_file = File.new( output_file_name, "w" )
|
157
|
-
script_file.print( script_contents )
|
158
|
-
end
|
159
|
-
|
160
|
-
end
|
161
|
-
|
162
|
-
end
|