Sha256: c6d4dbce3ff6d9908ddae5946de3bb737a05f68b0cb9e87757d5b328f638a2df

Contents?: true

Size: 1.42 KB

Versions: 18

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 2>&1 > /dev/null")
      if rbenv_installed
        'eval "$(rbenv init -)"'
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
terraspace-1.1.1 lib/terraspace/cli/new/shim.rb
terraspace-1.1.0 lib/terraspace/cli/new/shim.rb
terraspace-1.0.6 lib/terraspace/cli/new/shim.rb
terraspace-1.0.5 lib/terraspace/cli/new/shim.rb
terraspace-1.0.4 lib/terraspace/cli/new/shim.rb
terraspace-1.0.3 lib/terraspace/cli/new/shim.rb
terraspace-1.0.2 lib/terraspace/cli/new/shim.rb
terraspace-1.0.1 lib/terraspace/cli/new/shim.rb
terraspace-1.0.0 lib/terraspace/cli/new/shim.rb
terraspace-0.7.2 lib/terraspace/cli/new/shim.rb
terraspace-0.7.1 lib/terraspace/cli/new/shim.rb
terraspace-0.7.0 lib/terraspace/cli/new/shim.rb
terraspace-0.6.23 lib/terraspace/cli/new/shim.rb
terraspace-0.6.22 lib/terraspace/cli/new/shim.rb
terraspace-0.6.21 lib/terraspace/cli/new/shim.rb
terraspace-0.6.20 lib/terraspace/cli/new/shim.rb
terraspace-0.6.19 lib/terraspace/cli/new/shim.rb
terraspace-0.6.18 lib/terraspace/cli/new/shim.rb