diff --git a/Gemfile b/Gemfile index 3ee5010b..659a4643 100644 --- a/Gemfile +++ b/Gemfile @@ -35,7 +35,6 @@ gem 'globalize', '~> 6.2', '>= 6.2.1' # For reading and parsing HTML from Neopets.com, like importing Closet pages. gem 'nokogiri', '~> 1.15', '>= 1.15.3' -gem 'rest-client', '~> 2.1' # For safely rendering users' Markdown + HTML on item list pages. gem 'rdiscount', '~> 2.2', '>= 2.2.7.1' diff --git a/Gemfile.lock b/Gemfile.lock index 3a334dd6..7aeb122b 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -125,8 +125,6 @@ GEM warden (~> 1.2.3) devise-encryptable (0.2.0) devise (>= 2.1.0) - domain_name (0.5.20190701) - unf (>= 0.0.5, < 1.0.0) dotenv (2.8.1) dotenv-rails (2.8.1) dotenv (= 2.8.1) @@ -148,9 +146,6 @@ GEM temple (>= 0.8.2) thor tilt - http-accept (1.7.0) - http-cookie (1.0.5) - domain_name (~> 0.5) http_accept_language (2.1.1) httparty (0.21.0) mini_mime (>= 1.0.0) @@ -178,9 +173,6 @@ GEM net-smtp marcel (1.0.2) memory_profiler (1.0.1) - mime-types (3.4.1) - mime-types-data (~> 3.2015) - mime-types-data (3.2023.0218.1) mini_mime (1.1.5) mini_portile2 (2.8.4) minitest (5.19.0) @@ -197,7 +189,6 @@ GEM timeout net-smtp (0.4.0) net-protocol - netrc (0.11.0) nio4r (2.5.9) nokogiri (1.15.3) mini_portile2 (~> 2.8.2) @@ -280,11 +271,6 @@ GEM responders (3.1.1) actionpack (>= 5.2) railties (>= 5.2) - rest-client (2.1.0) - http-accept (>= 1.7.0, < 2.0) - http-cookie (>= 1.0.2, < 2.0) - mime-types (>= 1.16, < 4.0) - netrc (~> 0.8) ruby2_keywords (0.0.5) sanitize (6.0.2) crass (~> 1.0.2) @@ -324,9 +310,6 @@ GEM traces (0.11.1) tzinfo (2.0.6) concurrent-ruby (~> 1.0) - unf (0.1.4) - unf_ext - unf_ext (0.0.8.2) warden (1.2.7) rack (>= 1.0) web-console (4.2.1) @@ -371,7 +354,6 @@ DEPENDENCIES rdiscount (~> 2.2, >= 2.2.7.1) react-rails (~> 2.7, >= 2.7.1) record_tag_helper (~> 1.0, >= 1.0.1) - rest-client (~> 2.1) sanitize (~> 6.0, >= 6.0.2) sass-rails (~> 6.0) sentry-rails (~> 5.12) diff --git a/lib/tasks/colors.rake b/lib/tasks/colors.rake deleted file mode 100644 index efe22f02..00000000 --- a/lib/tasks/colors.rake +++ /dev/null @@ -1,15 +0,0 @@ -namespace :colors do - desc 'Create a color' - task :create, [:id, :name, :standard, :basic, :prank] => :environment do |t, args| - args.with_defaults(standard: true, basic: false, prank: false) - # TIL: ActiveRecord will convert strings to booleans automatically. Cool. - color = Color.new - color.id = args[:id] - color.name = args[:name] - color.standard = args[:standard] - color.basic = args[:basic] - color.prank = args[:prank] - color.save! - puts "Color #{color.inspect} created" - end -end diff --git a/lib/tasks/pet_types.rake b/lib/tasks/pet_types.rake deleted file mode 100644 index 17b8f71a..00000000 --- a/lib/tasks/pet_types.rake +++ /dev/null @@ -1,34 +0,0 @@ -namespace :pet_types do - desc "Download the Rainbow Pool data for the given locale" - task :download_basic_image_hashes => :environment do - Species.find_each do |species| - pool_url = "https://www.neopets.com/pool/all_pb.phtml" - pool_options = { - :cookies => {:neologin => URI.encode(ENV['NEOLOGIN'])}, - :params => {:lang => 'en', :f_species_id => species.id} - } - pool_response = RestClient.get(pool_url, pool_options) - pool_doc = Nokogiri::HTML(pool_response) - - counts = {saved: 0, skipped: 0} - PetType.transaction do - pool_doc.css('a[onclick^="set_pet_img("]').each do |link| - color = Color.find_by_name link.text - pet_type = PetType.find_by_species_id_and_color_id species, color - if pet_type - image_hash = PetType.get_hash_from_cp_path(link['onclick'][36..55]) - pet_type.basic_image_hash = image_hash - pet_type.save! - counts[:saved] += 1 - puts "* #{pet_type.human_name}: #{pet_type.basic_image_hash}" - else - dummy_pet_type = PetType.new color: color, species: species - counts[:skipped] += 1 - puts " #{dummy_pet_type.human_name}: skip: not yet modeled" - end - end - end - puts "- #{species.human_name}: saved #{counts[:saved]}, skipped #{counts[:skipped]}" - end - end -end \ No newline at end of file diff --git a/lib/tasks/translate.rake b/lib/tasks/translate.rake deleted file mode 100644 index 3b14ee1d..00000000 --- a/lib/tasks/translate.rake +++ /dev/null @@ -1,59 +0,0 @@ -require 'rocketamf/remote_gateway' - -namespace :translate do - desc "Download the Neopets zone data for the given locale" - task :zones => :environment do - with_given_locale do |neopets_language_code| - gateway = RocketAMF::RemoteGateway.new(Pet::GATEWAY_URL) - action = gateway.service('CustomPetService').action('getApplicationData') - envelope = action.request([]).post( - :headers => { - 'Cookie' => "lang=#{neopets_language_code}" - } - ) - application_data = envelope.messages[0].data.body - - zones_by_id = Zone.all.inject({}) { |h, z| h[z.id] = z ; h } - application_data[:zones].each do |zone_data| - zone = zones_by_id[zone_data[:id].to_i] - zone.label = zone_data[:label] - zone.plain_label = Zone.plainify_label(zone.label) - zone.save! - end - end - end - - desc "Download the Rainbow Pool data for the given locale" - task :pet_attributes => :environment do - with_given_locale do |neopets_language_code| - pool_url = "https://www.neopets.com/pool/all_pb.phtml" - pool_options = { - :cookies => {:neologin => URI.encode(ENV['NEOLOGIN'])}, - :params => {:lang => neopets_language_code} - } - pool_response = RestClient.get(pool_url, pool_options) - pool_doc = Nokogiri::HTML(pool_response) - - [Species, Color].each do |klass| - klass_name = klass.name.underscore - records_by_id = klass.all.inject({}) { |h, r| h[r.id] = r; h } - pool_doc.css("select[name=f_#{klass_name}_id] option").each do |option| - record = records_by_id[option['value'].to_i] - record.name = option.text.downcase - record.save! - end - end - end - end - - def with_given_locale - I18n.with_locale(ENV['LOCALE']) do - language_code = I18n.compatible_neopets_language_code_for(I18n.locale) - unless language_code - raise "Locale #{I18n.locale.inspect} has no neopets language code" - end - - yield(language_code) - end - end -end diff --git a/vendor/cache/domain_name-0.5.20190701.gem b/vendor/cache/domain_name-0.5.20190701.gem deleted file mode 100644 index c1a2c32e..00000000 Binary files a/vendor/cache/domain_name-0.5.20190701.gem and /dev/null differ diff --git a/vendor/cache/http-accept-1.7.0.gem b/vendor/cache/http-accept-1.7.0.gem deleted file mode 100644 index f648db4e..00000000 Binary files a/vendor/cache/http-accept-1.7.0.gem and /dev/null differ diff --git a/vendor/cache/http-cookie-1.0.5.gem b/vendor/cache/http-cookie-1.0.5.gem deleted file mode 100644 index ecb033e6..00000000 Binary files a/vendor/cache/http-cookie-1.0.5.gem and /dev/null differ diff --git a/vendor/cache/mime-types-3.4.1.gem b/vendor/cache/mime-types-3.4.1.gem deleted file mode 100644 index 7b1056ed..00000000 Binary files a/vendor/cache/mime-types-3.4.1.gem and /dev/null differ diff --git a/vendor/cache/mime-types-data-3.2023.0218.1.gem b/vendor/cache/mime-types-data-3.2023.0218.1.gem deleted file mode 100644 index d3a621d8..00000000 Binary files a/vendor/cache/mime-types-data-3.2023.0218.1.gem and /dev/null differ diff --git a/vendor/cache/netrc-0.11.0.gem b/vendor/cache/netrc-0.11.0.gem deleted file mode 100644 index 78226f36..00000000 Binary files a/vendor/cache/netrc-0.11.0.gem and /dev/null differ diff --git a/vendor/cache/rest-client-2.1.0.gem b/vendor/cache/rest-client-2.1.0.gem deleted file mode 100644 index 8af1a2fd..00000000 Binary files a/vendor/cache/rest-client-2.1.0.gem and /dev/null differ diff --git a/vendor/cache/unf-0.1.4.gem b/vendor/cache/unf-0.1.4.gem deleted file mode 100644 index 01f1852d..00000000 Binary files a/vendor/cache/unf-0.1.4.gem and /dev/null differ diff --git a/vendor/cache/unf_ext-0.0.8.2.gem b/vendor/cache/unf_ext-0.0.8.2.gem deleted file mode 100644 index f9a66cc4..00000000 Binary files a/vendor/cache/unf_ext-0.0.8.2.gem and /dev/null differ