Class: Rpremote::PicoRubySourcePatch
- Inherits:
-
Object
- Object
- Rpremote::PicoRubySourcePatch
- Defined in:
- lib/rpremote/picoruby_source_patch.rb,
sig/rpremote.rbs
Defined Under Namespace
Classes: Error
Constant Summary collapse
- JOB_PATH =
"mrbgems/picoruby-shell/mrblib/job.rb"- PATCH_ALIASES =
{ "3.4.2" => "3.4.5" }.freeze
Instance Attribute Summary collapse
-
#version ⇒ String
readonly
Returns the value of attribute version.
Instance Method Summary collapse
- #apply(source) ⇒ void
-
#initialize(version:) ⇒ PicoRubySourcePatch
constructor
A new instance of PicoRubySourcePatch.
Constructor Details
#initialize(version:) ⇒ PicoRubySourcePatch
Returns a new instance of PicoRubySourcePatch.
12 13 14 |
# File 'lib/rpremote/picoruby_source_patch.rb', line 12 def initialize(version:) @version = version end |
Instance Attribute Details
#version ⇒ String (readonly)
Returns the value of attribute version.
10 11 12 |
# File 'lib/rpremote/picoruby_source_patch.rb', line 10 def version @version end |
Instance Method Details
#apply(source) ⇒ void
This method returns an undefined value.
16 17 18 19 20 21 22 23 24 |
# File 'lib/rpremote/picoruby_source_patch.rb', line 16 def apply(source) patch_version = PATCH_ALIASES.fetch(version, version) patch = File.("../../patches/picoruby-#{patch_version}-ruby-exception-status.patch", __dir__) return unless File.file?(patch) && File.file?(File.join(source, JOB_PATH)) return if git_apply?(source, patch, "--reverse", "--check") raise Error, "cannot apply rpremote patch to PicoRuby #{version}" unless git_apply?(source, patch, "--check") raise Error, "cannot apply rpremote patch to PicoRuby #{version}" unless git_apply?(source, patch) end |