Permalink
Browse files

Add Rubocop

  • Loading branch information...
1 parent aa944d6 commit ecf3cd4a7bd3870783176cdc11b2ba72007c124b @sethvargo sethvargo committed Feb 26, 2014
Showing with 1,243 additions and 1,305 deletions.
  1. +28 −0 .rubocop.yml
  2. +2 −2 bin/makeself-header.sh
  3. +4 −4 bin/makeself.sh
  4. +2 −2 bin/omnibus
  5. +7 −9 functional/packagers/mac_pkg_spec.rb
  6. +10 −12 lib/omnibus.rb
  7. +12 −14 lib/omnibus/artifact.rb
  8. +17 −20 lib/omnibus/build_version.rb
  9. +31 −39 lib/omnibus/builder.rb
  10. +2 −4 lib/omnibus/clean_tasks.rb
  11. +1 −3 lib/omnibus/cli.rb
  12. +45 −52 lib/omnibus/cli/application.rb
  13. +15 −18 lib/omnibus/cli/base.rb
  14. +12 −12 lib/omnibus/cli/build.rb
  15. +12 −14 lib/omnibus/cli/cache.rb
  16. +3 −8 lib/omnibus/cli/release.rb
  17. +9 −11 lib/omnibus/config.rb
  18. +4 −5 lib/omnibus/exceptions.rb
  19. +8 −12 lib/omnibus/fetcher.rb
  20. +2 −2 lib/omnibus/fetchers.rb
  21. +14 −18 lib/omnibus/fetchers/git_fetcher.rb
  22. +33 −37 lib/omnibus/fetchers/net_fetcher.rb
  23. +6 −8 lib/omnibus/fetchers/path_fetcher.rb
  24. +2 −3 lib/omnibus/fetchers/s3_cache_fetcher.rb
  25. +125 −126 lib/omnibus/health_check.rb
  26. +9 −10 lib/omnibus/library.rb
  27. +6 −8 lib/omnibus/overrides.rb
  28. +19 −21 lib/omnibus/package_release.rb
  29. +15 −18 lib/omnibus/packagers/mac_pkg.rb
  30. +122 −119 lib/omnibus/project.rb
  31. +13 −21 lib/omnibus/reports.rb
  32. +15 −21 lib/omnibus/s3_cacher.rb
  33. +71 −74 lib/omnibus/software.rb
  34. +2 −2 lib/omnibus/templates/Vagrantfile.erb
  35. +1 −1 lib/omnibus/templates/package_scripts/makeselfinst.erb
  36. +1 −1 lib/omnibus/templates/package_scripts/postinst.erb
  37. +1 −1 lib/omnibus/templates/package_scripts/prerm.erb
  38. +7 −7 lib/omnibus/util.rb
  39. +1 −1 lib/omnibus/version.rb
  40. +5 −2 omnibus.gemspec
  41. +50 −47 spec/artifact_spec.rb
  42. +104 −112 spec/build_version_spec.rb
  43. +19 −19 spec/data/projects/chefdk.rb
  44. +11 −11 spec/data/software/erchef.rb
  45. +25 −25 spec/data/software/zlib.rb
  46. +44 −37 spec/fetchers/git_fetcher_spec.rb
  47. +67 −73 spec/fetchers/net_fetcher_spec.rb
  48. +60 −60 spec/overrides_spec.rb
  49. +52 −51 spec/package_release_spec.rb
  50. +53 −59 spec/packagers/mac_pkg_spec.rb
  51. +15 −15 spec/project_spec.rb
  52. +7 −8 spec/s3_cacher_spec.rb
  53. +37 −38 spec/software_spec.rb
  54. +5 −8 spec/spec_helper.rb
