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.9.3 lib/kubes/cli/sequence.rb
kubes-0.9.2 lib/kubes/cli/sequence.rb
kubes-0.9.1 lib/kubes/cli/sequence.rb
kubes-0.9.0 lib/kubes/cli/sequence.rb
kubes-0.8.10 lib/kubes/cli/sequence.rb
kubes-0.8.9 lib/kubes/cli/sequence.rb
kubes-0.8.8 lib/kubes/cli/sequence.rb
kubes-0.8.7 lib/kubes/cli/sequence.rb
kubes-0.8.6 lib/kubes/cli/sequence.rb
kubes-0.8.5 lib/kubes/cli/sequence.rb
kubes-0.8.4 lib/kubes/cli/sequence.rb
kubes-0.8.3 lib/kubes/cli/sequence.rb
kubes-0.8.2 lib/kubes/cli/sequence.rb
kubes-0.8.1 lib/kubes/cli/sequence.rb
kubes-0.8.0 lib/kubes/cli/sequence.rb
kubes-0.7.10 lib/kubes/cli/sequence.rb
kubes-0.7.9 lib/kubes/cli/sequence.rb
kubes-0.7.8 lib/kubes/cli/sequence.rb
kubes-0.7.7 lib/kubes/cli/sequence.rb
kubes-0.7.6 lib/kubes/cli/sequence.rb