Class: Travis::CLI::Init
- Inherits:
-
Enable
- Object
- Command
- ApiCommand
- RepoCommand
- Enable
- Travis::CLI::Init
- Defined in:
- lib/travis/cli/init.rb
Constant Summary collapse
- LANGUAGE_MAPPING =
{ 'node' => 'node_js', 'node.js' => 'node_js', 'javascript' => 'node_js', 'coffeescript' => 'node_js', 'c++' => 'cpp', 'obj-c' => 'objective-c' }.freeze
Constants inherited from RepoCommand
RepoCommand::GIT_REGEX, RepoCommand::TRAVIS
Constants inherited from Command
Command::DAY, Command::HOUR, Command::MINUTE, Command::WEEK
Constants included from Tools::Assets
Instance Attribute Summary collapse
-
#travis_config ⇒ Object
writeonly
Sets the attribute travis_config.
Attributes inherited from RepoCommand
Attributes inherited from ApiCommand
Attributes inherited from Command
#arguments, #config, #debug, #force_interactive, #formatter, #input, #output
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from RepoCommand
Methods inherited from ApiCommand
#authenticate, #detected_endpoint?, #endpoint_config, #enterprise?, #initialize, #org?, #pro?, #setup, #sync
Methods included from Travis::Client::Methods
#access_token, #access_token=, #account, #accounts, #api_endpoint, #api_endpoint=, #artifact, #broadcasts, #build, #cancel, #explicit_api_endpoint?, #github_auth, #hooks, #job, #lint, #listen, #logout, #regenerate_token, #remove_token, #repo, #repos, #restart, #user
Methods inherited from Command
abstract, abstract?, #check_completion, #check_ruby, #check_version, command_name, #command_name, #debug?, description, #error, #execute, #info, #initialize, #last_check, #on_signal, #parse, #say, #setup, skip, subcommands, #terminal, #time, #usage, #usage_for, #warn, #write_to
Methods included from Tools::Assets
Methods included from Parser
Constructor Details
This class inherits a constructor from Travis::CLI::ApiCommand
Instance Attribute Details
#travis_config=(value) ⇒ Object (writeonly)
Sets the attribute travis_config
37 38 39 |
# File 'lib/travis/cli/init.rb', line 37 def travis_config=(value) @travis_config = value end |
Class Method Details
Instance Method Details
#custom_config ⇒ Object
63 64 65 |
# File 'lib/travis/cli/init.rb', line 63 def custom_config @custom_config ||= {} end |
#help ⇒ Object
44 45 46 |
# File 'lib/travis/cli/init.rb', line 44 def help super("Available languages: #{self.class.languages.join(', ')}\n\n") end |
#run(language = nil, file = '.travis.yml') ⇒ Object
48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/travis/cli/init.rb', line 48 def run(language = nil, file = '.travis.yml') error "#{file} already exists, use --force to override" if File.exist?(file) && !force? && !print_conf? language ||= ask('Main programming language used: ') { |q| q.default = detect_language } self.travis_config = template(language).merge(custom_config) if print_conf? puts travis_config.to_yaml else save_travis_config(file) say("#{file} file created!") end super() unless skip_enable? end |