class ConfigmonkeyCli::Application::ManifestAction::Base
Attributes
app[R]
args[R]
manifest[R]
opts[R]
thor[R]
Public Class Methods
new(app, manifest, *args, &block)
click to toggle source
# File lib/configmonkey_cli/application/manifest_actions/base.rb, line 7 def initialize app, manifest, *args, &block @app = app @thor = manifest.thor @args = [] @opts = {} @manifest = manifest init(*args, &block) end
Public Instance Methods
args_and_opts(hargs_and_opts = {})
click to toggle source
# File lib/configmonkey_cli/application/manifest_actions/base.rb, line 22 def args_and_opts hargs_and_opts = {} args, opts = [], {} hargs_and_opts.each do |k, v| if k.is_a?(String) args << k << v elsif k.is_a?(Symbol) opts[k] = v else raise "what the heck did you pass as a key?" end end [args, opts] end
destructive(&b)
click to toggle source
# File lib/configmonkey_cli/application/manifest_actions/base.rb, line 72 def destructive &b end
exists?(*args)
click to toggle source
# File lib/configmonkey_cli/application/manifest_actions/base.rb, line 48 def exists? *args if args[0].is_a?(Hash) File.exists?(send(:"expand_#{args[0].keys[0]}", args[0].values[0])) else File.exists?(args[0]) end end
expand_dst(dst = "")
click to toggle source
# File lib/configmonkey_cli/application/manifest_actions/base.rb, line 44 def expand_dst dst = "" File.join(thor.destination_root, dst) end
expand_src(src = "")
click to toggle source
# File lib/configmonkey_cli/application/manifest_actions/base.rb, line 40 def expand_src src = "" File.join(manifest.directory, src) end
init(*a, &b)
click to toggle source
# File lib/configmonkey_cli/application/manifest_actions/base.rb, line 62 def init *a, &b end
prepare()
click to toggle source
# File lib/configmonkey_cli/application/manifest_actions/base.rb, line 65 def prepare end
rel(path)
click to toggle source
# File lib/configmonkey_cli/application/manifest_actions/base.rb, line 36 def rel path thor.relative_to_original_destination_root(path) end
simulate(&b)
click to toggle source
# File lib/configmonkey_cli/application/manifest_actions/base.rb, line 68 def simulate &b app.warn self.inspect end
to_s()
click to toggle source
# File lib/configmonkey_cli/application/manifest_actions/base.rb, line 17 def to_s "#<…::#{self.class.name.split("::").last(2).join("::")} @args=#{@args} @opts=#{@opts}>" end
Also aliased as: inspect