hoe 1.7.0 → 1.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (6) hide show
  1. data/History.txt +11 -0
  2. data/README.txt +25 -21
  3. data/bin/sow +1 -4
  4. data/lib/hoe.rb +179 -25
  5. data/test/test_hoe.rb +3 -0
  6. metadata +5 -5
@@ -1,3 +1,14 @@
1
+ === 1.8.0 / 2008-10-09
2
+
3
+ * 5 minor enhancements:
4
+
5
+ * Added Hoe.add_include_dirs to make setting up rake deps easier.
6
+ * Removed unused optional group arg in sow.
7
+ * Added testlib variable so you can specify what test library to use.
8
+ * Added deps:list to help you review dependent projects.
9
+ * Added deps:email to help you communicate with dependent projects.
10
+ * Added deps:fetch to help you search through dependent projects.
11
+
1
12
  === 1.7.0 / 2008-06-30
2
13
 
3
14
  * 3 minor enhancements:
data/README.txt CHANGED
@@ -12,27 +12,31 @@ testing, packaging, and deployment.
12
12
 
13
13
  Tasks Provided:
14
14
 
15
- * announce - Create news email file and post to rubyforge.
16
- * audit - Run ZenTest against the package.
17
- * check_manifest - Verify the manifest.
18
- * clean - Clean up all the extras.
19
- * config_hoe - Create a fresh ~/.hoerc file.
20
- * debug_gem - Show information about the gem.
21
- * default - Run the default tasks.
22
- * docs - Build the docs HTML Files
23
- * email - Generate email announcement file.
24
- * gem - Build the gem file hoe-1.5.0.gem
25
- * generate_key - Generate a key for signing your gems.
26
- * install_gem - Install the package as a gem.
27
- * multi - Run the test suite using multiruby.
28
- * package - Build all the packages
29
- * post_blog - Post announcement to blog.
30
- * post_news - Post announcement to rubyforge.
31
- * publish_docs - Publish RDoc to RubyForge.
32
- * release - Package and upload the release to rubyforge.
33
- * ridocs - Generate ri locally for testing.
34
- * test - Run the test suite.
35
- * test_deps - Show which test files fail when run alone.
15
+ * announce - Create news email file and post to rubyforge.
16
+ * audit - Run ZenTest against the package.
17
+ * check_manifest - Verify the manifest.
18
+ * clean - Clean up all the extras.
19
+ * config_hoe - Create a fresh ~/.hoerc file.
20
+ * debug_gem - Show information about the gem.
21
+ * default - Run the default tasks.
22
+ * deps:email - Print a contact list for gems dependent on this gem
23
+ * deps:fetch - Fetch all the dependent gems of this gem into tarballs
24
+ * deps:list - List all the dependent gems of this gem
25
+ * docs - Build the docs HTML Files
26
+ * email - Generate email announcement file.
27
+ * gem - Build the gem file hoe-1.8.0.gem
28
+ * generate_key - Generate a key for signing your gems.
29
+ * install_gem - Install the package as a gem.
30
+ * multi - Run the test suite using multiruby.
31
+ * package - Build all the packages
32
+ * post_blog - Post announcement to blog.
33
+ * post_news - Post announcement to rubyforge.
34
+ * publish_docs - Publish RDoc to RubyForge.
35
+ * release - Package and upload the release to rubyforge.
36
+ * ridocs - Generate ri locally for testing.
37
+ * tasks - Generate a list of tasks for doco.
38
+ * test - Run the test suite.
39
+ * test_deps - Show which test files fail when run alone.
36
40
 
37
41
  See class rdoc for help. Hint: ri Hoe
38
42
 
data/bin/sow CHANGED
@@ -4,18 +4,15 @@ $t ||= false
4
4
  $d ||= false
5
5
 
6
6
  if defined? $h then
7
- puts "usage: #{File.dirname($0)} [-d|-t] [group] project"
7
+ puts "usage: #{File.dirname($0)} [-d|-t] project"
8
8
  puts " -t = add project to subdir under 'trunk'"
9
9
  puts " -d = add project to subdir under 'dev'"
10
10
  end
11
11
 
12
12
  abort "You must specify only one of -t or -d" if $t and $d
13
13
 
14
- group = ARGV.shift
15
14
  project = ARGV.shift
16
15
 
17
- project ||= group
18
-
19
16
  # prevents false positives on my tag reporter
20
17
  X = 'FI' + 'X'
21
18
 
data/lib/hoe.rb CHANGED
@@ -38,27 +38,31 @@ end
38
38
  #
39
39
  # === Tasks Provided:
40
40
  #
