heart_seed 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.hound.yml +31 -0
- data/.travis.yml +15 -5
- data/CHANGELOG.md +7 -1
- data/Gemfile +0 -3
- data/README.md +2 -0
- data/heart_seed.gemspec +11 -11
- data/lib/heart_seed/converter.rb +4 -3
- data/lib/heart_seed/db_seed.rb +77 -27
- data/lib/heart_seed/helper.rb +2 -2
- data/lib/heart_seed/tasks/heart_seed.rake +2 -3
- data/lib/heart_seed/version.rb +1 -1
- data/spec/db/setup.rb +1 -1
- data/spec/db/test_models.rb +4 -4
- data/spec/heart_seed/db_seed_spec.rb +40 -9
- data/spec/spec_helper.rb +6 -4
- metadata +47 -32
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cf94922ae1a0a622269943b4598ac461fabb7f11
|
4
|
+
data.tar.gz: 84bb1c58325c03d3472656e763a27b892428b6f0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 53da2afdc2b19b6cd23a2d299b0540cf221738f5ca09e36cecf06f955e73d9049971b9ed0e4d4277f8227fcfb26fd75175c207262a14214a71c2607b37cf5f00
|
7
|
+
data.tar.gz: 22f75929ad85617f9516b714fe6c2672fdd1cce5de61e52186272438e5ce6d4ceff36b339d8bb0e36cc6c9cdf1548207cbf1b0ba4e23a8a145221fd1e1be96d8
|
data/.hound.yml
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
Style/LineLength:
|
2
|
+
Description: 'Limit lines to 130 characters.'
|
3
|
+
Max: 130
|
4
|
+
Style/SpaceInsideParens:
|
5
|
+
Enabled: false
|
6
|
+
Style/SpaceBeforeBlockBraces:
|
7
|
+
Enabled: false
|
8
|
+
StringLiterals:
|
9
|
+
Enabled: false
|
10
|
+
Style/TrailingComma:
|
11
|
+
Enabled: false
|
12
|
+
Style/BlockComments:
|
13
|
+
Enabled: false
|
14
|
+
Style/NilComparison:
|
15
|
+
Enabled: false
|
16
|
+
Style/Documentation:
|
17
|
+
Enabled: false
|
18
|
+
Style/RegexpLiteral:
|
19
|
+
Enabled: false
|
20
|
+
Style/SignalException:
|
21
|
+
Enabled: false
|
22
|
+
Style/CaseEquality:
|
23
|
+
Enabled: false
|
24
|
+
Style/SpaceInsideBlockBraces:
|
25
|
+
Enabled: false
|
26
|
+
Style/SpaceBeforeComma:
|
27
|
+
Enabled: false
|
28
|
+
Style/SpaceInsideHashLiteralBraces:
|
29
|
+
Enabled: false
|
30
|
+
Style/SingleSpaceBeforeFirstArg:
|
31
|
+
Enabled: false
|
data/.travis.yml
CHANGED
@@ -1,11 +1,21 @@
|
|
1
1
|
language: ruby
|
2
2
|
rvm:
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
3
|
+
- 2.0
|
4
|
+
- 2.1
|
5
|
+
- 2.2
|
6
|
+
- ruby-head
|
7
|
+
bundler_args: "--jobs=2"
|
8
|
+
before_script:
|
9
|
+
- export CODECLIMATE_REPO_TOKEN=9fe512c81149a06ced2b890ab071422bf553cbaf3253fe6830ad75ce92f37516
|
10
|
+
- export COVERAGE=true
|
11
|
+
script: bundle exec rspec
|
7
12
|
branches:
|
8
13
|
only:
|
9
|
-
|
14
|
+
- master
|
10
15
|
notifications:
|
11
16
|
email: false
|
17
|
+
slack:
|
18
|
+
secure: ZlXJJ1No8ZY7I8kpl+FDdhU/f6GaTCbstE8P1iIuW0f/gmk1mGhlxT7YLdWfRlBqQxMjxid6CfFuxfYNYBj8j/V4tR2z2Q22vb7YkMvBK32CdFTWeKVdNC0Znt91dbB5UwyHuUbkrWHGzGDddpr2tytbo6shaNDH3B7KQm30/WE=
|
19
|
+
matrix:
|
20
|
+
allow_failures:
|
21
|
+
- rvm: ruby-head
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
## master
|
2
|
-
[full changelog](https://github.com/sue445/heart_seed/compare/v0.0.
|
2
|
+
[full changelog](https://github.com/sue445/heart_seed/compare/v0.0.4...master)
|
3
|
+
|
4
|
+
## 0.0.4 (2015/01/16)
|
5
|
+
[full changelog](https://github.com/sue445/heart_seed/compare/v0.0.3...v0.0.4)
|
6
|
+
|
7
|
+
* Support insert by ActiveRecord (thx @takeshit19)
|
8
|
+
* https://github.com/sue445/heart_seed/pull/17
|
3
9
|
|
4
10
|
## 0.0.3 (2014/07/25)
|
5
11
|
[full changelog](https://github.com/sue445/heart_seed/compare/v0.0.2...v0.0.3)
|
data/Gemfile
CHANGED
data/README.md
CHANGED
data/heart_seed.gemspec
CHANGED
@@ -20,26 +20,26 @@ Gem::Specification.new do |spec|
|
|
20
20
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
21
21
|
spec.require_paths = ["lib"]
|
22
22
|
|
23
|
-
spec.add_dependency "activesupport", ">= 3.0.0"
|
24
23
|
spec.add_dependency "activerecord", ">= 3.0.0"
|
25
24
|
spec.add_dependency "activerecord-import"
|
25
|
+
spec.add_dependency "activesupport", ">= 3.0.0"
|
26
26
|
spec.add_dependency "roo", ">= 1.13.2"
|
27
27
|
|
28
28
|
spec.add_development_dependency "bundler", "~> 1.6"
|
29
|
+
spec.add_development_dependency "codeclimate-test-reporter"
|
30
|
+
spec.add_development_dependency "coveralls"
|
31
|
+
spec.add_development_dependency "database_rewinder", "> 0.2.0"
|
32
|
+
spec.add_development_dependency "pry"
|
33
|
+
spec.add_development_dependency "pry-nav"
|
34
|
+
spec.add_development_dependency "pry-remote"
|
29
35
|
spec.add_development_dependency "rake"
|
36
|
+
spec.add_development_dependency "rake_shared_context"
|
30
37
|
spec.add_development_dependency "rspec", "3.0.0"
|
31
|
-
spec.add_development_dependency "rspec-parameterized"
|
32
|
-
spec.add_development_dependency "rspec-its"
|
33
38
|
spec.add_development_dependency "rspec-collection_matchers"
|
39
|
+
spec.add_development_dependency "rspec-its"
|
40
|
+
spec.add_development_dependency "rspec-parameterized"
|
34
41
|
spec.add_development_dependency "rspec-temp_dir"
|
35
|
-
spec.add_development_dependency "yard"
|
36
|
-
# spec.add_development_dependency "database_rewinder"
|
37
42
|
spec.add_development_dependency "sqlite3"
|
38
|
-
spec.add_development_dependency "
|
39
|
-
spec.add_development_dependency "pry-remote"
|
40
|
-
spec.add_development_dependency "pry-nav"
|
41
|
-
spec.add_development_dependency "rake_shared_context"
|
42
|
-
spec.add_development_dependency "codeclimate-test-reporter"
|
43
|
-
spec.add_development_dependency "coveralls"
|
43
|
+
spec.add_development_dependency "yard"
|
44
44
|
end
|
45
45
|
|
data/lib/heart_seed/converter.rb
CHANGED
@@ -62,8 +62,6 @@ module HeartSeed
|
|
62
62
|
open_file(source_file).sheets.select{|sheet| sheet =~ /^[A-Za-z0-9_]+$/ }
|
63
63
|
end
|
64
64
|
|
65
|
-
private
|
66
|
-
|
67
65
|
# @param source_file [String]
|
68
66
|
#
|
69
67
|
# @return [Roo::Base]
|
@@ -77,10 +75,12 @@ module HeartSeed
|
|
77
75
|
raise ArgumentError, "unknown format: #{source_file}"
|
78
76
|
end
|
79
77
|
end
|
78
|
+
private_class_method :open_file
|
80
79
|
|
81
80
|
def self.empty_sheet?(sheet)
|
82
81
|
sheet.first_row == sheet.last_row || sheet.first_column == sheet.last_column
|
83
82
|
end
|
83
|
+
private_class_method :empty_sheet?
|
84
84
|
|
85
85
|
# @param sheet [Roo::Base]
|
86
86
|
# @param row_prefix [String]
|
@@ -108,7 +108,7 @@ module HeartSeed
|
|
108
108
|
row_value[key] = value
|
109
109
|
end
|
110
110
|
|
111
|
-
suffix = row_value.
|
111
|
+
suffix = row_value.key?("id") ? row_value["id"] : row_num - 1
|
112
112
|
row_name = "#{row_prefix}_#{suffix}"
|
113
113
|
|
114
114
|
fixtures[row_name] = row_value
|
@@ -116,6 +116,7 @@ module HeartSeed
|
|
116
116
|
|
117
117
|
fixtures
|
118
118
|
end
|
119
|
+
private_class_method :read_sheet
|
119
120
|
|
120
121
|
def self.select_left_of_blank(array)
|
121
122
|
response = []
|
data/lib/heart_seed/db_seed.rb
CHANGED
@@ -1,11 +1,13 @@
|
|
1
1
|
module HeartSeed
|
2
2
|
module DbSeed
|
3
|
-
|
3
|
+
BULK = "bulk"
|
4
|
+
ACTIVE_RECORD = "active_record"
|
5
|
+
# delete all records and bulk insert from seed yaml
|
4
6
|
#
|
5
|
-
# @param
|
7
|
+
# @param file_path [String]
|
6
8
|
# @param model_class [Class] require. extends {ActiveRecord::Base}
|
7
|
-
def self.bulk_insert(
|
8
|
-
fixtures = HeartSeed::Converter.read_fixture_yml(
|
9
|
+
def self.bulk_insert(file_path: nil, model_class: nil)
|
10
|
+
fixtures = HeartSeed::Converter.read_fixture_yml(file_path)
|
9
11
|
models = fixtures.each_with_object([]) do |fixture, response|
|
10
12
|
response << model_class.new(fixture)
|
11
13
|
response
|
@@ -17,30 +19,46 @@ module HeartSeed
|
|
17
19
|
end
|
18
20
|
end
|
19
21
|
|
20
|
-
#
|
22
|
+
# delete all records and insert from seed yaml
|
21
23
|
#
|
22
|
-
# @param
|
23
|
-
# @param
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
24
|
+
# @param file_path [String]
|
25
|
+
# @param model_class [Class] require. extends {ActiveRecord::Base}
|
26
|
+
def self.insert(file_path: nil, model_class: nil)
|
27
|
+
fixtures = HeartSeed::Converter.read_fixture_yml(file_path)
|
28
|
+
model_class.transaction do
|
29
|
+
model_class.delete_all
|
30
|
+
fixtures.each do |fixture|
|
31
|
+
model_class.create(fixture)
|
32
|
+
end
|
31
33
|
end
|
34
|
+
end
|
35
|
+
|
36
|
+
# import all seed yaml to table
|
37
|
+
#
|
38
|
+
# @param seed_dir [String]
|
39
|
+
# @param tables [Array<String>,String] table names array or comma separated table names.
|
40
|
+
# if empty, import all seed yaml.
|
41
|
+
# if not empty, import only these tables.
|
42
|
+
# @param catalogs [Array<String>,String] catalogs names array or comma separated catalog names.
|
43
|
+
# if empty, import all seed yaml.
|
44
|
+
# if not empty, import only these tables in catalogs.
|
45
|
+
# @param insert_mode [String] const ACTIVE_RECORD or other string.
|
46
|
+
# if empty or not ACTIVE_RECORD, using bulk insert.
|
47
|
+
# if ACTIVE_RECORD, import with ActiveRecord.
|
48
|
+
def self.import_all(seed_dir: HeartSeed::Helper.seed_dir, tables: ENV["TABLES"], catalogs: ENV["CATALOGS"], mode: ENV["MODE"])
|
49
|
+
mode ||= BULK
|
50
|
+
target_table_names = parse_target_table_names(tables: tables, catalogs: catalogs)
|
32
51
|
|
33
|
-
raise "require TABLES or CATALOGS if production" if HeartSeed::Helper.production? &&
|
52
|
+
raise "require TABLES or CATALOGS if production" if HeartSeed::Helper.production? && target_table_names.empty?
|
34
53
|
|
35
54
|
ActiveRecord::Migration.verbose = true
|
36
|
-
Dir.glob(File.join(seed_dir, "*.yml")) do |
|
37
|
-
table_name = File.basename(
|
38
|
-
next unless target_table?(table_name,
|
55
|
+
Dir.glob(File.join(seed_dir, "*.yml")) do |file_path|
|
56
|
+
table_name = File.basename(file_path, '.*')
|
57
|
+
next unless target_table?(table_name, target_table_names)
|
39
58
|
|
40
|
-
ActiveRecord::Migration.say_with_time("#{
|
59
|
+
ActiveRecord::Migration.say_with_time("#{file_path} -> #{table_name}") do
|
41
60
|
begin
|
42
|
-
|
43
|
-
bulk_insert(source_file: file, model_class: model_class)
|
61
|
+
insert_seed(file_path: file_path, table_name: table_name, mode: mode)
|
44
62
|
ActiveRecord::Migration.say("[INFO] success", true)
|
45
63
|
rescue => e
|
46
64
|
ActiveRecord::Migration.say("[ERROR] #{e.message}", true)
|
@@ -52,18 +70,36 @@ module HeartSeed
|
|
52
70
|
# import all seed yaml to table with specified shards
|
53
71
|
#
|
54
72
|
# @param seed_dir [String]
|
55
|
-
# @param tables [Array<String>,String] table names array or comma separated table names.
|
56
|
-
#
|
73
|
+
# @param tables [Array<String>,String] table names array or comma separated table names.
|
74
|
+
# if empty, import all seed yaml.
|
75
|
+
# if not empty, import only these tables.
|
76
|
+
# @param catalogs [Array<String>,String] catalogs names array or comma separated catalog names.
|
77
|
+
# if empty, import all seed yaml.
|
78
|
+
# if not empty, import only these tables in catalogs.
|
79
|
+
# @param insert_mode [String] const ACTIVE_RECORD or other string.
|
80
|
+
# if empty or not ACTIVE_RECORD, using bulk insert.
|
81
|
+
# if ACTIVE_RECORD, import with ActiveRecord.
|
57
82
|
# @param shard_names [Array<String>]
|
58
|
-
def self.import_all_with_shards(seed_dir: HeartSeed::Helper.seed_dir, tables: ENV["TABLES"], catalogs: ENV["CATALOGS"],
|
83
|
+
def self.import_all_with_shards(seed_dir: HeartSeed::Helper.seed_dir, tables: ENV["TABLES"], catalogs: ENV["CATALOGS"],
|
84
|
+
mode: ENV["MODE"] || BULK, shard_names: [])
|
59
85
|
shard_names.each do |shard_name|
|
60
86
|
ActiveRecord::Migration.say_with_time("import to shard: #{shard_name}") do
|
61
87
|
ActiveRecord::Base.establish_connection(shard_name.to_sym)
|
62
|
-
import_all(seed_dir: seed_dir, tables: tables, catalogs: catalogs)
|
88
|
+
import_all(seed_dir: seed_dir, tables: tables, catalogs: catalogs, mode: mode)
|
63
89
|
end
|
64
90
|
end
|
65
91
|
end
|
66
92
|
|
93
|
+
def self.parse_target_table_names(tables: nil, catalogs: nil)
|
94
|
+
# use tables in catalogs
|
95
|
+
target_table_names = parse_arg_catalogs(catalogs)
|
96
|
+
return target_table_names unless target_table_names.empty?
|
97
|
+
|
98
|
+
# use tables
|
99
|
+
parse_string_or_array_arg(tables)
|
100
|
+
end
|
101
|
+
private_class_method :parse_target_table_names
|
102
|
+
|
67
103
|
def self.parse_string_or_array_arg(tables)
|
68
104
|
return [] unless tables
|
69
105
|
return tables if tables.class == Array
|
@@ -82,10 +118,24 @@ module HeartSeed
|
|
82
118
|
tables.compact
|
83
119
|
end
|
84
120
|
|
85
|
-
private
|
86
121
|
def self.target_table?(source_table, target_tables)
|
87
122
|
return true if target_tables.empty?
|
88
|
-
|
123
|
+
target_tables.include?(source_table)
|
124
|
+
end
|
125
|
+
private_class_method :target_table?
|
126
|
+
|
127
|
+
# insert yaml file to table
|
128
|
+
# @param file_path [String] source seed yaml file
|
129
|
+
# @param table_name [String] output destination table
|
130
|
+
# @param mode [String] #{BULK} or #{ACTIVE_RECORD}
|
131
|
+
def self.insert_seed(file_path: nil, table_name: nil, mode: BULK)
|
132
|
+
model_class = table_name.classify.constantize
|
133
|
+
if mode == ACTIVE_RECORD
|
134
|
+
insert(file_path: file_path, model_class: model_class)
|
135
|
+
else
|
136
|
+
bulk_insert(file_path: file_path, model_class: model_class)
|
137
|
+
end
|
89
138
|
end
|
139
|
+
private_class_method :insert_seed
|
90
140
|
end
|
91
141
|
end
|
data/lib/heart_seed/helper.rb
CHANGED
@@ -5,7 +5,7 @@ module HeartSeed
|
|
5
5
|
# read config/heart_seed.yml
|
6
6
|
# @return [Hash{String => String}]
|
7
7
|
def self.config
|
8
|
-
if File.
|
8
|
+
if File.exist?(CONFIG_FILE)
|
9
9
|
YAML.load_file(CONFIG_FILE)
|
10
10
|
else
|
11
11
|
{
|
@@ -60,7 +60,7 @@ module HeartSeed
|
|
60
60
|
|
61
61
|
# @param default [String]
|
62
62
|
# @return [String] {Rails.env}, PADRINO_ENV, RACK_ENV or default
|
63
|
-
def self.environment(default="development")
|
63
|
+
def self.environment(default = "development")
|
64
64
|
env ||= Rails.env if defined? Rails
|
65
65
|
env ||= ENV["PADRINO_ENV"] if ENV["PADRINO_ENV"]
|
66
66
|
env ||= ENV["RACK_ENV"] if ENV["RACK_ENV"]
|
@@ -74,6 +74,7 @@ YAML
|
|
74
74
|
end
|
75
75
|
|
76
76
|
private
|
77
|
+
|
77
78
|
def target_file?(file)
|
78
79
|
return true if ENV["FILES"].blank?
|
79
80
|
|
@@ -95,9 +96,7 @@ YAML
|
|
95
96
|
end
|
96
97
|
|
97
98
|
def append_file(file, str)
|
98
|
-
if File.
|
99
|
-
return if File.open(file).read.include?(str)
|
100
|
-
end
|
99
|
+
return if File.exist?(file) && File.open(file).read.include?(str)
|
101
100
|
|
102
101
|
File.open(file, "a") do |out|
|
103
102
|
out.write(str)
|
data/lib/heart_seed/version.rb
CHANGED
data/spec/db/setup.rb
CHANGED
@@ -3,7 +3,7 @@ MAIN_SHARD = "test"
|
|
3
3
|
|
4
4
|
SHARD_NAMES.each do |shard_name|
|
5
5
|
db_file = File.join(__dir__, "#{shard_name}.sqlite3")
|
6
|
-
FileUtils.rm(db_file) if File.
|
6
|
+
FileUtils.rm(db_file) if File.exist?(db_file)
|
7
7
|
|
8
8
|
ActiveRecord::Base.configurations[shard_name] = {
|
9
9
|
adapter: "sqlite3",
|
data/spec/db/test_models.rb
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
class Article < ActiveRecord::Base
|
2
|
-
|
2
|
+
establish_connection(:test)
|
3
3
|
end
|
4
4
|
|
5
5
|
class Comment < ActiveRecord::Base
|
6
|
-
|
6
|
+
establish_connection(:test)
|
7
7
|
end
|
8
8
|
|
9
9
|
class Like < ActiveRecord::Base
|
10
|
-
|
10
|
+
establish_connection(:test)
|
11
11
|
end
|
12
12
|
|
13
13
|
class ShardArticle < ActiveRecord::Base
|
14
|
-
|
14
|
+
establish_connection(:shard_test)
|
15
15
|
end
|
16
16
|
|
@@ -1,19 +1,29 @@
|
|
1
1
|
describe HeartSeed::DbSeed do
|
2
2
|
describe "#bulk_insert" do
|
3
|
-
subject{ HeartSeed::DbSeed.bulk_insert(
|
3
|
+
subject{ HeartSeed::DbSeed.bulk_insert(file_path: file_path, model_class: model_class) }
|
4
4
|
|
5
|
-
let(:
|
5
|
+
let(:file_path){ "#{FIXTURE_DIR}/articles.yml" }
|
6
6
|
let(:model_class){ Article }
|
7
7
|
|
8
8
|
it{ expect{ subject }.to change(Article, :count).by(2) }
|
9
9
|
end
|
10
10
|
|
11
|
+
describe "#insert" do
|
12
|
+
subject { HeartSeed::DbSeed.insert(file_path: file_path, model_class: model_class) }
|
13
|
+
|
14
|
+
let(:file_path) { "#{FIXTURE_DIR}/comments.yml" }
|
15
|
+
let(:model_class) { Comment }
|
16
|
+
|
17
|
+
it{ expect{ subject }.to change(Comment, :count).by(2) }
|
18
|
+
end
|
19
|
+
|
11
20
|
describe "#import_all" do
|
12
|
-
subject{ HeartSeed::DbSeed.import_all(seed_dir: seed_dir, tables: tables, catalogs: catalogs)
|
21
|
+
subject{ HeartSeed::DbSeed.import_all(seed_dir: seed_dir, tables: tables, catalogs: catalogs, mode: mode) }
|
13
22
|
|
14
|
-
let(:seed_dir){ FIXTURE_DIR }
|
15
|
-
let(:tables)
|
16
|
-
let(:catalogs){ [] }
|
23
|
+
let(:seed_dir) { FIXTURE_DIR }
|
24
|
+
let(:tables) { [] }
|
25
|
+
let(:catalogs) { [] }
|
26
|
+
let(:mode){}
|
17
27
|
|
18
28
|
before do
|
19
29
|
# FIXME can not clear if using `DatabaseRewinder.clean`
|
@@ -52,18 +62,39 @@ describe HeartSeed::DbSeed do
|
|
52
62
|
it{ expect{ subject }.to change(Comment, :count).by(0) }
|
53
63
|
it{ expect{ subject }.to change(Like , :count).by(1) }
|
54
64
|
end
|
65
|
+
|
66
|
+
context "When specify mode" do
|
67
|
+
let(:mode) { HeartSeed::DbSeed::ACTIVE_RECORD }
|
68
|
+
|
69
|
+
it{ expect{ subject }.to change(Article, :count).by(2) }
|
70
|
+
it{ expect{ subject }.to change(Comment, :count).by(2) }
|
71
|
+
it{ expect{ subject }.to change(Like , :count).by(1) }
|
72
|
+
end
|
55
73
|
end
|
56
74
|
|
57
75
|
describe "#import_all_with_shards" do
|
58
|
-
subject
|
76
|
+
subject do
|
77
|
+
HeartSeed::DbSeed.import_all_with_shards(
|
78
|
+
seed_dir: seed_dir,
|
79
|
+
tables: tables,
|
80
|
+
catalogs: catalogs,
|
81
|
+
shard_names: shard_names
|
82
|
+
)
|
83
|
+
end
|
59
84
|
|
60
85
|
let(:seed_dir) { FIXTURE_DIR }
|
61
86
|
let(:tables) { [] }
|
62
87
|
let(:catalogs) { [] }
|
88
|
+
let(:mode) {}
|
63
89
|
let(:shard_names){ %w(test shard_test) }
|
64
90
|
|
65
|
-
|
66
|
-
# FIXME
|
91
|
+
around do |example|
|
92
|
+
# FIXME for travis unstable test
|
93
|
+
# https://github.com/sue445/heart_seed/issues/11
|
94
|
+
clean_all_shards
|
95
|
+
|
96
|
+
example.run
|
97
|
+
|
67
98
|
clean_all_shards
|
68
99
|
end
|
69
100
|
|
data/spec/spec_helper.rb
CHANGED
@@ -15,11 +15,13 @@
|
|
15
15
|
#
|
16
16
|
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
17
17
|
|
18
|
-
|
19
|
-
|
18
|
+
if ENV["COVERAGE"]
|
19
|
+
require "codeclimate-test-reporter"
|
20
|
+
CodeClimate::TestReporter.start
|
20
21
|
|
21
|
-
require 'coveralls'
|
22
|
-
Coveralls.wear!
|
22
|
+
require 'coveralls'
|
23
|
+
Coveralls.wear!
|
24
|
+
end
|
23
25
|
|
24
26
|
$LOAD_PATH.unshift(File.join(__dir__, "..", "lib"))
|
25
27
|
require "heart_seed"
|
metadata
CHANGED
@@ -1,17 +1,17 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: heart_seed
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- sue445
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-01-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: activerecord
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
@@ -25,33 +25,33 @@ dependencies:
|
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 3.0.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name: activerecord
|
28
|
+
name: activerecord-import
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: '0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: activesupport
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
47
|
+
version: 3.0.0
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
54
|
+
version: 3.0.0
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: roo
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -81,7 +81,7 @@ dependencies:
|
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '1.6'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
84
|
+
name: codeclimate-test-reporter
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
87
|
- - ">="
|
@@ -95,35 +95,35 @@ dependencies:
|
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
|
-
name:
|
98
|
+
name: coveralls
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- -
|
101
|
+
- - ">="
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version:
|
103
|
+
version: '0'
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- -
|
108
|
+
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version:
|
110
|
+
version: '0'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
|
-
name:
|
112
|
+
name: database_rewinder
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
|
-
- - "
|
115
|
+
- - ">"
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version:
|
117
|
+
version: 0.2.0
|
118
118
|
type: :development
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
|
-
- - "
|
122
|
+
- - ">"
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version:
|
124
|
+
version: 0.2.0
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
|
-
name:
|
126
|
+
name: pry
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
129
|
- - ">="
|
@@ -137,7 +137,7 @@ dependencies:
|
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: '0'
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
|
-
name:
|
140
|
+
name: pry-nav
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
142
142
|
requirements:
|
143
143
|
- - ">="
|
@@ -151,7 +151,7 @@ dependencies:
|
|
151
151
|
- !ruby/object:Gem::Version
|
152
152
|
version: '0'
|
153
153
|
- !ruby/object:Gem::Dependency
|
154
|
-
name:
|
154
|
+
name: pry-remote
|
155
155
|
requirement: !ruby/object:Gem::Requirement
|
156
156
|
requirements:
|
157
157
|
- - ">="
|
@@ -165,7 +165,7 @@ dependencies:
|
|
165
165
|
- !ruby/object:Gem::Version
|
166
166
|
version: '0'
|
167
167
|
- !ruby/object:Gem::Dependency
|
168
|
-
name:
|
168
|
+
name: rake
|
169
169
|
requirement: !ruby/object:Gem::Requirement
|
170
170
|
requirements:
|
171
171
|
- - ">="
|
@@ -179,7 +179,7 @@ dependencies:
|
|
179
179
|
- !ruby/object:Gem::Version
|
180
180
|
version: '0'
|
181
181
|
- !ruby/object:Gem::Dependency
|
182
|
-
name:
|
182
|
+
name: rake_shared_context
|
183
183
|
requirement: !ruby/object:Gem::Requirement
|
184
184
|
requirements:
|
185
185
|
- - ">="
|
@@ -193,7 +193,21 @@ dependencies:
|
|
193
193
|
- !ruby/object:Gem::Version
|
194
194
|
version: '0'
|
195
195
|
- !ruby/object:Gem::Dependency
|
196
|
-
name:
|
196
|
+
name: rspec
|
197
|
+
requirement: !ruby/object:Gem::Requirement
|
198
|
+
requirements:
|
199
|
+
- - '='
|
200
|
+
- !ruby/object:Gem::Version
|
201
|
+
version: 3.0.0
|
202
|
+
type: :development
|
203
|
+
prerelease: false
|
204
|
+
version_requirements: !ruby/object:Gem::Requirement
|
205
|
+
requirements:
|
206
|
+
- - '='
|
207
|
+
- !ruby/object:Gem::Version
|
208
|
+
version: 3.0.0
|
209
|
+
- !ruby/object:Gem::Dependency
|
210
|
+
name: rspec-collection_matchers
|
197
211
|
requirement: !ruby/object:Gem::Requirement
|
198
212
|
requirements:
|
199
213
|
- - ">="
|
@@ -207,7 +221,7 @@ dependencies:
|
|
207
221
|
- !ruby/object:Gem::Version
|
208
222
|
version: '0'
|
209
223
|
- !ruby/object:Gem::Dependency
|
210
|
-
name:
|
224
|
+
name: rspec-its
|
211
225
|
requirement: !ruby/object:Gem::Requirement
|
212
226
|
requirements:
|
213
227
|
- - ">="
|
@@ -221,7 +235,7 @@ dependencies:
|
|
221
235
|
- !ruby/object:Gem::Version
|
222
236
|
version: '0'
|
223
237
|
- !ruby/object:Gem::Dependency
|
224
|
-
name:
|
238
|
+
name: rspec-parameterized
|
225
239
|
requirement: !ruby/object:Gem::Requirement
|
226
240
|
requirements:
|
227
241
|
- - ">="
|
@@ -235,7 +249,7 @@ dependencies:
|
|
235
249
|
- !ruby/object:Gem::Version
|
236
250
|
version: '0'
|
237
251
|
- !ruby/object:Gem::Dependency
|
238
|
-
name:
|
252
|
+
name: rspec-temp_dir
|
239
253
|
requirement: !ruby/object:Gem::Requirement
|
240
254
|
requirements:
|
241
255
|
- - ">="
|
@@ -249,7 +263,7 @@ dependencies:
|
|
249
263
|
- !ruby/object:Gem::Version
|
250
264
|
version: '0'
|
251
265
|
- !ruby/object:Gem::Dependency
|
252
|
-
name:
|
266
|
+
name: sqlite3
|
253
267
|
requirement: !ruby/object:Gem::Requirement
|
254
268
|
requirements:
|
255
269
|
- - ">="
|
@@ -263,7 +277,7 @@ dependencies:
|
|
263
277
|
- !ruby/object:Gem::Version
|
264
278
|
version: '0'
|
265
279
|
- !ruby/object:Gem::Dependency
|
266
|
-
name:
|
280
|
+
name: yard
|
267
281
|
requirement: !ruby/object:Gem::Requirement
|
268
282
|
requirements:
|
269
283
|
- - ">="
|
@@ -285,6 +299,7 @@ extra_rdoc_files: []
|
|
285
299
|
files:
|
286
300
|
- ".coveralls.yml"
|
287
301
|
- ".gitignore"
|
302
|
+
- ".hound.yml"
|
288
303
|
- ".rspec"
|
289
304
|
- ".travis.yml"
|
290
305
|
- ".yardopts"
|
@@ -395,7 +410,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
395
410
|
version: '0'
|
396
411
|
requirements: []
|
397
412
|
rubyforge_project:
|
398
|
-
rubygems_version: 2.
|
413
|
+
rubygems_version: 2.4.5
|
399
414
|
signing_key:
|
400
415
|
specification_version: 4
|
401
416
|
summary: seed util (convert excel to yaml and insert yaml to db)
|