Class: Pantograph::Actions::MinPantographVersionAction

Inherits:
Pantograph::Action show all
Defined in:
pantograph/lib/pantograph/actions/min_pantograph_version.rb

Direct Known Subclasses

PantographVersionAction

Constant Summary

Constants inherited from Pantograph::Action

Pantograph::Action::AVAILABLE_CATEGORIES, Pantograph::Action::RETURN_TYPES

Class Method Summary collapse

Methods inherited from Pantograph::Action

action_name, author, 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

.authorsObject



28
29
30
# File 'pantograph/lib/pantograph/actions/min_pantograph_version.rb', line 28

def self.authors
  ['KrauseFx', 'johnknapprs']
end

.categoryObject



46
47
48
# File 'pantograph/lib/pantograph/actions/min_pantograph_version.rb', line 46

def self.category
  :misc
end

.descriptionObject



20
21
22
# File 'pantograph/lib/pantograph/actions/min_pantograph_version.rb', line 20

def self.description
  'Verifies the minimum pantograph version required'
end

.detailsObject



24
25
26
# File 'pantograph/lib/pantograph/actions/min_pantograph_version.rb', line 24

def self.details
  'Add this to your `Pantfile` to require a certain version of _pantograph_.'
end

.example_codeObject



36
37
38
39
40
# File 'pantograph/lib/pantograph/actions/min_pantograph_version.rb', line 36

def self.example_code
  [
    'min_pantograph_version("0.14.0")'
  ]
end

.is_supported?(platform) ⇒ Boolean

Returns:



32
33
34
# File 'pantograph/lib/pantograph/actions/min_pantograph_version.rb', line 32

def self.is_supported?(platform)
  true
end

.run(params) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'pantograph/lib/pantograph/actions/min_pantograph_version.rb', line 4

def self.run(params)
  begin
    defined_version = Gem::Version.new(params.first)
  rescue
    UI.user_error!('Please provide minimum pantograph version')
  end

  if Gem::Version.new(Pantograph::VERSION) < defined_version
    PantographCore::UpdateChecker.show_update_message('pantograph', Pantograph::VERSION)
    error_message = "The Pantfile requires a pantograph version of >= #{defined_version}. You are on #{Pantograph::VERSION}."
    UI.user_error!(error_message)
  else
    UI.success("Your pantograph version #{Pantograph::VERSION} matches the minimum requirement of #{defined_version}")
  end
end

.step_textObject



42
43
44
# File 'pantograph/lib/pantograph/actions/min_pantograph_version.rb', line 42

def self.step_text
  'Verifying pantograph version'
end