41
- # announce:: Create news email file and post to rubyforge.
42
- # audit:: Run ZenTest against the package.
43
- # check_manifest:: Verify the manifest.
44
- # clean:: Clean up all the extras.
45
- # config_hoe:: Create a fresh ~/.hoerc file.
46
- # debug_gem:: Show information about the gem.
47
- # default:: Run the default tasks.
48
- # docs:: Build the docs HTML Files
49
- # email:: Generate email announcement file.
50
- # gem:: Build the gem file hoe-1.5.0.gem
51
- # generate_key:: Generate a key for signing your gems.
52
- # install_gem:: Install the package as a gem.
53
- # multi:: Run the test suite using multiruby.
54
- # package:: Build all the packages
55
- # post_blog:: Post announcement to blog.
56
- # post_news:: Post announcement to rubyforge.
57
- # publish_docs:: Publish RDoc to RubyForge.
58
- # release:: Package and upload the release to rubyforge.
59
- # ridocs:: Generate ri locally for testing.
60
- # test:: Run the test suite.
61
- # test_deps:: Show which test files fail when run alone.
41
+ # announce:: Create news email file and post to rubyforge.
42
+ # audit:: Run ZenTest against the package.
43
+ # check_manifest:: Verify the manifest.
44
+ # clean:: Clean up all the extras.
45
+ # config_hoe:: Create a fresh ~/.hoerc file.
46
+ # debug_gem:: Show information about the gem.
47
+ # default:: Run the default tasks.
48
+ # deps:email:: Print a contact list for gems dependent on this gem
49
+ # deps:fetch:: Fetch all the dependent gems of this gem into tarballs
50
+ # deps:list:: List all the dependent gems of this gem
51
+ # docs:: Build the docs HTML Files
52
+ # email:: Generate email announcement file.
53
+ # gem:: Build the gem file hoe-1.8.0.gem
54
+ # generate_key:: Generate a key for signing your gems.
55
+ # install_gem:: Install the package as a gem.
56
+ # multi:: Run the test suite using multiruby.
57
+ # package:: Build all the packages
58
+ # post_blog:: Post announcement to blog.
59
+ # post_news:: Post announcement to rubyforge.
60
+ # publish_docs:: Publish RDoc to RubyForge.
61
+ # release:: Package and upload the release to rubyforge.
62
+ # ridocs:: Generate ri locally for testing.
63
+ # tasks:: Generate a list of tasks for doco.
64
+ # test:: Run the test suite.
65
+ # test_deps:: Show which test files fail when run alone.
62
66
  #
63
67
  # === Extra Configuration Options:
64
68
  #
@@ -120,7 +124,8 @@ end
120
124
  #
121
125
 
122
126
  class Hoe
123
- VERSION = '1.7.0'
127
+ VERSION = '1.8.0'
128
+ GEMURL = URI.parse 'http://gems.rubyforge.org' # for namespace :deps below
124
129
 
125
130
  ruby_prefix = Config::CONFIG['prefix']
126
131
  sitelibdir = Config::CONFIG['sitelibdir']
@@ -303,6 +308,11 @@ class Hoe
303
308
 
304
309
  attr_accessor :test_globs
305
310
 
311
+ ##
312
+ # Optional: What test library to require [default: test/unit]
313
+
314
+ attr_accessor :testlib
315
+
306
316
  ##
307
317
  # Optional: The url(s) of the project. (can be array). Auto-populates.
308
318
 
@@ -313,6 +323,15 @@ class Hoe
313
323
 
314
324
  attr_accessor :version
315
325
 
326
+ ##
327
+ # Add extra dirs to both $: and RUBY_FLAGS (for test runs)
328
+
329
+ def self.add_include_dirs(*dirs)
330
+ dirs = dirs.flatten
331
+ $:.unshift(*dirs)
332
+ Hoe::RUBY_FLAGS.sub!(/-I/, "-I#{dirs.join(":")}:")
333
+ end
334
+
316
335
  def normalize_deps deps
317
336
  Array(deps).map { |o| String === o ? [o] : o }
318
337
  end
@@ -328,7 +347,7 @@ class Hoe
328
347
 
329
348
  # Defaults
330
349
  self.author = []
