Class: Strobe::CLI

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

Instance Method Summary collapse

Constructor Details

#initializeCLI

Returns a new instance of CLI.



10
11
12
13
14
15
16
17
18
# File 'lib/strobe/cli.rb', line 10

def initialize(*)
  super

  opts = {"path" => Strobe.root}.merge(options)
  self.options = Thor::CoreExt::HashWithIndifferentAccess.new(opts)

  use_shell = options["no-color"] ? Thor::Shell::Basic.new : shell
  Strobe.ui = UI::Shell.new(use_shell)
end

Instance Method Details

#deployObject



26
27
28
# File 'lib/strobe/cli.rb', line 26

def deploy
  Deploy.new(options[:path]).deploy
end

#help(command) ⇒ Object



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/strobe/cli.rb', line 35

def help(command)
  case command
  when "gemfile" then command = "gemfile.5"
  when nil       then command = "bundle"
  else command = "bundle-#{cli}"
  end

  root = File.expand_path("../man", __FILE__)

  if manpages.include?(command)
    if have_groff?
      groff   = "groff -Wall -mtty-char -mandoc -Tascii"
      pager   = ENV['MANPAGER'] || ENV['PAGER'] || 'more'

      Kernel.exec "#{groff} #{root}/#{command} | #{pager}"
    else
      puts File.read("#{root}/#{command}.txt")
    end
  else
    super
  end
end

#previewObject



31
32
33
# File 'lib/strobe/cli.rb', line 31

def preview
  Server.new(options[:path]).start
end

#signupObject



21
22
23
# File 'lib/strobe/cli.rb', line 21

def 
  Account.
end