Class: Travis::CLI::Setup::Nodejitsu

Inherits:
Service
  • Object
show all
Defined in:
lib/travis/cli/setup/nodejitsu.rb

Instance Attribute Summary

Attributes inherited from Service

#command

Instance Method Summary collapse

Methods inherited from Service

description, #initialize, known_as?, #method_missing, normalized_name, service_name

Constructor Details

This class inherits a constructor from Travis::CLI::Setup::Service

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Travis::CLI::Setup::Service

Instance Method Details

#runObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/travis/cli/setup/nodejitsu.rb', line 10

def run
  deploy 'nodejitsu' do |config|
    jitsu_file = File.expand_path('.jitsuconf', ENV['HOME'])

    if File.exist? jitsu_file
      jitsu_conf        = JSON.parse(File.read(jitsu_file))
      config['user']    = jitsu_conf['username']
      config['api_key'] = jitsu_conf['apiToken']
    end

    config['user']    ||= ask("Nodejitsu user: ").to_s
    config['api_key'] ||= ask("Nodejitsu API token: ") { |q| q.echo = "*" }.to_s
  end
end