diff options
| author | Dan Allen <dan.j.allen@gmail.com> | 2021-05-31 23:53:00 -0600 |
|---|---|---|
| committer | Dan Allen <dan.j.allen@gmail.com> | 2021-06-02 00:23:44 -0600 |
| commit | 27659e1c29c545fc44b9e6f8dd2b318f2197acf0 (patch) | |
| tree | 46be9cfffaff5fe9dd4091e100f0f3f41cab3a6d /scripts | |
| parent | f8e2a3971010242bb2b86b6c789fa466fc15f323 (diff) | |
add extra dependencies for prawn HEAD to Gemfile when testing upstream
Diffstat (limited to 'scripts')
| -rw-r--r-- | scripts/switch-to-prawn-head.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/scripts/switch-to-prawn-head.rb b/scripts/switch-to-prawn-head.rb index 438e1021..92a0f28a 100644 --- a/scripts/switch-to-prawn-head.rb +++ b/scripts/switch-to-prawn-head.rb @@ -2,6 +2,8 @@ require 'fileutils' # NOTE it's necessary to hot patch the installed gem so that RubyGems can find it without Bundler prawn_spec = Gem::Specification.find_by_name 'prawn' +old_requirements = prawn_spec.runtime_dependencies.map {|it| [it.name, it.requirements_list[0]] }.to_h +new_requirements = nil FileUtils.rm_r prawn_spec.gem_dir, secure: true if Dir.exist? prawn_spec.gem_dir Process.wait Process.spawn %(git clone --depth=1 https://github.com/prawnpdf/prawn #{File.basename prawn_spec.gem_dir}), chdir: prawn_spec.gems_dir @@ -20,8 +22,15 @@ prawn_spec_replacement = nil Dir.chdir prawn_spec.gem_dir do new_prawn_spec_contents = File.readlines 'prawn.gemspec', mode: 'r:UTF-8' new_prawn_spec = eval new_prawn_spec_contents.join, nil, (File.join prawn_spec.gem_dir, 'prawn.gemspec') + new_requirements = new_prawn_spec + .runtime_dependencies + .map {|it| [it.name, it.requirements_list[0]] }.to_h + .delete_if {|name| old_requirements.key? name } new_prawn_spec.version = prawn_spec.version prawn_spec_replacement = new_prawn_spec.to_ruby end File.write prawn_spec.spec_file, prawn_spec_replacement +new_requirements.each do |name, requirement| + File.write 'Gemfile', %(gem '#{name}', '#{requirement}', require: false), mode: 'a' +end unless new_requirements.empty? |
