[DRE-commits] [ruby-hoe] 02/06: Imported Upstream version 3.14.2
Lucas Moura
lucasmoura-guest at moszumanska.debian.org
Sat Mar 12 18:18:03 UTC 2016
This is an automated email from the git hooks/post-receive script.
lucasmoura-guest pushed a commit to branch master
in repository ruby-hoe.
commit 022f4211f24e2ee4a725352c4f6b5dd36d7945f7
Author: Lucas Albuquerque Medeiros de Moura <lucas.moura128 at gmail.com>
Date: Sat Mar 12 15:11:54 2016 -0300
Imported Upstream version 3.14.2
---
.gemtest | 0
History.rdoc | 43 +++++++++++
Manifest.txt | 1 +
Rakefile | 12 +--
bin/sow | 49 +++++++-----
checksums.yaml.gz | Bin 266 -> 0 bytes
checksums.yaml.gz.sig | 6 +-
data.tar.gz.sig | Bin 256 -> 256 bytes
lib/hoe.rb | 110 +++++++++++++-------------
lib/hoe/clean.rb | 6 +-
lib/hoe/compiler.rb | 26 +++++--
lib/hoe/debug.rb | 24 +++---
lib/hoe/deps.rb | 34 ++++----
lib/hoe/flay.rb | 10 +--
lib/hoe/flog.rb | 10 +--
lib/hoe/gemcutter.rb | 2 +-
lib/hoe/inline.rb | 52 ++++++-------
lib/hoe/newb.rb | 2 +-
lib/hoe/package.rb | 37 ++++-----
lib/hoe/publish.rb | 66 ++++++++--------
lib/hoe/racc.rb | 8 +-
lib/hoe/rake.rb | 2 +-
lib/hoe/rcov.rb | 41 +++++-----
lib/hoe/signing.rb | 22 +++---
lib/hoe/test.rb | 57 ++++----------
metadata.gz.sig | Bin 256 -> 256 bytes
metadata.yml | 35 ++++-----
test/test_hoe.rb | 189 +++++++++++++++++++++++++--------------------
test/test_hoe_debug.rb | 30 +++----
test/test_hoe_gemcutter.rb | 2 +-
test/test_hoe_package.rb | 58 ++++++++++++++
test/test_hoe_publish.rb | 14 ++--
test/test_hoe_test.rb | 4 +-
33 files changed, 536 insertions(+), 416 deletions(-)
diff --git a/.gemtest b/.gemtest
deleted file mode 100644
index e69de29..0000000
diff --git a/History.rdoc b/History.rdoc
index ef28e3a..819c95f 100644
--- a/History.rdoc
+++ b/History.rdoc
@@ -1,3 +1,46 @@
+=== 3.14.2 / 2015-09-14
+
+* 1 minor enhancement:
+
+ * Updated Hoe.pdf to reflect reality (removed all rubyforge references).
+
+* 1 bug fix:
+
+ * Fixed extension paths. Again. Damnit. I normally don't release after midnight.
+
+=== 3.14.1 / 2015-09-13
+
+* 1 bug fix:
+
+ * *sigh* fixed bug setting up extensions data for spec.
+
+=== 3.14.0 / 2015-09-12
+
+* 5 minor enhancements:
+
+ * Added so_name variable to bin/sow for using hoe w/ c-extensions.
+ * Default config now excludes tmp, .git, and .bundle.
+ * Extended :compiler plugin to define #extension for hoe spec decls.
+ * Failures to detect/load rake-compiler are handled gracefully.
+ * Removed generation of synthesized .gemtest file. Dead.
+
+* 1 bug fix:
+
+ * Fix PRERELEASE= for packaging against newer versions of rubygems. (drbrain)
+
+=== 3.13.1 / 2015-02-03
+
+* 1 bug fix:
+
+ * Remove deprecated test_files from spec. (igas)
+
+=== 3.13.0 / 2014-09-26
+
+* 2 minor enhancements:
+
+ * Added ext_name to sow template expansion variables.
+ * Added oedipus version to generation output
+
=== 3.12.0 / 2014-04-23
* 3 minor enhancements:
diff --git a/Manifest.txt b/Manifest.txt
index 69c5654..e3924ab 100644
--- a/Manifest.txt
+++ b/Manifest.txt
@@ -35,5 +35,6 @@ template/test/test_file_name.rb.erb
test/test_hoe.rb
test/test_hoe_debug.rb
test/test_hoe_gemcutter.rb
+test/test_hoe_package.rb
test/test_hoe_publish.rb
test/test_hoe_test.rb
diff --git a/Rakefile b/Rakefile
index b911bfb..8881f19 100644
--- a/Rakefile
+++ b/Rakefile
@@ -1,12 +1,14 @@
# -*- ruby -*-
-$:.unshift 'lib'
-require './lib/hoe.rb'
+$:.unshift "lib"
+require "./lib/hoe.rb"
Hoe.plugin :seattlerb
Hoe.plugin :isolate
Hoe.plugin :rdoc
+Hoe.add_include_dirs "../../minitest/dev/lib"
+
Hoe.spec "hoe" do
developer "Ryan Davis", "ryand-ruby at zenspider.com"
@@ -17,14 +19,14 @@ Hoe.spec "hoe" do
license "MIT"
pluggable!
- require_rubygems_version '>= 1.4'
+ require_rubygems_version ">= 1.4"
dependency "rake", [">= 0.8", "< 11.0"] # FIX: to force it to exist pre-isolate
end
task :plugins do
puts `find lib/hoe -name \*.rb | xargs grep -h module.Hoe::`.
- gsub(/module/, '*')
+ gsub(/module/, "*")
end
task :known_plugins do
@@ -32,7 +34,7 @@ task :known_plugins do
fetcher = Gem::SpecFetcher.fetcher
spec_tuples = fetcher.find_matching dep
- max = spec_tuples.map { |(tuple, source)| tuple.first.size }.max
+ max = spec_tuples.map { |(tuple, _source)| tuple.first.size }.max
spec_tuples.each do |(tuple, source)|
spec = Gem::SpecFetcher.fetcher.fetch_spec(tuple, URI.parse(source))
diff --git a/bin/sow b/bin/sow
index 1c1fe59..30b03b1 100755
--- a/bin/sow
+++ b/bin/sow
@@ -1,12 +1,12 @@
#!/usr/bin/env ruby -w
-require 'optparse'
-require 'rubygems'
-require 'hoe'
-require 'fileutils'
-require 'erb'
+require "optparse"
+require "rubygems"
+require "hoe"
+require "fileutils"
+require "erb"
-XIF = 'FI' + 'X' # prevents extra hits on my TAG reporter
+XIF = "FI" + "X" # prevents extra hits on my TAG reporter
option = {
:style => "default",
@@ -14,17 +14,17 @@ option = {
}
def check_subdir option
- if option[:subdir] then
- warn "ERROR: you can't specify multiple subdirs"
- abort opts.to_s
- end
+ return unless option[:subdir]
+
+ warn "ERROR: you can't specify multiple subdirs"
+ abort opts.to_s
end
def make_sub_modules klass
last = nil
- result = ''
- klass.split('::')[0..-2].each do |part|
- last = [last, part].compact.join('::')
+ result = ""
+ klass.split("::")[0..-2].each do |part|
+ last = [last, part].compact.join("::")
result << "module #{last}; end\n"
end
result << "\n" unless result.empty?
@@ -87,12 +87,15 @@ end
project = ARGV.shift
abort op.to_s unless project
-abort "Project #{project} seems to exist" if test ?d, project
+abort "Project #{project} seems to exist" if File.directory? project
_, file_name, klass, test_klass = Hoe.normalize_names project
+ext_name = File.basename file_name # minitest/plugin => plugin
+so_name = RbConfig::CONFIG["DLEXT"]
klass = klass # quell unused warnings if they're not used in templates
test_klass = test_klass # ditto
+so_name = so_name # ditto
FileUtils.cp_r template_path, project
@@ -102,6 +105,11 @@ Dir.chdir project do
FileUtils.mv file, file.sub(/file_name$/, file_name)
end
+ dirs = Dir["**/*"].select { |f| File.directory? f }.sort.reverse
+ dirs.grep(/ext_name$/).each do |file|
+ FileUtils.mv file, file.sub(/ext_name$/, ext_name)
+ end
+
paths = (Dir["**/*"] + Dir["**/.*"]).select { |f| File.file? f }.sort
paths.each do |path|
file = File.read path
@@ -109,24 +117,27 @@ Dir.chdir project do
warn "erb: #{path}"
File.open path, "w" do |io|
- erb = ERB.new file, nil, '<>'
+ erb = ERB.new file, nil, "<>"
erb.filename = path
io.puts erb.result(binding)
end
end
- paths.grep(/file_name|\.erb$/).each do |file|
- new_file = file.sub(/(test_)?file_name/, file_name).sub(/\.erb$/, '')
+ paths.grep(/(file|ext)_name|\.erb$/).each do |file|
+ new_file = file.
+ sub(/(test_)?file_name/, file_name).
+ sub(/(test_)?ext_name/, ext_name).
+ sub(/\.erb$/, "")
case file
when /^bin/ then
dir, *rest = new_file.split File::SEPARATOR
- new_file = File.join dir, rest.join('_')
+ new_file = File.join dir, rest.join("_")
when /^test/ then
dir, *rest = new_file.split File::SEPARATOR
- rest.last.sub!(/^/, 'test_')
+ rest.last.sub!(/^/, "test_")
new_file = File.join dir, *rest
end
diff --git a/checksums.yaml.gz b/checksums.yaml.gz
deleted file mode 100644
index 2b4120a..0000000
Binary files a/checksums.yaml.gz and /dev/null differ
diff --git a/checksums.yaml.gz.sig b/checksums.yaml.gz.sig
index f16dc0e..ef840bd 100644
--- a/checksums.yaml.gz.sig
+++ b/checksums.yaml.gz.sig
@@ -1,4 +1,2 @@
-���P��VCIWy1'�JM�I�c
0)(�~�?39����IB:����A�P�
��ߡ���砏[p�f�f��!�
-�'&��<<�z����aZ��S}[�z';
`BJ�A j���"S�\d��11��j��^x��&��l۽j�ȸz�$��[�p�<Y�kd���̼��j_ʒ�Y%�Y���b_8W�fL�vP1�%���Q�l~0
-$�=�Hv�c��}9ͥ��C(��$0�l�<�
�A"�D���2Yn
-O�J^
\ No newline at end of file
+���4��VCÒZ(3����UcX�
���E��3~A�z��u�^�#D�Ha�m
���T.Iwo����-���.�yH��c�+
+2"B1D�.�N8��v'p��괃 ��Fg: ʵ"~���E��l:`����~��vơ���<�T�����6��AK��%�z�_�L�B��3a��l�\h�z���-�Q�X�
���#���Ǟ
�s��n2D=�Z,��nt}f�Y�Yҥ4����>��\��-T�w�L��4fD
\ No newline at end of file
diff --git a/data.tar.gz.sig b/data.tar.gz.sig
index 5e478c7..27be7da 100644
Binary files a/data.tar.gz.sig and b/data.tar.gz.sig differ
diff --git a/lib/hoe.rb b/lib/hoe.rb
index f30da1d..079cff4 100644
--- a/lib/hoe.rb
+++ b/lib/hoe.rb
@@ -1,24 +1,24 @@
# -*- mode: ruby; coding: us-ascii; -*-
-require 'rubygems'
+require "rubygems"
begin
- gem 'rake'
+ gem "rake"
rescue Gem::LoadError
warn "Using the crusty system installed rake... you probably want to upgrade"
end
-require 'rake'
-require 'rake/testtask'
-require 'rbconfig'
+require "rake"
+require "rake/testtask"
+require "rbconfig"
begin
- require 'psych'
+ require "psych"
rescue LoadError
# do nothing
end
-require 'yaml'
+require "yaml"
-require 'hoe/rake'
+require "hoe/rake"
##
# Hoe is a simple rake/rubygems helper for project Rakefiles. It helps
@@ -91,7 +91,7 @@ class Hoe
include Rake::DSL if defined?(Rake::DSL)
# duh
- VERSION = "3.12.0"
+ VERSION = "3.14.2"
@@plugins = [:clean, :debug, :deps, :flay, :flog, :newb, :package,
:publish, :gemcutter, :signing, :test]
@@ -101,28 +101,28 @@ class Hoe
##
# Used to add extra flags to RUBY_FLAGS.
- RUBY_DEBUG = ENV['RUBY_DEBUG']
+ RUBY_DEBUG = ENV["RUBY_DEBUG"]
- default_ruby_flags = "-w -I#{%w(lib bin test .).join(File::PATH_SEPARATOR)}" +
- (RUBY_DEBUG ? " #{RUBY_DEBUG}" : '')
+ default_ruby_flags = "-w -I#{%w[lib bin test .].join(File::PATH_SEPARATOR)}" +
+ (RUBY_DEBUG ? " #{RUBY_DEBUG}" : "")
##
# Used to specify flags to ruby [has smart default].
- RUBY_FLAGS = ENV['RUBY_FLAGS'] || default_ruby_flags
+ RUBY_FLAGS = ENV["RUBY_FLAGS"] || default_ruby_flags
##
# Default configuration values for .hoerc. Plugins should populate
# this on load.
DEFAULT_CONFIG = {
- "exclude" => /tmp$|CVS|\.svn|TAGS|extconf.h|\.o$|\.log$/,
+ "exclude" => /\/tmp\/|CVS|\.svn|\.git|TAGS|extconf.h|\.bundle$|\.o$|\.log$/,
}
##
# True if you're a masochistic developer. Used for building commands.
- WINDOZE = RbConfig::CONFIG['host_os'] =~ /mswin|mingw/
+ WINDOZE = RbConfig::CONFIG["host_os"] =~ /mswin|mingw/
##
# *MANDATORY*: The author(s) of the package. (can be array)
@@ -343,11 +343,11 @@ class Hoe
# Test klass names are same as Klass with Test prepended to each part.
def self.normalize_names project # :nodoc:
- project = project.gsub(/([A-Z])/, '_\1').downcase.sub(/^_/, '')
+ project = project.gsub(/([A-Z])/, '_\1').downcase.sub(/^_/, "")
klass = project.gsub(/(?:^|_)([a-z])/) { $1.upcase }
klass = klass. gsub(/(?:^|-)([a-z])/) { "::#{$1.upcase}" }
test_klass = klass. gsub(/(^|::)([A-Z])/) { "#{$1}Test#{$2}" }
- file_name = project.gsub(/-/, '/')
+ file_name = project.gsub(/-/, "/")
return project, file_name, klass, test_klass
end
@@ -396,14 +396,14 @@ class Hoe
def activate_plugins
with_config do |config, _|
- config_plugins = config['plugins']
+ config_plugins = config["plugins"]
break unless config_plugins
- Hoe.plugins.concat config_plugins.map { |plugin| plugin.intern }
+ Hoe.plugins.concat config_plugins.map(&:intern)
end
Hoe.load_plugins Hoe.plugins
- names = Hoe.constants.map { |s| s.to_s }
+ names = Hoe.constants.map(&:to_s)
names.reject! { |n| n =~ /^[A-Z_]+$/ }
names.each do |name|
@@ -471,7 +471,7 @@ class Hoe
self.extra_dev_deps = normalize_deps extra_dev_deps
case name
- when 'hoe' then
+ when "hoe" then
dependency "rake", [">= 0.8", "< 11.0"]
else
version = VERSION.split(/\./).first(2).join(".")
@@ -499,7 +499,7 @@ class Hoe
# Returns the proper dependency list for the thingy.
def dependency_target
- self.name == 'hoe' ? extra_deps : extra_dev_deps
+ self.name == "hoe" ? extra_deps : extra_dev_deps
end
##
@@ -507,7 +507,7 @@ class Hoe
def define_spec
self.spec = Gem::Specification.new do |s|
- dirs = Dir['lib']
+ dirs = Dir["lib"]
manifest = read_manifest
@@ -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
@@ -535,9 +535,8 @@ class Hoe
s.executables = s.files.grep(/^bin/) { |f| File.basename(f) }
s.bindir = "bin"
s.require_paths = dirs unless dirs.empty?
- s.rdoc_options = ['--main', readme_file]
+ s.rdoc_options = ["--main", readme_file]
s.post_install_message = post_install_message
- s.test_files = Dir[*self.test_globs].uniq
missing "Manifest.txt" if s.files.empty?
@@ -567,24 +566,24 @@ class Hoe
end
def check_for_version # :nodoc:
- unless self.version then
- version = nil
- version_re = /VERSION += +([\"\'])([\d][\w\.]+)\1/
+ return if self.version
- spec.files.each do |file|
- next unless File.exist? file
- version = File.read_utf(file)[version_re, 2] rescue nil
- break if version
- end
+ version = nil
+ version_re = /VERSION += +([\"\'])([\d][\w\.]+)\1/
- spec.version = self.version = version if version
+ spec.files.each do |file|
+ next unless File.exist? file
+ version = File.read_utf(file)[version_re, 2] rescue nil
+ break if version
+ end
- unless self.version then
- spec.version = self.version = "0.borked"
- warn "** Add 'VERSION = \"x.y.z\"' to your code,"
- warn " add a version to your hoe spec,"
- warn " or fix your Manifest.txt"
- end
+ spec.version = self.version = version if version
+
+ unless self.version then
+ spec.version = self.version = "0.borked"
+ warn "** Add 'VERSION = \"x.y.z\"' to your code,"
+ warn " add a version to your hoe spec,"
+ warn " or fix your Manifest.txt"
end
end
@@ -627,7 +626,7 @@ class Hoe
self.author = []
self.changes = nil
self.description = nil
- self.description_sections = %w(description)
+ self.description_sections = %w[description]
self.email = []
self.extra_deps = []
self.extra_dev_deps = []
@@ -639,10 +638,12 @@ class Hoe
self.spec_extras = {}
self.summary = nil
self.summary_sentences = 1
- self.test_globs = ['test/**/{test,spec}_*.rb',
- 'test/**/*_{test,spec}.rb']
+ 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
@@ -658,11 +659,11 @@ class Hoe
def intuit_values
header_re = /^((?:=+|#+) .*)$/
- readme = File.read_utf(readme_file).split(header_re)[1..-1] rescue ''
+ readme = File.read_utf(readme_file).split(header_re)[1..-1] rescue ""
unless readme.empty? then
sections = Hash[*readme.map { |s|
- s =~ /^[=#]/ ? s.strip.downcase.chomp(':').split.last : s.strip
+ s =~ /^[=#]/ ? s.strip.downcase.chomp(":").split.last : s.strip
}]
desc = sections.values_at(*description_sections).join("\n\n")
summ = desc.split(/\.\s+/).first(summary_sentences).join(". ")
@@ -680,7 +681,7 @@ class Hoe
h.split(/^(={2,}|\#{2,})/)[1..2].join.strip
rescue
missing history_file
- ''
+ ""
end
end
@@ -703,8 +704,7 @@ class Hoe
# should update the readme.
def parse_urls text
-
- lines = text.gsub(/^\* /, '').delete("<>").split(/\n/).grep(/\S+/)
+ lines = text.gsub(/^\* /, "").delete("<>").split(/\n/).grep(/\S+/)
if lines.first =~ /::/ then
Hash[lines.map { |line| line.split(/\s*::\s*/) }]
@@ -781,7 +781,7 @@ class Hoe
def pluggable!
abort "update rubygems to >= 1.3.1" unless Gem.respond_to? :find_files
- require_rubygems_version '>= 1.3.1'
+ require_rubygems_version ">= 1.3.1"
end
##
@@ -838,7 +838,7 @@ class Hoe
# 12/31 of the current year.
def timebomb n, m, finis = nil, start = nil
- require 'time'
+ require "time"
finis = Time.parse(finis || "#{Time.now.year}-12-31")
start = Time.parse(start || "#{Time.now.year}-01-01")
rest = (finis - Time.now)
@@ -851,7 +851,7 @@ class Hoe
# Verify that mandatory fields are set.
def validate_fields
- %w(email author).each do |field|
+ %w[email author].each do |field|
value = self.send(field)
abort "Hoe #{field} value not set. aborting" if value.nil? or value.empty?
end
@@ -870,7 +870,7 @@ class Hoe
config = config.merge homeconfig
- localrc = File.join Dir.pwd, '.hoerc'
+ localrc = File.join Dir.pwd, ".hoerc"
exists = File.exist? localrc
localconfig = exists ? YAML.load_file(localrc) : {}
@@ -890,7 +890,7 @@ class File
if r19 then
f.read
else
- f.read.sub %r/\A\xEF\xBB\xBF/, ''
+ f.read.sub %r%\A\xEF\xBB\xBF%, ""
end
end
end
diff --git a/lib/hoe/clean.rb b/lib/hoe/clean.rb
index 1fdeafa..32401db 100644
--- a/lib/hoe/clean.rb
+++ b/lib/hoe/clean.rb
@@ -15,15 +15,15 @@ module Hoe::Clean
# Initialize variables for plugin.
def initialize_clean
- self.clean_globs ||= %w(diff diff.txt TAGS ri deps .source_index
- *.gem **/*~ **/.*~ **/*.rbc coverage*)
+ self.clean_globs ||= %w[diff diff.txt TAGS ri deps .source_index
+ *.gem **/*~ **/.*~ **/*.rbc coverage*]
end
##
# Define tasks for plugin.
def define_clean_tasks
- desc 'Clean up all the extras.'
+ desc "Clean up all the extras."
task :clean => [ :clobber_docs, :clobber_package ] do
clean_globs.each do |pattern|
files = Dir[pattern]
diff --git a/lib/hoe/compiler.rb b/lib/hoe/compiler.rb
index 736dc8e..6df3493 100644
--- a/lib/hoe/compiler.rb
+++ b/lib/hoe/compiler.rb
@@ -24,17 +24,23 @@ module Hoe::Compiler
def initialize_compiler
self.compile_tasks = [:multi, :test, :check_manifest]
- self.spec_extras = { :extensions => ["ext/#{self.name}/extconf.rb"] }
-
- clean_globs << "lib/#{self.name}/*.{so,bundle,dll}"
end
##
# Activate the rake-compiler dependencies.
def activate_compiler_deps
- dependency "rake-compiler", "~> 0.7", :development
- gem "rake-compiler", "~> 0.7"
+ dependency "rake-compiler", "~> 0.9", :development
+
+ gem "rake-compiler", "~> 0.9"
+ rescue LoadError
+ warn "Couldn't load rake-compiler. Skipping. Run `rake newb` to fix."
+ end
+
+ def extension name
+ @extensions ||= []
+ @extensions << name
+ spec_extras[:extensions] = @extensions.map { |n| "ext/#{n}/extconf.rb" }
end
##
@@ -43,12 +49,18 @@ module Hoe::Compiler
def define_compiler_tasks
require "rake/extensiontask"
- Rake::ExtensionTask.new self.name, spec do |ext|
- ext.lib_dir = File.join(*["lib", self.name, ENV["FAT_DIR"]].compact)
+ @extensions.each do |name|
+ clean_globs << "lib/#{name}/*.{so,bundle,dll}"
+
+ Rake::ExtensionTask.new name, spec do |ext|
+ ext.lib_dir = File.join(*["lib", name.to_s, ENV["FAT_DIR"]].compact)
+ end
end
compile_tasks.each do |t|
task t => :compile
end
+ rescue LoadError
+ warn "Couldn't load rake-compiler. Skipping. Run `rake newb` to fix."
end
end
diff --git a/lib/hoe/debug.rb b/lib/hoe/debug.rb
index 93cea64..8bfdcf1 100644
--- a/lib/hoe/debug.rb
+++ b/lib/hoe/debug.rb
@@ -16,12 +16,12 @@ module Hoe::Debug
# :stopdoc:
DIFF = if Hoe::WINDOZE
- 'diff.exe'
+ "diff.exe"
else
if system("gdiff", __FILE__, __FILE__)
- 'gdiff' # solaris and kin suck
+ "gdiff" # solaris and kin suck
else
- 'diff'
+ "diff"
end
end unless defined? DIFF
@@ -31,31 +31,31 @@ module Hoe::Debug
# Define tasks for plugin.
def define_debug_tasks
- desc 'Create a fresh ~/.hoerc file.'
+ desc "Create a fresh ~/.hoerc file."
task :config_hoe do
with_config do |config, path|
File.open(path, "w") do |f|
YAML.dump(Hoe::DEFAULT_CONFIG.merge(config), f)
end
- editor = ENV['EDITOR'] || 'vi'
- system "#{editor} #{path}" if ENV['SHOW_EDITOR'] != 'no'
+ editor = ENV["EDITOR"] || "vi"
+ system "#{editor} #{path}" if ENV["SHOW_EDITOR"] != "no"
end
end
- desc 'Verify the manifest.'
+ desc "Verify the manifest."
task :check_manifest => :clean do
check_manifest
end
- desc 'Show information about the gem.'
+ desc "Show information about the gem."
task :debug_gem do
puts spec.to_ruby
end
task :isolate # stub
task :irb => :isolate do
- name = spec.name.gsub("-", '/')
+ name = spec.name.gsub("-", "/")
file = (spec.files.grep(/^lib\/#{name}\.rb$/).first ||
spec.files.grep(/^lib\/[^\/]*\.rb$/).first)
@@ -71,12 +71,12 @@ module Hoe::Debug
def check_manifest
f = "Manifest.tmp"
- require 'find'
+ require "find"
files = []
with_config do |config, _|
exclusions = config["exclude"]
- Find.find '.' do |path|
+ Find.find "." do |path|
next unless File.file? path
next if path =~ exclusions
files << path[2..-1]
@@ -84,7 +84,7 @@ module Hoe::Debug
files = files.sort.join "\n"
- File.open f, 'w' do |fp| fp.puts files end
+ File.open f, "w" do |fp| fp.puts files end
verbose = { :verbose => Rake.application.options.verbose }
diff --git a/lib/hoe/deps.rb b/lib/hoe/deps.rb
index e3cd55e..f1c4d12 100644
--- a/lib/hoe/deps.rb
+++ b/lib/hoe/deps.rb
@@ -1,5 +1,5 @@
-require 'rubygems/remote_fetcher'
-require 'uri'
+require "rubygems/remote_fetcher"
+require "uri"
##
# Deps plugin for hoe.
@@ -15,7 +15,7 @@ module Hoe::Deps
##
# The main rubygems repository.
- GEMURL = URI.parse 'http://rubygems.org'
+ GEMURL = URI.parse "http://rubygems.org"
##
# Define tasks for plugin.
@@ -38,12 +38,12 @@ module Hoe::Deps
end
end
- desc 'Install missing dependencies.'
+ desc "Install missing dependencies."
task :check_extra_deps do
check_extra_deps_task
end
- desc 'Install missing plugins.'
+ desc "Install missing plugins."
task :install_plugins do
install_missing_plugins
end
@@ -72,8 +72,8 @@ module Hoe::Deps
puts " dependents:"
unless deps.empty? then
- deps.sort_by { |spec| spec.full_name }.each do |spec|
- vers = spec.dependencies.find {|s| s.name == name}.requirements_list
+ deps.sort_by(&:full_name).each do |spec|
+ vers = spec.dependencies.find { |s| s.name == name }.requirements_list
puts " %-*s - %s" % [max, spec.full_name, vers.join(", ")]
end
else
@@ -88,11 +88,11 @@ module Hoe::Deps
abort "Couldn't find gem: #{self.name}" unless gem
deps = self.dependent_upon self.name
- email = deps.map { |s| s.email }.compact.flatten.sort.uniq
+ email = deps.map(&:email).compact.flatten.sort.uniq
email = email.map { |s| s.split(/,\s*/) }.flatten.sort.uniq
email.map! { |s| # don't you people realize how easy this is?
- s.gsub(/ at | _at_ |\s*(atmark|@nospam@|-at?-|@at?@|<at?>|\[at?\]|\(at?\))\s*/i, '@').gsub(/\s*(dot|\[d(ot)?\]|\.dot\.)\s*/i, '.').gsub(/\s+com$/, '.com')
+ s.gsub(/ at | _at_ |\s*(atmark|@nospam@|-at?-|@at?@|<at?>|\[at?\]|\(at?\))\s*/i, "@").gsub(/\s*(dot|\[d(ot)?\]|\.dot\.)\s*/i, ".").gsub(/\s+com$/, ".com")
}
bad, good = email.partition { |e| e !~ /^[\w.+-]+\@[\w.+-]+$/ }
@@ -111,7 +111,7 @@ module Hoe::Deps
mkdir "deps" unless File.directory? "deps"
Dir.chdir "deps" do
begin
- deps.sort_by { |spec| spec.full_name }.each do |spec|
+ deps.sort_by(&:full_name).each do |spec|
full_name = spec.full_name
tgz_name = "#{full_name}.tgz"
gem_name = "#{full_name}.gem"
@@ -122,7 +122,7 @@ module Hoe::Deps
begin
warn "downloading #{full_name}"
Gem::RemoteFetcher.fetcher.download(spec, GEMURL, Dir.pwd)
- FileUtils.mv "cache/#{gem_name}", '.'
+ FileUtils.mv "cache/#{gem_name}", "."
rescue Gem::RemoteFetcher::FetchError
warn " failed"
next
@@ -149,7 +149,7 @@ module Hoe::Deps
return @@index if @@index
- dump = unless File.exist? '.source_index' then
+ dump = unless File.exist? ".source_index" then
warn "Fetching full index and caching. This can take a while."
url = GEMURL + "Marshal.#{Gem.marshal_version}.Z"
dump = Gem::RemoteFetcher.fetcher.fetch_path url
@@ -160,15 +160,15 @@ 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
- open '.source_index', 'wb' do |io| io.write dump end
+ open ".source_index", "wb" do |io| io.write dump end
dump
else
- open '.source_index', 'rb' do |io| io.read end
+ open ".source_index", "rb" do |io| io.read end
end
@@index = Marshal.load dump
@@ -194,10 +194,10 @@ module Hoe::Deps
# Installs plugins that aren't currently installed
def install_missing_plugins plugins = Hoe.bad_plugins
- version = '>= 0'
+ version = ">= 0"
plugins.each do |name|
- dash_name = name.to_s.gsub '_', '-'
+ dash_name = name.to_s.gsub "_", "-"
next if have_gem?("hoe-#{name}") or
have_gem?(name) or
diff --git a/lib/hoe/flay.rb b/lib/hoe/flay.rb
index b6bcd33..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 56589f1..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/gemcutter.rb b/lib/hoe/gemcutter.rb
index ea63bd9..08ccbb8 100644
--- a/lib/hoe/gemcutter.rb
+++ b/lib/hoe/gemcutter.rb
@@ -1,4 +1,4 @@
-require 'rake'
+require "rake"
module Hoe::Gemcutter
include Rake::DSL if defined?(Rake::DSL)
diff --git a/lib/hoe/inline.rb b/lib/hoe/inline.rb
index e957aa9..800f87e 100644
--- a/lib/hoe/inline.rb
+++ b/lib/hoe/inline.rb
@@ -1,4 +1,4 @@
-require 'rbconfig'
+require "rbconfig"
##
# Hoe allows bundling of pre-compiled extensions in the +package+ task.
@@ -35,36 +35,36 @@ module Hoe::Inline
def define_inline_tasks
task :test => :clean
- if ENV['INLINE'] then
- s.platform = ENV['FORCE_PLATFORM'] || Gem::Platform::CURRENT
+ return unless ENV["INLINE"]
- # Try collecting Inline extensions for +name+
- if defined?(Inline) then
- directory 'lib/inline'
+ s.platform = ENV["FORCE_PLATFORM"] || Gem::Platform::CURRENT
- dlext = RbConfig::CONFIG['DLEXT']
+ return unless defined? Inline
- Inline.registered_inline_classes.each do |cls|
- name = cls.name.gsub(/::/, '')
- # name of the extension is CamelCase
- alternate_name = if name =~ /[A-Z]/ then
- name.gsub(/([A-Z])/, '_\1').downcase.sub(/^_/, '')
- elsif name =~ /_/ then
- name.capitalize.gsub(/_([a-z])/) { $1.upcase }
- end
- extensions = Dir.chdir(Inline::directory) {
- Dir["Inline_{#{name},#{alternate_name}}_*.#{dlext}"]
- }
+ # Try collecting Inline extensions for +name+
+ directory "lib/inline"
- extensions.each do |ext|
- # add the inlined extension to the spec files
- s.files += ["lib/inline/#{ext}"]
+ dlext = RbConfig::CONFIG["DLEXT"]
- # include the file in the tasks
- file "lib/inline/#{ext}" => ["lib/inline"] do
- cp File.join(Inline::directory, ext), "lib/inline"
- end
- end
+ Inline.registered_inline_classes.each do |cls|
+ name = cls.name.gsub(/::/, "")
+ # name of the extension is CamelCase
+ alternate_name = if name =~ /[A-Z]/ then
+ name.gsub(/([A-Z])/, '_\1').downcase.sub(/^_/, "")
+ elsif name =~ /_/ then
+ name.capitalize.gsub(/_([a-z])/) { $1.upcase }
+ end
+ extensions = Dir.chdir(Inline.directory) {
+ Dir["Inline_{#{name},#{alternate_name}}_*.#{dlext}"]
+ }
+
+ extensions.each do |ext|
+ # add the inlined extension to the spec files
+ s.files += ["lib/inline/#{ext}"]
+
+ # include the file in the tasks
+ file "lib/inline/#{ext}" => ["lib/inline"] do
+ cp File.join(Inline.directory, ext), "lib/inline"
end
end
end
diff --git a/lib/hoe/newb.rb b/lib/hoe/newb.rb
index e731386..bde8ec3 100644
--- a/lib/hoe/newb.rb
+++ b/lib/hoe/newb.rb
@@ -9,7 +9,7 @@ module Hoe::Newb
# define tasks for the newb plugin
def define_newb_tasks
desc "Install deps, generate docs, run tests/specs."
- task :newb => %w(check_extra_deps install_plugins docs default) do
+ task :newb => %w[check_extra_deps install_plugins docs default] do
puts <<-END
GOOD TO GO! Tests are passing, docs are generated,
diff --git a/lib/hoe/package.rb b/lib/hoe/package.rb
index 0718e8e..95bab62 100644
--- a/lib/hoe/package.rb
+++ b/lib/hoe/package.rb
@@ -1,8 +1,8 @@
begin
- require 'rubygems/package_task'
+ require "rubygems/package_task"
rescue LoadError
# rake/gempackagetask will go away some day
- require 'rake/gempackagetask'
+ require "rake/gempackagetask"
Gem::PackageTask = Rake::GemPackageTask
end
@@ -46,12 +46,12 @@ module Hoe::Package
pkg.need_zip = @need_zip
end
- desc 'Install the package as a gem. (opt. NOSUDO=1)'
+ desc "Install the package as a gem. (opt. NOSUDO=1)"
task :install_gem => [:clean, :package, :check_extra_deps] do
- install_gem Dir['pkg/*.gem'].first
+ install_gem Dir["pkg/*.gem"].first
end
- desc 'Package and upload; Requires VERSION=x.y.z (optional PRE=a.1)'
+ desc "Package and upload; Requires VERSION=x.y.z (optional PRE=a.1)"
task :release => [:prerelease, :release_to, :postrelease]
# no doco, invisible hook
@@ -69,7 +69,7 @@ module Hoe::Package
task :release_sanity do
v = ENV["VERSION"] or abort "Must supply VERSION=x.y.z"
- pre = ENV['PRERELEASE'] || ENV['PRE']
+ pre = ENV["PRERELEASE"] || ENV["PRE"]
v += ".#{pre}" if pre
abort "Versions don't match #{v} vs #{version}" if v != version
@@ -87,13 +87,13 @@ 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'
+ null_dev = Hoe::WINDOZE ? "> NUL 2>&1" : "> /dev/null 2>&1"
- gem_cmd = Gem.default_exec_format % 'gem'
- sudo = 'sudo ' unless should_not_sudo
- local = '--local' unless version
+ gem_cmd = Gem.default_exec_format % "gem"
+ sudo = "sudo " unless should_not_sudo
+ local = "--local" unless version
version = "--version '#{version}'" if version
cmd = "#{sudo}#{gem_cmd} install #{local} #{name} #{version}"
@@ -105,13 +105,14 @@ module Hoe::Package
end
def prerelease_version # :nodoc:
- pre = ENV['PRERELEASE'] || ENV['PRE']
- if pre then
- spec.version.version << "." << pre if pre
+ pre = ENV["PRERELEASE"] || ENV["PRE"]
- abort "ERROR: You should format PRE like pre or alpha.1 or something" if
- (Gem::VERSION < "1.4" and pre !~ /^[a-z]+(\.\d+)?$/) or
- (Gem::VERSION >= "1.4" and pre !~ /^[a-z]+(\.?\d+)?$/)
- end
+ return unless pre
+
+ spec.version = "#{spec.version}.#{pre}"
+
+ abort "ERROR: You should format PRE like pre or alpha.1 or something" if
+ (Gem::VERSION < "1.4" and pre !~ /^[a-z]+(\.\d+)?$/) or
+ (Gem::VERSION >= "1.4" and pre !~ /^[a-z]+(\.?\d+)?$/)
end
end
diff --git a/lib/hoe/publish.rb b/lib/hoe/publish.rb
index 3eebcc7..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",
},
- }
+ },
]
##
@@ -89,11 +89,11 @@ module Hoe::Publish
def initialize_publish
self.blog_categories ||= [self.name]
- self.local_rdoc_dir ||= 'doc'
+ self.local_rdoc_dir ||= "doc"
self.need_rdoc ||= true
self.rdoc_locations ||= []
self.remote_rdoc_dir ||= self.name
- self.rsync_args ||= '-av -O --delete'
+ self.rsync_args ||= "-av -O --delete"
end
##
@@ -117,7 +117,7 @@ module Hoe::Publish
desc "Generate rdoc coverage report"
task :dcov => :isolate do
- sh(*make_rdoc_cmd('-C'))
+ sh(*make_rdoc_cmd("-C"))
end
desc "Remove RDoc files"
@@ -127,9 +127,9 @@ module Hoe::Publish
task :clobber => :clobber_docs
- desc 'Generate ri locally for testing.'
+ desc "Generate ri locally for testing."
task :ridocs => [:clean, :isolate] do
- ruby(*make_rdoc_cmd('--ri', '-o', 'ri'))
+ ruby(*make_rdoc_cmd("--ri", "-o", "ri"))
end
end
@@ -143,7 +143,7 @@ module Hoe::Publish
publish_on_announce_task
end
- desc 'Generate email announcement file.'
+ desc "Generate email announcement file."
task :debug_email do
puts generate_email
end
@@ -153,47 +153,47 @@ module Hoe::Publish
post_blog_task
end
- desc 'Announce your release.'
+ desc "Announce your release."
task :announce => [:post_blog, :publish_on_announce ]
end
def publish_docs_task # :nodoc:
warn "no rdoc_location values" if rdoc_locations.empty?
self.rdoc_locations.each do |dest|
- sh %{rsync #{rsync_args} #{local_rdoc_dir}/ #{dest}}
+ sh %(rsync #{rsync_args} #{local_rdoc_dir}/ #{dest})
end
end
def publish_on_announce_task # :nodoc:
with_config do |config, _|
- Rake::Task['publish_docs'].invoke if config["publish_on_announce"]
+ Rake::Task["publish_docs"].invoke if config["publish_on_announce"]
end
end
def post_blog_task # :nodoc:
- with_config do |config, path|
- break unless config['blogs']
+ with_config do |config, _path|
+ break unless config["blogs"]
- config['blogs'].each do |site|
- if site['path'] then
- msg = "post_blog_#{site['type']}"
+ config["blogs"].each do |site|
+ if site["path"] then
+ msg = "post_blog_#{site["type"]}"
send msg, site
system site["cmd"] if site["cmd"]
else
- require 'xmlrpc/client'
+ require "xmlrpc/client"
_, title, body, urls = announcement
body += "\n\n#{urls}"
- server = XMLRPC::Client.new2(site['url'])
- content = site['extra_headers'].merge(:title => title,
+ server = XMLRPC::Client.new2(site["url"])
+ content = site["extra_headers"].merge(:title => title,
:description => body,
:categories => blog_categories)
- server.call('metaWeblog.newPost',
- site['blog_id'],
- site['user'],
- site['password'],
+ server.call("metaWeblog.newPost",
+ site["blog_id"],
+ site["user"],
+ site["password"],
content,
true)
end
@@ -225,7 +225,7 @@ module Hoe::Publish
Dir.chdir File.expand_path dir do
time = Time.at Time.now.to_i # nukes fractions
path = [time.strftime("%Y-%m-%d-"),
- title.sub(/\W+$/, '').gsub(/\W+/, '-'),
+ title.sub(/\W+$/, "").gsub(/\W+/, "-"),
".html.md"].join
header = {
@@ -235,7 +235,7 @@ module Hoe::Publish
}
File.open path, "w" do |f|
- f.puts header.to_yaml.gsub(/\s$/, '')
+ f.puts header.to_yaml.gsub(/\s$/, "")
f.puts "..."
f.puts
f.puts body
@@ -244,7 +244,7 @@ module Hoe::Publish
end
def generate_email full = nil # :nodoc:
- require 'time'
+ require "time"
abort "No email 'to' entry. Run `rake config_hoe` to fix." unless
!full || email_to
@@ -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
@@ -293,6 +295,6 @@ class String
# Very basic munge from rdoc to markdown format.
def rdoc_to_markdown
- self.gsub(/^mailto:/, '').gsub(/^(=+)/) { "#" * $1.size }
+ self.gsub(/^mailto:/, "").gsub(/^(=+)/) { "#" * $1.size }
end
end
diff --git a/lib/hoe/racc.rb b/lib/hoe/racc.rb
index d079d9a..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
@@ -50,7 +50,7 @@ module Hoe::Racc
# Activate the racc dependencies
def activate_racc_deps
- dependency 'racc', '~> 1.4.6', :development
+ dependency "racc", "~> 1.4.6", :development
end
##
@@ -75,9 +75,9 @@ 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}"
+ warn "Generating #{t.name} from #{t.source} from #{OedipusLex::VERSION}"
oedipus = OedipusLex.new oedipus_options
oedipus.parse_file t.source
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 5e4443f..d4fe9e2 100644
--- a/lib/hoe/signing.rb
+++ b/lib/hoe/signing.rb
@@ -45,7 +45,7 @@ module Hoe::Signing
def define_signing_tasks
set_up_signing
- desc 'Generate a key for signing your gems.'
+ desc "Generate a key for signing your gems."
task :generate_key do
generate_key_task
end
@@ -55,12 +55,12 @@ module Hoe::Signing
signing_key = nil
cert_chain = []
- 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
+ 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
- cert_file = File.expand_path config['signing_cert_file'].to_s
+ cert_file = File.expand_path config["signing_cert_file"].to_s
cert_chain << cert_file if File.exist? cert_file
end
@@ -74,15 +74,15 @@ module Hoe::Signing
email = Array(spec.email)
abort "No email in your gemspec" if email.nil? or email.empty?
- key_file = with_config { |config, _| config['signing_key_file'] }
- cert_file = with_config { |config, _| config['signing_cert_file'] }
+ key_file = with_config { |config, _| config["signing_key_file"] }
+ cert_file = with_config { |config, _| config["signing_cert_file"] }
if key_file.nil? or cert_file.nil? then
- ENV['SHOW_EDITOR'] ||= 'no'
- Rake::Task['config_hoe'].invoke
+ ENV["SHOW_EDITOR"] ||= "no"
+ Rake::Task["config_hoe"].invoke
- key_file = with_config { |config, _| config['signing_key_file'] }
- cert_file = with_config { |config, _| config['signing_cert_file'] }
+ key_file = with_config { |config, _| config["signing_key_file"] }
+ cert_file = with_config { |config, _| config["signing_cert_file"] }
end
key_file = File.expand_path key_file
diff --git a/lib/hoe/test.rb b/lib/hoe/test.rb
index 72d6066..8d97964 100644
--- a/lib/hoe/test.rb
+++ b/lib/hoe/test.rb
@@ -30,7 +30,7 @@ module Hoe::Test
# this is an unfortunate naming collision. I don't use the CPU (N)
# specifier so it is shifting to "C" inside of Hoe.
ENV.delete "N" if ENV["N"]
- ENV["N"] = ENV['C'] if ENV['C']
+ ENV["N"] = ENV["C"] if ENV["C"]
##
# Optional: Array of incompatible versions for multiruby filtering.
@@ -65,7 +65,7 @@ module Hoe::Test
self.multiruby_skip ||= []
self.testlib ||= :minitest
self.test_prelude ||= nil
- self.rspec_dirs ||= %w(spec lib)
+ self.rspec_dirs ||= %w[spec lib]
self.rspec_options ||= []
end
@@ -78,31 +78,31 @@ module Hoe::Test
task :test
if File.directory? "test" then
- desc 'Run the test suite. Use FILTER or TESTOPTS to add flags/args.'
+ desc "Run the test suite. Use FILTER or TESTOPTS to add flags/args."
task :test do
ruby make_test_cmd
end
- desc 'Print out the test command. Good for profiling and other tools.'
+ desc "Print out the test command. Good for profiling and other tools."
task :test_cmd do
puts make_test_cmd
end
- desc 'Run the test suite using multiruby.'
+ desc "Run the test suite using multiruby."
task :multi do
ENV["EXCLUDED_VERSIONS"] = multiruby_skip.join(":")
system "multiruby -S rake"
end
- desc 'Show which test files fail when run alone.'
+ desc "Show which test files fail when run alone."
task :test_deps do
tests = Dir[*self.test_globs].uniq
- paths = ['bin', 'lib', 'test'].join(File::PATH_SEPARATOR)
- null_dev = Hoe::WINDOZE ? '> NUL 2>&1' : '> /dev/null 2>&1'
+ 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
@@ -128,36 +128,13 @@ module Hoe::Test
end
end
- desc 'Run the default task(s).'
+ desc "Run the default task(s)."
task :default => default_tasks
- unless default_tasks.empty? then
- ##
- # This is for Erik Hollensbe's rubygems-test project. Hoe is
- # test-happy, so by using this plugin you're already testable. For
- # more information, see: <https://github.com/erikh/rubygems-test>
- # and/or <http://www.gem-testers.org/>
-
- gemtest = ".gemtest"
-
- gemtest.encode!(Encoding::UTF_8) if gemtest.respond_to?(:encoding)
-
- self.spec.files += [gemtest]
-
- pkg = pkg_path
- turd = "#{pkg}/.gemtest"
-
- file turd => pkg_path do
- touch turd
- end
-
- file "#{pkg}.gem" => turd
- end
-
- desc 'Run ZenTest against the package.'
+ desc "Run ZenTest against the package."
task :audit do
- libs = %w(lib test ext).join(File::PATH_SEPARATOR)
- sh "zentest -I=#{libs} #{spec.files.grep(/^(lib|test)/).join(' ')}"
+ libs = %w[lib test ext].join(File::PATH_SEPARATOR)
+ sh "zentest -I=#{libs} #{spec.files.grep(/^(lib|test)/).join(" ")}"
end
end
@@ -165,7 +142,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 +152,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
@@ -186,7 +163,7 @@ module Hoe::Test
# Attempt to load RSpec 2, returning true if successful
def try_loading_rspec2
- require 'rspec/core/rake_task'
+ require "rspec/core/rake_task"
desc "Run all specifications"
RSpec::Core::RakeTask.new(:spec) do |t|
@@ -205,7 +182,7 @@ module Hoe::Test
# Attempt to load RSpec 1, returning true if successful
def try_loading_rspec1
- require 'spec/rake/spectask'
+ require "spec/rake/spectask"
desc "Run all specifications"
Spec::Rake::SpecTask.new(:spec) do |t|
diff --git a/metadata.gz.sig b/metadata.gz.sig
index 5df2c4b..6c27eac 100644
Binary files a/metadata.gz.sig and b/metadata.gz.sig differ
diff --git a/metadata.yml b/metadata.yml
index 1ccbf21..4c82e7e 100644
--- a/metadata.yml
+++ b/metadata.yml
@@ -1,7 +1,7 @@
--- !ruby/object:Gem::Specification
name: hoe
version: !ruby/object:Gem::Version
- version: 3.12.0
+ version: 3.14.2
platform: ruby
authors:
- Ryan Davis
@@ -10,9 +10,9 @@ bindir: bin
cert_chain:
- |
-----BEGIN CERTIFICATE-----
- MIIDPjCCAiagAwIBAgIBATANBgkqhkiG9w0BAQUFADBFMRMwEQYDVQQDDApyeWFu
+ MIIDPjCCAiagAwIBAgIBAjANBgkqhkiG9w0BAQUFADBFMRMwEQYDVQQDDApyeWFu
ZC1ydWJ5MRkwFwYKCZImiZPyLGQBGRYJemVuc3BpZGVyMRMwEQYKCZImiZPyLGQB
- GRYDY29tMB4XDTEzMDkxNjIzMDQxMloXDTE0MDkxNjIzMDQxMlowRTETMBEGA1UE
+ GRYDY29tMB4XDTE0MDkxNzIzMDcwN1oXDTE1MDkxNzIzMDcwN1owRTETMBEGA1UE
AwwKcnlhbmQtcnVieTEZMBcGCgmSJomT8ixkARkWCXplbnNwaWRlcjETMBEGCgmS
JomT8ixkARkWA2NvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALda
b9DCgK+627gPJkB6XfjZ1itoOQvpqH1EXScSaba9/S2VF22VYQbXU1xQXL/WzCkx
@@ -22,14 +22,14 @@ cert_chain:
qhtV7HJxNKuPj/JFH0D2cswvzznE/a5FOYO68g+YCuFi5L8wZuuM8zzdwjrWHqSV
gBEfoTEGr7Zii72cx+sCAwEAAaM5MDcwCQYDVR0TBAIwADALBgNVHQ8EBAMCBLAw
HQYDVR0OBBYEFEfFe9md/r/tj/Wmwpy+MI8d9k/hMA0GCSqGSIb3DQEBBQUAA4IB
- AQCFZ7JTzoy1gcG4d8A6dmOJy7ygtO5MFpRIz8HuKCF5566nOvpy7aHhDDzFmQuu
- FX3zDU6ghx5cQIueDhf2SGOncyBmmJRRYawm3wI0o1MeN6LZJ/3cRaOTjSFy6+S6
- zqDmHBp8fVA2TGJtO0BLNkbGVrBJjh0UPmSoGzWlRhEVnYC33TpDAbNA+u39UrQI
- ynwhNN7YbnmSR7+JU2cUjBFv2iPBO+TGuWC+9L2zn3NHjuc6tnmSYipA9y8Hv+As
- Y4evBVezr3SjXz08vPqRO5YRdO3zfeMT8gBjRqZjWJGMZ2lD4XNfrs7eky74CyZw
- xx3n58i0lQkBE1EpKE0lFu/y
+ AQAFoDJRokCQdxFfOrmsKX41KOFlU/zjrbDVM9hgB/Ur999M6OXGSi8FitXNtMwY
+ FVjsiAPeU7HaWVVcZkj6IhINelTkXsxgGz/qCzjHy3iUMuZWw36cS0fiWJ5rvH+e
+ hD7uXxJSFuyf1riDGI1aeWbQ74WMwvNstOxLUMiV5a1fzBhlxPqb537ubDjq/M/h
+ zPUFPVYeL5KjDHLCqI2FwIk2sEMOQgjpXHzl+3NlD2LUgUhHDMevmgVua0e2GT1B
+ xJcC6UN6NHMOVMyAXsr2HR0gRRx4ofN1LoP2KhXzSr8UMvQYlwPmE0N5GQv1b5AO
+ VpzF30vNaJK6ZT7xlIsIlwmH
-----END CERTIFICATE-----
-date: 2014-04-23 00:00:00.000000000 Z
+date: 2015-09-14 00:00:00.000000000 Z
dependencies:
- !ruby/object:Gem::Dependency
name: rake
@@ -57,14 +57,14 @@ dependencies:
requirements:
- - ~>
- !ruby/object:Gem::Version
- version: '5.3'
+ version: '5.8'
type: :development
prerelease: false
version_requirements: !ruby/object:Gem::Requirement
requirements:
- - ~>
- !ruby/object:Gem::Version
- version: '5.3'
+ version: '5.8'
- !ruby/object:Gem::Dependency
name: rdoc
requirement: !ruby/object:Gem::Requirement
@@ -101,7 +101,6 @@ extra_rdoc_files:
- README.rdoc
files:
- .autotest
-- .gemtest
- History.rdoc
- Hoe.pdf
- Manifest.txt
@@ -138,6 +137,7 @@ files:
- test/test_hoe.rb
- test/test_hoe_debug.rb
- test/test_hoe_gemcutter.rb
+- test/test_hoe_package.rb
- test/test_hoe_publish.rb
- test/test_hoe_test.rb
homepage: http://www.zenspider.com/projects/hoe.html
@@ -162,13 +162,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
version: '1.4'
requirements: []
rubyforge_project:
-rubygems_version: 2.2.1
+rubygems_version: 2.4.5
signing_key:
specification_version: 4
summary: Hoe is a rake/rubygems helper for project Rakefiles
-test_files:
-- test/test_hoe.rb
-- test/test_hoe_debug.rb
-- test/test_hoe_gemcutter.rb
-- test/test_hoe_publish.rb
-- test/test_hoe_test.rb
+test_files: []
diff --git a/test/test_hoe.rb b/test/test_hoe.rb
index 0ca0d1e..f46b390 100644
--- a/test/test_hoe.rb
+++ b/test/test_hoe.rb
@@ -1,6 +1,6 @@
-require 'minitest/autorun'
-require 'hoe'
-require 'tempfile'
+require "minitest/autorun"
+require "hoe"
+require "tempfile"
class Hoe
def self.files= x
@@ -57,24 +57,24 @@ class TestHoe < Minitest::Test
end
def test_activate_plugins
- initializers = hoe.methods.grep(/^initialize/).map { |s| s.to_s }
+ initializers = hoe.methods.grep(/^initialize/).map(&:to_s)
- assert_includes initializers, 'initialize_package'
- assert_includes initializers, 'initialize_publish'
- assert_includes initializers, 'initialize_test'
+ assert_includes initializers, "initialize_package"
+ assert_includes initializers, "initialize_publish"
+ assert_includes initializers, "initialize_test"
end
def test_activate_plugins_hoerc
- home = ENV['HOME']
+ home = ENV["HOME"]
load_path = $LOAD_PATH.dup
Hoe.files = nil
Dir.mktmpdir do |path|
- ENV['HOME'] = path
+ ENV["HOME"] = path
$LOAD_PATH << path
- Dir.mkdir File.join(path, 'hoe')
- open File.join(path, 'hoe', 'hoerc.rb'), 'w' do |io|
+ Dir.mkdir File.join(path, "hoe")
+ open File.join(path, "hoe", "hoerc.rb"), "w" do |io|
io.write <<-EOM
module Hoe::Hoerc
def initialize_hoerc; end
@@ -83,11 +83,11 @@ class TestHoe < Minitest::Test
EOM
end
- write_hoerc path, 'plugins' => %w[hoerc]
+ write_hoerc path, "plugins" => %w[hoerc]
- methods = hoe.methods.grep(/^initialize/).map { |s| s.to_s }
+ methods = hoe.methods.grep(/^initialize/).map(&:to_s)
- assert_includes methods, 'initialize_hoerc'
+ assert_includes methods, "initialize_hoerc"
assert_includes Hoe.plugins, :hoerc
end
ensure
@@ -95,21 +95,21 @@ class TestHoe < Minitest::Test
end
def test_have_gem_eh
- assert hoe.have_gem? 'rake'
- refute hoe.have_gem? 'nonexistent'
+ assert hoe.have_gem? "rake"
+ refute hoe.have_gem? "nonexistent"
end
def test_initialize_plugins_hoerc
- home = ENV['HOME']
+ home = ENV["HOME"]
load_path = $LOAD_PATH.dup
Hoe.files = nil
Dir.mktmpdir do |path|
- ENV['HOME'] = path
+ ENV["HOME"] = path
$LOAD_PATH << path
- Dir.mkdir File.join(path, 'hoe')
- open File.join(path, 'hoe', 'hoerc.rb'), 'w' do |io|
+ Dir.mkdir File.join(path, "hoe")
+ open File.join(path, "hoe", "hoerc.rb"), "w" do |io|
io.write <<-EOM
module Hoe::Hoerc
def initialize_hoerc; @hoerc_plugin_initialized = true; end
@@ -118,10 +118,10 @@ class TestHoe < Minitest::Test
EOM
end
- write_hoerc path, 'plugins' => %w[hoerc]
+ write_hoerc path, "plugins" => %w[hoerc]
methods = hoe.instance_variables.map(&:to_s)
- assert_includes(methods, '@hoerc_plugin_initialized',
+ assert_includes(methods, "@hoerc_plugin_initialized",
"Hoerc plugin wasn't initialized")
assert_includes Hoe.plugins, :hoerc
end
@@ -130,7 +130,7 @@ class TestHoe < Minitest::Test
end
def write_hoerc path, data
- open File.join(path, '.hoerc'), 'w' do |io|
+ open File.join(path, ".hoerc"), "w" do |io|
io.write YAML.dump data
end
end
@@ -140,23 +140,23 @@ class TestHoe < Minitest::Test
Hoe.plugins.delete :hoerc
Hoe.send :remove_const, :Hoerc
$LOAD_PATH.replace load_path
- ENV['HOME'] = home
+ ENV["HOME"] = home
end
def test_initialize_intuit
Dir.mktmpdir do |path|
Dir.chdir path do
- open 'Manifest.txt', 'w' do |io| # sorted
- io.puts 'FAQ.rdoc'
- io.puts 'History.rdoc'
- io.puts 'README.rdoc'
+ open "Manifest.txt", "w" do |io| # sorted
+ io.puts "FAQ.rdoc"
+ io.puts "History.rdoc"
+ io.puts "README.rdoc"
end
- open 'README.rdoc', 'w' do |io| io.puts '= blah' end
- open 'History.rdoc', 'w' do |io| io.puts '=== 1.0' end
+ open "README.rdoc", "w" do |io| io.puts "= blah" end
+ open "History.rdoc", "w" do |io| io.puts "=== 1.0" end
- assert_equal 'History.rdoc', hoe.history_file
- assert_equal 'README.rdoc', hoe.readme_file
+ assert_equal "History.rdoc", hoe.history_file
+ assert_equal "README.rdoc", hoe.readme_file
assert_equal %w[FAQ.rdoc History.rdoc README.rdoc],
hoe.spec.extra_rdoc_files
end
@@ -166,28 +166,28 @@ class TestHoe < Minitest::Test
def test_initialize_intuit_ambiguous
Dir.mktmpdir do |path|
Dir.chdir path do
- open 'Manifest.txt', 'w' do |io|
- io.puts 'History.rdoc' # sorted
- io.puts 'README.ja.rdoc'
- io.puts 'README.rdoc'
+ open "Manifest.txt", "w" do |io|
+ io.puts "History.rdoc" # sorted
+ io.puts "README.ja.rdoc"
+ io.puts "README.rdoc"
end
- open 'README.rdoc', 'w' do |io| io.puts '= blah' end
- open 'README.ja.rdoc', 'w' do |io| io.puts '= blah' end
- open 'History.rdoc', 'w' do |io| io.puts '=== 1.0' end
+ open "README.rdoc", "w" do |io| io.puts "= blah" end
+ open "README.ja.rdoc", "w" do |io| io.puts "= blah" end
+ open "History.rdoc", "w" do |io| io.puts "=== 1.0" end
- assert_equal 'README.ja.rdoc', hoe(:skip_files).readme_file
+ assert_equal "README.ja.rdoc", hoe(:skip_files).readme_file
end
end
end
def test_file_read_utf
- Tempfile.open 'BOM' do |io|
+ Tempfile.open "BOM" do |io|
io.write "\xEF\xBB\xBFBOM"
io.rewind
content = File.read_utf io.path
- assert_equal 'BOM', content
+ assert_equal "BOM", content
if content.respond_to? :encoding then
assert_equal Encoding::UTF_8, content.encoding
@@ -231,10 +231,10 @@ class TestHoe < Minitest::Test
t = Gem::Specification::TODAY
hoe = self.hoe do
- self.version = '1.2.3'
+ self.version = "1.2.3"
end
- files = File.read("Manifest.txt").split(/\n/) + [".gemtest"]
+ files = File.read("Manifest.txt").split(/\n/)
spec = hoe.spec
@@ -251,28 +251,27 @@ class TestHoe < Minitest::Test
text_files = files.grep(/(txt|rdoc)$/).reject { |f| f =~ /template/ }
- assert_equal 'blah', spec.name
- assert_equal '1.2.3', spec.version.to_s
- assert_equal '>= 0', spec.required_rubygems_version.to_s
+ assert_equal "blah", spec.name
+ assert_equal "1.2.3", spec.version.to_s
+ assert_equal ">= 0", spec.required_rubygems_version.to_s
- assert_equal ['author'], spec.authors
+ assert_equal ["author"], spec.authors
assert_equal t, spec.date
assert_match(/Hoe.*Rakefiles/, spec.description)
- assert_equal ['email'], spec.email
- assert_equal ['sow'], spec.executables
+ assert_equal ["email"], spec.email
+ assert_equal ["sow"], spec.executables
assert_equal text_files, spec.extra_rdoc_files
assert_equal files.sort, spec.files.sort
assert_equal urls["home"], spec.homepage
- assert_equal ['--main', 'README.rdoc'], spec.rdoc_options
- assert_equal ['lib'], spec.require_paths
+ assert_equal ["--main", "README.rdoc"], spec.rdoc_options
+ assert_equal ["lib"], spec.require_paths
assert_equal Gem::RubyGemsVersion, spec.rubygems_version
assert_match(/^Hoe.*Rakefiles$/, spec.summary)
- assert_equal files.grep(/^test/).sort, spec.test_files.sort
- deps = spec.dependencies.sort_by { |dep| dep.name }
+ deps = spec.dependencies.sort_by(&:name)
expected = [
- ["hoe", :development, "~> #{Hoe::VERSION.sub(/\.\d+$/, '')}"],
+ ["hoe", :development, "~> #{Hoe::VERSION.sub(/\.\d+$/, "")}"],
["rdoc", :development, "~> 4.0"],
]
@@ -293,28 +292,28 @@ class TestHoe < Minitest::Test
def test_license
spec = self.hoe.spec
- assert_equal %w(MIT), spec.licenses
+ assert_equal %w[MIT], spec.licenses
end
def test_multiple_calls_to_license
hoe = self.hoe :skip_license do
- license 'MIT'
- license 'GPL-2'
+ license "MIT"
+ license "GPL-2"
end
spec = hoe.spec
- assert_equal %w(MIT GPL-2), spec.licenses
+ assert_equal %w[MIT GPL-2], spec.licenses
end
def test_setting_licenses
hoe = self.hoe :skip_license do
- self.licenses = ['MIT', 'GPL-2']
+ self.licenses = ["MIT", "GPL-2"]
end
spec = hoe.spec
- assert_equal %w(MIT GPL-2), spec.licenses
+ assert_equal %w[MIT GPL-2], spec.licenses
end
def test_plugins
@@ -328,7 +327,7 @@ class TestHoe < Minitest::Test
end
def test_read_manifest
- expected = File.read_utf('Manifest.txt').split
+ expected = File.read_utf("Manifest.txt").split
assert_equal expected, hoe.read_manifest
end
@@ -336,12 +335,12 @@ class TestHoe < Minitest::Test
def test_rename
# project, file_name, klass, test_klass = Hoe.normalize_names 'project_name'
- assert_equal %w( word word Word TestWord), Hoe.normalize_names('word')
- assert_equal %w( word word Word TestWord), Hoe.normalize_names('Word')
- assert_equal %w(two_words two_words TwoWords TestTwoWords), Hoe.normalize_names('TwoWords')
- assert_equal %w(two_words two_words TwoWords TestTwoWords), Hoe.normalize_names('twoWords')
- assert_equal %w(two-words two/words Two::Words TestTwo::TestWords), Hoe.normalize_names('two-words')
- assert_equal %w(two_words two_words TwoWords TestTwoWords), Hoe.normalize_names('two_words')
+ assert_equal %w[word word Word TestWord], Hoe.normalize_names("word")
+ assert_equal %w[word word Word TestWord], Hoe.normalize_names("Word")
+ assert_equal %w[two_words two_words TwoWords TestTwoWords], Hoe.normalize_names("TwoWords")
+ assert_equal %w[two_words two_words TwoWords TestTwoWords], Hoe.normalize_names("twoWords")
+ assert_equal %w[two-words two/words Two::Words TestTwo::TestWords], Hoe.normalize_names("two-words")
+ assert_equal %w[two_words two_words TwoWords TestTwoWords], Hoe.normalize_names("two_words")
end
def test_nosudo
@@ -351,40 +350,66 @@ class TestHoe < Minitest::Test
end
end
- assert_match(/^(sudo )?(j|maglev-)?gem.*/, hoe.install_gem('foo'))
- ENV['NOSUDO'] = '1'
- assert_match(/^(j|maglev-)?gem.*/, hoe.install_gem('foo'))
+ assert_match(/^(sudo )?(j|maglev-)?gem.*/, hoe.install_gem("foo"))
+ ENV["NOSUDO"] = "1"
+ assert_match(/^(j|maglev-)?gem.*/, hoe.install_gem("foo"))
ensure
ENV.delete "NOSUDO"
end
+ def test_extensions
+ Hoe.plugin :compiler
+ Hoe.load_plugins
+
+ hoe = nil
+
+ capture_io do
+ hoe = self.hoe do
+ extension "a"
+ end
+ end
+
+ assert_equal %w[ext/a/extconf.rb], hoe.spec.extensions
+
+ @hoe = nil # clear cache
+
+ capture_io do
+ hoe = self.hoe do
+ extension "a"
+ extension "b"
+ end
+ end
+
+ assert_equal %w[ext/a/extconf.rb ext/b/extconf.rb], hoe.spec.extensions
+ end
+
def test_with_config_default
- home = ENV['HOME']
+ home = ENV["HOME"]
Hoe.files = nil
Dir.mktmpdir do |path|
- ENV['HOME'] = path
+ ENV["HOME"] = path
- hoeconfig = hoe.with_config {|config, _| config }
+ hoeconfig = hoe.with_config { |config, _| config }
assert_equal Hoe::DEFAULT_CONFIG, hoeconfig
end
ensure
- ENV['HOME'] = home
+ ENV["HOME"] = home
end
def test_with_config_overrides
overrides = {
- 'exclude' => Regexp.union( Hoe::DEFAULT_CONFIG["exclude"], /\.hg/ ),
- 'plugins' => ['tweedledee', 'tweedledum']
+ "exclude" => Regexp.union( Hoe::DEFAULT_CONFIG["exclude"], /\.hg/ ),
+ "plugins" => %w[tweedledee tweedledum],
}
- overrides_rcfile = File.join(Dir.pwd, '.hoerc')
+ overrides_rcfile = File.join(Dir.pwd, ".hoerc")
- home = ENV['HOME']
+ home = ENV["HOME"]
Hoe.files = nil
Dir.mktmpdir do |path|
- ENV['HOME'] = path
+ ENV["HOME"] = path
write_hoerc path, Hoe::DEFAULT_CONFIG
@@ -392,12 +417,12 @@ class TestHoe < Minitest::Test
io.write YAML.dump( overrides )
end
- hoeconfig = hoe.with_config {|config, _| config }
+ hoeconfig = hoe.with_config { |config, _| config }
assert_equal Hoe::DEFAULT_CONFIG.merge(overrides), hoeconfig
end
ensure
File.delete overrides_rcfile if File.exist?( overrides_rcfile )
- ENV['HOME'] = home
+ ENV["HOME"] = home
end
end
diff --git a/test/test_hoe_debug.rb b/test/test_hoe_debug.rb
index 77ca413..e8c7f8d 100644
--- a/test/test_hoe_debug.rb
+++ b/test/test_hoe_debug.rb
@@ -1,8 +1,8 @@
-require 'hoe'
-require File.expand_path 'lib/hoe/debug.rb' # ugh. avoid dupe warnings
-require 'tmpdir'
-require 'tempfile'
-require 'minitest/autorun'
+require "hoe"
+require File.expand_path "lib/hoe/debug.rb" # ugh. avoid dupe warnings
+require "tmpdir"
+require "tempfile"
+require "minitest/autorun"
class TestHoeDebug < Minitest::Test
@@ -40,9 +40,9 @@ class TestHoeDebug < Minitest::Test
def test_check_manifest_generated
in_tmpdir do
- manifest 'generated.rb'
+ manifest "generated.rb"
- open 'generated.rb', 'w' do |io| io.puts 'generated = true' end
+ open "generated.rb", "w" do |io| io.puts "generated = true" end
assert_subprocess_silent do
check_manifest
@@ -56,7 +56,7 @@ class TestHoeDebug < Minitest::Test
in_tmpdir do
manifest
- open 'missing.rb', 'w' do |io| io.puts 'missing = true' end
+ open "missing.rb", "w" do |io| io.puts "missing = true" end
e = nil
@@ -86,18 +86,18 @@ class TestHoeDebug < Minitest::Test
end
def manifest extra = nil
- open 'Manifest.txt', 'w' do |io| # sorted
- io.puts 'History.txt'
- io.puts 'Manifest.txt'
- io.puts 'README.txt'
+ open "Manifest.txt", "w" do |io| # sorted
+ io.puts "History.txt"
+ io.puts "Manifest.txt"
+ io.puts "README.txt"
io.puts extra if extra
end
- open 'README.txt', 'w' do |io| io.puts '= blah' end
- open 'History.txt', 'w' do |io| io.puts '=== 1.0' end
+ open "README.txt", "w" do |io| io.puts "= blah" end
+ open "History.txt", "w" do |io| io.puts "=== 1.0" end
end
def with_config
- yield({ 'exclude' => [] }, '~/.hoerc')
+ yield({ "exclude" => [] }, "~/.hoerc")
end
end
diff --git a/test/test_hoe_gemcutter.rb b/test/test_hoe_gemcutter.rb
index 5e70024..82d2b7c 100644
--- a/test/test_hoe_gemcutter.rb
+++ b/test/test_hoe_gemcutter.rb
@@ -8,7 +8,7 @@ class TestHoeGemcutter < Minitest::Test
def test_gemcutter_tasks_defined
define_gemcutter_tasks
assert Rake::Task[:release_to_gemcutter]
- assert Rake::Task[:release_to].prerequisites.include?('release_to_gemcutter')
+ assert Rake::Task[:release_to].prerequisites.include?("release_to_gemcutter")
end
# TODO add tests for push once using Gem::Commands::Push (waiting on rubygems release)
diff --git a/test/test_hoe_package.rb b/test/test_hoe_package.rb
new file mode 100644
index 0000000..1d312e6
--- /dev/null
+++ b/test/test_hoe_package.rb
@@ -0,0 +1,58 @@
+Hoe.load_plugins
+
+class TestHoePackage < Minitest::Test
+ def setup
+ @orig_PRE = ENV['PRE']
+ @orig_PRERELEASE = ENV['PRERELEASE']
+
+ ENV.delete 'PRE'
+ ENV.delete 'PRERELEASE'
+
+ @tester = Module.new do
+ include Hoe::Package
+
+ extend self
+
+ initialize_package
+
+ @spec = Gem::Specification.new do |s|
+ s.version = '1.2.3'
+ end
+
+ attr_reader :spec
+ end
+ end
+
+ def teardown
+ ENV['PRE'] = @orig_PRE
+ ENV['PRERELEASE'] = @orig_PRERELEASE
+ end
+
+ def test_prerelease_version_pre
+ ENV['PRE'] = 'pre.0'
+
+ @tester.prerelease_version
+
+ expected = Gem::Version.new '1.2.3.pre.0'
+
+ assert_equal expected, @tester.spec.version
+ end
+
+ def test_prerelease_version_prerelease
+ ENV['PRERELEASE'] = 'prerelease.0'
+
+ @tester.prerelease_version
+
+ expected = Gem::Version.new '1.2.3.prerelease.0'
+
+ assert_equal expected, @tester.spec.version
+ end
+
+ def test_prerelease_version_regular
+ @tester.prerelease_version
+
+ expected = Gem::Version.new '1.2.3'
+
+ assert_equal expected, @tester.spec.version
+ end
+end
diff --git a/test/test_hoe_publish.rb b/test/test_hoe_publish.rb
index 1d243aa..8dd0137 100644
--- a/test/test_hoe_publish.rb
+++ b/test/test_hoe_publish.rb
@@ -1,14 +1,14 @@
-require 'rubygems'
-require 'minitest/autorun'
-require 'hoe'
+require "rubygems"
+require "minitest/autorun"
+require "hoe"
class TestHoePublish < Minitest::Test
def setup
- @hoe = Hoe.spec 'blah' do
- self.version = '1.0'
+ @hoe = Hoe.spec "blah" do
+ self.version = "1.0"
- developer 'author', ''
- license 'MIT'
+ developer "author", ""
+ license "MIT"
end
end
diff --git a/test/test_hoe_test.rb b/test/test_hoe_test.rb
index 6450d5c..a0bce31 100644
--- a/test/test_hoe_test.rb
+++ b/test/test_hoe_test.rb
@@ -13,13 +13,13 @@ class TestHoeTest < Minitest::Test
initialize_test
def test_globs
- ['test/test_hoe_test.rb']
+ ["test/test_hoe_test.rb"]
end
end
end
def test_make_test_cmd_with_different_testlibs
- skip "Using TESTOPTS... skipping" if ENV['TESTOPTS']
+ skip "Using TESTOPTS... skipping" if ENV["TESTOPTS"]
expected = ['-w -Ilib:bin:test:. -e \'require "rubygems"; %s',
'require "test/test_hoe_test.rb"',
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/ruby-hoe.git
More information about the Pkg-ruby-extras-commits
mailing list