Class: Freighthop::CLI::Help

Inherits:
Object
  • Object
show all
Defined in:
lib/freighthop/cli/help.rb

Constant Summary collapse

TOPICS =
[]

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ Help

Returns a new instance of Help.



8
9
10
# File 'lib/freighthop/cli/help.rb', line 8

def initialize(*args)
  _, @topic, *_ = args
end

Class Method Details

.match?(*args) ⇒ Boolean

Returns:

  • (Boolean)


4
5
6
# File 'lib/freighthop/cli/help.rb', line 4

def self.match?(*args)
  args.first == 'help' || args.empty?
end

Instance Method Details

#runObject



12
13
14
15
16
17
# File 'lib/freighthop/cli/help.rb', line 12

def run
  if TOPICS.include?(@topic)
  else
    usage
  end
end

#usageObject



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/freighthop/cli/help.rb', line 19

def usage
  puts <<USAGETEXT
NAME
fh - freighthop's friendly helper

DESCRIPTION
The fh command is used to interact with a freighthop-managed vm from the root
of your project directory.

SYNOPSIS
fh <COMMAND> [args...]

BUILT-IN COMMANDS
init      - create a template freighthop config in the current dir
up        - boot freighthop vm
halt      - shutdown freighthop vm
destroy   - shutdown and delete vm
provision - rerun provisioning on a booted freighthop vm
reload    - restart freighthop vm (picks up new config changes)
status    - check the current status of the freighthop vm
ssh       - opens a root shell inside the project dir of the freighthop vm
(other)   - see PASSTHROUGH TO VM below
help      - this help
version   - freighthop version

PASSTHROUGH TO VM
Anything that does not match the above list will be passed through to the
freighthop vm.

The command will be run in a bash shell, as root, from inside the shared
project directory.

This allows you to specify relative commands like ./script/server and expect
them to behave properly.

EXAMPLES
Get started with a fresh config:
  fh init

Boot your Freighthop-managed VM:
  fh up

Install gem dependencies:
  fh bundle install

Start a Rails 4 server:
  fh ./bin/rails server

Run a ruby test:
  fh ruby -Itest test/unit/object_test.rb

Install leiningen dependencies:
  fh lein deps

Run a ring server:
  fh lein ring server-headless
USAGETEXT
end