diff options
author | Ryan Davis <ryand@zenspider.com> | 2015-01-27 02:58:33 -0800 |
---|---|---|
committer | Ryan Davis <ryand@zenspider.com> | 2015-01-27 02:58:33 -0800 |
commit | 96b443559150088b1ad8b48528b220e3c2b815e3 (patch) | |
tree | 4358797fee4361d7dd0cf9f67e74784aa83b1a55 /lib | |
parent | 8c971c0cf939874ea71686df2b1e64ebf9362dc4 (diff) | |
download | hoe-96b443559150088b1ad8b48528b220e3c2b815e3.tar.gz |
more stylistic tweaks
[git-p4: depot-paths = "//src/hoe/dev/": change = 9958]
Diffstat (limited to 'lib')
-rw-r--r-- | lib/hoe.rb | 7 | ||||
-rw-r--r-- | lib/hoe/deps.rb | 4 | ||||
-rw-r--r-- | lib/hoe/flay.rb | 10 | ||||
-rw-r--r-- | lib/hoe/flog.rb | 10 | ||||
-rw-r--r-- | lib/hoe/inline.rb | 4 | ||||
-rw-r--r-- | lib/hoe/package.rb | 2 | ||||
-rw-r--r-- | lib/hoe/publish.rb | 18 | ||||
-rw-r--r-- | lib/hoe/racc.rb | 4 | ||||
-rw-r--r-- | lib/hoe/rake.rb | 2 | ||||
-rw-r--r-- | lib/hoe/rcov.rb | 41 | ||||
-rw-r--r-- | lib/hoe/signing.rb | 2 | ||||
-rw-r--r-- | lib/hoe/test.rb | 8 |
12 files changed, 55 insertions, 57 deletions
@@ -515,7 +515,7 @@ class Hoe "Manifest is missing or couldn't be read.", "The Manifest is kind of a big deal.", "Maybe you're using a gem packaged by a linux project.", - "It seems like they enjoy breaking other people's code." + "It seems like they enjoy breaking other people's code.", ].join "\n" unless manifest s.name = name @@ -641,7 +641,9 @@ class Hoe self.test_globs = ["test/**/{test,spec}_*.rb", "test/**/*_{test,spec}.rb"] - if manifest = read_manifest then + manifest = read_manifest + + if manifest then self.readme_file = manifest.grep(/^README\./).first self.history_file = manifest.grep(/^History\./).first end @@ -702,7 +704,6 @@ class Hoe # should update the readme. def parse_urls text - lines = text.gsub(/^\* /, "").delete("<>").split(/\n/).grep(/\S+/) if lines.first =~ /::/ then diff --git a/lib/hoe/deps.rb b/lib/hoe/deps.rb index 1981650..f1c4d12 100644 --- a/lib/hoe/deps.rb +++ b/lib/hoe/deps.rb @@ -73,7 +73,7 @@ module Hoe::Deps puts " dependents:" unless deps.empty? then deps.sort_by(&:full_name).each do |spec| - vers = spec.dependencies.find {|s| s.name == name}.requirements_list + vers = spec.dependencies.find { |s| s.name == name }.requirements_list puts " %-*s - %s" % [max, spec.full_name, vers.join(", ")] end else @@ -160,7 +160,7 @@ module Hoe::Deps h = {} Hash[ary].values.sort.each { |spec| h[spec.name] = spec } - ary = h.map { |k,v| [v.full_name, v] } + ary = h.map { |_, v| [v.full_name, v] } dump = Marshal.dump ary diff --git a/lib/hoe/flay.rb b/lib/hoe/flay.rb index 5cddfe0..4f56f0c 100644 --- a/lib/hoe/flay.rb +++ b/lib/hoe/flay.rb @@ -22,11 +22,9 @@ module Hoe::Flay # Define tasks for plugin. def define_flay_tasks - begin - require "flay_task" - FlayTask.new :flay, self.flay_threshold - rescue Exception - # skip - end + require "flay_task" + FlayTask.new :flay, self.flay_threshold + rescue Exception + # skip end end diff --git a/lib/hoe/flog.rb b/lib/hoe/flog.rb index a2888cb..0fa2487 100644 --- a/lib/hoe/flog.rb +++ b/lib/hoe/flog.rb @@ -28,11 +28,9 @@ module Hoe::Flog # Define tasks for plugin. def define_flog_tasks - begin - require "flog_task" - FlogTask.new :flog, self.flog_threshold, nil, self.flog_method - rescue LoadError - # skip - end + require "flog_task" + FlogTask.new :flog, self.flog_threshold, nil, self.flog_method + rescue LoadError + # skip end end diff --git a/lib/hoe/inline.rb b/lib/hoe/inline.rb index 811a0da..45b5f3c 100644 --- a/lib/hoe/inline.rb +++ b/lib/hoe/inline.rb @@ -52,7 +52,7 @@ module Hoe::Inline elsif name =~ /_/ then name.capitalize.gsub(/_([a-z])/) { $1.upcase } end - extensions = Dir.chdir(Inline::directory) { + extensions = Dir.chdir(Inline.directory) { Dir["Inline_{#{name},#{alternate_name}}_*.#{dlext}"] } @@ -62,7 +62,7 @@ module Hoe::Inline # include the file in the tasks file "lib/inline/#{ext}" => ["lib/inline"] do - cp File.join(Inline::directory, ext), "lib/inline" + cp File.join(Inline.directory, ext), "lib/inline" end end end diff --git a/lib/hoe/package.rb b/lib/hoe/package.rb index fb46ac0..652abd0 100644 --- a/lib/hoe/package.rb +++ b/lib/hoe/package.rb @@ -87,7 +87,7 @@ module Hoe::Package ## # Install the named gem. - def install_gem name, version = nil, rdoc=true + def install_gem name, version = nil, rdoc = true should_not_sudo = Hoe::WINDOZE || ENV["NOSUDO"] || File.writable?(Gem.dir) null_dev = Hoe::WINDOZE ? "> NUL 2>&1" : "> /dev/null 2>&1" diff --git a/lib/hoe/publish.rb b/lib/hoe/publish.rb index 57efa51..c9d8d2f 100644 --- a/lib/hoe/publish.rb +++ b/lib/hoe/publish.rb @@ -79,9 +79,9 @@ module Hoe::Publish "url" => "url", "blog_id" => "blog_id", "extra_headers" => { - "mt_convert_breaks" => "markdown" + "mt_convert_breaks" => "markdown", }, - } + }, ] ## @@ -171,7 +171,7 @@ module Hoe::Publish end def post_blog_task # :nodoc: - with_config do |config, path| + with_config do |config, _path| break unless config["blogs"] config["blogs"].each do |site| @@ -257,9 +257,12 @@ module Hoe::Publish full && "To: #{email_to.join(", ")}", full && "Date: #{Time.now.rfc2822}", "Subject: [ANN] #{subject}", - "", title, - "", urls, - "", body, + "", + title, + "", + urls, + "", + body, ].compact.join("\n") end @@ -272,14 +275,13 @@ module Hoe::Publish urls = case self.urls when Hash then - self.urls.map { |k,v| "* #{k}: <#{v.strip.rdoc_to_markdown}>" } + self.urls.map { |k, v| "* #{k}: <#{v.strip.rdoc_to_markdown}>" } when Array then self.urls.map { |s| "* <#{s.strip.rdoc_to_markdown}>" } else raise "unknown urls format: #{urls.inspect}" end - return subject, title, body, urls.join("\n") end end diff --git a/lib/hoe/racc.rb b/lib/hoe/racc.rb index 68a5e62..64f3db6 100644 --- a/lib/hoe/racc.rb +++ b/lib/hoe/racc.rb @@ -42,7 +42,7 @@ module Hoe::Racc # -l = no-line-convert (they don't ever line up anyhow) self.racc_flags ||= "-v -l" self.oedipus_options ||= { - :do_parse => false + :do_parse => false, } end @@ -75,7 +75,7 @@ module Hoe::Racc end # HACK: taken from oedipus_lex's .rake file to bypass isolate bootstrap - rule ".rex.rb" => proc {|path| path.sub(/\.rb$/, "") } do |t| + rule ".rex.rb" => proc { |path| path.sub(/\.rb$/, "") } do |t| require "oedipus_lex" warn "Generating #{t.name} from #{t.source} from #{OedipusLex::VERSION}" oedipus = OedipusLex.new oedipus_options diff --git a/lib/hoe/rake.rb b/lib/hoe/rake.rb index 810287f..8cc5744 100644 --- a/lib/hoe/rake.rb +++ b/lib/hoe/rake.rb @@ -51,7 +51,7 @@ module Rake tasks.flatten.each do |name| case name when Regexp then - all_tasks.delete_if { |k,_| k =~ name } + all_tasks.delete_if { |k, _| k =~ name } else all_tasks.delete(name) end diff --git a/lib/hoe/rcov.rb b/lib/hoe/rcov.rb index bb70e3e..c3ba542 100644 --- a/lib/hoe/rcov.rb +++ b/lib/hoe/rcov.rb @@ -18,32 +18,31 @@ module Hoe::RCov # Define tasks for plugin. def define_rcov_tasks - begin # take a whack at defining rcov tasks - task :isolate # ensure it exists + task :isolate # ensure it exists - task :rcov => :isolate do - sh(*make_rcov_cmd) - end + task :rcov => :isolate do + sh(*make_rcov_cmd) + end - task :clobber_rcov do - rm_rf "coverage" - end + task :clobber_rcov do + rm_rf "coverage" + end - task :clobber => :clobber_rcov + task :clobber => :clobber_rcov - # this is for my emacs rcov overlay stuff on emacswiki. - task :rcov_overlay do - path = ENV["FILE"] - rcov, eol = Marshal.load(File.read("coverage.info")).last[path], 1 - puts rcov[:lines].zip(rcov[:coverage]).map { |line, coverage| - bol, eol = eol, eol + line.length - [bol, eol, "#ffcccc"] unless coverage - }.compact.inspect - end - rescue LoadError - # skip - task :clobber_rcov # in case rcov didn't load + # this is for my emacs rcov overlay stuff on emacswiki. + task :rcov_overlay do + path = ENV["FILE"] + rcov, eol = Marshal.load(File.read("coverage.info")).last[path], 1 + puts rcov[:lines].zip(rcov[:coverage]).map { |line, coverage| + bol, eol = eol, eol + line.length + [bol, eol, "#ffcccc"] unless coverage + }.compact.inspect end + rescue LoadError + # skip + task :clobber_rcov # in case rcov didn't load + # TODO: didn't load? this must be terribly historical end def make_rcov_cmd # :nodoc: diff --git a/lib/hoe/signing.rb b/lib/hoe/signing.rb index 823172f..d4fe9e2 100644 --- a/lib/hoe/signing.rb +++ b/lib/hoe/signing.rb @@ -55,7 +55,7 @@ module Hoe::Signing signing_key = nil cert_chain = [] - with_config do |config, path| + with_config do |config, _path| break unless config["signing_key_file"] and config["signing_cert_file"] key_file = File.expand_path config["signing_key_file"].to_s signing_key = key_file if File.exist? key_file diff --git a/lib/hoe/test.rb b/lib/hoe/test.rb index 3e61c64..bc9aeb2 100644 --- a/lib/hoe/test.rb +++ b/lib/hoe/test.rb @@ -98,11 +98,11 @@ module Hoe::Test task :test_deps do tests = Dir[*self.test_globs].uniq - paths = ["bin", "lib", "test"].join(File::PATH_SEPARATOR) + paths = %w[bin lib test].join(File::PATH_SEPARATOR) null_dev = Hoe::WINDOZE ? "> NUL 2>&1" : "> /dev/null 2>&1" tests.each do |test| - if not system "ruby -I#{paths} #{test} #{null_dev}" then + unless system "ruby -I#{paths} #{test} #{null_dev}" then puts "Dependency Issues: #{test}" end end @@ -165,7 +165,7 @@ module Hoe::Test # Generate the test command-line. def make_test_cmd - unless SUPPORTED_TEST_FRAMEWORKS.has_key?(testlib) + unless SUPPORTED_TEST_FRAMEWORKS.key?(testlib) raise "unsupported test framework #{testlib}" end @@ -175,7 +175,7 @@ module Hoe::Test tests << framework if framework tests << test_globs.sort.map { |g| Dir.glob(g) } tests.flatten! - tests.map! {|f| %(require "#{f}")} + tests.map! { |f| %(require "#{f}") } tests.insert 1, test_prelude if test_prelude |