Class: Terraspace::CLI::New::Shim
- Inherits:
-
Thor::Group
- Object
- Thor::Group
- Terraspace::CLI::New::Shim
- Includes:
- Thor::Actions
- Defined in:
- lib/terraspace/cli/new/shim.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.cli_options ⇒ Object
5 6 7 8 9 |
# File 'lib/terraspace/cli/new/shim.rb', line 5 def self. [ [:path, aliases: %w[p], default: "/usr/local/bin/terraspace", desc: "path to save the shim script"], ] end |
.source_root ⇒ Object
12 13 14 |
# File 'lib/terraspace/cli/new/shim.rb', line 12 def self.source_root File.("../../../templates/base/shim", __dir__) end |
Instance Method Details
#create ⇒ Object
20 21 22 23 24 |
# File 'lib/terraspace/cli/new/shim.rb', line 20 def create dest = @path template "terraspace", dest chmod dest, 0755 end |
#message ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/terraspace/cli/new/shim.rb', line 26 def dir = File.dirname(@path) puts <<~EOL A terraspace shim as been generated at #{@path} Please make sure that it is found in the $PATH. You can double check with: which terraspace You should see $ which terraspace #{@path} If you do not, please add #{dir} to your PATH. You can usually do so by adding this line to ~/.bash_profile and opening a new terminal to check. export PATH=#{dir}:/$PATH Also note, the shim wrapper contains starter code. Though it should generally work for most systems, it might require adjustments depending on your system. EOL end |
#set_vars ⇒ Object
16 17 18 |
# File 'lib/terraspace/cli/new/shim.rb', line 16 def set_vars @path = @options[:path] end |