Class: Pantograph::Action

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
pantograph/lib/pantograph/action.rb

Direct Known Subclasses

Pantograph::Actions::ArtifactoryAction, Pantograph::Actions::BundleInstallAction, Pantograph::Actions::ChangelogFromGitCommitsAction, Pantograph::Actions::ClocAction, Pantograph::Actions::CreatePullRequestAction, Pantograph::Actions::DangerAction, Pantograph::Actions::DebugAction, Pantograph::Actions::DefaultPlatformAction, Pantograph::Actions::DownloadAction, Pantograph::Actions::EnsureBundleExecAction, Pantograph::Actions::EnsureEnvVarsAction, Pantograph::Actions::EnsureGitBranchAction, Pantograph::Actions::EnsureGitStatusCleanAction, Pantograph::Actions::EnsureNoDebugCodeAction, Pantograph::Actions::ErbAction, Pantograph::Actions::GetGithubReleaseAction, Pantograph::Actions::GitBranchAction, Pantograph::Actions::GitCommitAction, Pantograph::Actions::GitPullAction, Pantograph::Actions::GitPullTagsAction, Pantograph::Actions::GitSubmoduleUpdateAction, Pantograph::Actions::GitTagExistsAction, Pantograph::Actions::GithubApiAction, Pantograph::Actions::GradleAction, Pantograph::Actions::ImportAction, Pantograph::Actions::ImportFromGitAction, Pantograph::Actions::IsCiAction, Pantograph::Actions::IsVerboseAction, Pantograph::Actions::JiraAction, Pantograph::Actions::LaneContextAction, Pantograph::Actions::LastGitCommitAction, Pantograph::Actions::MinPantographVersionAction, Pantograph::Actions::NumberOfCommitsAction, Pantograph::Actions::OptOutUsageAction, Pantograph::Actions::PromptAction, Pantograph::Actions::PromptSecureAction, Pantograph::Actions::PushGitTagsAction, Pantograph::Actions::PushToGitRemoteAction, Pantograph::Actions::PutsAction, Pantograph::Actions::ResetGitRepoAction, Pantograph::Actions::RocketAction, Pantograph::Actions::RsyncAction, Pantograph::Actions::RubyVersionAction, Pantograph::Actions::SayAction, Pantograph::Actions::SetGithubReleaseAction, Pantograph::Actions::ShAction, Pantograph::Actions::SkipDocsAction, Pantograph::Actions::SlackAction, Pantograph::Actions::SonarAction, Pantograph::Actions::SshAction, Pantograph::Actions::TwitterAction, Pantograph::Actions::UpdatePantographAction, Pantograph::Actions::ZipAction

Constant Summary collapse

AVAILABLE_CATEGORIES =
[
  :testing,
  :building,
  :documentation,
  :beta,
  :push,
  :production,
  :source_control,
  :notifications,
  :misc,
  :deprecated # This should be the last item
]
RETURN_TYPES =
[
  :string,
  :array_of_strings,
  :hash_of_strings,
  :hash,
  :bool,
  :int
]

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.runnerObject

Returns the value of attribute runner.



29
30
31
# File 'pantograph/lib/pantograph/action.rb', line 29

def runner
  @runner
end

Class Method Details

.action_nameObject

instead of “AddGitAction”, this will return “add_git” to print it to the user



119
120
121
# File 'pantograph/lib/pantograph/action.rb', line 119

def self.action_name
  self.name.split('::').last.gsub('Action', '').pantograph_underscore
end

.authorObject



83
84
85
# File 'pantograph/lib/pantograph/action.rb', line 83

def self.author
  nil
end

.authorsObject



87
88
89
# File 'pantograph/lib/pantograph/action.rb', line 87

def self.authors
  nil
end

.available_optionsObject



49
50
51
52
53
54
55
56
# File 'pantograph/lib/pantograph/action.rb', line 49

