Class: Fastlane::Actions::RubyVersionAction

Inherits:
Fastlane::Action show all
Defined in:
fastlane/lib/fastlane/actions/ruby_version.rb

Constant Summary

Constants inherited from Fastlane::Action

Fastlane::Action::AVAILABLE_CATEGORIES, Fastlane::Action::RETURN_TYPES

Class Method Summary collapse

Methods inherited from Fastlane::Action

action_name, authors, available_options, deprecated_notes, lane_context, method_missing, other_action, output, return_type, return_value, sample_return_value, shell_out_should_use_bundle_exec?

Class Method Details

.authorObject



26
27
28
# File 'fastlane/lib/fastlane/actions/ruby_version.rb', line 26

def self.author
  "sebastianvarela"
end

.categoryObject



47
48
49
# File 'fastlane/lib/fastlane/actions/ruby_version.rb', line 47

def self.category
  :misc
end

.descriptionObject



30
31
32
# File 'fastlane/lib/fastlane/actions/ruby_version.rb', line 30

def self.description
  "Verifies the minimum ruby version required"
end

.detailsObject



40
41
42
43
44
45
# File 'fastlane/lib/fastlane/actions/ruby_version.rb', line 40

def self.details
  [
    "Add this to your `Fastfile` to require a certain version of _ruby_.",
    "Put it at the top of your `Fastfile to ensure that _fastlane_ is executed appropriately."
  ].join("\n")
end

.example_codeObject



34
35
36
37
38
# File 'fastlane/lib/fastlane/actions/ruby_version.rb', line 34

def self.example_code
  [
    'ruby_version("2.4.0")'
  ]
end

.is_supported?(platform) ⇒ Boolean

Returns:



51
52
53
# File 'fastlane/lib/fastlane/actions/ruby_version.rb', line 51

def self.is_supported?(platform)
  true
end

.run(params) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'fastlane/lib/fastlane/actions/ruby_version.rb', line 7

def self.run(params)
  params = nil unless params.kind_of?(Array)
  value = (params || []).first
  defined_version = Gem::Version.new(value) if value

  UI.user_error!("Please pass minimum ruby version as parameter to ruby_version") unless defined_version

  if Gem::Version.new(RUBY_VERSION) < defined_version
    error_message = "The Fastfile requires a ruby version of >= #{defined_version}. You are on #{RUBY_VERSION}."
    UI.user_error!(error_message)
  end

  UI.message("Your ruby version #{RUBY_VERSION} matches the minimum requirement of #{defined_version}")
end

.step_textObject



22
23
24
# File 'fastlane/lib/fastlane/actions/ruby_version.rb', line 22

def self.step_text
  "Verifying Ruby version"
end