View
@@ -0,0 +1,28 @@
+ClassLength:
+ Enabled: false
+CyclomaticComplexity:
+ Max: 20
+Documentation:
+ Enabled: false
+GlobalVars:
+ Enabled: false
+HandleExceptions:
+ Enabled: false
+IfUnlessModifier:
+ Enabled: false
+LineLength:
+ Enabled: false
+MethodLength:
+ Enabled: false
+ModuleFunction:
+ Enabled: false
+ParameterLists:
+ Max: 6
+RaiseArgs:
+ Enabled: false
+RescueException:
+ Enabled: false
+TrailingComma:
+ EnforcedStyleForMultiline: comma
+TrivialAccessors:
+ Enabled: false
View
@@ -65,7 +65,7 @@ Makeself version $MS_VERSION
\$0 --lsm Print embedded lsm entry (or no LSM)
\$0 --list Print the list of files in the archive
\$0 --check Checks integrity of the archive
-
+
2) Running \$0 :
\$0 [options] [--] [additional arguments to embedded script]
with following options (in that order)
@@ -84,7 +84,7 @@ EOH
MS_Check()
{
OLD_PATH="\$PATH"
- PATH=\${GUESS_MD5_PATH:-"\$OLD_PATH:/bin:/usr/bin:/sbin:/usr/local/ssl/bin:/usr/local/bin:/opt/openssl/bin"}
+ PATH=\${GUESS_MD5_PATH:-"\$OLD_PATH:/bin:/usr/bin:/sbin:/usr/local/ssl/bin:/usr/local/bin:/opt/openssl/bin" }
MD5_ARG=""
MD5_PATH=\`exec <&- 2>&-; which md5sum || type md5sum\`
test -x "\$MD5_PATH" || MD5_PATH=\`exec <&- 2>&-; which md5 || type md5\`
View
@@ -22,13 +22,13 @@
# support for non-temporary archives. Ideas thanks to Francois Petitjean
# - 1.3 : More patches from Bjarni R. Einarsson and Francois Petitjean:
# Support for no compression (--nocomp), script is no longer mandatory,
-# automatic launch in an xterm, optional verbose output, and -target
+# automatic launch in an xterm, optional verbose output, and -target
# archive option to indicate where to extract the files.
# - 1.4 : Improved UNIX compatibility (Francois Petitjean)
# Automatic integrity checking, support of LSM files (Francois Petitjean)
# - 1.5 : Many bugfixes. Optionally disable xterm spawning.
# - 1.5.1 : More bugfixes, added archive options -list and -check.
-# - 1.5.2 : Cosmetic changes to inform the user of what's going on with big
+# - 1.5.2 : Cosmetic changes to inform the user of what's going on with big
# archives (Quake III demo)
# - 1.5.3 : Check for validity of the DISPLAY variable before launching an xterm.
# More verbosity in xterms and check for embedded command's return value.
@@ -75,7 +75,7 @@ MS_VERSION=2.1.5
MS_COMMAND="$0"
unset CDPATH
-for f in "${1+"$@"}"; do
+for f in "${1+"$@" }"; do
MS_COMMAND="$MS_COMMAND \\\\
\\\"$f\\\""
done
@@ -355,7 +355,7 @@ if test "$NOMD5" = y; then
else
# Try to locate a MD5 binary
OLD_PATH=$PATH
- PATH=${GUESS_MD5_PATH:-"$OLD_PATH:/bin:/usr/bin:/sbin:/usr/local/ssl/bin:/usr/local/bin:/opt/openssl/bin"}
+ PATH=${GUESS_MD5_PATH:-"$OLD_PATH:/bin:/usr/bin:/sbin:/usr/local/ssl/bin:/usr/local/bin:/opt/openssl/bin" }
MD5_ARG=""
MD5_PATH=`exec <&- 2>&-; which md5sum || type md5sum`
test -x "$MD5_PATH" || MD5_PATH=`exec <&- 2>&-; which md5 || type md5`
View
@@ -2,9 +2,9 @@
# Trap interrupts to quit cleanly. See
# https://twitter.com/mitchellh/status/283014103189053442
-Signal.trap("INT") { exit 1 }
+Signal.trap('INT') { exit 1 }
-$:.unshift File.expand_path("../../lib", __FILE__)
+$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
require 'omnibus/cli'
@@ -21,9 +21,9 @@
describe Omnibus::Packagers::MacPkg do
- let(:mac_pkg_identifier) { "test.pkg.functional-test-project" }
+ let(:mac_pkg_identifier) { 'test.pkg.functional-test-project' }
- let(:omnibus_root) { File.expand_path("../../fixtures/mac_pkg", __FILE__) }
+ let(:omnibus_root) { File.expand_path('../../fixtures/mac_pkg', __FILE__) }
let(:scripts_path) { "#{omnibus_root}/package-scripts" }
@@ -36,7 +36,7 @@
Omnibus.stub(:project_root).and_return(omnibus_root)
Omnibus.config.stub(:package_dir).and_return(package_dir)
- project_file=<<-P
+ project_file = <<-P
name "functional-test-project"
maintainer "YOU"
homepage "http://www.theonion.com/articles/drunken-man-careens-wildly-across-internet,35249/"
@@ -47,15 +47,14 @@
Omnibus::Project.new(project_file, __FILE__)
end
-
let(:packager) do
Omnibus::Packagers::MacPkg.new(project)
end
def create_app_dir
- FileUtils.mkdir("/opt/functional-test-project") unless File.directory?("/opt/functional-test-project")
- File.open("/opt/functional-test-project/itworks.txt", "w+") do |f|
- f.puts "hello world"
+ FileUtils.mkdir('/opt/functional-test-project') unless File.directory?('/opt/functional-test-project')
+ File.open('/opt/functional-test-project/itworks.txt', 'w+') do |f|
+ f.puts 'hello world'
end
end
@@ -65,10 +64,9 @@ def create_app_dir
#
# There is no verification that the package was correctly created, you have
# to install it yourself to verify.
- it "builds a package" do
+ it 'builds a package' do
create_app_dir
packager.build
end
end
-
View
@@ -38,7 +38,6 @@
require 'pathname'
module Omnibus
-
DEFAULT_CONFIG_FILENAME = 'omnibus.rb'.freeze
# Configure Omnibus.
@@ -71,7 +70,7 @@ def self.config
# @param file [String] path to a configuration file to load
#
# @return [void]
- def self.load_configuration(file=nil)
+ def self.load_configuration(file = nil)
if file
Config.from_file(file)
end
@@ -98,15 +97,15 @@ def self.projects
#
# @return [Array<String>]
def self.project_names
- projects.map{|p| p.name}
+ projects.map { |p| p.name }
end
# Load the {Omnibus::Project} instance with the given name.
#
# @param name [String]
# @return {Omnibus::Project}
def self.project(name)
- projects.find{ |p| p.name == name}
+ projects.find { |p| p.name == name }
end
# The absolute path to the Omnibus project/repository directory.
@@ -123,7 +122,7 @@ def self.project_root
#
# @return [Pathname]
def self.source_root
- @source_root ||= Pathname.new(File.expand_path("../..", __FILE__))
+ @source_root ||= Pathname.new(File.expand_path('../..', __FILE__))
end
# The source root is the path to the root directory of the `omnibus-software`
@@ -132,7 +131,7 @@ def self.source_root
# @return [Pathname]
def self.omnibus_software_root
@omnibus_software_root ||= begin
- if spec = Gem::Specification.find_all_by_name('omnibus-software').first
+ if (spec = Gem::Specification.find_all_by_name('omnibus-software').first)
Pathname.new(spec.gem_dir)
else
nil
@@ -169,7 +168,7 @@ def self.software_dirs
#
# @todo print a deprecation message
class << self
- alias :root :project_root
+ alias_method :root, :project_root
end
private
@@ -197,7 +196,7 @@ def self.expand_projects
# @see Omnibus::Overrides#overrides
def self.expand_software(overrides, software_map)
unless overrides.is_a? Hash
- raise ArgumentError, "Overrides argument must be a hash! You passed #{overrides.inspect}."
+ fail ArgumentError, "Overrides argument must be a hash! You passed #{overrides.inspect}."
end
Omnibus.projects.each do |project|
@@ -216,8 +215,7 @@ def self.process_dsl_files
expand_projects
# Then do software
- final_software_map = prefer_local_software(omnibus_software_files,
- software_files)
+ final_software_map = prefer_local_software(omnibus_software_files, software_files)
overrides = Config.override_file ? Omnibus::Overrides.overrides : {}
@@ -281,7 +279,7 @@ def self.prefer_local_software(omnibus_files, local_files)
# @return [Hash<String, String>]
def self.software_map(files)
files.each_with_object({}) do |file, collection|
- software_name = File.basename(file, ".*")
+ software_name = File.basename(file, '.*')
collection[software_name] = file
end
end
@@ -299,7 +297,7 @@ def self.recursively_load_dependency(dependency_name, project, overrides, softwa
dep_file = software_map[dependency_name]
unless dep_file
- raise MissingProjectDependency.new(dependency_name, software_dirs)
+ fail MissingProjectDependency.new(dependency_name, software_dirs)
end
dep_software = Omnibus::Software.load(dep_file, project, overrides)
View
@@ -1,6 +1,5 @@
module Omnibus
class Artifact
-
attr_reader :path
attr_reader :platforms
attr_reader :config
@@ -65,9 +64,9 @@ def add_to_release_manifest!(release_manifest)
def add_to_v2_release_manifest!(release_manifest)
platforms.each do |distro, version, arch|
pkg_info = {
- "relpath" => relpath,
- "md5" => md5,
- "sha256" => sha256
+ 'relpath' => relpath,
+ 'md5' => md5,
+ 'sha256' => sha256,
}
release_manifest[distro] ||= {}
@@ -92,13 +91,13 @@ def add_to_v2_release_manifest!(release_manifest)
def flat_metadata
distro, version, arch = build_platform
{
- "platform" => distro,
- "platform_version" => version,
- "arch" => arch,
- "version" => build_version,
- "basename" => File.basename(path),
- "md5" => md5,
- "sha256" => sha256
+ 'platform' => distro,
+ 'platform_version' => version,
+ 'arch' => arch,
+ 'version' => build_version,
+ 'basename' => File.basename(path),
+ 'md5' => md5,
+ 'sha256' => sha256,
}
end
@@ -122,7 +121,7 @@ def build_version
# "/el/6/x86_64/chef-11.4.0-1.el5.x86_64.rpm"
def relpath
# upload build to build platform directory
- "/#{build_platform.join('/')}/#{path.split('/').last}"
+ "/#{build_platform.join('/') }/#{path.split('/').last}"
end
# @return [String] hex encoded MD5 of the package
@@ -140,12 +139,11 @@ def sha256
def digest(digest_class)
digest = digest_class.new
File.open(path) do |io|
- while chunk = io.read(1024 * 8)
+ while (chunk = io.read(1024 * 8))
digest.update(chunk)
end
end
digest.hexdigest
end
end
end
-
Oops, something went wrong.

0 comments on commit ecf3cd4

Please sign in to comment.