def self.available_options
  # [
  #   PantographCore::ConfigItem.new(key: :ipa_path,
  #                                env_name: "CRASHLYTICS_IPA_PATH",
  #                                description: "Value Description")
  # ]
  nil
end

.categoryObject

Documentation category, available values defined in AVAILABLE_CATEGORIES



114
115
116
# File 'pantograph/lib/pantograph/action.rb', line 114

def self.category
  :misc
end

.deprecated_notesObject

Describes how the user should handle deprecated an action if its deprecated Returns a string (or nil)



147
148
149
# File 'pantograph/lib/pantograph/action.rb', line 147

def self.deprecated_notes
  nil
end

.descriptionObject

Implement in subclasses



41
42
43
# File 'pantograph/lib/pantograph/action.rb', line 41

def self.description
  "No description provided".red
end

.detailsObject



45
46
47
# File 'pantograph/lib/pantograph/action.rb', line 45

def self.details
  nil # this is your chance to provide a more detailed description of this action
end

.example_codeObject

Returns an array of string of sample usage of this action



103
104
105
# File 'pantograph/lib/pantograph/action.rb', line 103

def self.example_code
  nil
end

.is_supported?(platform) ⇒ Boolean

Returns:



91
92
93
94
95
96
97
98
99
100
# File 'pantograph/lib/pantograph/action.rb', line 91

def self.is_supported?(platform)
  # you can do things like
  #  true
  #
  #  platform == :linux
  #
  #  [:linux, :mac].include?(platform)
  #
  UI.crash!("Implementing `is_supported?` for all actions is mandatory. Please update #{self}")
end

.lane_contextObject



123
124
125
# File 'pantograph/lib/pantograph/action.rb', line 123

def self.lane_context
  Actions.lane_context
end

.method_missing(method_sym, *arguments, &_block) ⇒ Object

Allows the user to call an action from an action



128
129
130
131
# File 'pantograph/lib/pantograph/action.rb', line 128

def self.method_missing(method_sym, *arguments, &_block)
  UI.error("Unknown method '#{method_sym}'")
  UI.user_error!("To call another action from an action use `other_action.#{method_sym}` instead")
end

.other_actionObject

Return a new instance of the OtherAction action We need to do this, since it has to have access to the runner object



141
142
143
# File 'pantograph/lib/pantograph/action.rb', line 141

def self.other_action
  return OtherAction.new(self.runner)
end

.outputObject



58
59
60
61
62
63
64
# File 'pantograph/lib/pantograph/action.rb', line 58

def self.output
  # Return the keys you provide on the shared area
  # [
  #   ['NUMBER_OF_COMMITS', 'The path to the newly generated ipa file']
  # ]
  nil
end

.return_typeObject



66
67
68
69
# File 'pantograph/lib/pantograph/action.rb', line 66

def self.return_type
  # Describes what type of data is expected to be returned, see RETURN_TYPES
  nil
end

.return_valueObject



71
72
73
74
# File 'pantograph/lib/pantograph/action.rb', line 71

def self.return_value
  # Describes what this method returns
  nil
end

.run(params) ⇒ Object



37
38
# File 'pantograph/lib/pantograph/action.rb', line 37

def self.run(params)
end

.sample_return_valueObject



76
77
78
79
80
81
# File 'pantograph/lib/pantograph/action.rb', line 76

def self.sample_return_value
  # Very optional
  # You can return a sample return value, that might be returned by the actual action
  # This is currently only used when generating the documentation and running its tests
  nil
end

.shell_out_should_use_bundle_exec?Boolean

When shelling out from the actoin, should we use ‘bundle exec`?

Returns:



134
135
136
# File 'pantograph/lib/pantograph/action.rb', line 134

def self.shell_out_should_use_bundle_exec?
  return File.exist?('Gemfile') && !Helper.contained_pantograph?
end

.step_textObject

Is printed out in the Steps: output in the terminal Return nil if you don’t want any logging in the terminal/JUnit Report



109
110
111
# File 'pantograph/lib/pantograph/action.rb', line 109

def self.step_text
  self.action_name
end