hoe 3.13.0 → 3.13.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/History.rdoc +6 -0
- data/Rakefile +7 -5
- data/bin/sow +18 -18
- data/lib/hoe.rb +54 -54
- data/lib/hoe/clean.rb +3 -3
- data/lib/hoe/debug.rb +12 -12
- data/lib/hoe/deps.rb +17 -17
- data/lib/hoe/flay.rb +4 -6
- data/lib/hoe/flog.rb +4 -6
- data/lib/hoe/gemcutter.rb +1 -1
- data/lib/hoe/inline.rb +26 -26
- data/lib/hoe/newb.rb +1 -1
- data/lib/hoe/package.rb +19 -18
- data/lib/hoe/publish.rb +34 -32
- data/lib/hoe/racc.rb +3 -3
- data/lib/hoe/rake.rb +1 -1
- data/lib/hoe/rcov.rb +20 -21
- data/lib/hoe/signing.rb +11 -11
- data/lib/hoe/test.rb +17 -17
- data/test/test_hoe.rb +80 -81
- data/test/test_hoe_debug.rb +15 -15
- data/test/test_hoe_gemcutter.rb +1 -1
- data/test/test_hoe_publish.rb +7 -7
- data/test/test_hoe_test.rb +2 -2
- metadata +6 -11
- metadata.gz.sig +0 -0
data/lib/hoe/racc.rb
CHANGED
@@ -42,7 +42,7 @@ module Hoe::Racc
|
|
42
42
|
# -l = no-line-convert (they don't ever line up anyhow)
|
43
43
|
self.racc_flags ||= "-v -l"
|
44
44
|
self.oedipus_options ||= {
|
45
|
-
:do_parse => false
|
45
|
+
:do_parse => false,
|
46
46
|
}
|
47
47
|
end
|
48
48
|
|
@@ -50,7 +50,7 @@ module Hoe::Racc
|
|
50
50
|
# Activate the racc dependencies
|
51
51
|
|
52
52
|
def activate_racc_deps
|
53
|
-
dependency
|
53
|
+
dependency "racc", "~> 1.4.6", :development
|
54
54
|
end
|
55
55
|
|
56
56
|
##
|
@@ -75,7 +75,7 @@ module Hoe::Racc
|
|
75
75
|
end
|
76
76
|
|
77
77
|
# HACK: taken from oedipus_lex's .rake file to bypass isolate bootstrap
|
78
|
-
rule ".rex.rb" => proc {|path| path.sub(/\.rb$/, "") } do |t|
|
78
|
+
rule ".rex.rb" => proc { |path| path.sub(/\.rb$/, "") } do |t|
|
79
79
|
require "oedipus_lex"
|
80
80
|
warn "Generating #{t.name} from #{t.source} from #{OedipusLex::VERSION}"
|
81
81
|
oedipus = OedipusLex.new oedipus_options
|
data/lib/hoe/rake.rb
CHANGED
data/lib/hoe/rcov.rb
CHANGED
@@ -18,32 +18,31 @@ module Hoe::RCov
|
|
18
18
|
# Define tasks for plugin.
|
19
19
|
|
20
20
|
def define_rcov_tasks
|
21
|
-
|
22
|
-
task :isolate # ensure it exists
|
21
|
+
task :isolate # ensure it exists
|
23
22
|
|
24
|
-
|
25
|
-
|
26
|
-
|
23
|
+
task :rcov => :isolate do
|
24
|
+
sh(*make_rcov_cmd)
|
25
|
+
end
|
27
26
|
|
28
|
-
|
29
|
-
|
30
|
-
|
27
|
+
task :clobber_rcov do
|
28
|
+
rm_rf "coverage"
|
29
|
+
end
|
31
30
|
|
32
|
-
|
31
|
+
task :clobber => :clobber_rcov
|
33
32
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
end
|
43
|
-
rescue LoadError
|
44
|
-
# skip
|
45
|
-
task :clobber_rcov # in case rcov didn't load
|
33
|
+
# this is for my emacs rcov overlay stuff on emacswiki.
|
34
|
+
task :rcov_overlay do
|
35
|
+
path = ENV["FILE"]
|
36
|
+
rcov, eol = Marshal.load(File.read("coverage.info")).last[path], 1
|
37
|
+
puts rcov[:lines].zip(rcov[:coverage]).map { |line, coverage|
|
38
|
+
bol, eol = eol, eol + line.length
|
39
|
+
[bol, eol, "#ffcccc"] unless coverage
|
40
|
+
}.compact.inspect
|
46
41
|
end
|
42
|
+
rescue LoadError
|
43
|
+
# skip
|
44
|
+
task :clobber_rcov # in case rcov didn't load
|
45
|
+
# TODO: didn't load? this must be terribly historical
|
47
46
|
end
|
48
47
|
|
49
48
|
def make_rcov_cmd # :nodoc:
|
data/lib/hoe/signing.rb
CHANGED
@@ -45,7 +45,7 @@ module Hoe::Signing
|
|
45
45
|
def define_signing_tasks
|
46
46
|
set_up_signing
|
47
47
|
|
48
|
-
desc
|
48
|
+
desc "Generate a key for signing your gems."
|
49
49
|
task :generate_key do
|
50
50
|
generate_key_task
|
51
51
|
end
|
@@ -55,12 +55,12 @@ module Hoe::Signing
|
|
55
55
|
signing_key = nil
|
56
56
|
cert_chain = []
|
57
57
|
|
58
|
-
with_config do |config,
|
59
|
-
break unless config[
|
60
|
-
key_file = File.expand_path config[
|
58
|
+
with_config do |config, _path|
|
59
|
+
break unless config["signing_key_file"] and config["signing_cert_file"]
|
60
|
+
key_file = File.expand_path config["signing_key_file"].to_s
|
61
61
|
signing_key = key_file if File.exist? key_file
|
62
62
|
|
63
|
-
cert_file = File.expand_path config[
|
63
|
+
cert_file = File.expand_path config["signing_cert_file"].to_s
|
64
64
|
cert_chain << cert_file if File.exist? cert_file
|
65
65
|
end
|
66
66
|
|
@@ -74,15 +74,15 @@ module Hoe::Signing
|
|
74
74
|
email = Array(spec.email)
|
75
75
|
abort "No email in your gemspec" if email.nil? or email.empty?
|
76
76
|
|
77
|
-
key_file = with_config { |config, _| config[
|
78
|
-
cert_file = with_config { |config, _| config[
|
77
|
+
key_file = with_config { |config, _| config["signing_key_file"] }
|
78
|
+
cert_file = with_config { |config, _| config["signing_cert_file"] }
|
79
79
|
|
80
80
|
if key_file.nil? or cert_file.nil? then
|
81
|
-
ENV[
|
82
|
-
Rake::Task[
|
81
|
+
ENV["SHOW_EDITOR"] ||= "no"
|
82
|
+
Rake::Task["config_hoe"].invoke
|
83
83
|
|
84
|
-
key_file = with_config { |config, _| config[
|
85
|
-
cert_file = with_config { |config, _| config[
|
84
|
+
key_file = with_config { |config, _| config["signing_key_file"] }
|
85
|
+
cert_file = with_config { |config, _| config["signing_cert_file"] }
|
86
86
|
end
|
87
87
|
|
88
88
|
key_file = File.expand_path key_file
|
data/lib/hoe/test.rb
CHANGED
@@ -30,7 +30,7 @@ module Hoe::Test
|
|
30
30
|
# this is an unfortunate naming collision. I don't use the CPU (N)
|
31
31
|
# specifier so it is shifting to "C" inside of Hoe.
|
32
32
|
ENV.delete "N" if ENV["N"]
|
33
|
-
ENV["N"] = ENV[
|
33
|
+
ENV["N"] = ENV["C"] if ENV["C"]
|
34
34
|
|
35
35
|
##
|
36
36
|
# Optional: Array of incompatible versions for multiruby filtering.
|
@@ -65,7 +65,7 @@ module Hoe::Test
|
|
65
65
|
self.multiruby_skip ||= []
|
66
66
|
self.testlib ||= :minitest
|
67
67
|
self.test_prelude ||= nil
|
68
|
-
self.rspec_dirs ||= %w
|
68
|
+
self.rspec_dirs ||= %w[spec lib]
|
69
69
|
self.rspec_options ||= []
|
70
70
|
end
|
71
71
|
|
@@ -78,31 +78,31 @@ module Hoe::Test
|
|
78
78
|
task :test
|
79
79
|
|
80
80
|
if File.directory? "test" then
|
81
|
-
desc
|
81
|
+
desc "Run the test suite. Use FILTER or TESTOPTS to add flags/args."
|
82
82
|
task :test do
|
83
83
|
ruby make_test_cmd
|
84
84
|
end
|
85
85
|
|
86
|
-
desc
|
86
|
+
desc "Print out the test command. Good for profiling and other tools."
|
87
87
|
task :test_cmd do
|
88
88
|
puts make_test_cmd
|
89
89
|
end
|
90
90
|
|
91
|
-
desc
|
91
|
+
desc "Run the test suite using multiruby."
|
92
92
|
task :multi do
|
93
93
|
ENV["EXCLUDED_VERSIONS"] = multiruby_skip.join(":")
|
94
94
|
system "multiruby -S rake"
|
95
95
|
end
|
96
96
|
|
97
|
-
desc
|
97
|
+
desc "Show which test files fail when run alone."
|
98
98
|
task :test_deps do
|
99
99
|
tests = Dir[*self.test_globs].uniq
|
100
100
|
|
101
|
-
paths = [
|
102
|
-
null_dev = Hoe::WINDOZE ?
|
101
|
+
paths = %w[bin lib test].join(File::PATH_SEPARATOR)
|
102
|
+
null_dev = Hoe::WINDOZE ? "> NUL 2>&1" : "> /dev/null 2>&1"
|
103
103
|
|
104
104
|
tests.each do |test|
|
105
|
-
|
105
|
+
unless system "ruby -I#{paths} #{test} #{null_dev}" then
|
106
106
|
puts "Dependency Issues: #{test}"
|
107
107
|
end
|
108
108
|
end
|
@@ -128,7 +128,7 @@ module Hoe::Test
|
|
128
128
|
end
|
129
129
|
end
|
130
130
|
|
131
|
-
desc
|
131
|
+
desc "Run the default task(s)."
|
132
132
|
task :default => default_tasks
|
133
133
|
|
134
134
|
unless default_tasks.empty? then
|
@@ -154,10 +154,10 @@ module Hoe::Test
|
|
154
154
|
file "#{pkg}.gem" => turd
|
155
155
|
end
|
156
156
|
|
157
|
-
desc
|
157
|
+
desc "Run ZenTest against the package."
|
158
158
|
task :audit do
|
159
|
-
libs = %w
|
160
|
-
sh "zentest -I=#{libs} #{spec.files.grep(/^(lib|test)/).join(
|
159
|
+
libs = %w[lib test ext].join(File::PATH_SEPARATOR)
|
160
|
+
sh "zentest -I=#{libs} #{spec.files.grep(/^(lib|test)/).join(" ")}"
|
161
161
|
end
|
162
162
|
end
|
163
163
|
|
@@ -165,7 +165,7 @@ module Hoe::Test
|
|
165
165
|
# Generate the test command-line.
|
166
166
|
|
167
167
|
def make_test_cmd
|
168
|
-
unless SUPPORTED_TEST_FRAMEWORKS.
|
168
|
+
unless SUPPORTED_TEST_FRAMEWORKS.key?(testlib)
|
169
169
|
raise "unsupported test framework #{testlib}"
|
170
170
|
end
|
171
171
|
|
@@ -175,7 +175,7 @@ module Hoe::Test
|
|
175
175
|
tests << framework if framework
|
176
176
|
tests << test_globs.sort.map { |g| Dir.glob(g) }
|
177
177
|
tests.flatten!
|
178
|
-
tests.map! {|f| %(require "#{f}")}
|
178
|
+
tests.map! { |f| %(require "#{f}") }
|
179
179
|
|
180
180
|
tests.insert 1, test_prelude if test_prelude
|
181
181
|
|
@@ -186,7 +186,7 @@ module Hoe::Test
|
|
186
186
|
# Attempt to load RSpec 2, returning true if successful
|
187
187
|
|
188
188
|
def try_loading_rspec2
|
189
|
-
require
|
189
|
+
require "rspec/core/rake_task"
|
190
190
|
|
191
191
|
desc "Run all specifications"
|
192
192
|
RSpec::Core::RakeTask.new(:spec) do |t|
|
@@ -205,7 +205,7 @@ module Hoe::Test
|
|
205
205
|
# Attempt to load RSpec 1, returning true if successful
|
206
206
|
|
207
207
|
def try_loading_rspec1
|
208
|
-
require
|
208
|
+
require "spec/rake/spectask"
|
209
209
|
|
210
210
|
desc "Run all specifications"
|
211
211
|
Spec::Rake::SpecTask.new(:spec) do |t|
|
data/test/test_hoe.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
1
|
+
require "minitest/autorun"
|
2
|
+
require "hoe"
|
3
|
+
require "tempfile"
|
4
4
|
|
5
5
|
class Hoe
|
6
6
|
def self.files= x
|
@@ -57,24 +57,24 @@ class TestHoe < Minitest::Test
|
|
57
57
|
end
|
58
58
|
|
59
59
|
def test_activate_plugins
|
60
|
-
initializers = hoe.methods.grep(/^initialize/).map
|
60
|
+
initializers = hoe.methods.grep(/^initialize/).map(&:to_s)
|
61
61
|
|
62
|
-
assert_includes initializers,
|
63
|
-
assert_includes initializers,
|
64
|
-
assert_includes initializers,
|
62
|
+
assert_includes initializers, "initialize_package"
|
63
|
+
assert_includes initializers, "initialize_publish"
|
64
|
+
assert_includes initializers, "initialize_test"
|
65
65
|
end
|
66
66
|
|
67
67
|
def test_activate_plugins_hoerc
|
68
|
-
home = ENV[
|
68
|
+
home = ENV["HOME"]
|
69
69
|
load_path = $LOAD_PATH.dup
|
70
70
|
Hoe.files = nil
|
71
71
|
|
72
72
|
Dir.mktmpdir do |path|
|
73
|
-
ENV[
|
73
|
+
ENV["HOME"] = path
|
74
74
|
$LOAD_PATH << path
|
75
75
|
|
76
|
-
Dir.mkdir File.join(path,
|
77
|
-
open File.join(path,
|
76
|
+
Dir.mkdir File.join(path, "hoe")
|
77
|
+
open File.join(path, "hoe", "hoerc.rb"), "w" do |io|
|
78
78
|
io.write <<-EOM
|
79
79
|
module Hoe::Hoerc
|
80
80
|
def initialize_hoerc; end
|
@@ -83,11 +83,11 @@ class TestHoe < Minitest::Test
|
|
83
83
|
EOM
|
84
84
|
end
|
85
85
|
|
86
|
-
write_hoerc path,
|
86
|
+
write_hoerc path, "plugins" => %w[hoerc]
|
87
87
|
|
88
|
-
methods = hoe.methods.grep(/^initialize/).map
|
88
|
+
methods = hoe.methods.grep(/^initialize/).map(&:to_s)
|
89
89
|
|
90
|
-
assert_includes methods,
|
90
|
+
assert_includes methods, "initialize_hoerc"
|
91
91
|
assert_includes Hoe.plugins, :hoerc
|
92
92
|
end
|
93
93
|
ensure
|
@@ -95,21 +95,21 @@ class TestHoe < Minitest::Test
|
|
95
95
|
end
|
96
96
|
|
97
97
|
def test_have_gem_eh
|
98
|
-
assert hoe.have_gem?
|
99
|
-
refute hoe.have_gem?
|
98
|
+
assert hoe.have_gem? "rake"
|
99
|
+
refute hoe.have_gem? "nonexistent"
|
100
100
|
end
|
101
101
|
|
102
102
|
def test_initialize_plugins_hoerc
|
103
|
-
home = ENV[
|
103
|
+
home = ENV["HOME"]
|
104
104
|
load_path = $LOAD_PATH.dup
|
105
105
|
Hoe.files = nil
|
106
106
|
|
107
107
|
Dir.mktmpdir do |path|
|
108
|
-
ENV[
|
108
|
+
ENV["HOME"] = path
|
109
109
|
$LOAD_PATH << path
|
110
110
|
|
111
|
-
Dir.mkdir File.join(path,
|
112
|
-
open File.join(path,
|
111
|
+
Dir.mkdir File.join(path, "hoe")
|
112
|
+
open File.join(path, "hoe", "hoerc.rb"), "w" do |io|
|
113
113
|
io.write <<-EOM
|
114
114
|
module Hoe::Hoerc
|
115
115
|
def initialize_hoerc; @hoerc_plugin_initialized = true; end
|
@@ -118,10 +118,10 @@ class TestHoe < Minitest::Test
|
|
118
118
|
EOM
|
119
119
|
end
|
120
120
|
|
121
|
-
write_hoerc path,
|
121
|
+
write_hoerc path, "plugins" => %w[hoerc]
|
122
122
|
|
123
123
|
methods = hoe.instance_variables.map(&:to_s)
|
124
|
-
assert_includes(methods,
|
124
|
+
assert_includes(methods, "@hoerc_plugin_initialized",
|
125
125
|
"Hoerc plugin wasn't initialized")
|
126
126
|
assert_includes Hoe.plugins, :hoerc
|
127
127
|
end
|
@@ -130,7 +130,7 @@ class TestHoe < Minitest::Test
|
|
130
130
|
end
|
131
131
|
|
132
132
|
def write_hoerc path, data
|
133
|
-
open File.join(path,
|
133
|
+
open File.join(path, ".hoerc"), "w" do |io|
|
134
134
|
io.write YAML.dump data
|
135
135
|
end
|
136
136
|
end
|
@@ -140,23 +140,23 @@ class TestHoe < Minitest::Test
|
|
140
140
|
Hoe.plugins.delete :hoerc
|
141
141
|
Hoe.send :remove_const, :Hoerc
|
142
142
|
$LOAD_PATH.replace load_path
|
143
|
-
ENV[
|
143
|
+
ENV["HOME"] = home
|
144
144
|
end
|
145
145
|
|
146
146
|
def test_initialize_intuit
|
147
147
|
Dir.mktmpdir do |path|
|
148
148
|
Dir.chdir path do
|
149
|
-
open
|
150
|
-
io.puts
|
151
|
-
io.puts
|
152
|
-
io.puts
|
149
|
+
open "Manifest.txt", "w" do |io| # sorted
|
150
|
+
io.puts "FAQ.rdoc"
|
151
|
+
io.puts "History.rdoc"
|
152
|
+
io.puts "README.rdoc"
|
153
153
|
end
|
154
154
|
|
155
|
-
open
|
156
|
-
open
|
155
|
+
open "README.rdoc", "w" do |io| io.puts "= blah" end
|
156
|
+
open "History.rdoc", "w" do |io| io.puts "=== 1.0" end
|
157
157
|
|
158
|
-
assert_equal
|
159
|
-
assert_equal
|
158
|
+
assert_equal "History.rdoc", hoe.history_file
|
159
|
+
assert_equal "README.rdoc", hoe.readme_file
|
160
160
|
assert_equal %w[FAQ.rdoc History.rdoc README.rdoc],
|
161
161
|
hoe.spec.extra_rdoc_files
|
162
162
|
end
|
@@ -166,28 +166,28 @@ class TestHoe < Minitest::Test
|
|
166
166
|
def test_initialize_intuit_ambiguous
|
167
167
|
Dir.mktmpdir do |path|
|
168
168
|
Dir.chdir path do
|
169
|
-
open
|
170
|
-
io.puts
|
171
|
-
io.puts
|
172
|
-
io.puts
|
169
|
+
open "Manifest.txt", "w" do |io|
|
170
|
+
io.puts "History.rdoc" # sorted
|
171
|
+
io.puts "README.ja.rdoc"
|
172
|
+
io.puts "README.rdoc"
|
173
173
|
end
|
174
174
|
|
175
|
-
open
|
176
|
-
open
|
177
|
-
open
|
175
|
+
open "README.rdoc", "w" do |io| io.puts "= blah" end
|
176
|
+
open "README.ja.rdoc", "w" do |io| io.puts "= blah" end
|
177
|
+
open "History.rdoc", "w" do |io| io.puts "=== 1.0" end
|
178
178
|
|
179
|
-
assert_equal
|
179
|
+
assert_equal "README.ja.rdoc", hoe(:skip_files).readme_file
|
180
180
|
end
|
181
181
|
end
|
182
182
|
end
|
183
183
|
|
184
184
|
def test_file_read_utf
|
185
|
-
Tempfile.open
|
185
|
+
Tempfile.open "BOM" do |io|
|
186
186
|
io.write "\xEF\xBB\xBFBOM"
|
187
187
|
io.rewind
|
188
188
|
|
189
189
|
content = File.read_utf io.path
|
190
|
-
assert_equal
|
190
|
+
assert_equal "BOM", content
|
191
191
|
|
192
192
|
if content.respond_to? :encoding then
|
193
193
|
assert_equal Encoding::UTF_8, content.encoding
|
@@ -231,7 +231,7 @@ class TestHoe < Minitest::Test
|
|
231
231
|
t = Gem::Specification::TODAY
|
232
232
|
|
233
233
|
hoe = self.hoe do
|
234
|
-
self.version =
|
234
|
+
self.version = "1.2.3"
|
235
235
|
end
|
236
236
|
|
237
237
|
files = File.read("Manifest.txt").split(/\n/) + [".gemtest"]
|
@@ -251,28 +251,27 @@ class TestHoe < Minitest::Test
|
|
251
251
|
|
252
252
|
text_files = files.grep(/(txt|rdoc)$/).reject { |f| f =~ /template/ }
|
253
253
|
|
254
|
-
assert_equal
|
255
|
-
assert_equal
|
256
|
-
assert_equal
|
254
|
+
assert_equal "blah", spec.name
|
255
|
+
assert_equal "1.2.3", spec.version.to_s
|
256
|
+
assert_equal ">= 0", spec.required_rubygems_version.to_s
|
257
257
|
|
258
|
-
assert_equal [
|
258
|
+
assert_equal ["author"], spec.authors
|
259
259
|
assert_equal t, spec.date
|
260
260
|
assert_match(/Hoe.*Rakefiles/, spec.description)
|
261
|
-
assert_equal [
|
262
|
-
assert_equal [
|
261
|
+
assert_equal ["email"], spec.email
|
262
|
+
assert_equal ["sow"], spec.executables
|
263
263
|
assert_equal text_files, spec.extra_rdoc_files
|
264
264
|
assert_equal files.sort, spec.files.sort
|
265
265
|
assert_equal urls["home"], spec.homepage
|
266
|
-
assert_equal [
|
267
|
-
assert_equal [
|
266
|
+
assert_equal ["--main", "README.rdoc"], spec.rdoc_options
|
267
|
+
assert_equal ["lib"], spec.require_paths
|
268
268
|
assert_equal Gem::RubyGemsVersion, spec.rubygems_version
|
269
269
|
assert_match(/^Hoe.*Rakefiles$/, spec.summary)
|
270
|
-
assert_equal files.grep(/^test/).sort, spec.test_files.sort
|
271
270
|
|
272
|
-
deps = spec.dependencies.sort_by
|
271
|
+
deps = spec.dependencies.sort_by(&:name)
|
273
272
|
|
274
273
|
expected = [
|
275
|
-
["hoe", :development, "~> #{Hoe::VERSION.sub(/\.\d+$/,
|
274
|
+
["hoe", :development, "~> #{Hoe::VERSION.sub(/\.\d+$/, "")}"],
|
276
275
|
["rdoc", :development, "~> 4.0"],
|
277
276
|
]
|
278
277
|
|
@@ -293,28 +292,28 @@ class TestHoe < Minitest::Test
|
|
293
292
|
def test_license
|
294
293
|
spec = self.hoe.spec
|
295
294
|
|
296
|
-
assert_equal %w
|
295
|
+
assert_equal %w[MIT], spec.licenses
|
297
296
|
end
|
298
297
|
|
299
298
|
def test_multiple_calls_to_license
|
300
299
|
hoe = self.hoe :skip_license do
|
301
|
-
license
|
302
|
-
license
|
300
|
+
license "MIT"
|
301
|
+
license "GPL-2"
|
303
302
|
end
|
304
303
|
|
305
304
|
spec = hoe.spec
|
306
305
|
|
307
|
-
assert_equal %w
|
306
|
+
assert_equal %w[MIT GPL-2], spec.licenses
|
308
307
|
end
|
309
308
|
|
310
309
|
def test_setting_licenses
|
311
310
|
hoe = self.hoe :skip_license do
|
312
|
-
self.licenses = [
|
311
|
+
self.licenses = ["MIT", "GPL-2"]
|
313
312
|
end
|
314
313
|
|
315
314
|
spec = hoe.spec
|
316
315
|
|
317
|
-
assert_equal %w
|
316
|
+
assert_equal %w[MIT GPL-2], spec.licenses
|
318
317
|
end
|
319
318
|
|
320
319
|
def test_plugins
|
@@ -328,7 +327,7 @@ class TestHoe < Minitest::Test
|
|
328
327
|
end
|
329
328
|
|
330
329
|
def test_read_manifest
|
331
|
-
expected = File.read_utf(
|
330
|
+
expected = File.read_utf("Manifest.txt").split
|
332
331
|
|
333
332
|
assert_equal expected, hoe.read_manifest
|
334
333
|
end
|
@@ -336,12 +335,12 @@ class TestHoe < Minitest::Test
|
|
336
335
|
def test_rename
|
337
336
|
# project, file_name, klass, test_klass = Hoe.normalize_names 'project_name'
|
338
337
|
|
339
|
-
assert_equal %w
|
340
|
-
assert_equal %w
|
341
|
-
assert_equal %w
|
342
|
-
assert_equal %w
|
343
|
-
assert_equal %w
|
344
|
-
assert_equal %w
|
338
|
+
assert_equal %w[word word Word TestWord], Hoe.normalize_names("word")
|
339
|
+
assert_equal %w[word word Word TestWord], Hoe.normalize_names("Word")
|
340
|
+
assert_equal %w[two_words two_words TwoWords TestTwoWords], Hoe.normalize_names("TwoWords")
|
341
|
+
assert_equal %w[two_words two_words TwoWords TestTwoWords], Hoe.normalize_names("twoWords")
|
342
|
+
assert_equal %w[two-words two/words Two::Words TestTwo::TestWords], Hoe.normalize_names("two-words")
|
343
|
+
assert_equal %w[two_words two_words TwoWords TestTwoWords], Hoe.normalize_names("two_words")
|
345
344
|
end
|
346
345
|
|
347
346
|
def test_nosudo
|
@@ -351,40 +350,40 @@ class TestHoe < Minitest::Test
|
|
351
350
|
end
|
352
351
|
end
|
353
352
|
|
354
|
-
assert_match(/^(sudo )?(j|maglev-)?gem.*/, hoe.install_gem(
|
355
|
-
ENV[
|
356
|
-
assert_match(/^(j|maglev-)?gem.*/, hoe.install_gem(
|
353
|
+
assert_match(/^(sudo )?(j|maglev-)?gem.*/, hoe.install_gem("foo"))
|
354
|
+
ENV["NOSUDO"] = "1"
|
355
|
+
assert_match(/^(j|maglev-)?gem.*/, hoe.install_gem("foo"))
|
357
356
|
ensure
|
358
357
|
ENV.delete "NOSUDO"
|
359
358
|
end
|
360
359
|
|
361
360
|
def test_with_config_default
|
362
|
-
home = ENV[
|
361
|
+
home = ENV["HOME"]
|
363
362
|
Hoe.files = nil
|
364
363
|
|
365
364
|
Dir.mktmpdir do |path|
|
366
|
-
ENV[
|
365
|
+
ENV["HOME"] = path
|
367
366
|
|
368
|
-
hoeconfig = hoe.with_config {|config, _| config }
|
367
|
+
hoeconfig = hoe.with_config { |config, _| config }
|
369
368
|
|
370
369
|
assert_equal Hoe::DEFAULT_CONFIG, hoeconfig
|
371
370
|
end
|
372
371
|
ensure
|
373
|
-
ENV[
|
372
|
+
ENV["HOME"] = home
|
374
373
|
end
|
375
374
|
|
376
375
|
def test_with_config_overrides
|
377
376
|
overrides = {
|
378
|
-
|
379
|
-
|
377
|
+
"exclude" => Regexp.union( Hoe::DEFAULT_CONFIG["exclude"], /\.hg/ ),
|
378
|
+
"plugins" => %w[tweedledee tweedledum],
|
380
379
|
}
|
381
|
-
overrides_rcfile = File.join(Dir.pwd,
|
380
|
+
overrides_rcfile = File.join(Dir.pwd, ".hoerc")
|
382
381
|
|
383
|
-
home = ENV[
|
382
|
+
home = ENV["HOME"]
|
384
383
|
Hoe.files = nil
|
385
384
|
|
386
385
|
Dir.mktmpdir do |path|
|
387
|
-
ENV[
|
386
|
+
ENV["HOME"] = path
|
388
387
|
|
389
388
|
write_hoerc path, Hoe::DEFAULT_CONFIG
|
390
389
|
|
@@ -392,12 +391,12 @@ class TestHoe < Minitest::Test
|
|
392
391
|
io.write YAML.dump( overrides )
|
393
392
|
end
|
394
393
|
|
395
|
-
hoeconfig = hoe.with_config {|config, _| config }
|
394
|
+
hoeconfig = hoe.with_config { |config, _| config }
|
396
395
|
|
397
396
|
assert_equal Hoe::DEFAULT_CONFIG.merge(overrides), hoeconfig
|
398
397
|
end
|
399
398
|
ensure
|
400
399
|
File.delete overrides_rcfile if File.exist?( overrides_rcfile )
|
401
|
-
ENV[
|
400
|
+
ENV["HOME"] = home
|
402
401
|
end
|
403
402
|
end
|