seed-fu 2.3.1 → 2.3.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- NzBjMTJiMTdlZDQ2ZWZkOTFhNWZhOWQ3OTlkYjgwZWI4YTJlNjFmMw==
5
- data.tar.gz: !binary |-
6
- ODg4MmNiZDEwZDM0MmZmNDhhOWRhZWMxNTBmNzFlNjVmNjM1ZGI2MQ==
2
+ SHA1:
3
+ metadata.gz: 05e8cbc7d552c919a6e1b4e35442fe50a6252c0e
4
+ data.tar.gz: 0e60964ee17d29ef2bdd60efeca10506ac4bb474
7
5
  SHA512:
8
- metadata.gz: !binary |-
9
- NDM4NTI2YTIxNDg4YmQyMGQ5YzA1YmFkYmZhZWQ4ZTViY2JjYjRiZTBmODc5
10
- MjA0YjkxZjE4MDkzZTc5NjgyMmE3YWJiMTE2NjlkZjhjN2U1NmU5Nzc3OTBl
11
- OGRkMTQ4ZTA0OGVlNDU5MzcxYTM5N2NmMjk5NjMxYWU4ZWQ1OTg=
12
- data.tar.gz: !binary |-
13
- MzI0YzEyZjQ3YWRhYWNkZmFlYWI5NGMzZmI4YzQ5MjIxYzM4YjMyYmMyYzYy
14
- YjFlYjU4NjlhOWJmZGEzNTlhODg0Yjk0MDQ5OGM4MDEwYzk4YjA5YTI4MzBk
15
- ZmZmMjAyM2JkZDJmMTkyMzlhODI5ODQyMzNiNDg4NGViM2UyNjk=
6
+ metadata.gz: 8decdff95c7bacf3e5e5aab012c70652fac27bf835f1a442fcd2af8865370046809560da7a6e472c25c4688e8eedd91a72b688b29283831b3926487fdc39e6d4
7
+ data.tar.gz: da68036bc158f353b2a0191b1e8b8f4a07b9b3576f89be4b6640fdfb378a5de87d26416258aceb7c896952a21ef12d249502cff63b2b350efa1c624b0b7e02d2
data/CHANGELOG.md CHANGED
@@ -1,3 +1,21 @@
1
+ Version 2.3.2
2
+ -------------
3
+
4
+ Features:
5
+
6
+ * Documentation improvements (by @george, @kenips, @joshuapinter)
7
+ * Fix documentation of seed_once method (by weedySeaDragon)
8
+ * Allow to seed data with an id < 1 (by @SamSaffron, @aserafin)
9
+ * Seeds work on postgresql when there is no primary key or if primary key has no sequence assigned (by @aserafin)
10
+
11
+ Version 2.3.1
12
+ -------------
13
+
14
+ Features:
15
+
16
+ * Rails 4.1 support added.
17
+ * Capistrano task included. (by @linjunpop)
18
+
1
19
  Version 2.3.0
2
20
  -------------
3
21
 
data/README.md CHANGED
@@ -39,9 +39,9 @@ Basic Example
39
39
  Installation
40
40
  ------------
41
41
 
42
- ### Rails 3.1
42
+ ### Rails 3.1, 3.2, 4.0, 4.1
43
43
 
44
- Just add `gem 'seed-fu', '~> 2.1.0'` to your `Gemfile`
44
+ Just add `gem 'seed-fu', '~> 2.3'` to your `Gemfile`
45
45
 
46
46
  Seed Fu depends on Active Record, but doesn't have to be used with a full Rails app. Simply load and require the `seed-fu` gem and you're set.
47
47
 
@@ -89,8 +89,8 @@ Where to put seed files
89
89
 
90
90
  By default, seed files are looked for in the following locations:
91
91
 
