gdshowsdb 1.0.0 → 1.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.
data/lib/gdshowsdb.rb CHANGED
@@ -23,15 +23,25 @@ module Gdshowsdb
23
23
 
24
24
  def self.load(level = nil)
25
25
  ActiveRecord::Migrator.up File.dirname(__FILE__) + '/gdshowsdb/db/migrations', level
26
- end
26
+ end
27
+
28
+ def self.yaml_file_location(file_name)
29
+ Gem.loaded_specs['gdshowsdb'].full_gem_path + "/data/gdshowsdb/#{file_name}"
30
+ end
27
31
 
28
32
  def self.load_yaml(file_name)
29
- YAML.load_file(Gem.loaded_specs['gdshowsdb'].full_gem_path + "/data/gdshowsdb/#{file_name}")
33
+ YAML.load_file(yaml_file_location(file_name))
30
34
  end
31
35
 
32
36
  def self.load_yaml_for_year(year)
33
37
  load_yaml("#{year}.yaml")
34
38
  end
39
+
40
+ def self.write_yaml(file_name, data)
41
+ File.open(yaml_file_location(file_name), "w") do |file|
42
+ file.write data.to_yaml
43
+ end
44
+ end
35
45
  end
36
46
 
37
47
  class Hash
@@ -14,6 +14,7 @@ class Song < ActiveRecord::Base
14
14
 
15
15
  def self.create_song_relationships(spec)
16
16
  song_ref = SongRef.find_by_name(spec[:name])
17
+ raise "Unable to find a song ref named #{spec[:name]} #{spec.inspect}" unless song_ref
17
18
  song_ref.songs << Song.find_by_uuid(spec[:uuid])
18
19
  song_ref.song_occurences << SongOccurence.create_from(uuid: SecureRandom.uuid, position: spec[:position], show_set_uuid: spec[:show_set_uuid])
19
20
  song_ref.save
@@ -1,7 +1,7 @@
1
1
  module Gdshowsdb
2
2
  class ShowDBExtractor
3
3
  def self.from_db(year)
4
- ShowDBExtractor.new(Show.find_all_by_year(year))
4
+ ShowDBExtractor.new(Show.where(year: year))
5
5
  end
6
6
 
7
7
  def initialize(shows)
@@ -1,7 +1,7 @@
1
1
  module Gdshowsdb
2
2
  class SongRefDBExtractor
3
3
  def self.from_db
4
- raw_db = SongRef.find(:all, order: :name)
4
+ raw_db = SongRef.order(:name)
5
5
  Gdshowsdb::SongRefDBExtractor.new(raw_db)
6
6
  end
7
7
 
@@ -1,4 +1,4 @@
1
- class UpdateGdshowsdbData < ActiveRecord::Migration
1
+ class UpdateGdshowsdbData < ActiveRecord::Migration[5.0]
2
2
  def up
3
3
  # added song_refs <% @added_song_refs.each do |song_ref_spec| %>
4
4
  SongRef.create_from(<%= song_ref_spec.inspect %>)
@@ -1,3 +1,3 @@
1
1
  module Gdshowsdb
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gdshowsdb
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeff Smith
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-10-04 00:00:00.000000000 Z
11
+ date: 2018-01-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -86,6 +86,7 @@ files:
86
86
  - data/gdshowsdb/1995.yaml
87
87
  - data/gdshowsdb/shows-debug.yaml
88
88
  - data/gdshowsdb/song_refs.yaml
89
+ - deadlists_parser.rb
89
90
  - gdshowsdb.gemspec
90
91
  - lib/gdshowsdb.rb
91
92
  - lib/gdshowsdb/db/migrations/001_create_song_ref_table.rb
@@ -152,7 +153,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
152
153
  version: '0'
153
154
  requirements: []
154
155
  rubyforge_project:
155
- rubygems_version: 2.6.13
156
+ rubygems_version: 2.6.14
156
157
  signing_key:
157
158
  specification_version: 4
158
159
  summary: All Grateful Dead show information in a relational database.