Update tasks
This commit is contained in:
parent
0350d940c6
commit
eb765e2463
3 changed files with 33 additions and 21 deletions
|
|
@ -22,10 +22,11 @@ namespace :granblue do
|
|||
|
||||
# Set up filepath
|
||||
dir = "#{Rails.root}/export/"
|
||||
filename = "#{dir}/character-#{size}.txt"
|
||||
FileUtils.mkdir(dir) unless Dir.exist?(dir)
|
||||
|
||||
unless File.exist?("#{dir}/character-#{size}.txt")
|
||||
File.open("#{dir}/character-#{size}.txt", 'w') do |f|
|
||||
# Write to file
|
||||
File.open(filename, 'w+') do |f|
|
||||
Character.all.each do |c|
|
||||
f.write("#{build_chara_url("#{c.granblue_id}_01", size)} \n")
|
||||
f.write("#{build_chara_url("#{c.granblue_id}_02", size)} \n")
|
||||
|
|
@ -33,9 +34,10 @@ namespace :granblue do
|
|||
f.write("#{build_chara_url("#{c.granblue_id}_04", size)} \n") if c.ulb
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
puts "Wrote #{Character.count} character URLs for \"#{size}\" size"
|
||||
# CLI Output
|
||||
count = `wc -l #{filename}`.split.first.to_i
|
||||
puts "Wrote #{count} character URLs for \"#{size}\" size"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -22,18 +22,26 @@ namespace :granblue do
|
|||
|
||||
# Set up filepath
|
||||
dir = "#{Rails.root}/export/"
|
||||
filename = "#{dir}/summon-#{size}.txt"
|
||||
FileUtils.mkdir(dir) unless Dir.exist?(dir)
|
||||
|
||||
unless File.exist?("#{dir}/summon-#{size}.txt")
|
||||
File.open("#{dir}/summon-#{size}.txt", 'w') do |f|
|
||||
# Write to file
|
||||
File.open(filename, 'w') do |f|
|
||||
Summon.all.each do |s|
|
||||
f.write("#{build_summon_url("#{s.granblue_id}_01", size)} \n")
|
||||
f.write("#{build_summon_url("#{s.granblue_id}_02", size)} \n") if (s.series == 3 || s.series == 0) && s.ulb
|
||||
series = s.series.to_i
|
||||
f.write("#{build_summon_url(s.granblue_id.to_s, size)} \n")
|
||||
|
||||
# Download second images only for Providence ULBs and Primal summons
|
||||
if series == 3 || (series == 0 && s.ulb)
|
||||
f.write("#{build_summon_url("#{s.granblue_id}_02",
|
||||
size)} \n")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
puts "Wrote #{Summon.count} summon URLs for \"#{size}\" size"
|
||||
# CLI output
|
||||
count = `wc -l #{filename}`.split.first.to_i
|
||||
puts "Wrote #{count} summon URLs for \"#{size}\" size"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -22,17 +22,19 @@ namespace :granblue do
|
|||
|
||||
# Set up filepath
|
||||
dir = "#{Rails.root}/export/"
|
||||
filename = "#{dir}/weapon-#{size}.txt"
|
||||
FileUtils.mkdir(dir) unless Dir.exist?(dir)
|
||||
|
||||
unless File.exist?("#{dir}/weapon-#{size}.txt")
|
||||
File.open("#{dir}/weapon-#{size}.txt", 'w') do |f|
|
||||
# Write to file
|
||||
File.open(filename, 'w') do |f|
|
||||
Weapon.all.each do |w|
|
||||
f.write("#{build_weapon_url(w.granblue_id.to_s, size)} \n")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
puts "Wrote #{Weapon.count} weapon URLs for \"#{size}\" size"
|
||||
# CLI output
|
||||
count = `wc -l #{filename}`.split.first.to_i
|
||||
puts "Wrote #{count} weapon URLs for \"#{size}\" size"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in a new issue