Class: Scatter::CLI

Inherits:
Thor
  • Object
show all
Defined in:
lib/scatter/cli.rb

Instance Method Summary collapse

Instance Method Details

#alias(from, *to) ⇒ Object



51
52
53
54
55
56
57
58
# File 'lib/scatter/cli.rb', line 51

def alias(from, *to)
  config = Config.get
  config['aliases'] ||= {}
  config['aliases'][from] = to.join ' '
  Config.save config

  say Config.show 'aliases'
end

#cap(*cmd) ⇒ Object



35
36
37
# File 'lib/scatter/cli.rb', line 35

def cap(*cmd)
  exec "cap", cmd
end

#config(*args) ⇒ Object



62
63
64
65
66
67
68
69
70
71
# File 'lib/scatter/cli.rb', line 62

def config(*args)
  unless options.show
    abort "Incorrect number of arguments" unless args.length == 2
    setting = args.first
    value = args.last
    Config.set setting, value
  end

  say Config.show
end

#deployObject



29
30
31
# File 'lib/scatter/cli.rb', line 29

def deploy
  run
end

#exec(*cmd) ⇒ Object



40
41
42
# File 'lib/scatter/cli.rb', line 40

def exec(*cmd)
  run cmd.join ' '
end

#existsObject



74
75
76
77
78
79
80
# File 'lib/scatter/cli.rb', line 74

def exists
  begin
    generate_command ? say("true") : abort("false")
  rescue
    abort "false"
  end
end

#versionObject



46
47
48
# File 'lib/scatter/cli.rb', line 46

def version
  say Scatter::VERSION
end