wdw_sources 0.1.6 → 0.2.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 +4 -4
- data/app/models/wdw_sources/touringplans_update.rb +7 -1
- data/db/seeds/touringplans_hotels.rb +2 -0
- data/db/seeds.rb +15 -0
- data/lib/tasks/wdw_sources_tasks.rake +20 -0
- data/lib/wdw_sources/version.rb +1 -1
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5e8259f351928fa508c0c94707966067a4540bec91dbb68a08156aec34568a16
|
4
|
+
data.tar.gz: 30ec2127ad8cc0f30b711a84bf7044bcfbca7cd839a3ecf00952fa42472fd1a6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3ca24acd279437a79e6a9516b9450df754cdbd0279aec4a37df8958b5c3685308045a117a167ddd3c103c12fc9444c25fb64b615d77cabc2c83701d038ac7526
|
7
|
+
data.tar.gz: 323a3f327c5083ec78af628f3244812276142a142fe2354b1edf61b0651f480fc383a095579f3a3d5d291482799da016150ef029b1ce6032dd5b2cd1c5f8ffc6
|
@@ -9,7 +9,13 @@ module WdwSources
|
|
9
9
|
def self.sync_all(interest)
|
10
10
|
|
11
11
|
tp_list = Touringplans.list_all(interest)
|
12
|
-
tp_list.
|
12
|
+
tp_list.each_with_index do |tp_list_item, index|
|
13
|
+
numerator = (index + 1).to_f
|
14
|
+
denominator = tp_list.length.to_f
|
15
|
+
percentage = (numerator / denominator * 100).round(2)
|
16
|
+
|
17
|
+
puts "#{tp_list_item.permalink} -- #{percentage}% of #{interest.to_s} synced"
|
18
|
+
|
13
19
|
tp_list_item_venue_permalink = tp_list_item.venue_permalink
|
14
20
|
tp_list_item_permalink = tp_list_item.permalink
|
15
21
|
|
data/db/seeds.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
# This file should contain all the record creation needed to seed the database with its default values.
|
2
|
+
# The data can then be loaded with the bin/rails db:seed command (or created alongside the database with db:setup).
|
3
|
+
#
|
4
|
+
# Examples:
|
5
|
+
#
|
6
|
+
# movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }])
|
7
|
+
# Character.create(name: 'Luke', movie: movies.first)
|
8
|
+
require_relative "../app/models/wdw_sources/touringplans_update.rb"
|
9
|
+
# cache data from touringplans.com
|
10
|
+
puts "syncing attractions".upcase
|
11
|
+
WdwSources::TouringplansUpdate.sync_all('attractions')
|
12
|
+
puts "syncing dining".upcase
|
13
|
+
WdwSources::TouringplansUpdate.sync_all('dining')
|
14
|
+
puts "syncing hotels".upcase
|
15
|
+
WdwSources::TouringplansUpdate.sync_all('hotels')
|
@@ -2,3 +2,23 @@
|
|
2
2
|
# task :wdw_sources do
|
3
3
|
# # Task goes here
|
4
4
|
# end
|
5
|
+
namespace :db do
|
6
|
+
namespace :WdwSources do
|
7
|
+
desc "loads all seeds in db/seeds.rb"
|
8
|
+
task :seeds => :environment do
|
9
|
+
puts "Loading WdwSources db/seeds.rb"
|
10
|
+
WdwSources::Engine.load_seed
|
11
|
+
end
|
12
|
+
|
13
|
+
# namespace :seed do
|
14
|
+
# Dir[Rails.root.join('WdwSources', 'db', 'seeds', '*.rb')].each do |filename|
|
15
|
+
# task_name = File.basename(filename, '.rb')
|
16
|
+
# desc "Seed " task_name ", based on the file with the same name in `db/seeds/*.rb`"
|
17
|
+
# task task_name.to_sym => :environment do
|
18
|
+
# load(filename) if File.exist?(filename)
|
19
|
+
# end
|
20
|
+
# end
|
21
|
+
# end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
data/lib/wdw_sources/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wdw_sources
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- captproton
|
@@ -113,6 +113,8 @@ files:
|
|
113
113
|
- db/migrate/20211024225255_create_wdw_sources_touringplans_dining_venues.rb
|
114
114
|
- db/migrate/20211024225412_create_wdw_sources_touringplans_attractions.rb
|
115
115
|
- db/migrate/20211024225455_create_wdw_sources_touringplans_hotels.rb
|
116
|
+
- db/seeds.rb
|
117
|
+
- db/seeds/touringplans_hotels.rb
|
116
118
|
- lib/generators/wdw_sources/install/install_generator.rb
|
117
119
|
- lib/tasks/wdw_sources_tasks.rake
|
118
120
|
- lib/wdw_sources.rb
|