db_reference 0.0.2 → 0.0.3
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/Rakefile +34 -1
- metadata +23 -4
data/Rakefile
CHANGED
@@ -35,12 +35,45 @@ PKG_FILES = FileList[
|
|
35
35
|
|
36
36
|
spec = Gem::Specification.new do |s|
|
37
37
|
s.name = "db_reference"
|
38
|
-
s.version = "0.0.
|
38
|
+
s.version = "0.0.3"
|
39
39
|
s.author = "Cam Fowler"
|
40
40
|
s.email = "cameron.fowler@abletech.co.nz"
|
41
41
|
s.homepage = "http://www.abletech.co.nz/"
|
42
42
|
s.platform = Gem::Platform::RUBY
|
43
43
|
s.summary = "Loads files from db/reference/"
|
44
|
+
s.description = """
|
45
|
+
Reference
|
46
|
+
=========
|
47
|
+
|
48
|
+
Used for creating a predefined set of models, similar to db:seed, but will not repopulate if entries already exist.
|
49
|
+
|
50
|
+
Place references in 'db/reference/'
|
51
|
+
References will be loaded in ascending order, so if an order is desired, prepend 000, 001, 002... etc to the filename.
|
52
|
+
|
53
|
+
Run with:
|
54
|
+
rake reference:load
|
55
|
+
|
56
|
+
Example
|
57
|
+
=======
|
58
|
+
|
59
|
+
The below example ensures that there are 6 locations existing in the database after running the 'rake reference:load'
|
60
|
+
|
61
|
+
|
62
|
+
# db/schema.rb
|
63
|
+
create_table 'locations', :force => true do |t|
|
64
|
+
t.string 'name', :null => false
|
65
|
+
end
|
66
|
+
|
67
|
+
|
68
|
+
# db/reference/000_locations.rb
|
69
|
+
Location.update_or_create :id => 1, :name => 'Wellington City'
|
70
|
+
Location.update_or_create :id => 2, :name => 'Lower Hutt'
|
71
|
+
Location.update_or_create :id => 3, :name => 'Kapiti Coast'
|
72
|
+
Location.update_or_create :id => 4, :name => 'Porirua'
|
73
|
+
Location.update_or_create :id => 5, :name => 'Upper Hutt'
|
74
|
+
Location.update_or_create :id => 6, :name => 'Wairarapa'
|
75
|
+
|
76
|
+
"""
|
44
77
|
s.files = PKG_FILES.to_a
|
45
78
|
s.require_path = "lib"
|
46
79
|
s.has_rdoc = false
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: db_reference
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 25
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 3
|
10
|
+
version: 0.0.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Cam Fowler
|
@@ -19,7 +19,26 @@ date: 2010-12-20 00:00:00 +13:00
|
|
19
19
|
default_executable:
|
20
20
|
dependencies: []
|
21
21
|
|
22
|
-
description:
|
22
|
+
description: "\n\
|
23
|
+
Reference\n\
|
24
|
+
=========\n\n\
|
25
|
+
Used for creating a predefined set of models, similar to db:seed, but will not repopulate if entries already exist.\n\n\
|
26
|
+
Place references in 'db/reference/'\n\
|
27
|
+
References will be loaded in ascending order, so if an order is desired, prepend 000, 001, 002... etc to the filename.\n\n\
|
28
|
+
Run with:\n rake reference:load\n\n\
|
29
|
+
Example\n\
|
30
|
+
=======\n\n\
|
31
|
+
The below example ensures that there are 6 locations existing in the database after running the 'rake reference:load'\n\n\n\
|
32
|
+
# db/schema.rb\n\
|
33
|
+
create_table 'locations', :force => true do |t|\n t.string 'name', :null => false\n\
|
34
|
+
end\n\n\n\
|
35
|
+
# db/reference/000_locations.rb\n\
|
36
|
+
Location.update_or_create :id => 1, :name => 'Wellington City'\n\
|
37
|
+
Location.update_or_create :id => 2, :name => 'Lower Hutt'\n\
|
38
|
+
Location.update_or_create :id => 3, :name => 'Kapiti Coast'\n\
|
39
|
+
Location.update_or_create :id => 4, :name => 'Porirua'\n\
|
40
|
+
Location.update_or_create :id => 5, :name => 'Upper Hutt'\n\
|
41
|
+
Location.update_or_create :id => 6, :name => 'Wairarapa'\n\n "
|
23
42
|
email: cameron.fowler@abletech.co.nz
|
24
43
|
executables: []
|
25
44
|
|