summaryrefslogtreecommitdiff
path: root/lib/chef/application
diff options
context:
space:
mode:
authorThom May <thom@chef.io>2016-01-14 14:08:03 +0000
committerThom May <thom@chef.io>2016-01-14 14:08:03 +0000
commit51cfbdc4d16739caac4d946fadbe678444aafe34 (patch)
tree56dfd8f1cd9fd933de27268b32402e955a43ac2b /lib/chef/application
parent05064423057d4cf46f4713b81b08829cf6d20af6 (diff)
downloadchef-51cfbdc4d16739caac4d946fadbe678444aafe34.tar.gz
Use double quotes by default
This is an entirely mechanically generated (chefstyle -a) change, to go along with chef/chefstyle#5 . We should pick something and use it consistently, and my opinion is that double quotes are the appropriate thing.
Diffstat (limited to 'lib/chef/application')
-rw-r--r--lib/chef/application/apply.rb28
-rw-r--r--lib/chef/application/client.rb40
-rw-r--r--lib/chef/application/knife.rb18
-rw-r--r--lib/chef/application/solo.rb46
-rw-r--r--lib/chef/application/windows_service.rb26
-rw-r--r--lib/chef/application/windows_service_manager.rb32
6 files changed, 95 insertions, 95 deletions
diff --git a/lib/chef/application/apply.rb b/lib/chef/application/apply.rb
index 6a371c89c4..f6348a951b 100644
--- a/lib/chef/application/apply.rb
+++ b/lib/chef/application/apply.rb
@@ -17,15 +17,15 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require 'chef'
-require 'chef/application'
-require 'chef/client'
-require 'chef/config'
-require 'chef/log'
-require 'fileutils'
-require 'tempfile'
-require 'chef/providers'
-require 'chef/resources'
+require "chef"
+require "chef/application"
+require "chef/client"
+require "chef/config"
+require "chef/log"
+require "fileutils"
+require "tempfile"
+require "chef/providers"
+require "chef/resources"
class Chef::Application::Apply < Chef::Application
@@ -92,9 +92,9 @@ class Chef::Application::Apply < Chef::Application
:exit => 0
option :why_run,
- :short => '-W',
- :long => '--why-run',
- :description => 'Enable whyrun mode',
+ :short => "-W",
+ :long => "--why-run",
+ :description => "Enable whyrun mode",
:boolean => true
option :profile_ruby,
@@ -104,7 +104,7 @@ class Chef::Application::Apply < Chef::Application
:default => false
option :color,
- :long => '--[no-]color',
+ :long => "--[no-]color",
:boolean => true,
:default => true,
:description => "Use colored output, defaults to enabled"
@@ -167,7 +167,7 @@ class Chef::Application::Apply < Chef::Application
# write recipe to temp file, so in case of error,
# user gets error w/ context
def temp_recipe_file
- @recipe_fh = Tempfile.open('recipe-temporary-file')
+ @recipe_fh = Tempfile.open("recipe-temporary-file")
@recipe_fh.write(@recipe_text)
@recipe_fh.rewind
@recipe_filename = @recipe_fh.path
diff --git a/lib/chef/application/client.rb b/lib/chef/application/client.rb
index 8cc045cb8e..ba357b420d 100644
--- a/lib/chef/application/client.rb
+++ b/lib/chef/application/client.rb
@@ -17,14 +17,14 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require 'chef/application'
-require 'chef/client'
-require 'chef/config'
-require 'chef/daemon'
-require 'chef/log'
-require 'chef/config_fetcher'
-require 'chef/handler/error_report'
-require 'chef/workstation_config_loader'
+require "chef/application"
+require "chef/client"
+require "chef/config"
+require "chef/daemon"
+require "chef/log"
+require "chef/config_fetcher"
+require "chef/handler/error_report"
+require "chef/workstation_config_loader"
class Chef::Application::Client < Chef::Application
include Chef::Mixin::ShellOut
@@ -62,7 +62,7 @@ class Chef::Application::Client < Chef::Application
:default => false
option :color,
- :long => '--[no-]color',
+ :long => "--[no-]color",
:boolean => true,
:default => true,
:description => "Use colored output, defaults to enabled"
@@ -172,9 +172,9 @@ class Chef::Application::Client < Chef::Application
:description => "Use a policyfile's named run list instead of the default run list"
option :environment,
- :short => '-E ENVIRONMENT',
- :long => '--environment ENVIRONMENT',
- :description => 'Set the Chef Environment on the node'
+ :short => "-E ENVIRONMENT",
+ :long => "--environment ENVIRONMENT",
+ :description => "Set the Chef Environment on the node"
option :version,
:short => "-v",
@@ -189,7 +189,7 @@ class Chef::Application::Client < Chef::Application
:long => "--override-runlist RunlistItem,RunlistItem...",
:description => "Replace current run list with specified items for a single run",
:proc => lambda{|items|
- items = items.split(',')
+ items = items.split(",")
items.compact.map{|item|
Chef::RunList::RunListItem.new(item)
}
@@ -200,15 +200,15 @@ class Chef::Application::Client < Chef::Application
:long => "--runlist RunlistItem,RunlistItem...",
:description => "Permanently replace current run list with specified items",
:proc => lambda{|items|
- items = items.split(',')
+ items = items.split(",")
items.compact.map{|item|
Chef::RunList::RunListItem.new(item)
}
}
option :why_run,
- :short => '-W',
- :long => '--why-run',
- :description => 'Enable whyrun mode',
+ :short => "-W",
+ :long => "--why-run",
+ :description => "Enable whyrun mode",
:boolean => true
option :client_fork,
@@ -283,7 +283,7 @@ class Chef::Application::Client < Chef::Application
def reconfigure
super
- raise Chef::Exceptions::PIDFileLockfileMatch if Chef::Util::PathHelper.paths_eql? (Chef::Config[:pid_file] || '' ), (Chef::Config[:lockfile] || '')
+ raise Chef::Exceptions::PIDFileLockfileMatch if Chef::Util::PathHelper.paths_eql? (Chef::Config[:pid_file] || "" ), (Chef::Config[:lockfile] || "")
set_specific_recipes
@@ -305,7 +305,7 @@ class Chef::Application::Client < Chef::Application
elsif Chef::Config.local_mode && Chef::Config.has_key?(:recipe_url)
Chef::Log.debug "Creating path #{Chef::Config.chef_repo_path} to extract recipes into"
FileUtils.mkdir_p(Chef::Config.chef_repo_path)
- tarball_path = File.join(Chef::Config.chef_repo_path, 'recipes.tgz')
+ tarball_path = File.join(Chef::Config.chef_repo_path, "recipes.tgz")
fetch_recipe_tarball(Chef::Config[:recipe_url], tarball_path)
result = shell_out!("tar zxvf #{tarball_path} -C #{Chef::Config.chef_repo_path}")
Chef::Log.debug "#{result.stdout}"
@@ -472,7 +472,7 @@ class Chef::Application::Client < Chef::Application
def fetch_recipe_tarball(url, path)
Chef::Log.debug("Download recipes tarball from #{url} to #{path}")
- File.open(path, 'wb') do |f|
+ File.open(path, "wb") do |f|
open(url) do |r|
f.write(r.read)
end
diff --git a/lib/chef/application/knife.rb b/lib/chef/application/knife.rb
index 11e3246cfb..1742223657 100644
--- a/lib/chef/application/knife.rb
+++ b/lib/chef/application/knife.rb
@@ -15,11 +15,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require 'chef/knife'
-require 'chef/application'
-require 'mixlib/log'
-require 'ohai/config'
-require 'chef/monkey_patches/net_http.rb'
+require "chef/knife"
+require "chef/application"
+require "mixlib/log"
+require "ohai/config"
+require "chef/monkey_patches/net_http.rb"
class Chef::Application::Knife < Chef::Application
@@ -35,14 +35,14 @@ class Chef::Application::Knife < Chef::Application
verbosity_level = 0
option :verbosity,
- :short => '-V',
- :long => '--verbose',
+ :short => "-V",
+ :long => "--verbose",
:description => "More verbose output. Use twice for max verbosity",
:proc => Proc.new { verbosity_level += 1},
:default => 0
option :color,
- :long => '--[no-]color',
+ :long => "--[no-]color",
:boolean => true,
:default => true,
:description => "Use colored output, defaults to enabled"
@@ -56,7 +56,7 @@ class Chef::Application::Knife < Chef::Application
:short => "-e EDITOR",
:long => "--editor EDITOR",
:description => "Set the editor to use for interactive commands",
- :default => ENV['EDITOR']
+ :default => ENV["EDITOR"]
option :disable_editing,
:short => "-d",
diff --git a/lib/chef/application/solo.rb b/lib/chef/application/solo.rb
index 4b472e9662..b3197c3dbe 100644
--- a/lib/chef/application/solo.rb
+++ b/lib/chef/application/solo.rb
@@ -16,22 +16,22 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-require 'chef'
-require 'chef/application'
-require 'chef/client'
-require 'chef/config'
-require 'chef/daemon'
-require 'chef/log'
-require 'chef/rest'
-require 'chef/config_fetcher'
-require 'fileutils'
+require "chef"
+require "chef/application"
+require "chef/client"
+require "chef/config"
+require "chef/daemon"
+require "chef/log"
+require "chef/rest"
+require "chef/config_fetcher"
+require "fileutils"
class Chef::Application::Solo < Chef::Application
option :config_file,
:short => "-c CONFIG",
:long => "--config CONFIG",
- :default => Chef::Config.platform_specific_path('/etc/chef/solo.rb'),
+ :default => Chef::Config.platform_specific_path("/etc/chef/solo.rb"),
:description => "The configuration file to use"
option :formatter,
@@ -59,7 +59,7 @@ class Chef::Application::Solo < Chef::Application
:default => false
option :color,
- :long => '--[no-]color',
+ :long => "--[no-]color",
:boolean => true,
:default => !Chef::Platform.windows?,
:description => "Use colored output, defaults to enabled"
@@ -153,7 +153,7 @@ class Chef::Application::Solo < Chef::Application
:long => "--override-runlist RunlistItem,RunlistItem...",
:description => "Replace current run list with specified items",
:proc => lambda{|items|
- items = items.split(',')
+ items = items.split(",")
items.compact.map{|item|
Chef::RunList::RunListItem.new(item)
}
@@ -166,20 +166,20 @@ class Chef::Application::Solo < Chef::Application
:boolean => true
option :why_run,
- :short => '-W',
- :long => '--why-run',
- :description => 'Enable whyrun mode',
+ :short => "-W",
+ :long => "--why-run",
+ :description => "Enable whyrun mode",
:boolean => true
option :ez,
- :long => '--ez',
- :description => 'A memorial for Ezra Zygmuntowicz',
+ :long => "--ez",
+ :description => "A memorial for Ezra Zygmuntowicz",
:boolean => true
option :environment,
- :short => '-E ENVIRONMENT',
- :long => '--environment ENVIRONMENT',
- :description => 'Set the Chef Environment on the node'
+ :short => "-E ENVIRONMENT",
+ :long => "--environment ENVIRONMENT",
+ :description => "Set the Chef Environment on the node"
option :run_lock_timeout,
:long => "--run-lock-timeout SECONDS",
@@ -212,13 +212,13 @@ class Chef::Application::Solo < Chef::Application
if Chef::Config[:recipe_url]
cookbooks_path = Array(Chef::Config[:cookbook_path]).detect{|e| e =~ /\/cookbooks\/*$/ }
- recipes_path = File.expand_path(File.join(cookbooks_path, '..'))
+ recipes_path = File.expand_path(File.join(cookbooks_path, ".."))
Chef::Log.debug "Cleanup path #{recipes_path} before extract recipes into it"
FileUtils.rm_rf(recipes_path, :secure => true)
Chef::Log.debug "Creating path #{recipes_path} to extract recipes into"
FileUtils.mkdir_p(recipes_path)
- tarball_path = File.join(recipes_path, 'recipes.tgz')
+ tarball_path = File.join(recipes_path, "recipes.tgz")
fetch_recipe_tarball(Chef::Config[:recipe_url], tarball_path)
Mixlib::ShellOut.new("tar zxvf #{tarball_path} -C #{recipes_path}").run_command
end
@@ -303,7 +303,7 @@ EOH
def fetch_recipe_tarball(url, path)
Chef::Log.debug("Download recipes tarball from #{url} to #{path}")
- File.open(path, 'wb') do |f|
+ File.open(path, "wb") do |f|
open(url) do |r|
f.write(r.read)
end
diff --git a/lib/chef/application/windows_service.rb b/lib/chef/application/windows_service.rb
index fd7cc7dd18..957123b1e9 100644
--- a/lib/chef/application/windows_service.rb
+++ b/lib/chef/application/windows_service.rb
@@ -16,19 +16,19 @@
# limitations under the License.
#
-require 'chef'
-require 'chef/monologger'
-require 'chef/application'
-require 'chef/client'
-require 'chef/config'
-require 'chef/handler/error_report'
-require 'chef/log'
-require 'chef/http'
-require 'mixlib/cli'
-require 'socket'
-require 'uri'
-require 'win32/daemon'
-require 'chef/mixin/shell_out'
+require "chef"
+require "chef/monologger"
+require "chef/application"
+require "chef/client"
+require "chef/config"
+require "chef/handler/error_report"
+require "chef/log"
+require "chef/http"
+require "mixlib/cli"
+require "socket"
+require "uri"
+require "win32/daemon"
+require "chef/mixin/shell_out"
class Chef
class Application
diff --git a/lib/chef/application/windows_service_manager.rb b/lib/chef/application/windows_service_manager.rb
index 4bb624989e..b651d622e6 100644
--- a/lib/chef/application/windows_service_manager.rb
+++ b/lib/chef/application/windows_service_manager.rb
@@ -17,10 +17,10 @@
#
if RUBY_PLATFORM =~ /mswin|mingw32|windows/
- require 'win32/service'
+ require "win32/service"
end
-require 'chef/config'
-require 'mixlib/cli'
+require "chef/config"
+require "mixlib/cli"
class Chef
class Application
@@ -99,11 +99,11 @@ class Chef
parse_options(params)
case config[:action]
- when 'install'
+ when "install"
if service_exists?
puts "Service #{@service_name} already exists on the system."
else
- ruby = File.join(RbConfig::CONFIG['bindir'], 'ruby')
+ ruby = File.join(RbConfig::CONFIG["bindir"], "ruby")
opts = ""
opts << " -c #{config[:config_file]}" if config[:config_file]
@@ -132,29 +132,29 @@ class Chef
) unless @delayed_start.nil?
puts "Service '#{@service_name}' has successfully been installed."
end
- when 'status'
+ when "status"
if !service_exists?
puts "Service #{@service_name} doesn't exist on the system."
else
puts "State of #{@service_name} service is: #{current_state}"
end
- when 'start'
+ when "start"
# TODO: allow override of startup parameters here?
- take_action('start', RUNNING)
- when 'stop'
- take_action('stop', STOPPED)
- when 'uninstall', 'delete'
- take_action('stop', STOPPED)
+ take_action("start", RUNNING)
+ when "stop"
+ take_action("stop", STOPPED)
+ when "uninstall", "delete"
+ take_action("stop", STOPPED)
unless service_exists?
puts "Service #{@service_name} doesn't exist on the system."
else
::Win32::Service.delete(@service_name)
puts "Service #{@service_name} deleted"
end
- when 'pause'
- take_action('pause', PAUSED)
- when 'resume'
- take_action('resume', RUNNING)
+ when "pause"
+ take_action("pause", PAUSED)
+ when "resume"
+ take_action("resume", RUNNING)
end
end