data_seeder 0.0.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.
Files changed (52) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +256 -0
  3. data/Rakefile +34 -0
  4. data/app/models/data_seeder/seed_file.rb +34 -0
  5. data/db/migrate/20150306195118_create_data_seeder_seed_files.rb +9 -0
  6. data/lib/data_seeder.rb +68 -0
  7. data/lib/data_seeder/config.rb +41 -0
  8. data/lib/data_seeder/engine.rb +5 -0
  9. data/lib/data_seeder/loader.rb +122 -0
  10. data/lib/data_seeder/loader/csv.rb +15 -0
  11. data/lib/data_seeder/loader/json.rb +20 -0
  12. data/lib/data_seeder/loader/txt.rb +23 -0
  13. data/lib/data_seeder/loader/yaml.rb +23 -0
  14. data/lib/data_seeder/logger.rb +15 -0
  15. data/lib/data_seeder/version.rb +3 -0
  16. data/test/dummy/Rakefile +6 -0
  17. data/test/dummy/app/models/app.rb +3 -0
  18. data/test/dummy/app/models/app_error.rb +3 -0
  19. data/test/dummy/app/models/app_error_data_seeder.rb +52 -0
  20. data/test/dummy/app/models/country.rb +14 -0
  21. data/test/dummy/app/models/state.rb +2 -0
  22. data/test/dummy/bin/bundle +3 -0
  23. data/test/dummy/bin/rails +4 -0
  24. data/test/dummy/bin/rake +4 -0
  25. data/test/dummy/config.ru +4 -0
  26. data/test/dummy/config/application.rb +26 -0
  27. data/test/dummy/config/boot.rb +5 -0
  28. data/test/dummy/config/database.yml +12 -0
  29. data/test/dummy/config/environment.rb +5 -0
  30. data/test/dummy/config/environments/development.rb +37 -0
  31. data/test/dummy/config/environments/test.rb +42 -0
  32. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  33. data/test/dummy/config/initializers/inflections.rb +16 -0
  34. data/test/dummy/db/migrate/20150313022149_create_countries.rb +8 -0
  35. data/test/dummy/db/migrate/20150313022228_create_states.rb +8 -0
  36. data/test/dummy/db/migrate/20150313172634_create_apps.rb +7 -0
  37. data/test/dummy/db/migrate/20150313172719_create_app_errors.rb +10 -0
  38. data/test/dummy/db/schema.rb +45 -0
  39. data/test/dummy/db/seed.test/bar.err +3 -0
  40. data/test/dummy/db/seed.test/countries.txt +249 -0
  41. data/test/dummy/db/seed.test/foo.err +3 -0
  42. data/test/dummy/db/seed.test/states.csv +51 -0
  43. data/test/dummy/db/seed.test/states.json +153 -0
  44. data/test/dummy/db/seed.test/states.txt +51 -0
  45. data/test/dummy/db/seed.test/states.yml +101 -0
  46. data/test/dummy/db/seed.test/zulu.err +2 -0
  47. data/test/dummy/db/test.sqlite3 +0 -0
  48. data/test/dummy/log/development.log +39 -0
  49. data/test/dummy/log/test.log +68768 -0
  50. data/test/models/data_seeder_test.rb +147 -0
  51. data/test/test_helper.rb +12 -0
  52. metadata +159 -0