92
- * `Rails.root/db/fixtures` and `Rails.root/db/fixtures/Rails.env` in a Rails app
93
- * `db/fixtures` when loaded without Rails
92
+ * `#{Rails.root}/db/fixtures` and `#{Rails.root}/db/fixtures/#{Rails.env}` in a Rails app
93
+ * `./db/fixtures` when loaded without Rails
94
94
 
95
95
  You can change these defaults by modifying the `SeedFu.fixture_paths` array.
96
96
 
@@ -38,7 +38,7 @@ module SeedFu
38
38
  # @example
39
39
  # Person.seed(:id, :id => 1, :name => "Jon") # => Record created
40
40
  # Person.seed(:id, :id => 1, :name => "Bob") # => Name changed
41
- # Person.seed(:id, :id => 1, :name => "Harry") # => Name *not* changed
41
+ # Person.seed_once(:id, :id => 1, :name => "Harry") # => Name *not* changed
42
42
  def seed_once(*args, &block)
43
43
  constraints, data = parse_seed_fu_args(args, block)
44
44
  SeedFu::Seeder.new(self, constraints, data, :insert_only => true).seed
@@ -86,14 +86,14 @@ module SeedFu
86
86
 
87
87
  def update_id_sequence
88
88
  if @model_class.connection.adapter_name == "PostgreSQL"
89
+ return if @model_class.primary_key.nil? || @model_class.sequence_name.nil?
90
+
89
91
  quoted_id = @model_class.connection.quote_column_name(@model_class.primary_key)
