orasaurus 0.0.6.rc1 → 0.0.6.rc2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +7 -3
- data/lib/orasaurus/cli.rb +11 -44
- data/lib/orasaurus/version.rb +1 -1
- metadata +9 -9
data/README.md
CHANGED
@@ -19,15 +19,19 @@ Install the gem
|
|
19
19
|
|
20
20
|
From the command-line, navigate to the directory that contains your application, then run the following command.
|
21
21
|
|
22
|
-
`orasaurus generate
|
22
|
+
`orasaurus generate [script_type]`
|
23
23
|
|
24
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
25
|
|
26
|
-
|
26
|
+
There are two kinds of `script_types`: build and teardown. Build scripts are sql\*plus scripts that run the contents of each buildable file into sql\*plus. The teardown scripts attempts to reverse the build scripts by dynamically creating scripts to drop the database objects (this really only works if your filenames are database object names).
|
27
|
+
|
28
|
+
If you choose to order your build scripts using sql, you must name your files to match the database object that the files contain. For instance, if you have a table called notes, the DDL for that table should be in a file titled "notes.some_buildable_extension".
|
29
|
+
|
30
|
+
You can also use the underlying code,as you see fit.
|
27
31
|
|
28
32
|
There is command-line help, as well: `orasaurus help`.
|
29
33
|
|
30
34
|
Coming Soon
|
31
35
|
-----------
|
32
36
|
|
33
|
-
I will be adding features
|
37
|
+
I will be adding features adding automation for executing the build and evaluating the results (i.e. were there errors), a richer interface for customizing builds, and some additional generators for automating the execution of the builds.
|
data/lib/orasaurus/cli.rb
CHANGED
@@ -7,18 +7,6 @@ module Orasaurus
|
|
7
7
|
|
8
8
|
class CLI < Thor
|
9
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
|
-
|
20
|
-
end
|
21
|
-
|
22
10
|
include Thor::Actions
|
23
11
|
|
24
12
|
map "-v" => :version
|
@@ -37,7 +25,8 @@ module Orasaurus
|
|
37
25
|
|
38
26
|
if options.sort_method.upcase == "SQL" then
|
39
27
|
puts "connecting for sql sorting."
|
40
|
-
|
28
|
+
db_connect_options = process_db_connect_options(options.db_username, options.db_password, options,db_name)
|
29
|
+
a.connect(db_connect_options[:db_username], db_connect_options[:db_password],db_connect_options[:db_name])
|
41
30
|
sort_options = { :method => :SQL, :db_connection => a.connection }
|
42
31
|
else
|
43
32
|
sort_options = {}
|
@@ -54,42 +43,20 @@ module Orasaurus
|
|
54
43
|
end
|
55
44
|
|
56
45
|
end
|
57
|
-
|
46
|
+
|
58
47
|
desc "version", "Currently running version of Orasaurus."
|
59
48
|
def version
|
60
49
|
puts "Orasarus v"+Orasaurus::VERSION
|
61
50
|
end
|
62
|
-
|
63
|
-
end
|
64
|
-
=begin
|
65
|
-
class Generate < Thor::Group
|
66
|
-
argument :script_type, :type => :string, :desc => "Use build, teardown, or all."
|
67
|
-
desc "generate scripts", "generate sqlplus scripts."
|
68
|
-
|
69
|
-
def generate(script_type)
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
build_script_name = options[:build_script_name]||"build.sql"
|
74
|
-
teardown_script_name = options[:teardown_script_name]||"teardown.sql"
|
75
|
-
|
76
|
-
say "generating build scripts"
|
77
|
-
s = Orasaurus.new( '.' )
|
78
|
-
s.build_all_scripts( build_script_name, teardown_script_name )
|
79
|
-
end
|
80
|
-
|
81
|
-
desc "generate_build_scripts", "generate sqlplus build scripts for the current directory."
|
82
|
-
method_options :build_script_name => :string, :teardown_script_name => :string
|
83
|
-
def teardown_scripts
|
84
|
-
build_script_name = options[:build_script_name]||"build.sql"
|
85
|
-
teardown_script_name = options[:teardown_script_name]||"teardown.sql"
|
86
|
-
|
87
|
-
say "generating build scripts"
|
88
|
-
s = Orasaurus::ScriptBuilder.new( '.' )
|
89
|
-
s.build_all_scripts( build_script_name, teardown_script_name )
|
90
|
-
end
|
91
51
|
|
52
|
+
def process_db_connect_options(db_username=nil, db_password=nil, db_name=nil)
|
53
|
+
params = Hash.new
|
54
|
+
params[:db_name] = db_name||ask("Database Name? ") { |q| q.echo = true }
|
55
|
+
params[:db_username] = db_username||ask("Database User? ") { |q| q.echo = true }
|
56
|
+
params[:db_password] = db_password||ask("Database Password? ") { |q| q.echo = "*" }
|
57
|
+
return params
|
58
|
+
end
|
59
|
+
|
92
60
|
end
|
93
|
-
=end
|
94
61
|
|
95
62
|
end
|
data/lib/orasaurus/version.rb
CHANGED
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.6.
|
4
|
+
version: 0.0.6.rc2
|
5
5
|
prerelease: 6
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2011-11-20 00:00:00.000000000Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
16
|
-
requirement: &
|
16
|
+
requirement: &74616620 !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: *74616620
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: thor
|
27
|
-
requirement: &
|
27
|
+
requirement: &74725720 !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: *74725720
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: highline
|
38
|
-
requirement: &
|
38
|
+
requirement: &74726760 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *74726760
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: ruby-oci8
|
49
|
-
requirement: &
|
49
|
+
requirement: &74727660 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,7 +54,7 @@ dependencies:
|
|
54
54
|
version: '0'
|
55
55
|
type: :runtime
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *74727660
|
58
58
|
description: A simple toolset for making it easier to build Oracle databases.
|
59
59
|
email:
|
60
60
|
- andrewthomascampbell@gmail.com
|