Sha256: 4b28019c4cb9103220688cdab38f0470bd0bf7df7d5ae0f035f8668a947edda6

Contents?: true

Size: 1.11 KB

Versions: 3

Compression:

Stored size: 1.11 KB

Contents

#!/usr/bin/env ruby
# -*- coding: utf-8 -*-

require "chef/rest"

class Chef
  class Fork
    module Commands
      class Noop
        def initialize(application)
          @application = application
          define_options
        end

        def run(args=[])
          order_args(args=[])
        end

        private
        def define_options()
          command_name = self.class.to_s.split("::").last.scan(/[A-Z][0-9_a-z]*/).join("-").downcase
          optparse.banner = "Usage: #{File.basename($0)} #{command_name} [OPTIONS]"
        end

        def options()
          @application.options
        end

        def optparse()
          @application.optparse
        end

        def order_args(args=[])
          args = @application.optparse.order(args)
          @application.configure(@application.options)
          args
        end

        def parse_args(args=[])
          args = @application.optparse.parse(args)
          @application.configure(@application.options)
          args
        end

        def rest()
          @rest ||= Chef::REST.new(Chef::Config[:chef_server_url])
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
chef-fork-0.2.0 lib/chef/fork/commands.rb
chef-fork-0.1.4 lib/chef/fork/commands.rb
chef-fork-0.1.3 lib/chef/fork/commands.rb