seeder 1.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.travis.yml +30 -6
- data/lib/seeder/version.rb +1 -1
- data/seeder.gemspec +3 -2
- data/spec/seeder_spec.rb +5 -3
- data/spec/support/active_record/connection_adapters/abstract_mysql_adapter.rb +9 -0
- data/spec/support/setup.rb +5 -1
- metadata +21 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 64c508e96448005b41a7d0a30b84170aa4a41dd26b475fe6245b63a5237005b9
|
4
|
+
data.tar.gz: 49c7c2b35c6747a184473500f9cee7ed89a16fc3114a3e23a287d8ef5b436c21
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 424b8ad661cd099f8c491106ac59c57813943ccf52ce40ac2f7eb0934527091b4adf1cd95cfd19aa7238864f5fb604dee35bc8f7be10eece072c2e065d84eefc
|
7
|
+
data.tar.gz: 13fb268e4cc35b6b53395e88fd430242b8dcee808e96498cd1474faf801a4786dd6804cb009a1562230810b7461e1fd8bfe2528c6b7e2edced97e6f2d6c5719f
|
data/.travis.yml
CHANGED
@@ -4,15 +4,39 @@ language: ruby
|
|
4
4
|
rvm:
|
5
5
|
- 1.9.3
|
6
6
|
- 2.0.0
|
7
|
-
- 2.1.
|
8
|
-
- 2.2.
|
7
|
+
- 2.1.10
|
8
|
+
- 2.2.7
|
9
|
+
- 2.3.4
|
10
|
+
- 2.4.1
|
9
11
|
env:
|
10
12
|
global:
|
11
13
|
- NOKOGIRI_USE_SYSTEM_LIBRARIES=true
|
12
14
|
matrix:
|
13
|
-
- AR=3.2.
|
14
|
-
- AR=4.0.
|
15
|
-
- AR=4.1.
|
16
|
-
- AR=4.2.
|
15
|
+
- AR=3.2.22.5
|
16
|
+
- AR=4.0.13
|
17
|
+
- AR=4.1.16
|
18
|
+
- AR=4.2.8
|
19
|
+
- AR=5.0.3
|
20
|
+
- AR=5.1.1
|
21
|
+
matrix:
|
22
|
+
exclude:
|
23
|
+
- rvm: 1.9.3
|
24
|
+
env: AR=5.0.3
|
25
|
+
- rvm: 1.9.3
|
26
|
+
env: AR=5.1.1
|
27
|
+
- rvm: 2.0.0
|
28
|
+
env: AR=5.0.3
|
29
|
+
- rvm: 2.0.0
|
30
|
+
env: AR=5.1.1
|
31
|
+
- rvm: 2.1.10
|
32
|
+
env: AR=5.0.3
|
33
|
+
- rvm: 2.1.10
|
34
|
+
env: AR=5.1.1
|
35
|
+
- rvm: 2.4.1
|
36
|
+
env: AR=3.2.22.5
|
37
|
+
- rvm: 2.4.1
|
38
|
+
env: AR=4.0.13
|
39
|
+
- rvm: 2.4.1
|
40
|
+
env: AR=4.1.16
|
17
41
|
before_script:
|
18
42
|
- mysql -e 'create database seeder_test;'
|
data/lib/seeder/version.rb
CHANGED
data/seeder.gemspec
CHANGED
@@ -15,8 +15,9 @@ Gem::Specification.new do |s|
|
|
15
15
|
s.extra_rdoc_files = ["README.md", "LICENSE.txt"]
|
16
16
|
s.license = 'MIT'
|
17
17
|
|
18
|
-
s.add_dependency('activerecord', '>= 3.2', '< 5.
|
18
|
+
s.add_dependency('activerecord', '>= 3.2', '< 5.2')
|
19
19
|
|
20
20
|
s.add_development_dependency('mysql2', '~> 0.3.10')
|
21
|
-
s.add_development_dependency('rspec
|
21
|
+
s.add_development_dependency('rspec', '~> 3.0')
|
22
|
+
s.add_development_dependency('rake', '>= 10.4')
|
22
23
|
end
|
data/spec/seeder_spec.rb
CHANGED
@@ -76,10 +76,12 @@ describe Seeder do
|
|
76
76
|
end
|
77
77
|
|
78
78
|
it 'aborts when an exception is raised' do
|
79
|
-
|
79
|
+
allow(seeder)
|
80
|
+
.to receive(:create_new_records)
|
81
|
+
.and_raise(ActiveRecord::RecordInvalid.new(Grade.new))
|
80
82
|
initial_attributes = Grade.all.map(&:attributes)
|
81
83
|
|
82
|
-
expect { seeder.create }.to raise_error
|
84
|
+
expect { seeder.create }.to raise_error(ActiveRecord::RecordInvalid)
|
83
85
|
|
84
86
|
expect(Grade.all.map(&:attributes)).to eq(initial_attributes)
|
85
87
|
end
|
@@ -91,7 +93,7 @@ describe Seeder do
|
|
91
93
|
seeder.create
|
92
94
|
|
93
95
|
expect(Grade.count).to eq(2)
|
94
|
-
expect(Grade.exists?(grade1)).to eq(false)
|
96
|
+
expect(Grade.exists?(grade1.id)).to eq(false)
|
95
97
|
|
96
98
|
grade2.reload
|
97
99
|
expect(grade2.student_id).to eq(1)
|
@@ -0,0 +1,9 @@
|
|
1
|
+
# Patch support for MySQL 5.7+ onto ActiveRecord < 4.1.
|
2
|
+
if ActiveRecord::VERSION::MAJOR < 4 ||
|
3
|
+
(ActiveRecord::VERSION::MAJOR == 4 && ActiveRecord::VERSION::MINOR < 1)
|
4
|
+
|
5
|
+
require 'active_record/connection_adapters/abstract_mysql_adapter'
|
6
|
+
class ActiveRecord::ConnectionAdapters::AbstractMysqlAdapter
|
7
|
+
NATIVE_DATABASE_TYPES[:primary_key] = "int(11) auto_increment PRIMARY KEY"
|
8
|
+
end
|
9
|
+
end
|
data/spec/support/setup.rb
CHANGED
@@ -1,10 +1,14 @@
|
|
1
|
+
require 'support/active_record/connection_adapters/abstract_mysql_adapter'
|
2
|
+
|
1
3
|
ActiveRecord::Base.establish_connection({
|
2
4
|
adapter: 'mysql2',
|
3
5
|
username: 'travis',
|
4
6
|
database: 'seeder_test'
|
5
7
|
})
|
6
8
|
|
7
|
-
ActiveRecord::
|
9
|
+
tables_method = ActiveRecord::VERSION::MAJOR >= 5 ? :data_sources : :tables
|
10
|
+
|
11
|
+
ActiveRecord::Base.connection.public_send(tables_method).each do |table|
|
8
12
|
ActiveRecord::Base.connection.drop_table table
|
9
13
|
end
|
10
14
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: seeder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Barun Singh
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-03-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -19,7 +19,7 @@ dependencies:
|
|
19
19
|
version: '3.2'
|
20
20
|
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: '5.
|
22
|
+
version: '5.2'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -29,7 +29,7 @@ dependencies:
|
|
29
29
|
version: '3.2'
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: '5.
|
32
|
+
version: '5.2'
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: mysql2
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -45,7 +45,7 @@ dependencies:
|
|
45
45
|
- !ruby/object:Gem::Version
|
46
46
|
version: 0.3.10
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
|
-
name: rspec
|
48
|
+
name: rspec
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|
50
50
|
requirements:
|
51
51
|
- - "~>"
|
@@ -58,6 +58,20 @@ dependencies:
|
|
58
58
|
- - "~>"
|
59
59
|
- !ruby/object:Gem::Version
|
60
60
|
version: '3.0'
|
61
|
+
- !ruby/object:Gem::Dependency
|
62
|
+
name: rake
|
63
|
+
requirement: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - ">="
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '10.4'
|
68
|
+
type: :development
|
69
|
+
prerelease: false
|
70
|
+
version_requirements: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - ">="
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: '10.4'
|
61
75
|
description: Keep your app's seed data in one file and update it easily
|
62
76
|
email: bsingh@wegowise.com
|
63
77
|
executables: []
|
@@ -77,6 +91,7 @@ files:
|
|
77
91
|
- lib/seeder/version.rb
|
78
92
|
- seeder.gemspec
|
79
93
|
- spec/seeder_spec.rb
|
94
|
+
- spec/support/active_record/connection_adapters/abstract_mysql_adapter.rb
|
80
95
|
- spec/support/setup.rb
|
81
96
|
homepage: http://github.com/wegowise/seeder
|
82
97
|
licenses:
|
@@ -98,7 +113,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
98
113
|
version: 1.3.6
|
99
114
|
requirements: []
|
100
115
|
rubyforge_project:
|
101
|
-
rubygems_version: 2.
|
116
|
+
rubygems_version: 2.7.6
|
102
117
|
signing_key:
|
103
118
|
specification_version: 4
|
104
119
|
summary: Manage seed data for your Rails app
|