orasaurus 0.0.1

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.
Files changed (41) hide show
  1. data/.gitignore +4 -0
  2. data/Gemfile +4 -0
  3. data/README.textile +7 -0
  4. data/Rakefile +1 -0
  5. data/bin/orasaurus +4 -0
  6. data/lib/orasaurus/sql_script_builder.rb +162 -0
  7. data/lib/orasaurus/version.rb +3 -0
  8. data/lib/orasaurus.rb +12 -0
  9. data/notes/build_table_build_script.rb +207 -0
  10. data/notes/db_migrator.rb +115 -0
  11. data/notes/file_dependencies.rb +65 -0
  12. data/notes/main_db.rb +130 -0
  13. data/notes/rakefile.rb +375 -0
  14. data/notes/stractor.rb +41 -0
  15. data/notes/try_to_compile.rb +28 -0
  16. data/orasaurus.gemspec +26 -0
  17. data/spec/orasaurus_spec.rb +12 -0
  18. data/spec/spec_helper.rb +8 -0
  19. data/test/db/Notes/Packages/build.sql +35 -0
  20. data/test/db/Notes/Packages/pkg_note_comments.pkg +164 -0
  21. data/test/db/Notes/Packages/pkg_note_tags.pkg +146 -0
  22. data/test/db/Notes/Packages/pkg_notebooks.pkg +135 -0
  23. data/test/db/Notes/Packages/pkg_notes.pkg +418 -0
  24. data/test/db/Notes/Packages/teardown.sql +36 -0
  25. data/test/db/Notes/Sequences/build.sql +35 -0
  26. data/test/db/Notes/Sequences/note_comments_seq.sql +1 -0
  27. data/test/db/Notes/Sequences/note_tags_seq.sql +1 -0
  28. data/test/db/Notes/Sequences/notebooks_seq.sql +1 -0
  29. data/test/db/Notes/Sequences/notes_seq.sql +1 -0
  30. data/test/db/Notes/Sequences/teardown.sql +36 -0
  31. data/test/db/Notes/Tables/build.sql +35 -0
  32. data/test/db/Notes/Tables/note_comments.sql +27 -0
  33. data/test/db/Notes/Tables/note_tags.sql +25 -0
  34. data/test/db/Notes/Tables/notebooks.sql +26 -0
  35. data/test/db/Notes/Tables/notes.sql +30 -0
  36. data/test/db/Notes/Tables/teardown.sql +36 -0
  37. data/test/db/Rakefile +75 -0
  38. data/test/db/build.sql +26 -0
  39. data/test/db/create_test_user.sql +3 -0
  40. data/test/db/teardown.sql +36 -0
  41. metadata +119 -0
