diff options
| author | Daniel Pittman <daniel@puppetlabs.com> | 2011-03-26 00:12:17 -0700 |
|---|---|---|
| committer | Daniel Pittman <daniel@puppetlabs.com> | 2011-03-28 10:45:34 -0700 |
| commit | b859baa04737644e40002f511c5941d002a956e3 (patch) | |
| tree | f8f4d581c3b0445df836d5e55945f62547239598 /lib/puppet/application | |
| parent | 88aeb04a50d8997b5e1e0ed7a5a2239508b174ee (diff) | |
MAINT: the API is officially named "string" as of this moment.
Now that we have settled on the final public name for the API,
"Puppet::String", mass-rename and mass-edit all the files to follow.
Reviewed-By: Randall Hansen <randall@puppetlabs.com>
Diffstat (limited to 'lib/puppet/application')
| -rw-r--r-- | lib/puppet/application/config.rb | 4 | ||||
| -rw-r--r-- | lib/puppet/application/configurer.rb | 6 | ||||
| -rw-r--r-- | lib/puppet/application/indirection_base.rb | 10 | ||||
| -rw-r--r-- | lib/puppet/application/string.rb (renamed from lib/puppet/application/interface.rb) | 18 | ||||
| -rw-r--r-- | lib/puppet/application/string_base.rb (renamed from lib/puppet/application/interface_base.rb) | 26 |
5 files changed, 32 insertions, 32 deletions
diff --git a/lib/puppet/application/config.rb b/lib/puppet/application/config.rb index 90c5f53c4..f6559277b 100644 --- a/lib/puppet/application/config.rb +++ b/lib/puppet/application/config.rb @@ -1,4 +1,4 @@ -require 'puppet/application/interface_base' +require 'puppet/application/string_base' -class Puppet::Application::Config < Puppet::Application::InterfaceBase +class Puppet::Application::Config < Puppet::Application::StringBase end diff --git a/lib/puppet/application/configurer.rb b/lib/puppet/application/configurer.rb index 5c9af37d7..b440098ee 100644 --- a/lib/puppet/application/configurer.rb +++ b/lib/puppet/application/configurer.rb @@ -1,5 +1,5 @@ require 'puppet/application' -require 'puppet/interface' +require 'puppet/string' class Puppet::Application::Configurer < Puppet::Application should_parse_config @@ -17,7 +17,7 @@ class Puppet::Application::Configurer < Puppet::Application end def run_command - report = Puppet::Interface[:configurer, '0.0.1'].synchronize(Puppet[:certname]) - Puppet::Interface[:report, '0.0.1'].submit(report) + report = Puppet::String[:configurer, '0.0.1'].synchronize(Puppet[:certname]) + Puppet::String[:report, '0.0.1'].submit(report) end end diff --git a/lib/puppet/application/indirection_base.rb b/lib/puppet/application/indirection_base.rb index 7d1c851cf..da61f408d 100644 --- a/lib/puppet/application/indirection_base.rb +++ b/lib/puppet/application/indirection_base.rb @@ -1,6 +1,6 @@ -require 'puppet/application/interface_base' +require 'puppet/application/string_base' -class Puppet::Application::IndirectionBase < Puppet::Application::InterfaceBase +class Puppet::Application::IndirectionBase < Puppet::Application::StringBase option("--terminus TERMINUS") do |arg| @terminus = arg end @@ -10,10 +10,10 @@ class Puppet::Application::IndirectionBase < Puppet::Application::InterfaceBase def setup super - if interface.respond_to?(:indirection) - raise "Could not find data type #{type} for application #{self.class.name}" unless interface.indirection + if string.respond_to?(:indirection) + raise "Could not find data type #{type} for application #{self.class.name}" unless string.indirection - interface.set_terminus(terminus) if terminus + string.set_terminus(terminus) if terminus end end end diff --git a/lib/puppet/application/interface.rb b/lib/puppet/application/string.rb index f447dc30d..aa369e669 100644 --- a/lib/puppet/application/interface.rb +++ b/lib/puppet/application/string.rb @@ -1,7 +1,7 @@ require 'puppet/application' -require 'puppet/interface' +require 'puppet/string' -class Puppet::Application::Interface < Puppet::Application +class Puppet::Application::String < Puppet::Application should_parse_config run_mode :agent @@ -18,7 +18,7 @@ class Puppet::Application::Interface < Puppet::Application if arguments.empty? arguments = %w{terminuses actions} end - interfaces.each do |name| + strings.each do |name| str = "#{name}:\n" if arguments.include?("terminuses") begin @@ -68,12 +68,12 @@ class Puppet::Application::Interface < Puppet::Application end unless respond_to?(verb) - raise "Command '#{verb}' not found for 'interface'" + raise "Command '#{verb}' not found for 'string'" end end - def interfaces - Puppet::Interface.interfaces + def strings + Puppet::String.strings end def terminus_classes(indirection) @@ -81,9 +81,9 @@ class Puppet::Application::Interface < Puppet::Application end def actions(indirection) - return [] unless interface = Puppet::Interface[indirection, '0.0.1'] - interface.load_actions - return interface.actions.sort { |a,b| a.to_s <=> b.to_s } + return [] unless string = Puppet::String[indirection, '0.0.1'] + string.load_actions + return string.actions.sort { |a,b| a.to_s <=> b.to_s } end def load_applications diff --git a/lib/puppet/application/interface_base.rb b/lib/puppet/application/string_base.rb index 841f3ca12..5b701597d 100644 --- a/lib/puppet/application/interface_base.rb +++ b/lib/puppet/application/string_base.rb @@ -1,14 +1,14 @@ require 'puppet/application' -require 'puppet/interface' +require 'puppet/string' -class Puppet::Application::InterfaceBase < Puppet::Application +class Puppet::Application::StringBase < Puppet::Application should_parse_config run_mode :agent def preinit super trap(:INT) do - $stderr.puts "Cancelling Interface" + $stderr.puts "Cancelling String" exit(0) end end @@ -32,7 +32,7 @@ class Puppet::Application::InterfaceBase < Puppet::Application end - attr_accessor :interface, :type, :verb, :arguments, :format + attr_accessor :string, :type, :verb, :arguments, :format attr_writer :exit_code # This allows you to set the exit code if you don't want to just exit @@ -43,7 +43,7 @@ class Puppet::Application::InterfaceBase < Puppet::Application def main # Call the method associated with the provided action (e.g., 'find'). - if result = interface.send(verb, *arguments) + if result = string.send(verb, *arguments) puts render(result) end exit(exit_code) @@ -72,25 +72,25 @@ class Puppet::Application::InterfaceBase < Puppet::Application @type = self.class.name.to_s.sub(/.+:/, '').downcase.to_sym # TODO: These should be configurable versions. - unless Puppet::Interface.interface?(@type, :latest) - raise "Could not find any version of interface '#{@type}'" + unless Puppet::String.string?(@type, :latest) + raise "Could not find any version of string '#{@type}'" end - @interface = Puppet::Interface[@type, :latest] - @format ||= @interface.default_format + @string = Puppet::String[@type, :latest] + @format ||= @string.default_format - # We copy all of the app options to the interface. + # We copy all of the app options to the string. # This allows each action to read in the options. - @interface.options = options + @string.options = options validate end def validate unless verb - raise "You must specify #{interface.actions.join(", ")} as a verb; 'save' probably does not work right now" + raise "You must specify #{string.actions.join(", ")} as a verb; 'save' probably does not work right now" end - unless interface.action?(verb) + unless string.action?(verb) raise "Command '#{verb}' not found for #{type}" end end |