331
- self.clean_globs = %w(diff diff.txt email.txt ri
350
+ self.clean_globs = %w(diff diff.txt email.txt ri deps .source_index
332
351
  *.gem *~ **/*~ *.rbc **/*.rbc)
333
352
  self.description_sections = %w(description)
334
353
  self.blog_categories = [name]
@@ -345,6 +364,7 @@ class Hoe
345
364
  self.spec_extras = {}
346
365
  self.summary_sentences = 1
347
366
  self.test_globs = ['test/**/test_*.rb']
367
+ self.testlib = 'test/unit'
348
368
  self.post_install_message = nil
349
369
 
350
370
  yield self if block_given?
@@ -635,6 +655,133 @@ class Hoe
635
655
  end
636
656
  end
637
657
 
658
+ ############################################################
659
+ # Dependencies:
660
+
661
+ namespace :deps do
662
+ require 'zlib' # HACK for rubygems 1.3.0
663
+ require 'rubygems/remote_fetcher'
664
+
665
+ @@index = nil
666
+
667
+ def self.get_source_index
668
+ return @@index if @@index
669
+
670
+ dump = unless File.exist? '.source_index' then
671
+ url = GEMURL + "Marshal.#{Gem.marshal_version}.Z"
672
+ dump = Gem::RemoteFetcher.fetcher.fetch_path url
673
+ dump = Gem.inflate dump
674
+ open '.source_index', 'wb' do |io| io.write dump end
675
+ dump
676
+ else
677
+ open '.source_index', 'rb' do |io| io.read end
678
+ end
679
+
680
+ @@index = Marshal.load dump
681
+ end
682
+
683
+ def self.get_latest_gems
684
+ @@cache ||= get_source_index.latest_specs
685
+ end
686
+
687
+ def self.get_gems_by_name
688
+ @@by_name ||= Hash[*get_latest_gems.map { |gem|
689
+ [gem.name, gem, gem.full_name, gem]
690
+ }.flatten]
691
+ end
692
+
693
+ def self.dependent_upon name
694
+ get_latest_gems.find_all { |gem|
695
+ gem.dependencies.any? { |dep| dep.name == name }
696
+ }
697
+ end
698
+
699
+
700
+ desc "List all the dependent gems of this gem"
701
+ task :list do
702
+ gems = self.get_gems_by_name
703
+ gem = gems[self.name]
704
+
705
+ abort "Couldn't find gem: #{self.name}" unless gem
706
+
707
+ deps = self.dependent_upon self.name
708
+ max = deps.map { |s| s.full_name.size }.max
709
+
710
+ puts " dependents:"
711
+ unless deps.empty? then
712
+ deps.sort_by { |spec| spec.full_name }.each do |spec|
713
+ vers = spec.dependencies.find {|s| s.name == name }.requirement_list
714
+ puts " %-*s - %s" % [max, spec.full_name, vers.join(", ")]
715
+ end
716
+ else
717
+ puts " none"
718
+ end
719
+ end
720
+
721
+ desc "Print a contact list for gems dependent on this gem"
722
+ task :email do
723
+ gems = self.get_gems_by_name
724
+ gem = gems[self.name]
725
+
726
+ abort "Couldn't find gem: #{self.name}" unless gem
727
+
728
+ deps = self.dependent_upon self.name
729
+
730
+ email = deps.map { |s| s.email }.flatten.sort.uniq
731
+ email = email.map { |s| s.split(/,\s*/) }.flatten.sort.uniq
732
+
733
+ email.map! { |s| # don't you people realize how easy this is?
734
+ 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')
735
+ }
736
+
737
+ bad, good = email.partition { |e| e !~ /^[\w.+-]+\@[\w.+-]+$/ }
738
+
739
+ warn "Rejecting #{bad.size} email. I couldn't unmunge them." unless
740
+ bad.empty?
741
+
742
+ puts good.join(", ")
743
+ end
744
+
745
+ desc "Fetch all the dependent gems of this gem into tarballs"
746
+ task :fetch do
747
+ gems = self.get_gems_by_name
748
+ gem = gems[self.name]
749
+ deps = self.dependent_upon self.name
750
+
751
+ mkdir "deps" unless File.directory? "deps"
752
+ Dir.chdir "deps" do
753
+ begin
754
+ deps.sort_by { |spec| spec.full_name }.each do |spec|
755
+ full_name = spec.full_name
756
+ tgz_name = "#{full_name}.tgz"
757
+ gem_name = "#{full_name}.gem"
758
+
759
+ next if File.exist? tgz_name
760
+ FileUtils.rm_rf [full_name, gem_name]
761
+
762
+ begin
763
+ warn "downloading #{full_name}"
764
+ Gem::RemoteFetcher.fetcher.download(spec, GEMURL, Dir.pwd)
765
+ FileUtils.mv "cache/#{gem_name}", '.'
766
+ rescue Gem::RemoteFetcher::FetchError
767
+ warn " failed"
768
+ next
769
+ end
770
+
771
+ warn "converting #{gem_name} to tarball"
772
+
773
+ system "gem unpack #{gem_name} 2> /dev/null"
774
+ system "gem spec -l #{gem_name} > #{full_name}/gemspec.rb"
775
+ system "tar zmcf #{tgz_name} #{full_name}"
776
+ FileUtils.rm_rf [full_name, gem_name, "cache"]
777
+ end
778
+ ensure
779
+ FileUtils.rm_rf "cache"
780
+ end
781
+ end
782
+ end
783
+ end
784
+
638
785
  ############################################################
639
786
  # Misc/Maintenance:
640
787
 
@@ -825,7 +972,8 @@ class Hoe
825
972
  cmd = if test ?f, 'test/test_all.rb' then
826
973
  "#{RUBY_FLAGS} test/test_all.rb #{FILTER}"
827
974
  else
828
- tests = ['test/unit'] + test_globs.map { |g| Dir.glob(g) }.flatten
975
+ tests = ["rubygems", self.testlib] +
976
+ test_globs.map { |g| Dir.glob(g) }.flatten
829
977
  tests.map! {|f| %Q(require "#{f}")}
830
978
  "#{RUBY_FLAGS} -e '#{tests.join("; ")}' #{FILTER}"
831
979
  end
@@ -862,5 +1010,11 @@ end
862
1010
 
863
1011
  if $0 == __FILE__ then
864
1012
  out = `rake -T | egrep -v "redocs|repackage|clobber|trunk"`
865
- puts out.gsub(/\#/, '-').gsub(/^rake /, '# * ')
1013
+ if ARGV.empty? then
1014
+ # # default:: Run the default tasks.
1015
+ puts out.gsub(/(\s*)\#/, '::\1').gsub(/^rake /, '# ')
1016
+ else
1017
+ # * default - Run the default tasks.
1018
+ puts out.gsub(/\#/, '-').gsub(/^rake /, '* ')
1019
+ end
866
1020
  end
@@ -22,6 +22,9 @@ class TestHoe < Test::Unit::TestCase
22
22
  config_hoe
23
23
  debug_gem
24
24
  default
25
+ deps:email
26
+ deps:fetch
27
+ deps:list
25
28
  docs
26
29
  email
27
30
  generate_key
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hoe
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.0
4
+ version: 1.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Davis
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-06-30 00:00:00 -07:00
12
+ date: 2008-10-09 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -30,9 +30,9 @@ dependencies:
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: 0.8.1
33
+ version: 0.8.3
34
34
  version:
35
- description: "Hoe is a simple rake/rubygems helper for project Rakefiles. It generates all the usual tasks for projects including rdoc generation, testing, packaging, and deployment. Tasks Provided: * announce - Create news email file and post to rubyforge. * audit - Run ZenTest against the package. * check_manifest - Verify the manifest. * clean - Clean up all the extras. * config_hoe - Create a fresh ~/.hoerc file. * debug_gem - Show information about the gem. * default - Run the default tasks. * docs - Build the docs HTML Files * email - Generate email announcement file. * gem - Build the gem file hoe-1.5.0.gem * generate_key - Generate a key for signing your gems. * install_gem - Install the package as a gem. * multi - Run the test suite using multiruby. * package - Build all the packages * post_blog - Post announcement to blog. * post_news - Post announcement to rubyforge. * publish_docs - Publish RDoc to RubyForge. * release - Package and upload the release to rubyforge. * ridocs - Generate ri locally for testing. * test - Run the test suite. * test_deps - Show which test files fail when run alone. See class rdoc for help. Hint: ri Hoe"
35
+ description: "Hoe is a simple rake/rubygems helper for project Rakefiles. It generates all the usual tasks for projects including rdoc generation, testing, packaging, and deployment. Tasks Provided: * announce - Create news email file and post to rubyforge. * audit - Run ZenTest against the package. * check_manifest - Verify the manifest. * clean - Clean up all the extras. * config_hoe - Create a fresh ~/.hoerc file. * debug_gem - Show information about the gem. * default - Run the default tasks. * deps:email - Print a contact list for gems dependent on this gem * deps:fetch - Fetch all the dependent gems of this gem into tarballs * deps:list - List all the dependent gems of this gem * docs - Build the docs HTML Files * email - Generate email announcement file. * gem - Build the gem file hoe-1.8.0.gem * generate_key - Generate a key for signing your gems. * install_gem - Install the package as a gem. * multi - Run the test suite using multiruby. * package - Build all the packages * post_blog - Post announcement to blog. * post_news - Post announcement to rubyforge. * publish_docs - Publish RDoc to RubyForge. * release - Package and upload the release to rubyforge. * ridocs - Generate ri locally for testing. * tasks - Generate a list of tasks for doco. * test - Run the test suite. * test_deps - Show which test files fail when run alone. See class rdoc for help. Hint: ri Hoe"
36
36
  email:
37
37
  - ryand-ruby@zenspider.com
38
38
  executables:
@@ -74,7 +74,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
74
74
  requirements: []
75
75
 
76
76
  rubyforge_project: seattlerb
77
- rubygems_version: 1.2.0
77
+ rubygems_version: 1.3.0
78
78
  signing_key:
79
79
  specification_version: 2
80
80
  summary: Hoe is a simple rake/rubygems helper for project Rakefiles