Class: Shaman::CLI

Inherits:
Object
  • Object
show all
Includes:
Commander::Methods
Defined in:
lib/shaman/cli.rb

Defined Under Namespace

Modules: ExitCode

Instance Method Summary collapse

Instance Method Details

#deployObject

rubocop:disable Metrics/MethodLength



40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/shaman/cli.rb', line 40

def deploy # rubocop:disable Metrics/MethodLength
  command :deploy do |c|
    c.syntax = 'shaman deploy [environment]'
    c.description = 'Deploy a release to specified environment'
    c.option '-m', '--message MESSAGE', String, 'Changelog message'
    c.option '-f', '--file FILE', String, 'Release path'
    c.option '-t', '--token TOKEN', String, 'Use different user token'
    c.option '-c', '--config FILE', String, 'Use different config file'
    c.option '-g', '--git', 'Use git for message (overrides any manual settings!)'
    c.option '-C', '--commit COMMIT', String, 'Which commit to use instead of HEAD'
    c.option '-M', '--minimum_version', 'Set release as minimum version'
    c.option '-n', '--release_name RELEASE_NAME', String, 'Release name (ZIP platform only)'
    c.option '-x', '--env_token ENV_TOKEN', String, 'Environment token'
    c.action do |args, options|
      Shaman::Deploy.new(args, options).deploy
    end
  end
end

#initObject

rubocop:disable Metrics/MethodLength



25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/shaman/cli.rb', line 25

def init # rubocop:disable Metrics/MethodLength
  command :init do |c|
    c.syntax = 'shaman init'
    c.description = 'Initialize your project. EXAMPLE: shaman init -s abamobi'
    c.option '-s', '--search SEARCH', String, 'Filter projects by a search term'
    c.option '-f', '--favorites', 'Show only favorites'
    c.option '-p', '--platform PLATFORM', 'Choose platform'
    c.option '-i', '--project_id PROJECT', 'Choose project id'
    c.action do |_args, options|
      Shaman::Init.check!
      Shaman::Init.init(options)
    end
  end
end

#runObject



13
14
15
16
17
18
19
20
21
22
23
# File 'lib/shaman/cli.rb', line 13

def run
  program :name, 'shaman'
  program :version, Shaman::VERSION
  program :description, 'Shaman CLI for labs'
  program :help_formatter, :compact

  init
  deploy

  run!
end