seed_dump 3.2.0 → 3.2.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bfceec9ace09fe7f6bec3d37e650177e6d38a498
4
- data.tar.gz: d29db6f1aeab2121c7d384ff8caf9cb1c3e25cee
3
+ metadata.gz: e68a311668435ac3671cea8f316a78f7ed0e614f
4
+ data.tar.gz: 6c0e787af6ba4a654443ac96bc54232e1f244376
5
5
  SHA512:
6
- metadata.gz: d1701fa7864603423e03e1fa615a54fcf550c599cee96d11f746e081cb5e677dc4bb628b9153c9dd3981fb829e060b61406b72edd145e345a051eeb37efcec06
7
- data.tar.gz: c300b879c570e0225fc5091db798375ae5f3e3eecd52c1dfc4c22613458c48fcc51f70e8b44ecc2909fb33ecf0ef3f462e7f21ec199a4ab801644794d942ed6c
6
+ metadata.gz: 0b566197175084fde13648a4bf0315a7b443bce05c6a97fe5b06bdb1e3ef5d57b81ed0661c0077393d2d85844760d49858d35a35e157d409753668a4e0cf48b0
7
+ data.tar.gz: a574f0f3671f6de35e23f38950747b3d62106ac34e13bf016c1fe8f4865c30a6f578ffd9cea0dcf2df0de3f5f62afbdee77da064d4820ed506bbf5ea4ccd1cd0
data/README.md CHANGED
@@ -36,8 +36,8 @@ Result:
36
36
  {category_id: 3, description: "Plain White Tee Shirt", name: "Plain T-Shirt"}
37
37
  ])
38
38
  User.create!([
39
- {id: 1, password: "123456", username: "test_1"},
40
- {id: 2, password: "234567", username: "test_2"}
39
+ {password: "123456", username: "test_1"},
40
+ {password: "234567", username: "test_2"}
41
41
  ])
42
42
 
43
43
  Dump only data from the users table and dump a maximum of 1 record:
@@ -47,7 +47,7 @@ Dump only data from the users table and dump a maximum of 1 record:
47
47
  Result:
48
48
 
49
49
  User.create!([
50
- {id: 1, password: "123456", username: "test_1"}
50
+ {password: "123456", username: "test_1"}
51
51
  ])
52
52
 
53
53
  Append to `db/seeds.rb` instead of overwriting it:
@@ -70,8 +70,8 @@ Output a dump of all User records:
70
70
 
71
71
  irb(main):001:0> puts SeedDump.dump(User)
72
72
  User.create!([
73
- {id: 1, password: "123456", username: "test_1"},
74
- {id: 2, password: "234567", username: "test_2"}
73
+ {password: "123456", username: "test_1"},
74
+ {password: "234567", username: "test_2"}
75
75
  ])
76
76
 
77
77
  Write the dump to a file:
@@ -88,6 +88,15 @@ Exclude `name` and `age` from the dump:
88
88
 
89
89
  Options are specified as a Hash for the second argument.
90
90
 
