From 62c69db9ebfa5cf9cb8896afaa997cea4793e04e Mon Sep 17 00:00:00 2001 From: Judah Meek Date: Tue, 25 Jun 2024 21:09:50 -0500 Subject: [PATCH] further debugging --- lib/react_on_rails/packer_utils.rb | 5 +++-- rakelib/shakapacker_examples.rake | 2 +- rakelib/webpacker_examples.rake | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/react_on_rails/packer_utils.rb b/lib/react_on_rails/packer_utils.rb index 4e49d1865..dced19112 100644 --- a/lib/react_on_rails/packer_utils.rb +++ b/lib/react_on_rails/packer_utils.rb @@ -8,7 +8,8 @@ def self.using_packer? def self.using_shakapacker? return @using_shakapacker if defined?(@using_shakapacker) - + puts "ReactOnRails::Utils.gem_available?("shakapacker")? #{ReactOnRails::Utils.gem_available?("shakapacker")}" + puts "shakapacker_version_requirement_met?([7, 0, 0])? #{shakapacker_version_requirement_met?([7, 0, 0])}" @using_shakapacker = ReactOnRails::Utils.gem_available?("shakapacker") && shakapacker_version_requirement_met?([7, 0, 0]) end @@ -48,7 +49,7 @@ def self.dev_server_running? def self.shakapacker_version return @shakapacker_version if defined?(@shakapacker_version) return nil unless ReactOnRails::Utils.gem_available?("shakapacker") - + puts "Gem.loaded_specs["shakapacker"].version.to_s: #{Gem.loaded_specs["shakapacker"].version.to_s}" @shakapacker_version = Gem.loaded_specs["shakapacker"].version.to_s end diff --git a/rakelib/shakapacker_examples.rake b/rakelib/shakapacker_examples.rake index e61d5728f..73f3ed79b 100644 --- a/rakelib/shakapacker_examples.rake +++ b/rakelib/shakapacker_examples.rake @@ -35,7 +35,6 @@ namespace :shakapacker_examples do # rubocop:disable Metrics/BlockLength example_type.rails_options += "--skip-javascript" sh_in_dir(examples_dir, "rails new #{example_type.name} #{example_type.rails_options}") sh_in_dir(example_type.dir, "touch .gitignore") - sh_in_dir(example_type.dir, "cat Gemfile") append_to_gemfile(example_type.gemfile, example_type.dir) sh_in_dir(example_type.dir, "cat Gemfile") bundle_install_in(example_type.dir) @@ -67,6 +66,7 @@ def append_to_gemfile(gemfile, dir) "gem 'react_on_rails', path: '#{relative_gem_root}'", "gem 'shakapacker', '~> 8.0.0'" ] + puts "appending #{lines}" old_text = File.read(gemfile) new_text = lines.reduce(old_text) { |a, e| a << "#{e}\n" } File.open(gemfile, "w") { |f| f.puts(new_text) } diff --git a/rakelib/webpacker_examples.rake b/rakelib/webpacker_examples.rake index a399f6b17..a11c459af 100644 --- a/rakelib/webpacker_examples.rake +++ b/rakelib/webpacker_examples.rake @@ -35,7 +35,6 @@ namespace :webpacker_examples do # rubocop:disable Metrics/BlockLength example_type.rails_options += "--skip-javascript" sh_in_dir(examples_dir, "rails new #{example_type.name} #{example_type.rails_options}") sh_in_dir(example_type.dir, "touch .gitignore") - sh_in_dir(example_type.dir, "cat Gemfile") append_to_gemfile(example_type.gemfile, example_type.dir) sh_in_dir(example_type.dir, "cat Gemfile") bundle_install_in(example_type.dir) @@ -67,6 +66,7 @@ def append_to_gemfile(gemfile, dir) "gem 'react_on_rails', path: '#{relative_gem_root}'", "gem 'shakapacker', '~> 6.6.0'" ] + puts "appending #{lines}" old_text = File.read(gemfile) new_text = lines.reduce(old_text) { |a, e| a << "#{e}\n" } File.open(gemfile, "w") { |f| f.puts(new_text) }