Sha256: bcab9fb527d303ee4d82822c1ce1052db40121abae23fed22a5543831f3a4d1c

Contents?: true

Size: 748 Bytes

Versions: 37

Compression:

Stored size: 748 Bytes

Contents

require 'thor'

class Kubes::CLI
  class Sequence < Thor::Group
    include Thor::Actions
    include Kubes::Logging

  private
    def logger
      Kubes.logger
    end

    def set_source(type)
      override_source_paths(File.expand_path("../../templates/#{type}", __dir__))
    end

    def override_source_paths(*paths)
      # https://github.com/erikhuda/thor/blob/34df888d721ecaa8cf0cea97d51dc6c388002742/lib/thor/actions.rb#L128
      instance_variable_set(:@source_paths, nil) # unset instance variable cache
      # Using string with instance_eval because block doesnt have access to path at runtime.
      self.class.instance_eval %{
        def self.source_paths
          #{paths.flatten.inspect}
        end
      }
    end
  end
end

Version data entries

37 entries across 37 versions & 1 rubygems

Version Path
kubes-0.7.5 lib/kubes/cli/sequence.rb
kubes-0.7.4 lib/kubes/cli/sequence.rb
kubes-0.7.3 lib/kubes/cli/sequence.rb
kubes-0.7.2 lib/kubes/cli/sequence.rb
kubes-0.7.1 lib/kubes/cli/sequence.rb
kubes-0.7.0 lib/kubes/cli/sequence.rb
kubes-0.6.8 lib/kubes/cli/sequence.rb
kubes-0.6.7 lib/kubes/cli/sequence.rb
kubes-0.6.6 lib/kubes/cli/sequence.rb
kubes-0.6.5 lib/kubes/cli/sequence.rb
kubes-0.6.4 lib/kubes/cli/sequence.rb
kubes-0.6.3 lib/kubes/cli/sequence.rb
kubes-0.6.2 lib/kubes/cli/sequence.rb
kubes-0.6.1 lib/kubes/cli/sequence.rb
kubes-0.6.0 lib/kubes/cli/sequence.rb
kubes-0.5.1 lib/kubes/cli/sequence.rb
kubes-0.5.0 lib/kubes/cli/sequence.rb