Class: Devcenter::Commands::Base
- Inherits:
-
Object
- Object
- Devcenter::Commands::Base
- Defined in:
- lib/devcenter/commands/base.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(*args) ⇒ Base
constructor
A new instance of Base.
- #run ⇒ Object
-
#validate ⇒ Object
add error messages to @validation_errors.
Methods included from Helpers
#article_api_path, #article_path, #article_url?, #broken_link_checks_path, #devcenter_base_url, #get_oauth_token, #html_file_path, #md_file_path, #netrc_path, #search_api_path, #slug_from_article_url, #update_article_path, #validate_article_path, #write_file
Methods included from Logger
Constructor Details
#initialize(*args) ⇒ Base
Returns a new instance of Base.
22 23 24 25 26 27 28 29 30 31 |
# File 'lib/devcenter/commands/base.rb', line 22 def initialize(*args) @validation_errors = [] validate if @validation_errors.any? @validation_errors.each{ |e| say e } abort else run end end |
Class Method Details
.run(*args) ⇒ Object
13 14 15 16 17 18 19 20 |
# File 'lib/devcenter/commands/base.rb', line 13 def self.run(*args) if Devcenter::GemVersionChecker.new_version_available? say "devcenter has a new version available, please update with: gem install devcenter" return unless agree('Continue executing your command? (yes/no)') end command = self.new(*args) end |
Instance Method Details
#run ⇒ Object
34 |
# File 'lib/devcenter/commands/base.rb', line 34 def run; end |
#validate ⇒ Object
add error messages to @validation_errors
33 |
# File 'lib/devcenter/commands/base.rb', line 33 def validate; end |