@@ -0,0 +1,42 @@
1
+ Rails.application.configure do
2
+ # Settings specified here will take precedence over those in config/application.rb.
3
+
4
+ # The test environment is used exclusively to run your application's
5
+ # test suite. You never need to work with it otherwise. Remember that
6
+ # your test database is "scratch space" for the test suite and is wiped
7
+ # and recreated between test runs. Don't rely on the data there!
8
+ config.cache_classes = true
9
+
10
+ # Do not eager load code on boot. This avoids loading your whole application
11
+ # just for the purpose of running a single test. If you are using a tool that
12
+ # preloads Rails for running tests, you may have to set it to true.
13
+ config.eager_load = false
14
+
15
+ # Configure static asset server for tests with Cache-Control for performance.
16
+ config.serve_static_files = true
17
+ config.static_cache_control = 'public, max-age=3600'
18
+
19
+ # Show full error reports and disable caching.
20
+ config.consider_all_requests_local = true
21
+ config.action_controller.perform_caching = false
22
+
23
+ # Raise exceptions instead of rendering exception templates.
24
+ config.action_dispatch.show_exceptions = false
25
+
26
+ # Disable request forgery protection in test environment.
27
+ config.action_controller.allow_forgery_protection = false
28
+
29
+ # Tell Action Mailer not to deliver emails to the real world.
30
+ # The :test delivery method accumulates sent emails in the
31
+ # ActionMailer::Base.deliveries array.
32
+ config.action_mailer.delivery_method = :test
33
+
34
+ # Print deprecation notices to the stderr.
35
+ config.active_support.deprecation = :stderr
36
+
37
+ # Raises error for missing translations
38
+ # config.action_view.raise_on_missing_translations = true
39
+
40
+ config.active_support.test_order = :random
41
+
42
+ end
@@ -0,0 +1,7 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
4
+ # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
5
+
6
+ # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
7
+ # Rails.backtrace_cleaner.remove_silencers!
@@ -0,0 +1,16 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Add new inflection rules using the following format. Inflections
4
+ # are locale specific, and you may define rules for as many different
5
+ # locales as you wish. All of these examples are active by default:
6
+ # ActiveSupport::Inflector.inflections(:en) do |inflect|
7
+ # inflect.plural /^(ox)$/i, '\1en'
8
+ # inflect.singular /^(ox)en/i, '\1'
9
+ # inflect.irregular 'person', 'people'
10
+ # inflect.uncountable %w( fish sheep )
11
+ # end
12
+
13
+ # These inflection rules are supported but not enabled by default:
14
+ # ActiveSupport::Inflector.inflections(:en) do |inflect|
15
+ # inflect.acronym 'RESTful'
16
+ # end
@@ -0,0 +1,8 @@
1
+ class CreateCountries < ActiveRecord::Migration
2
+ def change
3
+ create_table :countries do |t|
4
+ t.string :code
5
+ t.string :name
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,8 @@
1
+ class CreateStates < ActiveRecord::Migration
2
+ def change
3
+ create_table :states do |t|
4
+ t.string :code
5
+ t.string :name
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,7 @@
1
+ class CreateApps < ActiveRecord::Migration
2
+ def change
3
+ create_table :apps do |t|
4
+ t.string :name
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,10 @@
1
+ class CreateAppErrors < ActiveRecord::Migration
2
+ def change
3
+ create_table :app_errors do |t|
4
+ t.references :app, index: true
5
+ t.string :code
6
+ t.string :message
7
+ end
8
+ add_foreign_key :app_errors, :apps
9
+ end
10
+ end
@@ -0,0 +1,45 @@
1
+ # encoding: UTF-8
2
+ # This file is auto-generated from the current state of the database. Instead
3
+ # of editing this file, please use the migrations feature of Active Record to
4
+ # incrementally modify your database, and then regenerate this schema definition.
5
+ #
6
+ # Note that this schema.rb definition is the authoritative source for your
7
+ # database schema. If you need to create the application database on another
8
+ # system, you should be using db:schema:load, not running all the migrations
9
+ # from scratch. The latter is a flawed and unsustainable approach (the more migrations
10
+ # you'll amass, the slower it'll run and the greater likelihood for issues).
11
+ #
12
+ # It's strongly recommended that you check this file into your version control system.
13
+
14
+ ActiveRecord::Schema.define(version: 20150313172719) do
15
+
16
+ create_table "app_errors", force: :cascade do |t|
17
+ t.integer "app_id"
18
+ t.string "code"
19
+ t.string "message"
20
+ end
21
+
22
+ add_index "app_errors", ["app_id"], name: "index_app_errors_on_app_id"
23
+
24
+ create_table "apps", force: :cascade do |t|
25
+ t.string "name"
26
+ end
27
+
28
+ create_table "countries", force: :cascade do |t|
29
+ t.string "code"
30
+ t.string "name"
31
+ end
32
+
33
+ create_table "data_seeder_seed_files", force: :cascade do |t|
34
+ t.string "path", null: false
35
+ t.string "sha256", null: false
36
+ end
37
+
38
+ add_index "data_seeder_seed_files", ["path"], name: "index_data_seeder_seed_files_on_path", unique: true
39
+
40
+ create_table "states", force: :cascade do |t|
41
+ t.string "code"
42
+ t.string "name"
43
+ end
44
+
45
+ end
@@ -0,0 +1,3 @@
1
+ A1 Error message for A1
2
+ A2 Error message for A2
3
+ B1 Error message for B1
@@ -0,0 +1,249 @@
1
+ # This file is configured in the Country model
2
+ AD Andorra
3
+ AE United Arab Emirates
4
+ AF Afghanistan
5
+ AG Antigua and Barbuda
6
+ AI Anguilla
7
+ AL Albania
8
+ AM Armenia
9
+ AO Angola
10
+ AQ Antarctica
11
+ AR Argentina
12
+ AS American Samoa
13
+ AT Austria
14
+ AU Australia
15
+ AW Aruba
16
+ AX Åland Islands
17
+ AZ Azerbaijan
18
+ BA Bosnia and Herzegovina
19
+ BB Barbados
20
+ BD Bangladesh
21
+ BE Belgium
22
+ BF Burkina Faso
23
+ BG Bulgaria
24
+ BH Bahrain
25
+ BI Burundi
26
+ BJ Benin
27
+ BL Saint Barthélemy
28
+ BM Bermuda
29
+ BN Brunei Darussalam
30
+ BO Bolivia, Plurinational State of
31
+ BQ Bonaire, Sint Eustatius and Saba
32
+ BR Brazil
33
+ BS Bahamas
34
+ BT Bhutan
35
+ BV Bouvet Island
36
+ BW Botswana
37
+ BY Belarus
38
+ BZ Belize
39
+ CA Canada
40
+ CC Cocos (Keeling) Islands
41
+ CD Congo, the Democratic Republic of the
42
+ CF Central African Republic
43
+ CG Congo
44
+ CH Switzerland
45
+ CI Côte d'Ivoire
46
+ CK Cook Islands
47
+ CL Chile
48
+ CM Cameroon
49
+ CN China
50
+ CO Colombia
51
+ CR Costa Rica
52
+ CU Cuba
53
+ CV Cape Verde
54
+ CW Curaçao
55
+ CX Christmas Island
56
+ CY Cyprus
57
+ CZ Czech Republic
58
+ DE Germany
59
+ DJ Djibouti
60
+ DK Denmark
61
+ DM Dominica
62
+ DO Dominican Republic
63
+ DZ Algeria
64
+ EC Ecuador
65
+ EE Estonia
66
+ EG Egypt
67
+ EH Western Sahara
68
+ ER Eritrea
69
+ ES Spain
70
+ ET Ethiopia
71
+ FI Finland
72
+ FJ Fiji
73
+ FK Falkland Islands (Malvinas)
74
+ FM Micronesia, Federated States of
75
+ FO Faroe Islands
76
+ FR France
77
+ GA Gabon
78
+ GB United Kingdom
79
+ GD Grenada
80
+ GE Georgia
81
+ GF French Guiana
82
+ GG Guernsey
83
+ GH Ghana
84
+ GI Gibraltar
85
+ GL Greenland
86
+ GM Gambia
87
+ GN Guinea
88
+ GP Guadeloupe
89
+ GQ Equatorial Guinea
90
+ GR Greece
91
+ GS South Georgia and the South Sandwich Islands
92
+ GT Guatemala
93
+ GU Guam
94
+ GW Guinea-Bissau
95
+ GY Guyana
96
+ HK Hong Kong
97
+ HM Heard Island and McDonald Islands
98
+ HN Honduras
99
+ HR Croatia
100
+ HT Haiti
101
+ HU Hungary
102
+ ID Indonesia
103
+ IE Ireland
104
+ IL Israel
105
+ IM Isle of Man
106
+ IN India
107
+ IO British Indian Ocean Territory
108
+ IQ Iraq
109
+ IR Iran, Islamic Republic of
110
+ IS Iceland
111
+ IT Italy
112
+ JE Jersey
113
+ JM Jamaica
114
+ JO Jordan
115
+ JP Japan
116
+ KE Kenya
117
+ KG Kyrgyzstan
118
+ KH Cambodia
119
+ KI Kiribati
120
+ KM Comoros
121
+ KN Saint Kitts and Nevis
122
+ KP Korea, Democratic People's Republic of
123
+ KR Korea, Republic of
124
+ KW Kuwait
125
+ KY Cayman Islands
126
+ KZ Kazakhstan
127
+ LA Lao People's Democratic Republic
128
+ LB Lebanon
129
+ LC Saint Lucia
130
+ LI Liechtenstein
131
+ LK Sri Lanka
132
+ LR Liberia
133
+ LS Lesotho
134
+ LT Lithuania
135
+ LU Luxembourg
136
+ LV Latvia
137
+ LY Libya
138
+ MA Morocco
139
+ MC Monaco
140
+ MD Moldova, Republic of
141
+ ME Montenegro
142
+ MF Saint Martin (French part)
143
+ MG Madagascar
144
+ MH Marshall Islands
145
+ MK Macedonia, the former Yugoslav Republic of
146
+ ML Mali
147
+ MM Myanmar
148
+ MN Mongolia
149
+ MO Macao
150
+ MP Northern Mariana Islands
151
+ MQ Martinique
152
+ MR Mauritania
153
+ MS Montserrat
154
+ MT Malta
155
+ MU Mauritius
156
+ MV Maldives
157
+ MW Malawi
158
+ MX Mexico
159
+ MY Malaysia
160
+ MZ Mozambique
161
+ NA Namibia
162
+ NC New Caledonia
163
+ NE Niger
164
+ NF Norfolk Island
165
+ NG Nigeria
166
+ NI Nicaragua
167
+ NL Netherlands
168
+ NO Norway
169
+ NP Nepal
170
+ NR Nauru
171
+ NU Niue
172
+ NZ New Zealand
173
+ OM Oman
174
+ PA Panama
175
+ PE Peru
176
+ PF French Polynesia
177
+ PG Papua New Guinea
178
+ PH Philippines
179
+ PK Pakistan
180
+ PL Poland
181
+ PM Saint Pierre and Miquelon
182
+ PN Pitcairn
183
+ PR Puerto Rico
184
+ PS Palestine, State of
185
+ PT Portugal
186
+ PW Palau
187
+ PY Paraguay
188
+ QA Qatar
189
+ RE Réunion
190
+ RO Romania
191
+ RS Serbia
192
+ RU Russian Federation
193
+ RW Rwanda
194
+ SA Saudi Arabia
195
+ SB Solomon Islands
196
+ SC Seychelles
197
+ SD Sudan
198
+ SE Sweden
199
+ SG Singapore
200
+ SH Saint Helena, Ascension and Tristan da Cunha
201
+ SI Slovenia
202
+ SJ Svalbard and Jan Mayen
203
+ SK Slovakia
204
+ SL Sierra Leone
205
+ SM San Marino
206
+ SN Senegal
207
+ SO Somalia
208
+ SR Suriname
209
+ SS South Sudan
210
+ ST Sao Tome and Principe
211
+ SV El Salvador
212
+ SX Sint Maarten (Dutch part)
213
+ SY Syrian Arab Republic
214
+ SZ Swaziland
215
+ TC Turks and Caicos Islands
216
+ TD Chad
217
+ TF French Southern Territories
218
+ TG Togo
219
+ TH Thailand
220
+ TJ Tajikistan
221
+ TK Tokelau
222
+ TL Timor-Leste
223
+ TM Turkmenistan
224
+ TN Tunisia
225
+ TO Tonga
226
+ TR Turkey
227
+ TT Trinidad and Tobago
228
+ TV Tuvalu
229
+ TW Taiwan, Province of China
230
+ TZ Tanzania, United Republic of
231
+ UA Ukraine
232
+ UG Uganda
233
+ UM United States Minor Outlying Islands
234
+ US United States
235
+ UY Uruguay
236
+ UZ Uzbekistan
237
+ VA Holy See (Vatican City State)
238
+ VC Saint Vincent and the Grenadines
239
+ VE Venezuela, Bolivarian Republic of
240
+ VG Virgin Islands, British
241
+ VI Virgin Islands, U.S.
242
+ VN Viet Nam
243
+ VU Vanuatu
244
+ WF Wallis and Futuna
245
+ WS Samoa
246
+ YE Yemen
247
+ YT Mayotte
248
+ ZA South Africa
249
+ ZM Zambia
@@ -0,0 +1,3 @@
1
+ 1 Something went wrong
2
+ 2 We are seriously foobared
3
+ 3 We are less seriously foobared
@@ -0,0 +1,51 @@
1
+ id,code,name
2
+ 1,AK,Alaska
3
+ 2,AL,Alabama
4
+ 3,AR,Arkansas
5
+ 4,AZ,Arizona
6
+ 5,CA,California
7
+ 6,CO,Colorado
8
+ 7,CT,Connecticut
9
+ 8,DE,Delaware
10
+ 9,FL,Florida
11
+ 10,GA,Georgia
12
+ 11,HI,Hawaii
13
+ 12,IA,Iowa
14
+ 13,ID,Idaho
15
+ 14,IL,Illinois
16
+ 15,IN,Indiana
17
+ 16,KS,Kansas
18
+ 17,KY,Kentucky
19
+ 18,LA,Louisiana
20
+ 19,MA,Massachusetts
21
+ 20,MD,Maryland
22
+ 21,ME,Maine
23
+ 22,MI,Michigan
24
+ 23,MN,Minnesota
25
+ 24,MO,Missouri
26
+ 25,MS,Mississippi
27
+ 26,MT,Montana
28
+ 27,NC,North Carolina
29
+ 28,ND,North Dakota
30
+ 29,NE,Nebraska
31
+ 30,NH,New Hampshire
32
+ 31,NJ,New Jersey
33
+ 32,NM,New Mexico
34
+ 33,NV,Nevada
35
+ 34,NY,New York
36
+ 35,OH,Ohio
37
+ 36,OK,Oklahoma
38
+ 37,OR,Oregon
39
+ 38,PA,Pennsylvania
40
+ 39,RI,Rhode Island
41
+ 40,SC,South Carolina
42
+ 41,SD,South Dakota
43
+ 42,TN,Tennessee
44
+ 43,TX,Texas
45
+ 44,UT,Utah
46
+ 45,VA,Virginia
47
+ 46,VT,Vermont
48
+ 47,WA,Washington
49
+ 48,WI,Wisconsin
50
+ 49,WV,West Virginia
51
+ 50,WY,Wyoming