Class: Slugforge::Cli

Inherits:
Command
  • Object
show all
Defined in:
lib/slugforge/cli.rb

Instance Method Summary collapse

Methods inherited from Command

#initialize, start

Methods included from Helper

included

Constructor Details

This class inherits a constructor from Slugforge::Command

Instance Method Details

#buildObject



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

def build
  verify_procfile_exists!
  invoke Slugforge::Commands::Build
end

#debug(cmd) ⇒ Object



120
121
122
# File 'lib/slugforge/cli.rb', line 120

def debug(cmd)
  eval(cmd)
end

#help(command = nil, subcommand = nil) ⇒ Object



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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# File 'lib/slugforge/cli.rb', line 51

def help(command = nil, subcommand = nil)
  return super if command

  self.class.help(shell, subcommand)

  logger.say <<-HELP
Project Naming

  The easiest way to name a project is to name it after a repository. The only reason you may have to use a different
  name is for testing of some kind. That said, once you've named your project there are a few ways for slugforge to
  determine what project you are attempting to run project-specific commands (such as build) against. There are two
  basic ways of telling slugforge which project you are working with:

1. With the provided configuration option (through a CLI flag, environment variable or config file)
2. By running the slugforge command from inside the project's repository. slugforge will use the name of the
   project's root folder (as defined by the location of .git), which generally matches the name of the repository
   which should be the name of the project in slugforge.

Configuring the CLI

  The configuration options above can all be configured through several candidate configuration files, environment
  variables or the flags as shown. Precedence is by proximity to the command: flags trump environment, which trumps
  configuration files. Slugforge will attempt to load configuration files in the following locations, listed in order
  of priority highest to lowest:

.slugforge
~/.slugforge
/etc/slugforge

  Configuration files are written in yaml for simplicity. Below is a list of each option and the keys expected for each
  type. File keys should be split on periods and expanded into hashes. AWS buckets accepts a comma seperated list,
  which will be tried from first to last. There is an example config at the end of this screen.

  HELP

  rows = []
  rows << %w(CLI Environment File)
  Slugforge::Configuration.options.each do |name, config|
    rows << [config[:option], config[:env], config[:key]]

    unless rows.last.first.nil?
      rows.last[0] = "--#{rows.last.first}"
    end
  end
  print_table(rows, :indent => 4)

  logger.say <<-HELP

Example configuration file

aws:
  access_key: hashhashhashhashhash
  secret_key: hashhashhashhashhashhashhashhashhashhash

  HELP
end

#pryObject



112
113
114
# File 'lib/slugforge/cli.rb', line 112

def pry
  binding.pry
end

#versionObject



14
15
16
17
# File 'lib/slugforge/cli.rb', line 14

def version
  logger.say_json :slugforge => Slugforge::VERSION
  logger.say "slugforge #{Slugforge::VERSION}"
end