oracle-model-generator 0.4.0 → 0.5.0

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.tar.gz.sig ADDED
Binary file
metadata CHANGED
@@ -1,57 +1,84 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oracle-model-generator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel J. Berger
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
- cert_chain: []
11
- date: 2014-11-08 00:00:00.000000000 Z
10
+ cert_chain:
11
+ - |
12
+ -----BEGIN CERTIFICATE-----
13
+ MIIEcDCCAtigAwIBAgIBATANBgkqhkiG9w0BAQsFADA/MREwDwYDVQQDDAhkamJl
14
+ cmc5NjEVMBMGCgmSJomT8ixkARkWBWdtYWlsMRMwEQYKCZImiZPyLGQBGRYDY29t
15
+ MB4XDTE4MDMxODE1MjIwN1oXDTI4MDMxNTE1MjIwN1owPzERMA8GA1UEAwwIZGpi
16
+ ZXJnOTYxFTATBgoJkiaJk/IsZAEZFgVnbWFpbDETMBEGCgmSJomT8ixkARkWA2Nv
17
+ bTCCAaIwDQYJKoZIhvcNAQEBBQADggGPADCCAYoCggGBALgfaroVM6CI06cxr0/h
18
+ A+j+pc8fgpRgBVmHFaFunq28GPC3IvW7Nvc3Y8SnAW7pP1EQIbhlwRIaQzJ93/yj
19
+ u95KpkP7tA9erypnV7dpzBkzNlX14ACaFD/6pHoXoe2ltBxk3CCyyzx70mTqJpph
20
+ 75IB03ni9a8yqn8pmse+s83bFJOAqddSj009sGPcQO+QOWiNxqYv1n5EHcvj2ebO
21
+ 6hN7YTmhx7aSia4qL/quc4DlIaGMWoAhvML7u1fmo53CYxkKskfN8MOecq2vfEmL
22
+ iLu+SsVVEAufMDDFMXMJlvDsviolUSGMSNRTujkyCcJoXKYYxZSNtIiyd9etI0X3
23
+ ctu0uhrFyrMZXCedutvXNjUolD5r9KGBFSWH1R9u2I3n3SAyFF2yzv/7idQHLJJq
24
+ 74BMnx0FIq6fCpu5slAipvxZ3ZkZpEXZFr3cIBtO1gFvQWW7E/Y3ijliWJS1GQFq
25
+ 058qERadHGu1yu1dojmFRo6W2KZvY9al2yIlbkpDrD5MYQIDAQABo3cwdTAJBgNV
26
+ HRMEAjAAMAsGA1UdDwQEAwIEsDAdBgNVHQ4EFgQUFZsMapgzJimzsbaBG2Tm8j5e
27
+ AzgwHQYDVR0RBBYwFIESZGpiZXJnOTZAZ21haWwuY29tMB0GA1UdEgQWMBSBEmRq
28
+ YmVyZzk2QGdtYWlsLmNvbTANBgkqhkiG9w0BAQsFAAOCAYEAW2tnYixXQtKxgGXq
29
+ /3iSWG2bLwvxS4go3srO+aRXZHrFUMlJ5W0mCxl03aazxxKTsVVpZD8QZxvK91OQ
30
+ h9zr9JBYqCLcCVbr8SkmYCi/laxIZxsNE5YI8cC8vvlLI7AMgSfPSnn/Epq1GjGY
31
+ 6L1iRcEDtanGCIvjqlCXO9+BmsnCfEVehqZkQHeYczA03tpOWb6pon2wzvMKSsKH
32
+ ks0ApVdstSLz1kzzAqem/uHdG9FyXdbTAwH1G4ZPv69sQAFAOCgAqYmdnzedsQtE
33
+ 1LQfaQrx0twO+CZJPcRLEESjq8ScQxWRRkfuh2VeR7cEU7L7KqT10mtUwrvw7APf
34
+ DYoeCY9KyjIBjQXfbj2ke5u1hZj94Fsq9FfbEQg8ygCgwThnmkTrrKEiMSs3alYR
35
+ ORVCZpRuCPpmC8qmqxUnARDArzucjaclkxjLWvCVHeFa9UP7K3Nl9oTjJNv+7/jM
36
+ WZs4eecIcUc4tKdHxcAJ0MO/Dkqq7hGaiHpwKY76wQ1+8xAh
37
+ -----END CERTIFICATE-----
38
+ date: 2025-07-23 00:00:00.000000000 Z
12
39
  dependencies:
