Class: CreateGithubRelease::TaskBase Private
- Inherits:
-
Object
- Object
- CreateGithubRelease::TaskBase
- Includes:
- BacktickDebug
- Defined in:
- lib/create_github_release/task_base.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Base class for tasks
All tasks must inherit from this class.
It holds the options and knows how to print, puts and error while respecting the quiet
flag.
Direct Known Subclasses
CreateGithubRelease::Tasks::CommitRelease, CreateGithubRelease::Tasks::CreateGithubRelease, CreateGithubRelease::Tasks::CreateReleaseBranch, CreateGithubRelease::Tasks::CreateReleasePullRequest, CreateGithubRelease::Tasks::CreateReleaseTag, CreateGithubRelease::Tasks::PushRelease, CreateGithubRelease::Tasks::UpdateChangelog, CreateGithubRelease::Tasks::UpdateVersion
Instance Attribute Summary collapse
-
#project ⇒ CreateGithubRelease::Project
readonly
private
The project passed to the task object.
Instance Method Summary collapse
-
#backtick_debug? ⇒ Boolean
private
true
if theproject.verbose?
flag istrue
. -
#error(message)
private
Writes a message to stderr and exits with exitcode 1.
-
#initialize(project) ⇒ TaskBase
constructor
private
Create a new tasks object and save the given
project
. -
#print(*args)
private
Calls
Kernel.print
if thequiet
flag is not set in theoptions
. -
#puts(*args)
private
Calls
Kernel.puts
if thequiet
flag is not set in theproject
. -
#run
private
This method must be overriden by a subclass.
Methods included from BacktickDebug
Constructor Details
#initialize(project) ⇒ TaskBase
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Create a new tasks object and save the given project
15 16 17 18 19 20 |
# File 'lib/create_github_release/task_base.rb', line 15 def initialize(project) raise ArgumentError, 'project must be a CreateGithubRelease::Project' unless project.is_a?(CreateGithubRelease::Project) @project = project end |
Instance Attribute Details
#project ⇒ CreateGithubRelease::Project (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
The project passed to the task object
38 39 40 |
# File 'lib/create_github_release/task_base.rb', line 38 def project @project end |
Instance Method Details
#backtick_debug? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
true
if the project.verbose?
flag is true
68 69 70 |
# File 'lib/create_github_release/task_base.rb', line 68 def backtick_debug? project.verbose? end |
#error(message)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
Writes a message to stderr and exits with exitcode 1
60 61 62 63 |
# File 'lib/create_github_release/task_base.rb', line 60 def error() warn "ERROR: #{}" exit 1 end |
#print(*args)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
Calls Kernel.print
if the quiet
flag is not set in the options
44 45 46 |
# File 'lib/create_github_release/task_base.rb', line 44 def print(*args) super unless project.quiet? end |
#puts(*args)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
Calls Kernel.puts
if the quiet
flag is not set in the project
52 53 54 |
# File 'lib/create_github_release/task_base.rb', line 52 def puts(*args) super unless project.quiet? end |
#run
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
This method must be overriden by a subclass
The subclass is expected to call error
if the task fails.
29 30 31 |
# File 'lib/create_github_release/task_base.rb', line 29 def run raise NotImplementedError end |