usda-nutrient-database 0.5.0 → 0.6.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fd3a9157bd4c59d9a33a7b0d360fbd09558904b4
4
- data.tar.gz: 3222844968dbf95a113c76a480870ae0cdb77cb1
3
+ metadata.gz: 647906ce598ce7cea75fa74b70f0dd2522d1f9dd
4
+ data.tar.gz: 1030b4cb7d1b668c4e2c866bef500fa88f7fc656
5
5
  SHA512:
6
- metadata.gz: 439158006e6be1b8a20dafee9d5994a33e6d470dbab00dfbb1cc3a12fb583e181484c9b8cbdec5670cd92696420470ba03fdce0796fd3bb687725de8689688a0
7
- data.tar.gz: 199f3b62e2d32de1b3803b5cd60b96a8c9cae44a09860ea7261e4e12d6bf7dc3937a2ea1c8b633021be49f939cd80503ab6404c6086bfd51aa4e093769d49f23
6
+ metadata.gz: 1c7bf956846e0c5acd1979a8c63189a73029f43bda0da70540ed5021dcf6c799c4cc824fba8e4e329d79f2247eda46c8f8ef22cd1acb7ff0b301d01d54455645
7
+ data.tar.gz: aef31c4e423bdc6d412a375925360ffa58861c5deb49092aa7be270ead4e2de5991b5c7cb4dcceb4357b6c0d61f851f682a962febd6a60949a80b7e0b4e7985d
@@ -1,4 +1,4 @@
1
- class CreateFootnotes < ActiveRecord::Migration
1
+ class CreateUsdaFootnotes < ActiveRecord::Migration
2
2
  def change
3
3
  create_table :usda_footnotes do |t|
4
4
  t.string :nutrient_databank_number, null: false, index: true
@@ -3,7 +3,7 @@ module UsdaNutrientDatabase
3
3
  railtie_name :usda_nutrient_database
4
4
 
5
5
  rake_tasks do
6
- load 'tasks/usda_nutrient_database.rake'
6
+ load 'usda_nutrient_database/tasks/usda_nutrient_database.rake'
7
7
  end
8
8
  end
9
9
  end
@@ -6,10 +6,20 @@ namespace :usda do
6
6
 
7
7
  desc 'Import the USDA weights table'
8
8
  task import_weights: :environment do
9
+ download_and_import('Weights')
10
+ end
11
+
12
+ desc 'Import USDA foot notes data'
13
+ task import_footnotes: :environment do
14
+ download_and_import('Footnotes')
15
+ end
16
+
17
+ def download_and_import(importer_name)
9
18
  UsdaNutrientDatabase::Import::Downloader.new('tmp/usda', 'sr25').
10
19
  tap do |downloader|
11
20
  downloader.download_and_unzip
12
- UsdaNutrientDatabase::Import::Weights.new('tmp/usda/sr25').import
21
+ "UsdaNutrientDatabase::Import::#{importer_name}".constantize.
22
+ new('tmp/usda/sr25').import
13
23
  downloader.cleanup
14
24
  end
15
25
  end
@@ -1,3 +1,3 @@
1
1
  module UsdaNutrientDatabase
2
- VERSION = "0.5.0"
2
+ VERSION = '0.6.0'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: usda-nutrient-database
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Beedle
@@ -197,8 +197,7 @@ files:
197
197
  - db/migrate/3_create_usda_foods_nutrients.rb
198
198
  - db/migrate/4_create_usda_nutrients.rb
199
199
  - db/migrate/5_create_usda_weights.rb
200
- - db/migrate/6_create_footnotes.rb
201
- - lib/tasks/usda_nutrient_database.rake
200
+ - db/migrate/6_create_usda_footnotes.rb
202
201
  - lib/usda-nutrient-database.rb
203
202
  - lib/usda_nutrient_database/configuration.rb
204
203
  - lib/usda_nutrient_database/engine.rb
@@ -217,6 +216,7 @@ files:
217
216
  - lib/usda_nutrient_database/importer.rb
218
217
  - lib/usda_nutrient_database/nutrient.rb
219
218
  - lib/usda_nutrient_database/railtie.rb
219
+ - lib/usda_nutrient_database/tasks/usda_nutrient_database.rake
220
220
  - lib/usda_nutrient_database/version.rb
221
221
  - lib/usda_nutrient_database/weight.rb
222
222
  - spec/database.yml