Sha256: 870446f2bfe23baa04fb3363b7f75581c320db7fe081161a04361bb3ec48071a

Contents?: true

Size: 1.42 KB

Versions: 36

Compression:

Stored size: 1.42 KB

Contents

class Terraspace::CLI::New
  class Shim < Thor::Group
    include Thor::Actions

    def self.cli_options
      [
        [:path, aliases: %w[p], default: "/usr/local/bin/terraspace", desc: "path to save the shim script"],
      ]
    end
    cli_options.each { |args| class_option(*args) }

    def self.source_root
      File.expand_path("../../../templates/base/shim", __dir__)
    end

    def set_vars
      @path = @options[:path]
    end

    def create
      dest = @path
      template "terraspace", dest
      chmod dest, 0755
    end

    def message
      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

  private
    def switch_ruby_version_line
      rbenv_installed = system("type rbenv > /dev/null 2>&1")
      if rbenv_installed
        'eval "$(rbenv init -)"'
      end
    end
  end
end

Version data entries

36 entries across 36 versions & 1 rubygems

Version Path
terraspace-2.2.17 lib/terraspace/cli/new/shim.rb
terraspace-2.2.16 lib/terraspace/cli/new/shim.rb
terraspace-2.2.15 lib/terraspace/cli/new/shim.rb
terraspace-2.2.14 lib/terraspace/cli/new/shim.rb
terraspace-2.2.13 lib/terraspace/cli/new/shim.rb
terraspace-2.2.12 lib/terraspace/cli/new/shim.rb
terraspace-2.2.11 lib/terraspace/cli/new/shim.rb
terraspace-2.2.10 lib/terraspace/cli/new/shim.rb
terraspace-2.2.9 lib/terraspace/cli/new/shim.rb
terraspace-2.2.8 lib/terraspace/cli/new/shim.rb
terraspace-2.2.7 lib/terraspace/cli/new/shim.rb
terraspace-2.2.6 lib/terraspace/cli/new/shim.rb
terraspace-2.2.5 lib/terraspace/cli/new/shim.rb
terraspace-2.2.4 lib/terraspace/cli/new/shim.rb
terraspace-2.2.3 lib/terraspace/cli/new/shim.rb
terraspace-2.2.2 lib/terraspace/cli/new/shim.rb
terraspace-2.2.1 lib/terraspace/cli/new/shim.rb
terraspace-2.2.0 lib/terraspace/cli/new/shim.rb
terraspace-2.1.7 lib/terraspace/cli/new/shim.rb
terraspace-2.1.6 lib/terraspace/cli/new/shim.rb