91
+ In the console, any relation of ActiveRecord rows can be dumped (not individual objects though)
92
+
93
+ irb(main):001:0> puts SeedDump.dump(User.where(is_admin: false)
94
+ User.create!([
95
+ {password: "123456", username: "test_1", is_admin: false},
96
+ {password: "234567", username: "test_2", is_admin: false}
97
+ ])
98
+
99
+
91
100
  Options
92
101
  -------
93
102
 
@@ -97,7 +106,7 @@ Options are common to both the Rake task and the console, except where noted.
97
106
 
98
107
  `batch_size`: Controls the number of records that are written to file at a given time. Default: 1000. If you're running out of memory when dumping, try decreasing this. If things are dumping too slow, trying increasing this.
99
108
 
100
- `exclude`: Attributes to be excluded from the dump. By default `id`, `created_at`, and `updated_at` are excluded. Pass a comma-separated list to the Rake task (i.e. `name,age`) and an array on the console (i.e. `[:name, :age]`).
109
+ `exclude`: Attributes to be excluded from the dump.Pass a comma-separated list to the Rake task (i.e. `name,age`) and an array on the console (i.e. `[:name, :age]`). Default: `[:id, :created_at, :updated_at]` (this default can be overridden by just setting this option)
101
110
 
102
111
  `file`: Write to the specified output file. The Rake task default is `db/seeds.rb`. The console returns the dump as a string by default.
103
112
 
@@ -106,4 +115,3 @@ Options are common to both the Rake task and the console, except where noted.
106
115
  `limit`: Dump no more than this amount of data. Default: no limit. Rake task only. In the console just pass in an ActiveRecord::Relation with the appropriate limit (e.g. `SeedDump.dump(User.limit(5))`).
107
116
 
108
117
  `model[s]`: Restrict the dump to the specified comma-separated list of models. Default: all models. If you are using a Rails engine you can dump a specific model by passing "EngineName::ModelName". Rake task only. Example: `rake db:seed:dump MODELS="User, Position, Function"`
109
-
data/VERSION CHANGED
@@ -1 +1 @@
1
- 3.2.0
1
+ 3.2.1
@@ -36,7 +36,7 @@ class SeedDump
36
36
 
37
37
  def value_to_s(value)
38
38
  value = case value
39
- when BigDecimal
39
+ when BigDecimal, IPAddr
40
40
  value.to_s
41
41
  when Date, Time, DateTime
42
42
  value.to_s(:db)
data/seed_dump.gemspec CHANGED
@@ -2,16 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: seed_dump 3.2.0 ruby lib
5
+ # stub: seed_dump 3.2.1 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "seed_dump"
9
- s.version = "3.2.0"
9
+ s.version = "3.2.1"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib"]
13
13
  s.authors = ["Rob Halff", "Ryan Oblak"]
14
- s.date = "2014-07-27"
14
+ s.date = "2014-12-15"
15
15
  s.description = "Dump (parts) of your database to db/seeds.rb to get a headstart creating a meaningful seeds.rb file"
16
16
  s.email = "rroblak@gmail.com"
17
17
  s.extra_rdoc_files = [
@@ -41,7 +41,7 @@ Gem::Specification.new do |s|
41
41
  ]
42
42
  s.homepage = "https://github.com/rroblak/seed_dump"
43
43
  s.licenses = ["MIT"]
44
- s.rubygems_version = "2.2.1"
44
+ s.rubygems_version = "2.4.3"
45
45
  s.summary = "{Seed Dumper for Rails}"
46
46
 
47
47
  if s.respond_to? :specification_version then
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: seed_dump
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.0
4
+ version: 3.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rob Halff
@@ -9,90 +9,90 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-07-27 00:00:00.000000000 Z
12
+ date: 2014-12-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - ~>
18
+ - - "~>"
19
19
  - !ruby/object:Gem::Version
20
20
  version: '4'
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
- - - ~>
25
+ - - "~>"
26
26
  - !ruby/object:Gem::Version
27
27
  version: '4'
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: activerecord
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
- - - ~>
32
+ - - "~>"
33
33
  - !ruby/object:Gem::Version
34
34
  version: '4'
35
35
  type: :runtime
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
- - - ~>
39
+ - - "~>"
40
40
  - !ruby/object:Gem::Version
41
41
  version: '4'
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: byebug
44
44
  requirement: !ruby/object:Gem::Requirement
45
45
  requirements:
46
- - - ~>
46
+ - - "~>"
47
47
  - !ruby/object:Gem::Version
48
48
  version: '2.0'
49
49
  type: :development
50
50
  prerelease: false
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
53
- - - ~>
53
+ - - "~>"
54
54
  - !ruby/object:Gem::Version
55
55
  version: '2.0'
56
56
  - !ruby/object:Gem::Dependency
57
57
  name: factory_girl
58
58
  requirement: !ruby/object:Gem::Requirement
59
59
  requirements:
60
- - - ~>
60
+ - - "~>"
61
61
  - !ruby/object:Gem::Version
62
62
  version: '4.0'
63
63
  type: :development
64
64
  prerelease: false
65
65
  version_requirements: !ruby/object:Gem::Requirement
66
66
  requirements:
67
- - - ~>
67
+ - - "~>"
68
68
  - !ruby/object:Gem::Version
69
69
  version: '4.0'
70
70
  - !ruby/object:Gem::Dependency
71
71
  name: activerecord-import
72
72
  requirement: !ruby/object:Gem::Requirement
73
73
  requirements:
74
- - - ~>
74
+ - - "~>"
75
75
  - !ruby/object:Gem::Version
76
76
  version: '0.4'
77
77
  type: :development
78
78
  prerelease: false
79
79
  version_requirements: !ruby/object:Gem::Requirement
80
80
  requirements:
81
- - - ~>
81
+ - - "~>"
82
82
  - !ruby/object:Gem::Version
83
83
  version: '0.4'
84
84
  - !ruby/object:Gem::Dependency
85
85
  name: jeweler
86
86
  requirement: !ruby/object:Gem::Requirement
87
87
  requirements:
88
- - - ~>
88
+ - - "~>"
89
89
  - !ruby/object:Gem::Version
90
90
  version: '2.0'
91
91
  type: :development
92
92
  prerelease: false
93
93
  version_requirements: !ruby/object:Gem::Requirement
94
94
  requirements:
95
- - - ~>
95
+ - - "~>"
96
96
  - !ruby/object:Gem::Version
97
97
  version: '2.0'
98
98
  description: Dump (parts) of your database to db/seeds.rb to get a headstart creating
@@ -103,7 +103,7 @@ extensions: []
103
103
  extra_rdoc_files:
104
104
  - README.md
105
105
  files:
106
- - .rspec
106
+ - ".rspec"
107
107
  - Gemfile
108
108
  - MIT-LICENSE
109
109
  - README.md
@@ -133,18 +133,18 @@ require_paths:
133
133
  - lib
134
134
  required_ruby_version: !ruby/object:Gem::Requirement
135
135
  requirements:
136
- - - '>='
136
+ - - ">="
137
137
  - !ruby/object:Gem::Version
138
138
  version: '0'
139
139
  required_rubygems_version: !ruby/object:Gem::Requirement
140
140
  requirements:
141
- - - '>='
141
+ - - ">="
142
142
  - !ruby/object:Gem::Version
143
143
  version: '0'
144
144
  requirements: []
145
145
  rubyforge_project:
146
- rubygems_version: 2.2.1
146
+ rubygems_version: 2.4.3
147
147
  signing_key:
148
148
  specification_version: 4
149
- summary: '{Seed Dumper for Rails}'
149
+ summary: "{Seed Dumper for Rails}"
150
150
  test_files: []