db_reference 0.0.8 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in db_reference.gemspec
4
+ gemspec
@@ -1,4 +1,6 @@
1
- Copyright (c) 2010 [name of plugin creator]
1
+ Copyright (c) 2010 Able Technology
2
+
3
+ MIT License
2
4
 
3
5
  Permission is hereby granted, free of charge, to any person obtaining
4
6
  a copy of this software and associated documentation files (the
@@ -17,4 +19,4 @@ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
19
  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
20
  LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
21
  OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,52 @@
1
+ # DB Reference
2
+
3
+ Used for creating a predefined set of model instances, similar to db:seed, but will not repopulate if entries already exist.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'db_reference'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install db_reference
18
+
19
+ ## Usage
20
+
21
+ Place references in 'db/reference/'
22
+ References will be loaded in ascending order, so if an order is desired, prepend 000, 001, 002... etc to the filename.
23
+
24
+ Run with:
25
+ rake reference:load
26
+
27
+ ## Example
28
+
29
+ The below example ensures that there are 6 locations existing in the database after running the 'rake reference:load'
30
+
31
+
32
+ ### db/schema.rb
33
+ create_table 'locations', :force => true do |t|
34
+ t.string 'name', :null => false
35
+ end
36
+
37
+
38
+ ### db/reference/000_locations.rb
39
+ Location.update_or_create :id => 1, :name => 'Wellington City'
40
+ Location.update_or_create :id => 2, :name => 'Lower Hutt'
41
+ Location.update_or_create :id => 3, :name => 'Kapiti Coast'
42
+ Location.update_or_create :id => 4, :name => 'Porirua'
43
+ Location.update_or_create :id => 5, :name => 'Upper Hutt'
44
+ Location.update_or_create :id => 6, :name => 'Wairarapa'
45
+
46
+ ## Contributing
47
+
48
+ 1. Fork it
49
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
50
+ 3. Commit your changes (`git commit -am 'Added some feature'`)
51
+ 4. Push to the branch (`git push origin my-new-feature`)
52
+ 5. Create new Pull Request
data/Rakefile CHANGED
@@ -1,85 +1,2 @@
1
- require 'rake'
2
- require 'rake/testtask'
3
- require 'rake/rdoctask'
4
- require 'rake/gempackagetask'
5
-
6
- desc 'Default: run unit tests.'
7
- task :default => :test
8
-
9
- desc 'Test the reference plugin.'
10
- Rake::TestTask.new(:test) do |t|
11
- t.libs << 'lib'
12
- t.libs << 'test'
13
- t.pattern = 'test/**/*_test.rb'
14
- t.verbose = true
15
- end
16
-
17
- desc 'Generate documentation for the reference plugin.'
18
- Rake::RDocTask.new(:rdoc) do |rdoc|
19
- rdoc.rdoc_dir = 'rdoc'
20
- rdoc.title = 'Reference'
21
- rdoc.options << '--line-numbers' << '--inline-source'
22
- rdoc.rdoc_files.include('README')
23
- rdoc.rdoc_files.include('lib/**/*.rb')
24
- end
25
-
26
-
27
- PKG_FILES = FileList[
28
- '[a-zA-Z]*',
29
- 'generators/**/*',
30
- 'lib/**/*',
31
- 'tasks/**/*',
32
- 'rails/**/*',
33
- 'test/**/*'
34
- ]
35
-
36
- spec = Gem::Specification.new do |s|
37
- s.name = "db_reference"
38
- s.version = "0.0.8"
39
- s.author = "Cam Fowler"
40
- s.email = "cameron.fowler@abletech.co.nz"
41
- s.homepage = "http://www.abletech.co.nz/"
42
- s.platform = Gem::Platform::RUBY
43
- s.summary = "Loads files from db/reference/"
44
- s.description = """
45
-
46
- Used for creating a predefined set of models, similar to db:seed, but will not repopulate if entries already exist.
47
-
48
- Place references in 'db/reference/'
49
- References will be loaded in ascending order, so if an order is desired, prepend 000, 001, 002... etc to the filename.
50
-
51
- Run with:
52
- rake reference:load
53
-
54
- Example
55
- =======
56
-
57
- The below example ensures that there are 6 locations existing in the database after running the 'rake reference:load'
58
-
59
-
60
- # db/schema.rb
61
- create_table 'locations', :force => true do |t|
62
- t.string 'name', :null => false
63
- end
64
-
65
-
66
- # db/reference/000_locations.rb
67
- Location.update_or_create :id => 1, :name => 'Wellington City'
68
- Location.update_or_create :id => 2, :name => 'Lower Hutt'
69
- Location.update_or_create :id => 3, :name => 'Kapiti Coast'
70
- Location.update_or_create :id => 4, :name => 'Porirua'
71
- Location.update_or_create :id => 5, :name => 'Upper Hutt'
72
- Location.update_or_create :id => 6, :name => 'Wairarapa'
73
-
74
- """
75
- s.files = PKG_FILES.to_a
76
- s.require_path = "lib"
77
- s.has_rdoc = false
78
- s.extra_rdoc_files = ["README"]
79
- end
80
-
81
- desc 'Turn this plugin into a gem.'
82
- Rake::GemPackageTask.new(spec) do |pkg|
83
- pkg.gem_spec = spec
84
- end
85
-
1
+ #!/usr/bin/env rake
2
+ require "bundler/gem_tasks"
@@ -0,0 +1,20 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path('../lib/db_reference/version', __FILE__)
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.authors = ["Cameron Fowler"]
6
+ gem.email = ["cameron.fowler@abletech.co.nz"]
7
+ gem.description = %q{Used to create a predefined set of model instances}
8
+ gem.summary = %q{Loads files from db/reference/*.rb}
9
+ gem.homepage = ""
10
+
11
+ gem.files = `git ls-files`.split($\)
12
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
13
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
14
+ gem.name = "db_reference"
15
+ gem.require_paths = ["lib"]
16
+ gem.version = DbReference::VERSION
17
+
18
+ gem.add_runtime_dependency 'rake'
19
+ gem.add_runtime_dependency 'rails', '~> 3.0'
20
+ end
@@ -1,2 +1,3 @@
1
1
  require 'db_reference/active_record_ext'
2
2
  require 'db_reference/railtie'
3
+ require "db_reference/version"
@@ -0,0 +1,3 @@
1
+ module DbReference
2
+ VERSION = "0.1.0"
3
+ end
metadata CHANGED
@@ -1,93 +1,98 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: db_reference
3
- version: !ruby/object:Gem::Version
4
- hash: 15
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
5
  prerelease:
6
- segments:
7
- - 0
8
- - 0
9
- - 8
10
- version: 0.0.8
11
6
  platform: ruby
12
- authors:
13
- - Cam Fowler
7
+ authors:
8
+ - Cameron Fowler
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2011-07-19 00:00:00 Z
19
- dependencies: []
20
-
21
- description: "\n\n\
22
- Used for creating a predefined set of models, similar to db:seed, but will not repopulate if entries already exist.\n\n\
23
- Place references in 'db/reference/'\n\
24
- References will be loaded in ascending order, so if an order is desired, prepend 000, 001, 002... etc to the filename.\n\n\
25
- Run with:\n rake reference:load\n\n\
26
- Example\n\
27
- =======\n\n\
28
- The below example ensures that there are 6 locations existing in the database after running the 'rake reference:load'\n\n\n\
29
- # db/schema.rb\n\
30
- create_table 'locations', :force => true do |t|\n t.string 'name', :null => false\n\
31
- end\n\n\n\
32
- # db/reference/000_locations.rb\n\
33
- Location.update_or_create :id => 1, :name => 'Wellington City'\n\
34
- Location.update_or_create :id => 2, :name => 'Lower Hutt'\n\
35
- Location.update_or_create :id => 3, :name => 'Kapiti Coast'\n\
36
- Location.update_or_create :id => 4, :name => 'Porirua'\n\
37
- Location.update_or_create :id => 5, :name => 'Upper Hutt'\n\
38
- Location.update_or_create :id => 6, :name => 'Wairarapa'\n\n "
39
- email: cameron.fowler@abletech.co.nz
12
+ date: 2012-05-29 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rake
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: rails
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ~>
36
+ - !ruby/object:Gem::Version
37
+ version: '3.0'
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: '3.0'
46
+ description: Used to create a predefined set of model instances
47
+ email:
48
+ - cameron.fowler@abletech.co.nz
40
49
  executables: []
41
-
42
50
  extensions: []
43
-
44
- extra_rdoc_files:
45
- - README
46
- files:
47
- - init.rb
48
- - install.rb
49
- - MIT-LICENSE
51
+ extra_rdoc_files: []
52
+ files:
53
+ - .gitignore
54
+ - Gemfile
55
+ - LICENSE
56
+ - README.md
50
57
  - Rakefile
51
- - README
52
- - uninstall.rb
58
+ - db_reference.gemspec
59
+ - lib/db_reference.rb
53
60
  - lib/db_reference/active_record_ext.rb
54
61
  - lib/db_reference/railtie.rb
55
- - lib/db_reference.rb
62
+ - lib/db_reference/version.rb
56
63
  - lib/tasks/db_reference_tasks.rake
57
64
  - test/reference_test.rb
58
65
  - test/test_helper.rb
59
- homepage: http://www.abletech.co.nz/
66
+ homepage: ''
60
67
  licenses: []
61
-
62
68
  post_install_message:
63
69
  rdoc_options: []
64
-
65
- require_paths:
70
+ require_paths:
66
71
  - lib
67
- required_ruby_version: !ruby/object:Gem::Requirement
72
+ required_ruby_version: !ruby/object:Gem::Requirement
68
73
  none: false
69
- requirements:
70
- - - ">="
71
- - !ruby/object:Gem::Version
72
- hash: 3
73
- segments:
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ segments:
74
79
  - 0
75
- version: "0"
76
- required_rubygems_version: !ruby/object:Gem::Requirement
80
+ hash: -2635922066652001072
81
+ required_rubygems_version: !ruby/object:Gem::Requirement
77
82
  none: false
78
- requirements:
79
- - - ">="
80
- - !ruby/object:Gem::Version
81
- hash: 3
82
- segments:
83
+ requirements:
84
+ - - ! '>='
85
+ - !ruby/object:Gem::Version
86
+ version: '0'
87
+ segments:
83
88
  - 0
84
- version: "0"
89
+ hash: -2635922066652001072
85
90
  requirements: []
86
-
87
91
  rubyforge_project:
88
- rubygems_version: 1.8.5
92
+ rubygems_version: 1.8.24
89
93
  signing_key:
90
94
  specification_version: 3
91
- summary: Loads files from db/reference/
92
- test_files: []
93
-
95
+ summary: Loads files from db/reference/*.rb
96
+ test_files:
97
+ - test/reference_test.rb
98
+ - test/test_helper.rb
data/README DELETED
@@ -1,38 +0,0 @@
1
- Reference
2
- =========
3
-
4
- Used for creating a predefined set of models, similar to db:seed, but will not repopulate if entries already exist.
5
-
6
- Place references in 'db/reference/'
7
- References will be loaded in ascending order, so if an order is desired, prepend 000, 001, 002... etc to the filename.
8
-
9
- Run with:
10
- rake reference:load
11
-
12
- Example
13
- =======
14
-
15
- The below example ensures that there are 6 locations existing in the database after running the 'rake reference:load'
16
-
17
-
18
- # db/schema.rb
19
- create_table "locations", :force => true do |t|
20
- t.string "name", :null => false
21
- end
22
-
23
-
24
- # db/reference/000_locations.rb
25
- Location.update_or_create :id => 1, :name => 'Wellington City'
26
- Location.update_or_create :id => 2, :name => 'Lower Hutt'
27
- Location.update_or_create :id => 3, :name => 'Kapiti Coast'
28
- Location.update_or_create :id => 4, :name => 'Porirua'
29
- Location.update_or_create :id => 5, :name => 'Upper Hutt'
30
- Location.update_or_create :id => 6, :name => 'Wairarapa'
31
-
32
-
33
-
34
-
35
-
36
-
37
-
38
- Copyright (c) 2010 Able Technology, released under the MIT license
data/init.rb DELETED
@@ -1 +0,0 @@
1
- require 'reference'
data/install.rb DELETED
@@ -1 +0,0 @@
1
- # Install hook code here
@@ -1 +0,0 @@
1
- # Uninstall hook code here