13
40
  - !ruby/object:Gem::Dependency
14
41
  name: ruby-oci8
15
42
  requirement: !ruby/object:Gem::Requirement
16
43
  requirements:
17
- - - ">="
44
+ - - "~>"
18
45
  - !ruby/object:Gem::Version
19
- version: '0'
46
+ version: '2.2'
20
47
  type: :runtime
21
48
  prerelease: false
22
49
  version_requirements: !ruby/object:Gem::Requirement
23
50
  requirements:
24
- - - ">="
51
+ - - "~>"
25
52
  - !ruby/object:Gem::Version
26
- version: '0'
53
+ version: '2.2'
27
54
  - !ruby/object:Gem::Dependency
28
55
  name: getopt
29
56
  requirement: !ruby/object:Gem::Requirement
30
57
  requirements:
31
- - - ">="
58
+ - - "~>"
32
59
  - !ruby/object:Gem::Version
33
- version: '0'
60
+ version: '1.6'
34
61
  type: :runtime
35
62
  prerelease: false
36
63
  version_requirements: !ruby/object:Gem::Requirement
37
64
  requirements:
38
- - - ">="
65
+ - - "~>"
39
66
  - !ruby/object:Gem::Version
40
- version: '0'
67
+ version: '1.6'
41
68
  - !ruby/object:Gem::Dependency
42
- name: test-unit
69
+ name: rspec
43
70
  requirement: !ruby/object:Gem::Requirement
44
71
  requirements:
45
- - - ">="
72
+ - - "~>"
46
73
  - !ruby/object:Gem::Version
47
- version: '0'
74
+ version: '3.12'
48
75
  type: :development
49
76
  prerelease: false
50
77
  version_requirements: !ruby/object:Gem::Requirement
51
78
  requirements:
52
- - - ">="
79
+ - - "~>"
53
80
  - !ruby/object:Gem::Version
54
- version: '0'
81
+ version: '3.12'
55
82
  description: |2
56
83
  The oracle-model-generator library allows you to generate an ActiveRecord
57
84
  model from an existing Oracle table or view, as well as automatically
@@ -60,25 +87,31 @@ email: djberg96@gmail.com
60
87
  executables:
61
88
  - omg
62
89
  extensions: []
63
- extra_rdoc_files:
64
- - CHANGES
65
- - README
66
- - MANIFEST
90
+ extra_rdoc_files: []
67
91
  files:
68
- - CHANGES
69
- - MANIFEST
70
- - README
92
+ - CHANGES.md
93
+ - DOCKER.md
94
+ - Dockerfile
95
+ - Gemfile
96
+ - LICENSE
97
+ - MANIFEST.md
98
+ - README-Docker.md
99
+ - README.md
71
100
  - Rakefile
72
101
  - bin/omg
102
+ - certs/djberg96_pub.pem
103
+ - docker-compose.yml
104
+ - lib/oracle-model-generator.rb
73
105
  - lib/oracle/model/generator.rb
74
- - lib/oracle_model_generator.rb
75
106
  - oracle-model-generator.gemspec
76
- - test/test_oracle_model_generator.rb
107
+ - spec/oracle_model_generator_spec.rb
108
+ - spec/spec_helper.rb
109
+ - spec/support/oracle_connection.rb
77
110
  homepage: http://www.github.com/djberg96/oracle-model-generator
78
111
  licenses:
79
- - Artistic 2.0
112
+ - Apache-2.0
80
113
  metadata: {}
81
- post_install_message:
114
+ post_install_message:
82
115
  rdoc_options: []
83
116
  require_paths:
84
117
  - lib
@@ -93,10 +126,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
93
126
  - !ruby/object:Gem::Version
94
127
  version: '0'
95
128
  requirements: []
96
- rubyforge_project:
97
- rubygems_version: 2.4.2
98
- signing_key:
129
+ rubygems_version: 3.5.22
130
+ signing_key:
99
131
  specification_version: 4
100
132
  summary: A Ruby interface for determining protocol information
