live_fixtures 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -2
- data/lib/live_fixtures/import.rb +2 -2
- data/lib/live_fixtures/import/fixtures.rb +7 -7
- data/lib/live_fixtures/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 65c289e9334bcc64e494914412b0009ba331df5d
|
4
|
+
data.tar.gz: 1c4e83eb54bc2e270b425e04626fe24d15b0f327
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1ce276cc748f25dd873cd6685da27f96893cba3a1fe254b3dfaf135f46c2ed2db485b9710ad9d45f53f10faa2759a54d419b00fee50c8e9efd147ae83b7a3bae
|
7
|
+
data.tar.gz: 16dafe289086b77e9177766fe059451258c1647d84b1c03249c83f965a176930be4d9d9578ab72ac50a2388040bd37ab24751f551398ddeeb3ccc9f48e1a4ae5
|
data/CHANGELOG.md
CHANGED
@@ -2,12 +2,18 @@
|
|
2
2
|
All notable changes to this project will be documented in this file.
|
3
3
|
This project adheres to [Semantic Versioning](http://semver.org/).
|
4
4
|
|
5
|
+
## [0.2.0] - (Unreleased)
|
6
|
+
### Breaking change
|
7
|
+
- live_fixtures now depends on activerecord ~> 4.2
|
8
|
+
|
9
|
+
[0.2.0]: https://github.com/NoRedInk/live_fixtures/compare/v0.1.1...v0.2.0
|
10
|
+
|
5
11
|
## [0.1.1] - 2016-06-30
|
6
12
|
### Fixed
|
7
13
|
- [live fixtures works better with slow TTYs & zeus](https://github.com/NoRedInk/live_fixtures/pull/4)
|
8
14
|
|
15
|
+
[0.1.1]: https://github.com/NoRedInk/live_fixtures/compare/v0.1.0...v0.1.1
|
16
|
+
|
9
17
|
## 0.1.0 - 2016-06-13
|
10
18
|
### Added
|
11
19
|
- initial release
|
12
|
-
|
13
|
-
[0.1.1]: https://github.com/NoRedInk/live_fixtures/compare/v0.1.0...v0.1.1
|
data/lib/live_fixtures/import.rb
CHANGED
@@ -65,8 +65,8 @@ class LiveFixtures::Import
|
|
65
65
|
@label_to_id = {}
|
66
66
|
end
|
67
67
|
|
68
|
-
# https://github.com/rails/rails/blob/
|
69
|
-
# The very similar method: ActiveRecord::
|
68
|
+
# https://github.com/rails/rails/blob/4-2-stable/activerecord/lib/active_record/fixtures.rb#L496
|
69
|
+
# The very similar method: ActiveRecord::FixtureSet.create_fixtures has the
|
70
70
|
# unfortunate side effect of truncating each table!!
|
71
71
|
#
|
72
72
|
# Therefore, we have reproduced the relevant sections here, without DELETEs,
|
@@ -8,15 +8,15 @@ class LiveFixtures::Import
|
|
8
8
|
attr_reader :ar_fixtures
|
9
9
|
|
10
10
|
def initialize(connection, table_name, class_name, filepath, label_to_id)
|
11
|
-
@ar_fixtures = ActiveRecord::
|
12
|
-
|
13
|
-
|
14
|
-
|
11
|
+
@ar_fixtures = ActiveRecord::FixtureSet.new connection,
|
12
|
+
table_name,
|
13
|
+
class_name,
|
14
|
+
filepath
|
15
15
|
@label_to_id = label_to_id
|
16
16
|
end
|
17
17
|
|
18
|
-
# https://github.com/rails/rails/blob/
|
19
|
-
# Rewritten to take advantage of @label_to_id instead of AR::
|
18
|
+
# https://github.com/rails/rails/blob/4-2-stable/activerecord/lib/active_record/fixtures.rb#L611
|
19
|
+
# Rewritten to take advantage of @label_to_id instead of AR::FixtureSet#identify,
|
20
20
|
# and to make an iterator.
|
21
21
|
#
|
22
22
|
# Iterator which yields [table_name, label, row] for each fixture
|
@@ -37,7 +37,7 @@ class LiveFixtures::Import
|
|
37
37
|
maybe_convert_association_to_foreign_key row, association
|
38
38
|
|
39
39
|
when :has_and_belongs_to_many
|
40
|
-
join_table_name = association.
|
40
|
+
join_table_name = association.join_table
|
41
41
|
|
42
42
|
targets = row.delete(association.name.to_s)
|
43
43
|
targets = targets.split(/\s*,\s*/) unless targets.is_a?(Array)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: live_fixtures
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- jleven
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-05-
|
11
|
+
date: 2017-05-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '4.2'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '4.2'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: ruby-progressbar
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -150,7 +150,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
150
150
|
requirements:
|
151
151
|
- - ">="
|
152
152
|
- !ruby/object:Gem::Version
|
153
|
-
version: '
|
153
|
+
version: '2.1'
|
154
154
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
155
155
|
requirements:
|
156
156
|
- - ">="
|