@@ -0,0 +1,36 @@
1
+
2
+ SET SERVEROUTPUT ON
3
+ SET DEFINE OFF
4
+ SPOOL teardown.log
5
+
6
+ DECLARE
7
+ CURSOR cur_drop_list
8
+ IS
9
+ SELECT *
10
+ FROM USER_OBJECTS
11
+ WHERE OBJECT_NAME IN ( 'NOTE_COMMENTS', 'NOTE_TAGS', 'NOTEBOOKS', 'NOTES' )
12
+ AND OBJECT_TYPE != 'PACKAGE BODY';
13
+ x BOOLEAN := FALSE;
14
+ BEGIN
15
+ DBMS_OUTPUT.PUT_LINE( 'starting work' );
16
+ FOR i IN cur_drop_list LOOP
17
+ x := TRUE;
18
+ BEGIN
19
+ EXECUTE IMMEDIATE 'DROP '||i.object_type||' '||i.object_name||' CASCADE CONSTRAINTS';
20
+ DBMS_OUTPUT.PUT_LINE( 'DROPPED '||i.object_name );
21
+ EXCEPTION
22
+ WHEN OTHERS THEN
23
+ DBMS_OUTPUT.PUT_LINE( 'WHILE DROPPING '||i.object_type||' '||i.object_name );
24
+ DBMS_OUTPUT.PUT_LINE( SUBSTR( SQLERRM, 1, 255 ) );
25
+ END;
26
+ END LOOP;
27
+ IF NOT x THEN
28
+ DBMS_OUTPUT.PUT_LINE( 'NOTHING FOUND TO DROP' );
29
+ END IF;
30
+ DBMS_OUTPUT.PUT_LINE( 'completed successfully' );
31
+ END;
32
+ /
33
+
34
+ EXIT
35
+ /
36
+
data/test/db/Rakefile ADDED
@@ -0,0 +1,75 @@
1
+ require "oci8"
2
+ require "highline/import"
3
+ require "orasaurus"
4
+
5
+ $db_name = ""
6
+ $db_user = ""
7
+ $db_user_password = ""
8
+
9
+ def process_db_connect_params
10
+
11
+ if ENV['db_user'].nil? then
12
+ $db_user = ask("Database User: ") { |q| q.echo = true }
13
+ else
14
+ $db_user = ENV['db_user']
15
+ end
16
+
17
+ if ENV['db_user_password'].nil? then
18
+ $db_user_password = ask("Database User Password: ") { |q| q.echo = "*" }
19
+ else
20
+ $db_user_password = ENV['db_user_password']
21
+ end
22
+
23
+ if ENV['db_name'].nil? then
24
+ $db_name = ask("Database Instance: ") { |q| q.echo = true }
25
+ else
26
+ $db_name = ENV['db_name']
27
+ end
28
+
29
+ if not $db_user.nil? and not $db_user_password.nil? and not $db_name.nil? then
30
+ return true
31
+ else
32
+ puts "INVALID DATABASE CONNECTION PARAMETERS"
33
+ end
34
+
35
+ end
36
+
37
+ def sqlplus_connect_string
38
+ return $db_user + "/" + $db_user_password + "@" + $db_name
39
+ end
40
+
41
+ desc "Test database connection"
42
+ task :test_connection do
43
+ if not process_db_connect_params then
44
+ exit
45
+ puts "test failed"
46
+ else
47
+ puts "valid parameters"
48
+ end
49
+ puts "Starting database connection test"
50
+ begin
51
+ conn = OCI8.new( $db_user, $db_user_password, $db_name )
52
+ conn.logoff
53
+ puts "Connection successful"
54
+ rescue
55
+ puts $!
56
+ puts "Connection failed"
57
+ end
58
+ end
59
+
60
+ desc "Rebuild all build and teardown scripts"
61
+ task :rebuild_build_scripts do
62
+ if not process_db_connect_params then
63
+ exit
64
+ end
65
+
66
+ s = Orasaurus::ScriptBuilder.new( '.' )
67
+ puts "building simple build scripts"
68
+ s.build_all_scripts( 'build.sql', 'teardown.sql' )
69
+
70
+ #puts "re-doing table build scripts for proper order"
71
+ #t = Orasaurus::TableScriptBuilder.new( $db_user, $db_user_password, $db_name, './Tables/' )
72
+ #puts 'build_tables has finished'
73
+
74
+ puts 'done'
75
+ end
data/test/db/build.sql ADDED
@@ -0,0 +1,26 @@
1
+
2
+ SET SERVEROUTPUT ON
3
+ SET DEFINE OFF
4
+ SPOOL build.log
5
+
6
+ PROMPT
7
+ PROMPT *****************************GETTING STARTED************************
8
+ PROMPT
9
+ /
10
+ BEGIN DBMS_OUTPUT.PUT_LINE( 'BEGIN TIME: '||TO_CHAR( SYSDATE, 'MM/DD/YYYY HH:MI:SS' ) ); END;
11
+ /
12
+
13
+ PROMPT ***** create_test_user.sql *****
14
+ @create_test_user.sql;
15
+ SHOW ERRORS
16
+
17
+ BEGIN DBMS_OUTPUT.PUT_LINE( 'END TIME: '||TO_CHAR( SYSDATE, 'MM/DD/YYYY HH:MI:SS' ) ); END;
18
+ /
19
+ PROMPT
20
+ PROMPT *******************************FINISHED*******************************
21
+ PROMPT
22
+
23
+
24
+ EXIT
25
+ /
26
+
@@ -0,0 +1,3 @@
1
+ CREATE USER "ben" IDENTIFIED BY "FRANKLIN";
2
+ GRANT CONNECT TO "BEN";
3
+ GRANT DBA TO "BEN";
@@ -0,0 +1,36 @@
1
+
2
+ SET SERVEROUTPUT ON
3
+ SET DEFINE OFF
4
+ SPOOL teardown.log
5
+
6
+ DECLARE
7
+ CURSOR cur_drop_list
8
+ IS
9
+ SELECT *
10
+ FROM USER_OBJECTS
11
+ WHERE OBJECT_NAME IN ( 'CREATE_TEST_USER' )
12
+ AND OBJECT_TYPE != 'PACKAGE BODY';
13
+ x BOOLEAN := FALSE;
14
+ BEGIN
15
+ DBMS_OUTPUT.PUT_LINE( 'starting work' );
16
+ FOR i IN cur_drop_list LOOP
17
+ x := TRUE;
18
+ BEGIN
19
+ EXECUTE IMMEDIATE 'DROP '||i.object_type||' '||i.object_name||' CASCADE CONSTRAINTS';
20
+ DBMS_OUTPUT.PUT_LINE( 'DROPPED '||i.object_name );
21
+ EXCEPTION
22
+ WHEN OTHERS THEN
23
+ DBMS_OUTPUT.PUT_LINE( 'WHILE DROPPING '||i.object_type||' '||i.object_name );
24
+ DBMS_OUTPUT.PUT_LINE( SUBSTR( SQLERRM, 1, 255 ) );
25
+ END;
26
+ END LOOP;
27
+ IF NOT x THEN
28
+ DBMS_OUTPUT.PUT_LINE( 'NOTHING FOUND TO DROP' );
29
+ END IF;
30
+ DBMS_OUTPUT.PUT_LINE( 'completed successfully' );
31
+ END;
32
+ /
33
+
34
+ EXIT
35
+ /
36
+
metadata ADDED
@@ -0,0 +1,119 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: orasaurus
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Andy Campbell
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2011-10-22 00:00:00.000000000Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rspec
16
+ requirement: &9959040 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: *9959040
25
+ - !ruby/object:Gem::Dependency
26
+ name: ruby-oci8
27
+ requirement: &9958788 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: *9958788
36
+ - !ruby/object:Gem::Dependency
37
+ name: ruby-plsql
38
+ requirement: &9958536 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
44
+ type: :runtime
45
+ prerelease: false
46
+ version_requirements: *9958536
47
+ description: A robust interface for building Oracle Applications, especially pl/sql.
48
+ email:
49
+ - pmacydna@gmail.com
50
+ executables:
51
+ - orasaurus
52
+ extensions: []
53
+ extra_rdoc_files: []
54
+ files:
55
+ - .gitignore
56
+ - Gemfile
57
+ - README.textile
58
+ - Rakefile
59
+ - bin/orasaurus
60
+ - lib/orasaurus.rb
61
+ - lib/orasaurus/sql_script_builder.rb
62
+ - lib/orasaurus/version.rb
63
+ - notes/build_table_build_script.rb
64
+ - notes/db_migrator.rb
65
+ - notes/file_dependencies.rb
66
+ - notes/main_db.rb
67
+ - notes/rakefile.rb
68
+ - notes/stractor.rb
69
+ - notes/try_to_compile.rb
70
+ - orasaurus.gemspec
71
+ - spec/orasaurus_spec.rb
72
+ - spec/spec_helper.rb
73
+ - test/db/Notes/Packages/build.sql
74
+ - test/db/Notes/Packages/pkg_note_comments.pkg
75
+ - test/db/Notes/Packages/pkg_note_tags.pkg
76
+ - test/db/Notes/Packages/pkg_notebooks.pkg
77
+ - test/db/Notes/Packages/pkg_notes.pkg
78
+ - test/db/Notes/Packages/teardown.sql
79
+ - test/db/Notes/Sequences/build.sql
80
+ - test/db/Notes/Sequences/note_comments_seq.sql
81
+ - test/db/Notes/Sequences/note_tags_seq.sql
82
+ - test/db/Notes/Sequences/notebooks_seq.sql
83
+ - test/db/Notes/Sequences/notes_seq.sql
84
+ - test/db/Notes/Sequences/teardown.sql
85
+ - test/db/Notes/Tables/build.sql
86
+ - test/db/Notes/Tables/note_comments.sql
87
+ - test/db/Notes/Tables/note_tags.sql
88
+ - test/db/Notes/Tables/notebooks.sql
89
+ - test/db/Notes/Tables/notes.sql
90
+ - test/db/Notes/Tables/teardown.sql
91
+ - test/db/Rakefile
92
+ - test/db/build.sql
93
+ - test/db/create_test_user.sql
94
+ - test/db/teardown.sql
95
+ homepage: ''
96
+ licenses: []
97
+ post_install_message:
98
+ rdoc_options: []
99
+ require_paths:
100
+ - lib
101
+ required_ruby_version: !ruby/object:Gem::Requirement
102
+ none: false
103
+ requirements:
104
+ - - ! '>='
105
+ - !ruby/object:Gem::Version
106
+ version: '0'
107
+ required_rubygems_version: !ruby/object:Gem::Requirement
108
+ none: false
109
+ requirements:
110
+ - - ! '>='
111
+ - !ruby/object:Gem::Version
112
+ version: '0'
113
+ requirements: []
114
+ rubyforge_project: orasaurus
115
+ rubygems_version: 1.7.2
116
+ signing_key:
117
+ specification_version: 3
118
+ summary: Tools for building Oracle Applications
119
+ test_files: []