101
133
  test_files:
102
- - test/test_oracle_model_generator.rb
134
+ - spec/oracle_model_generator_spec.rb
135
+ - spec/spec_helper.rb
136
+ - spec/support/oracle_connection.rb
metadata.gz.sig ADDED
Binary file
data/README DELETED
@@ -1,150 +0,0 @@
1
- = Description
2
- A library for generating an ActiveRecord model from an existing Oracle table.
3
- This will install an "omg" executable that you can use from the command line.
4
-
5
- = Synopsis
6
- Using the command line tool:
7
-
8
- omg -d your_database -t locations -u some_user -p some_password
9
-
10
- The above command results in a file called "location.rb". This is an
11
- ActiveRecord model declaration, with all validations, primary keys,
12
- table name and belongs_to relationships defined.
13
-
14
- If your LOCATIONS table looks like this:
15
-
16
- create table locations(
17
- location_id number(4,0) primary key,
18
- street_address varchar2(40),
19
- postal_code varchar2(12),
20
- city varchar2(30) not null
21
- state_province varchar2(25),
22
- country_id CHAR(2),
23
- constraint "LOC_C_ID_FK" FOREIGN KEY (country_id)
24
- references COUNTRIES (country_id)
25
- )
26
-
27
- The omg library will generate this:
28
-
29
- class Location < ActiveRecord::Base
30
- set_table_name :locations
31
- set_primary_key :location_id
32
-
33
- # Table relationships
34
-
35
- belongs_to :countries
36
-
37
- # Validations
38
-
39
- validates :location_id, :presence => true, :numericality => {
40
- :less_than_or_equal_to => 9999,
41
- :greater_than_or_equal_to => -9999,
42
- :only_integer => true
43
- }
44
-
45
- validates :street_address, :length => {:maximum => 40}
46
- validates :postal_code, :length => {:maximum => 12}
47
- validates :city, :length => {:maximum => 30}, :presence => true
48
- validates :state_province, :length => {:maximum => 25}
49
- validates :country_id, :length => {:maximum => 2}
50
- end
51
-
52
- It will also generate a corresponding test file using test-unit 2 by default.
53
- For the above example you will see some tests like this:
54
-
55
- class TC_Location < Test::Unit::TestCase
56
- def setup
57
- @location = Location.new
58
- end
59
-
60
- test 'table name is locations' do
61
- assert_equal('locations', Location.table_name)
62
- end
63
-
64
- test 'primary key is location_id' do
65
- assert_equal('location_id', Location.primary_key)
66
- end
67
-
68
- test 'location_id basic functionality' do
69
- assert_respond_to(@location, :location_id)
70
- assert_nothing_raised{ @location.location_id }
71
- assert_kind_of(Numeric, @location.location_id)
72
- end
73
-
74
- test 'location_id must be a number' do
75
- @location.location_id = 'test_string'
76
- assert_false(@location.valid?)
77
- assert_true(@location.errors[:location_id].include?('is not a number'))
78
- end
79
-
80
- test 'location_id cannot exceed the value 9999' do
81
- @location.location_id = 10000
82
- assert_false(@location.valid?)
83
- assert_true(@location.errors[:location_id].include?('must be less than or equal to 9999'))
84
- end
85
-
86
- # ... and so on.
87
- end
88
-
89
- = Requirements
90
- == Must Have
91
- * ruby-oci8
92
- * getopt
93
-
94
- == Optional
95
- If you want to be able to avoid specifying a username and password on the
96
- command line then you will need the dbi-dbrc library.
97
-
98
- If you want your models to support multiple primary keys, then you will
99
- need to install the composite_primary_keys library.
100
-
101
- If you want date format validations, then you will need to install the
102
- validates_timeliness library.
103
-
104
- = What this library doesn't do
105
- I do not attempt to set has_many or has_one relationships. There's no good
106
- way to determine that relationship (one or many?). Besides, in practice I
107
- find that most people set custom has_xxx relationships that go over and
108
- above what's set in the Oracle database anyway for purposes of their
109
- application.
110
-
111
- I also do not go out of my way to get the model name correct with regards
112
- to singular vs plural. I do a simple guess that covers most cases, but
113
- complex cases will break it. It's much easier for you to rename a class or
114
- file name than it is for me to get this 100% correct. As of 0.3.1 there's
115
- also the --class option that let's you eplicitly set it if you like.
116
-
117
- = Author's Comments
118
- I chose not to patch legacy_data because I have no interest in supporting
119
- other vendors other than Oracle with this library. By focusing only on
120
- Oracle I could take advantage of ruby-oci8 features. In addition, I have no
121
- interest in making this a Rails plugin, and I needed the support of multiple
122
- primary keys.
123
-
124
- = Future Plans
125
- Add support for views.
126
- Add automatic test suite generation for rspec.
127
- Explicitly set :foreign_key if using CPK in belongs_to relationships.
128
- The output could use a little formatting love.
129
-
130
- = Acknowlegements
131
- Thanks go to Daniel Luna for his --class patch.
132
-
133
- = Known Issues
134
- None known. If you find any issues, please report them on the github project
135
- page at http://www.github.com/djberg96/oracle-model-generator.
136
-
137
- = Warranty
138
- This package is provided "as is" and without any express or
139
- implied warranties, including, without limitation, the implied
140
- warranties of merchantability and fitness for a particular purpose.
141
-
142
- = Copyright
143
- (C) 2010-2014 Daniel J. Berger
144
- All Rights Reserved
145
-
146
- = License
147
- Artistic 2.0
148
-
149
- = Author
150
- Daniel J. Berger
@@ -1 +0,0 @@
1
- require File.join(File.dirname(__FILE__), 'oracle/model/generator')
@@ -1,70 +0,0 @@
1
- #############################################################################
2
- # test_oracle_model_generator.rb
3
- #
4
- # Test suite for the oracle-model-generator library. For testing purposes
5
- # I'm using the 'hr' database that comes as part of the Oracle Express
6
- # edition which you can download from oracle.com. Adjust as necessary.
7
- #############################################################################
8
- require 'rubygems'
9
- gem 'test-unit'
10
- require 'test/unit'
11
- require 'oracle/model/generator'
12
-
13
- class TC_Oracle_Model_Generator < Test::Unit::TestCase
14
- def setup
15
- @username = 'hr'
16
- @password = 'hr'
17
- @database = 'xe'
18
- @generator = nil
19
- @connection = OCI8.new(@username, @password, @database)
20
- end
21
-
22
- test "version number is correct" do
23
- assert_equal('0.4.0', Oracle::Model::Generator::VERSION)
24
- end
25
-
26
- test "constructor accepts an oci8 connection object" do
27
- assert_nothing_raised{ @generator = Oracle::Model::Generator.new(@connection) }
28
- end
29
-
30
- test "generate method basic functionality" do
31
- assert_nothing_raised{ @generator = Oracle::Model::Generator.new(@connection) }
32
- assert_respond_to(@generator, :generate)
33
- end
34
-
35
- test "generate method works with a table name or view" do
36
- @generator = Oracle::Model::Generator.new(@connection)
37
- assert_nothing_raised{ @generator.generate('employees') }
38
- assert_nothing_raised{ @generator.generate('emp_details_view', true) }
39
- end
40
-
41
- test "model method returns active record model name" do
42
- @generator = Oracle::Model::Generator.new(@connection)
43
- @generator.generate('emp_details_view', true)
44
- assert_respond_to(@generator, :model)
45
- assert_equal('EmpDetailsView', @generator.model)
46
- end
47
-
48
- test "table method returns uppercased table name passed to generate method" do
49
- @generator = Oracle::Model::Generator.new(@connection)
50
- @generator.generate('emp_details_view', true)
51
- assert_respond_to(@generator, :table)
52
- assert_equal('EMP_DETAILS_VIEW', @generator.table)
53
- end
54
-
55
- test "dependencies method returns an array of hashes" do
56
- @generator = Oracle::Model::Generator.new(@connection)
57
- @generator.generate('employees', true)
58
- assert_respond_to(@generator, :dependencies)
59
- assert_kind_of(Array, @generator.dependencies)
60
- assert_kind_of(Hash, @generator.dependencies.first)
61
- end
62
-
63
- def teardown
64
- @username = nil
65
- @password = nil
66
- @database = nil
67
- @generator = nil
68
- @connection.logoff if @connection
69
- end
70
- end