Class: Travis::CLI::Setup

Inherits:
RepoCommand show all
Defined in:
lib/travis/cli/setup.rb,
lib/travis/cli/setup/s3.rb,
lib/travis/cli/setup/gcs.rb,
lib/travis/cli/setup/npm.rb,
lib/travis/cli/setup/deis.rb,
lib/travis/cli/setup/pypi.rb,
lib/travis/cli/setup/appfog.rb,
lib/travis/cli/setup/heroku.rb,
lib/travis/cli/setup/biicode.rb,
lib/travis/cli/setup/divshot.rb,
lib/travis/cli/setup/hackage.rb,
lib/travis/cli/setup/modulus.rb,
lib/travis/cli/setup/service.rb,
lib/travis/cli/setup/anynines.rb,
lib/travis/cli/setup/cloud_66.rb,
lib/travis/cli/setup/ninefold.rb,
lib/travis/cli/setup/opsworks.rb,
lib/travis/cli/setup/releases.rb,
lib/travis/cli/setup/artifacts.rb,
lib/travis/cli/setup/nodejitsu.rb,
lib/travis/cli/setup/ruby_gems.rb,
lib/travis/cli/setup/open_shift.rb,
lib/travis/cli/setup/cloud_files.rb,
lib/travis/cli/setup/code_deploy.rb,
lib/travis/cli/setup/engine_yard.rb,
lib/travis/cli/setup/cloud_control.rb,
lib/travis/cli/setup/cloud_foundry.rb,
lib/travis/cli/setup/sauce_connect.rb,
lib/travis/cli/setup/elastic_beanstalk.rb

Defined Under Namespace

Classes: Anynines, Appfog, Artifacts, Biicode, CloudControl, CloudFiles, CloudFoundry, Cloud_66, CodeDeploy, Deis, Divshot, ElasticBeanstalk, EngineYard, GCS, Hackage, Heroku, Modulus, NPM, Ninefold, Nodejitsu, OpenShift, OpsWorks, PyPI, Releases, RubyGems, S3, SauceConnect, Service

Constant Summary

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

Tools::Assets::BASE

Instance Attribute Summary

Attributes inherited from RepoCommand

#slug

Attributes inherited from ApiCommand

#enterprise_name, #session

Attributes inherited from Command

#arguments, #config, #debug, #force_interactive, #formatter, #input, #output

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from RepoCommand

#repository, #setup

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, #repo, #repos, #restart, #user

Methods inherited from Command

abstract, abstract?, #check_completion, #check_ruby, #check_version, #command_name, command_name, #debug?, description, #execute, #info, #initialize, #last_check, #on_signal, #parse, #say, #setup, skip, subcommands, #terminal, #time, #usage, #usage_for, #write_to

Methods included from Tools::Assets

#asset, #asset_path

Methods included from Parser

#new, #on, #on_initialize

Constructor Details

This class inherits a constructor from Travis::CLI::ApiCommand

Class Method Details

.service(name) ⇒ Object



38
39
40
41
42
43
# File 'lib/travis/cli/setup.rb', line 38

def self.service(name)
  normal_name = Service.normalized_name(name)
  const_name  = constants(false).detect { |c| Service.normalized_name(c) == normal_name }
  constant    = const_get(const_name) if const_name
  constant if constant and constant < Service and constant.known_as? name
end

.servicesObject



45
46
47
# File 'lib/travis/cli/setup.rb', line 45

def self.services
  constants(false).sort.map { |c| const_get(c) }.select { |c| c < Service }
end

Instance Method Details

#helpObject



49
50
51
52
# File 'lib/travis/cli/setup.rb', line 49

def help
  services = self.class.services.map { |s| "\t" << color(s.service_name.ljust(20), :command) << color(s.description, :info) }.join("\n")
  super("\nAvailable services:\n\n#{services}\n\n")
end

#run(service, file = travis_yaml) ⇒ Object



54
55
56
57
# File 'lib/travis/cli/setup.rb', line 54

def run(service, file = travis_yaml)
  service(service).run
  save_travis_config(file)
end

#service(name) ⇒ Object



59
60
61
62
63
# File 'lib/travis/cli/setup.rb', line 59

def service(name)
  factory = self.class.service(name)
  error("unknown service #{name}") unless factory
  factory.new(self)
end