Sha256: ac43f9ed07a545a3f19e137ea598b42eb04656f9e8afb0ef0f8b88bee9455c8d

Contents?: true

Size: 997 Bytes

Versions: 20

Compression:

Stored size: 997 Bytes

Contents

require 'thor'
require 'yaml'

module PuppetMagnum
  class Module < Thor

    desc 'create [MODULE_NAME]', 'Creates a new Puppet module.'
    def create(module_name)
      PuppetMagnum::CreateGenerator.new([File.join(Dir.pwd, module_name), module_name], options).invoke_all
    end

    desc 'init [MODULE_NAME]', 'Initializes an existing Puppet module.'
    def init(module_name)
      PuppetMagnum::CreateGenerator.new([File.join(Dir.pwd, module_name), module_name], options).invoke_all
    end

    def self.banner(task, namespace = false, subcommand = true)
      "#{basename} #{task.formatted_usage(self, namespace, subcommand).split(':').join(' ')}"
    end

    private
      def options
        original_options = super

        rcfile = File.expand_path('~/.magnumrc')
        return original_options unless File.exists?(rcfile)

        defaults = ::YAML::load_file(rcfile) || {}
        Thor::CoreExt::HashWithIndifferentAccess.new(defaults.merge(original_options))
      end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
puppet-magnum-4.0.1 lib/puppet-magnum/cli/module.rb
puppet-magnum-4.0.0 lib/puppet-magnum/cli/module.rb
puppet-magnum-3.1.5 lib/puppet-magnum/cli/module.rb
puppet-magnum-3.1.3 lib/puppet-magnum/cli/module.rb
puppet-magnum-3.1.2 lib/puppet-magnum/cli/module.rb
puppet-magnum-3.1.1 lib/puppet-magnum/cli/module.rb
puppet-magnum-3.1.0 lib/puppet-magnum/cli/module.rb
puppet-magnum-3.0.12 lib/puppet-magnum/cli/module.rb
puppet-magnum-3.0.11 lib/puppet-magnum/cli/module.rb
puppet-magnum-3.0.10 lib/puppet-magnum/cli/module.rb
puppet-magnum-3.0.9 lib/puppet-magnum/cli/module.rb
puppet-magnum-3.0.8 lib/puppet-magnum/cli/module.rb
puppet-magnum-3.0.7 lib/puppet-magnum/cli/module.rb
puppet-magnum-3.0.6 lib/puppet-magnum/cli/module.rb
puppet-magnum-3.0.5 lib/puppet-magnum/cli/module.rb
puppet-magnum-3.0.4 lib/puppet-magnum/cli/module.rb
puppet-magnum-3.0.3 lib/puppet-magnum/cli/module.rb
puppet-magnum-3.0.2 lib/puppet-magnum/cli/module.rb
puppet-magnum-3.0.1 lib/puppet-magnum/cli/module.rb
puppet-magnum-3.0.0 lib/puppet-magnum/cli/module.rb