Class: Pantograph::Actions::EnsureBundleExecAction

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

Overview

Raises an exception and stop the lane execution if not using bundle exec to run pantograph

Constant Summary

Constants inherited from Pantograph::Action

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

Documentation collapse

Class Method Summary collapse

Methods inherited from Pantograph::Action

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

Class Method Details

.authorObject



43
44
45
# File 'pantograph/lib/pantograph/actions/ensure_bundle_exec.rb', line 43

def self.author
  ['rishabhtayal', 'johnknapprs']
end

.available_optionsObject



35
36
37
# File 'pantograph/lib/pantograph/actions/ensure_bundle_exec.rb', line 35

def self.available_options
  []
end

.categoryObject



58
59
60
# File 'pantograph/lib/pantograph/actions/ensure_bundle_exec.rb', line 58

def self.category
  :misc
end

.descriptionObject



25
26
27
# File 'pantograph/lib/pantograph/actions/ensure_bundle_exec.rb', line 25

def self.description
  'Raises an exception if not using `bundle exec` to run pantograph'
end

.detailsObject



29
30
31
32
33
# File 'pantograph/lib/pantograph/actions/ensure_bundle_exec.rb', line 29

def self.details
  [
    'This action will check if you are using bundle exec to run pantograph.'
  ].join("\n")
end

.example_codeObject



47
48
49
50
51
52
53
54
55
56
# File 'pantograph/lib/pantograph/actions/ensure_bundle_exec.rb', line 47

def self.example_code
  [
    'ensure_bundle_exec',
    ' # always check before running a lane
    before_all do
      ensure_bundle_exec
    end
    '
  ]
end

.is_supported?(platform) ⇒ Boolean

Returns:



62
63
64
# File 'pantograph/lib/pantograph/actions/ensure_bundle_exec.rb', line 62

def self.is_supported?(platform)
  true
end

.outputObject



39
40
41
# File 'pantograph/lib/pantograph/actions/ensure_bundle_exec.rb', line 39

def self.output
  []
end

.run(params) ⇒ Object



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

def self.run(params)
  return if PluginManager.new.gemfile_path.nil?
  if PantographCore::Helper.bundler?
    UI.success('Using bundled pantograph ✅')
  else
    error_message = [
      'pantograph detected a Gemfile in the current directory.',
      'However it seems like you did not use `bundle exec`.',
      "Use `bundle exec pantograph #{ARGV.join(' ')}`"
    ]
    error_message = error_message.join(' ')

    UI.user_error!(error_message)
  end
end