90
- quoted_sequence = "'" + @model_class.sequence_name + "'"
91
- @model_class.connection.execute(
92
- "SELECT pg_catalog.setval(" +
93
- "#{quoted_sequence}," +
94
- "(SELECT MAX(#{quoted_id}) FROM #{@model_class.quoted_table_name}) + 1" +
95
- ");"
96
- )
92
+ sequence = @model_class.sequence_name
93
+
94
+ @model_class.connection.execute <<-EOS
95
+ SELECT setval('#{sequence}', (SELECT GREATEST(MAX(#{quoted_id})+(SELECT increment_by FROM #{sequence}), (SELECT min_value FROM #{sequence})) FROM #{@model_class.quoted_table_name}), false)
96
+ EOS
97
97
  end
98
98
  end
99
99
  end
@@ -1,4 +1,4 @@
1
1
  module SeedFu
2
2
  # The current version of Seed Fu
3
- VERSION = '2.3.1'
3
+ VERSION = '2.3.2'
4
4
  end
@@ -16,13 +16,13 @@ namespace :db do
16
16
 
17
17
  Examples:
18
18
  # default, to load all seed files for the current environment
19
- rake db:seed
19
+ rake db:seed_fu
20
20
 
21
21
  # to load seed files matching orders or customers
22
- rake db:seed FILTER=orders,customers
22
+ rake db:seed_fu FILTER=orders,customers
23
23
 
24
24
  # to load files from RAILS_ROOT/features/fixtures
25
- rake db:seed FIXTURE_PATH=features/fixtures
25
+ rake db:seed_fu FIXTURE_PATH=features/fixtures
26
26
  EOS
27
27
  task :seed_fu => :environment do
28
28
  if ENV["FILTER"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: seed-fu
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.1
4
+ version: 2.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Bleigh
@@ -9,102 +9,102 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-04-14 00:00:00.000000000 Z
12
+ date: 2014-06-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activerecord
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - ! '>='
18
+ - - ">="
19
19
  - !ruby/object:Gem::Version
20
20
  version: '3.1'
21
- - - <
21
+ - - "<"
22
22
  - !ruby/object:Gem::Version
23
23
  version: '4.2'
24
24
  type: :runtime
25
25
  prerelease: false
26
26
  version_requirements: !ruby/object:Gem::Requirement
27
27
  requirements:
28
- - - ! '>='
28
+ - - ">="
29
29
  - !ruby/object:Gem::Version
30
30
  version: '3.1'
31
- - - <
31
+ - - "<"
32
32
  - !ruby/object:Gem::Version
33
33
  version: '4.2'
34
34
  - !ruby/object:Gem::Dependency
35
35
  name: activesupport
36
36
  requirement: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ! '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '3.1'
41
- - - <
41
+ - - "<"
42
42
  - !ruby/object:Gem::Version
43
43
  version: '4.2'
44
44
  type: :runtime
45
45
  prerelease: false
46
46
  version_requirements: !ruby/object:Gem::Requirement
47
47
  requirements:
48
- - - ! '>='
48
+ - - ">="
49
49
  - !ruby/object:Gem::Version
50
50
  version: '3.1'
51
- - - <
51
+ - - "<"
52
52
  - !ruby/object:Gem::Version
53
53
  version: '4.2'
54
54
  - !ruby/object:Gem::Dependency
55
55
  name: rspec
56
56
  requirement: !ruby/object:Gem::Requirement
57
57
  requirements:
58
- - - ~>
58
+ - - "~>"
59
59
  - !ruby/object:Gem::Version
60
60
  version: '2.0'
61
61
  type: :development
62
62
  prerelease: false
63
63
  version_requirements: !ruby/object:Gem::Requirement
64
64
  requirements:
65
- - - ~>
65
+ - - "~>"
66
66
  - !ruby/object:Gem::Version
67
67
  version: '2.0'
68
68
  - !ruby/object:Gem::Dependency
69
69
  name: pg
70
70
  requirement: !ruby/object:Gem::Requirement
71
71
  requirements:
72
- - - ! '>='
72
+ - - "~>"
73
73
  - !ruby/object:Gem::Version
74
74
  version: '0'
75
75
  type: :development
76
76
  prerelease: false
77
77
  version_requirements: !ruby/object:Gem::Requirement
78
78
  requirements:
79
- - - ! '>='
79
+ - - "~>"
80
80
  - !ruby/object:Gem::Version
81
81
  version: '0'
82
82
  - !ruby/object:Gem::Dependency
83
83
  name: mysql2
84
84
  requirement: !ruby/object:Gem::Requirement
85
85
  requirements:
86
- - - ! '>='
86
+ - - "~>"
87
87
  - !ruby/object:Gem::Version
88
88
  version: '0'
89
89
  type: :development
90
90
  prerelease: false
91
91
  version_requirements: !ruby/object:Gem::Requirement
92
92
  requirements:
93
- - - ! '>='
93
+ - - "~>"
94
94
  - !ruby/object:Gem::Version
95
95
  version: '0'
96
96
  - !ruby/object:Gem::Dependency
97
97
  name: sqlite3
98
98
  requirement: !ruby/object:Gem::Requirement
99
99
  requirements:
100
- - - ! '>='
100
+ - - "~>"
101
101
  - !ruby/object:Gem::Version
102
102
  version: '0'
103
103
  type: :development
104
104
  prerelease: false
105
105
  version_requirements: !ruby/object:Gem::Requirement
106
106
  requirements:
107
- - - ! '>='
107
+ - - "~>"
108
108
  - !ruby/object:Gem::Version
109
109
  version: '0'
110
110
  description: Seed Fu is an attempt to once and for all solve the problem of inserting
@@ -140,12 +140,12 @@ require_paths:
140
140
  - lib
141
141
  required_ruby_version: !ruby/object:Gem::Requirement
142
142
  requirements:
143
- - - ! '>='
143
+ - - ">="
144
144
  - !ruby/object:Gem::Version
145
145
  version: '0'
146
146
  required_rubygems_version: !ruby/object:Gem::Requirement
147
147
  requirements:
148
- - - ! '>='
148
+ - - ">="
149
149
  - !ruby/object:Gem::Version
150
150
  version: '0'
151
151
  requirements: []
@@ -155,3 +155,4 @@ signing_key:
155
155
  specification_version: 4
156
156
  summary: Easily manage seed data in your Active Record application
157
157
  test_files: []
158
+ has_rdoc: