Class: Travis::CLI::Init
- Inherits:
-
Enable
- Object
- Command
- ApiCommand
- RepoCommand
- Enable
- Travis::CLI::Init
- Defined in:
- lib/travis/cli/init.rb
Constant Summary
Constants inherited from RepoCommand
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, #force_interactive, #formatter, #input, #output
Instance Method Summary collapse
Methods inherited from RepoCommand
Methods inherited from ApiCommand
#authenticate, #detected_endpoint?, #endpoint_config, #initialize, #org?, #pro?, #setup, #sync
Methods included from Travis::Client::Methods
#access_token, #access_token=, #accounts, #api_endpoint, #api_endpoint=, #artifact, #build, #explicit_api_endpoint?, #github_auth, #job, #repo, #repos, #restart, #user, #worker, #workers
Methods inherited from Command
abstract, abstract?, #check_ruby, #check_version, command_name, #command_name, #debug, #execute, #help, #initialize, #parse, #say, #setup, skip, #terminal, #usage, #write_to
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
23 24 25 |
# File 'lib/travis/cli/init.rb', line 23 def travis_config=(value) @travis_config = value end |
Instance Method Details
#custom_config ⇒ Object
40 41 42 |
# File 'lib/travis/cli/init.rb', line 40 def custom_config @custom_config ||= {} end |
#run(language = nil, file = '.travis.yml') ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/travis/cli/init.rb', line 25 def run(language = nil, file = '.travis.yml') error ".travis.yml already exists, use --force to override" if File.exist?(file) and not force? and not 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 |