newgem 1.4.1 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/History.txt +71 -64
- data/Manifest.txt +4 -13
- data/Rakefile +15 -47
- data/app_generators/newgem/newgem_generator.rb +2 -3
- data/app_generators/newgem/templates/History.txt +1 -1
- data/app_generators/newgem/templates/Rakefile +19 -22
- data/app_generators/newgem_simple/templates/Rakefile +7 -13
- data/features/install_cucumber.feature +5 -1
- data/features/install_website.feature +1 -1
- data/features/newgem_cli.feature +0 -12
- data/features/step_definitions/cli_steps.rb +0 -2
- data/features/step_definitions/common_steps.rb +0 -9
- data/features/step_definitions/rubygems_steps.rb +8 -0
- data/features/support/env.rb +7 -11
- data/lib/hoe/cucumberfeatures.rb +22 -0
- data/lib/hoe/manifest.rb +30 -0
- data/lib/hoe/newgem.rb +74 -0
- data/lib/hoe/website.rb +66 -0
- data/lib/newgem.rb +1 -3
- data/lib/newgem/tasks.rb +10 -2
- data/newgem_generators/install_website/install_website_generator.rb +0 -3
- data/rubygems_generators/executable/templates/bin/app.rb.erb +1 -1
- data/rubygems_generators/install_cucumber/templates/features/step_definitions/common_steps.rb +0 -9
- data/rubygems_generators/install_cucumber/templates/features/support/env.rb.erb +8 -0
- metadata +12 -24
- data/bundles/RubyGem.tmbundle/Snippets/History header trunk.tmSnippet +0 -18
- data/bundles/RubyGem.tmbundle/Snippets/History header.tmSnippet +0 -18
- data/bundles/RubyGem.tmbundle/Syntaxes/Rdoc.tmLanguage +0 -70
- data/bundles/RubyGem.tmbundle/info.plist +0 -16
- data/lib/hoe-patched.rb +0 -1029
- data/lib/newgem/support/tasks.rb +0 -10
- data/newgem_generators/install_website/templates/tasks/website.rake +0 -47
- data/patches/hoe/0001-readme-can-be-txt-or-rdoc.patch +0 -62
- data/tasks/bundles.rake +0 -12
- data/tasks/cucumber.rake +0 -9
- data/tasks/deployment.rake +0 -37
- data/tasks/environment.rake +0 -7
- data/tasks/website.rake +0 -47
data/Rakefile
CHANGED
@@ -1,60 +1,28 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
gem 'hoe', '>= 2.3.0'
|
2
|
+
require 'hoe'
|
3
|
+
%w[fileutils rubigen].each { |f| require f }
|
4
|
+
$:.unshift(File.dirname(__FILE__) + "/lib")
|
5
|
+
|
6
|
+
Hoe.plugin :newgem
|
7
|
+
Hoe.plugin :website
|
8
|
+
Hoe.plugin :cucumberfeatures
|
4
9
|
|
5
10
|
# Generate all the Rake tasks
|
6
11
|
# Run 'rake -T' to see list of generated tasks (from gem root directory)
|
7
|
-
$hoe = Hoe.
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
p.extra_deps = [
|
12
|
+
$hoe = Hoe.spec 'newgem' do
|
13
|
+
developer 'Dr Nic Williams', 'drnicwilliams@gmail.com'
|
14
|
+
self.post_install_message = 'PostInstall.txt'
|
15
|
+
self.extra_deps = [
|
12
16
|
['activesupport','>= 2.0.2'],
|
13
17
|
['rubigen',">= #{RubiGen::VERSION}"],
|
14
18
|
['hoe', ">= #{Hoe::VERSION}"],
|
15
|
-
['RedCloth','
|
19
|
+
['RedCloth','= 4.1.1'], # for website generation
|
16
20
|
['syntax','>= 1.0.0']
|
17
21
|
]
|
18
|
-
|
19
|
-
['cucumber', ">= 0.1.8"]
|
20
|
-
]
|
21
|
-
p.clean_globs |= %w[**/.DS_Store tmp *.log]
|
22
|
-
path = (p.rubyforge_name == p.name) ? p.rubyforge_name : "\#{p.rubyforge_name}/\#{p.name}"
|
23
|
-
p.remote_rdoc_dir = File.join(path.gsub(/^#{p.rubyforge_name}\/?/,''), 'rdoc')
|
24
|
-
p.rsync_args = '-av --delete --ignore-errors'
|
22
|
+
extra_dev_deps << ['cucumber', ">= 0.3.11"]
|
25
23
|
end
|
26
24
|
|
27
|
-
require 'newgem/tasks'
|
28
|
-
|
29
|
-
namespace :hoe do
|
30
|
-
desc "Applies patch files to the hoe.rb in latest hoe rubygem and stores in lib/hoe-patched.rb"
|
31
|
-
task :patch do
|
32
|
-
gem 'hoe'
|
33
|
-
hoe_lib = $LOAD_PATH.grep(/hoe.*\/lib/)
|
34
|
-
hoe_rb = File.join(hoe_lib, 'hoe.rb')
|
35
|
-
FileUtils.cp hoe_rb, File.dirname(__FILE__) + "/lib/hoe.rb"
|
36
|
-
patches = Dir[File.dirname(__FILE__) + "/patches/hoe/*.patch"].sort
|
37
|
-
patches.each do |patch|
|
38
|
-
puts "Applying patch #{File.basename patch}"
|
39
|
-
sh %{ cat #{patch} | patch -p1 }
|
40
|
-
end
|
41
|
-
patched_hoe = File.dirname(__FILE__) + "/lib/hoe-patched.rb"
|
42
|
-
FileUtils.mv File.dirname(__FILE__) + "/lib/hoe.rb", patched_hoe
|
43
|
-
|
44
|
-
help_msg = <<-EOS.gsub(/^\s+/,'')
|
45
|
-
# Patched version of Hoe to allow any README.* file
|
46
|
-
# Pending acceptance of ticket with this feature
|
47
|
-
# File created by 'rake hoe:patch' in newgem
|
48
|
-
# from patch files in patches/hoe/*.patch
|
49
|
-
EOS
|
50
|
-
|
51
|
-
contents = File.read(patched_hoe)
|
52
|
-
File.open(patched_hoe, "w") do |f|
|
53
|
-
f << help_msg + "\n"
|
54
|
-
f << contents
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|
25
|
+
require 'newgem/tasks'
|
58
26
|
|
59
27
|
remove_task :default
|
60
28
|
task :default => :features
|
@@ -22,7 +22,7 @@ class NewgemGenerator < RubiGen::Base
|
|
22
22
|
# extensions/option
|
23
23
|
attr_reader :test_framework
|
24
24
|
attr_reader :bin_names_list
|
25
|
-
attr_reader :enable_website
|
25
|
+
attr_reader :enable_website, :enable_cucumber
|
26
26
|
attr_reader :manifest
|
27
27
|
attr_reader :is_jruby
|
28
28
|
|
@@ -166,6 +166,7 @@ EOS
|
|
166
166
|
@is_jruby = options[:jruby]
|
167
167
|
@project_name = options[:project] if options.include?(:project)
|
168
168
|
@install_generators = options[:install] || []
|
169
|
+
@enable_cucumber = @install_generators.include?('cucumber')
|
169
170
|
end
|
170
171
|
|
171
172
|
# first attempt to merge config args (single string) and runtime args
|
@@ -183,9 +184,7 @@ EOS
|
|
183
184
|
# Installation skeleton. Intermediate directories are automatically
|
184
185
|
# created so don't sweat their absence here.
|
185
186
|
BASEDIRS = %w(
|
186
|
-
doc
|
187
187
|
lib
|
188
188
|
script
|
189
|
-
tasks
|
190
189
|
)
|
191
190
|
end
|
@@ -1,31 +1,28 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
|
3
|
-
require
|
1
|
+
require 'rubygems'
|
2
|
+
gem 'hoe', '>= 2.1.0'
|
3
|
+
require 'hoe'
|
4
|
+
require 'fileutils'
|
5
|
+
require './lib/<%= gem_name %>'
|
6
|
+
|
7
|
+
Hoe.plugin :newgem
|
8
|
+
<%= enable_website ? '' : '# ' %>Hoe.plugin :website
|
9
|
+
<%= enable_cucumber ? '' : '# ' %>Hoe.plugin :cucumber_features
|
4
10
|
|
5
11
|
# Generate all the Rake tasks
|
6
12
|
# Run 'rake -T' to see list of generated tasks (from gem root directory)
|
7
|
-
$hoe = Hoe.
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
p.extra_dev_deps = [
|
16
|
-
['newgem', ">= #{::Newgem::VERSION}"]
|
17
|
-
]
|
18
|
-
<% if is_jruby -%>
|
19
|
-
p.spec_extras['platform'] = 'jruby' # JRuby gem created, e.g. <%= gem_name %>-X.Y.Z-jruby.gem
|
20
|
-
<% end -%>
|
21
|
-
p.clean_globs |= %w[**/.DS_Store tmp *.log]
|
22
|
-
path = (p.rubyforge_name == p.name) ? p.rubyforge_name : "\#{p.rubyforge_name}/\#{p.name}"
|
23
|
-
p.remote_rdoc_dir = File.join(path.gsub(/^#{p.rubyforge_name}\/?/,''), 'rdoc')
|
24
|
-
p.rsync_args = '-av --delete --ignore-errors'
|
13
|
+
$hoe = Hoe.spec '<%= gem_name %>' do
|
14
|
+
self.developer '<%= author %>', '<%= email %>'
|
15
|
+
self.post_install_message = 'PostInstall.txt' # TODO remove if post-install message not required
|
16
|
+
self.rubyforge_name = self.name # TODO this is default value
|
17
|
+
# self.extra_deps = [['activesupport','>= 2.0.2']]
|
18
|
+
<%- if is_jruby -%>
|
19
|
+
self.spec_extras['platform'] = 'jruby' # JRuby gem created, e.g. <%= gem_name %>-X.Y.Z-jruby.gem
|
20
|
+
<%- end -%>
|
25
21
|
end
|
26
22
|
|
27
|
-
require 'newgem/tasks'
|
23
|
+
require 'newgem/tasks'
|
28
24
|
Dir['tasks/**/*.rake'].each { |t| load t }
|
29
25
|
|
30
26
|
# TODO - want other tests/tasks run by default? Add them to the list
|
27
|
+
# remove_task :default
|
31
28
|
# task :default => [:spec, :features]
|
@@ -4,24 +4,18 @@ require 'rubygems/specification'
|
|
4
4
|
require 'date'
|
5
5
|
require 'spec/rake/spectask'
|
6
6
|
|
7
|
-
GEM = "<%= name %>"
|
8
|
-
GEM_VERSION = "0.0.1"
|
9
|
-
AUTHOR = "Your Name"
|
10
|
-
EMAIL = "Your Email"
|
11
|
-
HOMEPAGE = "http://example.com"
|
12
|
-
SUMMARY = "A gem that provides..."
|
13
|
-
|
14
7
|
spec = Gem::Specification.new do |s|
|
15
|
-
s.name =
|
16
|
-
s.version =
|
8
|
+
s.name = "<%= name %>"
|
9
|
+
s.version = "0.0.1"
|
10
|
+
s.author = "Your Name"
|
11
|
+
s.email = "Your Email"
|
12
|
+
s.homepage = "http://example.com"
|
13
|
+
s.description = s.summary = "A gem that provides..."
|
14
|
+
|
17
15
|
s.platform = Gem::Platform::RUBY
|
18
16
|
s.has_rdoc = true
|
19
17
|
s.extra_rdoc_files = ["README", "LICENSE", 'TODO']
|
20
18
|
s.summary = SUMMARY
|
21
|
-
s.description = s.summary
|
22
|
-
s.author = AUTHOR
|
23
|
-
s.email = EMAIL
|
24
|
-
s.homepage = HOMEPAGE
|
25
19
|
|
26
20
|
# Uncomment this to add a dependency
|
27
21
|
# s.add_dependency "foo"
|
@@ -8,6 +8,7 @@ Feature: RubyGems have features to be described and tested
|
|
8
8
|
Given default env variables setup for name and email
|
9
9
|
And an existing newgem scaffold [called "my_project"]
|
10
10
|
When I invoke "install_cucumber" generator with arguments ""
|
11
|
+
And I enable hoe plugin "cucumber_features"
|
11
12
|
Then folder "features/step_definitions" is created
|
12
13
|
Then folder "features/support" is created
|
13
14
|
And file "features/development.feature" is created
|
@@ -21,14 +22,17 @@ Feature: RubyGems have features to be described and tested
|
|
21
22
|
Given default env variables setup for name and email
|
22
23
|
And an existing newgem scaffold [called "my_project"]
|
23
24
|
When I invoke "install_cucumber" generator with arguments ""
|
25
|
+
And I enable hoe plugin "cucumber_features"
|
24
26
|
Then gem file "features/step_definitions/common_steps.rb" and generated file "features/step_definitions/common_steps.rb" should be the same
|
25
27
|
Then gem file "features/support/common.rb" and generated file "features/support/common.rb" should be the same
|
26
28
|
Then gem file "features/support/matchers.rb" and generated file "features/support/matchers.rb" should be the same
|
27
29
|
Then gem file "features/development.feature" and generated file "features/development.feature" should be the same
|
28
30
|
|
29
31
|
Scenario: Installed Cucumber includes a "rake features" task
|
30
|
-
Given
|
32
|
+
Given default env variables setup for name and email
|
33
|
+
And an existing newgem scaffold [called "my_project"]
|
31
34
|
And I invoke "install_cucumber" generator with arguments ""
|
35
|
+
And I enable hoe plugin "cucumber_features"
|
32
36
|
And I invoke task "rake manifest"
|
33
37
|
When I invoke task "rake features"
|
34
38
|
Then task "rake features" is executed successfully
|
@@ -5,7 +5,7 @@ Feature: RubyGems can have a website to promote and teach
|
|
5
5
|
So that I can spend time on the tests and code, and not excessive time on maintenance processes
|
6
6
|
|
7
7
|
Scenario: Deploy project website via local rsync
|
8
|
-
Given an existing newgem scaffold [called "my_project"]
|
8
|
+
Given an existing newgem scaffold using options "-w" [called "my_project"]
|
9
9
|
And project website configuration for safe folder on local machine
|
10
10
|
When I invoke "install_website" generator with arguments ""
|
11
11
|
And I invoke task "rake website"
|
data/features/newgem_cli.feature
CHANGED
@@ -5,7 +5,6 @@ Feature: Can run "newgem" to create RubyGem scaffolds
|
|
5
5
|
So that I can rapidly produce specs and code for encapsulated applications and libraries
|
6
6
|
|
7
7
|
Scenario: Run newgem without any arguments
|
8
|
-
Given a safe folder
|
9
8
|
Given env variable $RUBYFORGE_USERNAME set to ""
|
10
9
|
When newgem is executed for project "my_project" with no options
|
11
10
|
Then file "Rakefile" is created
|
@@ -19,10 +18,8 @@ Feature: Can run "newgem" to create RubyGem scaffolds
|
|
19
18
|
And I should see
|
20
19
|
"""
|
21
20
|
create
|
22
|
-
create doc
|
23
21
|
create lib
|
24
22
|
create script
|
25
|
-
create tasks
|
26
23
|
create lib/my_project
|
27
24
|
create History.txt
|
28
25
|
create Rakefile
|
@@ -51,13 +48,11 @@ Feature: Can run "newgem" to create RubyGem scaffolds
|
|
51
48
|
Then I should see all 1 tests pass
|
52
49
|
|
53
50
|
Scenario: Run newgem with project name containing hypens
|
54
|
-
Given a safe folder
|
55
51
|
Given env variable $RUBYFORGE_USERNAME set to ""
|
56
52
|
When newgem is executed for project "my-project" with no options
|
57
53
|
Then Rakefile can display tasks successfully
|
58
54
|
|
59
55
|
Scenario: Run newgem to include rspec
|
60
|
-
Given a safe folder
|
61
56
|
When newgem is executed for project "my_rspec_project" with options "-T rspec"
|
62
57
|
Then does invoke generator "install_rspec"
|
63
58
|
And does not invoke generator "install_test_unit"
|
@@ -68,7 +63,6 @@ Feature: Can run "newgem" to create RubyGem scaffolds
|
|
68
63
|
Then I should see all 1 examples pass
|
69
64
|
|
70
65
|
Scenario: Run newgem to include shoulda
|
71
|
-
Given a safe folder
|
72
66
|
When newgem is executed for project "my_shoulda_project" with options "-T shoulda"
|
73
67
|
Then does invoke generator "install_shoulda"
|
74
68
|
And does not invoke generator "install_test_unit"
|
@@ -79,7 +73,6 @@ Feature: Can run "newgem" to create RubyGem scaffolds
|
|
79
73
|
Then I should see all 1 tests pass
|
80
74
|
|
81
75
|
Scenario: Run newgem to enable website
|
82
|
-
Given a safe folder
|
83
76
|
When newgem is executed for project "my_project" with options "-w"
|
84
77
|
Then does invoke generator "install_website"
|
85
78
|
And file "config/website.yml.sample" is created
|
@@ -87,7 +80,6 @@ Feature: Can run "newgem" to create RubyGem scaffolds
|
|
87
80
|
And Rakefile can display tasks successfully
|
88
81
|
|
89
82
|
Scenario: Run newgem to enable website, with env $RUBYFORGE_USERNAME set
|
90
|
-
Given a safe folder
|
91
83
|
Given env variable $RUBYFORGE_USERNAME set to "nicwilliams"
|
92
84
|
When newgem is executed for project "my_project" with options "-w"
|
93
85
|
Then file "config/website.yml.sample" is created
|
@@ -95,7 +87,6 @@ Feature: Can run "newgem" to create RubyGem scaffolds
|
|
95
87
|
And Rakefile can display tasks successfully
|
96
88
|
|
97
89
|
Scenario: Run newgem to install misc generators on top of unit test framework
|
98
|
-
Given a safe folder
|
99
90
|
When newgem is executed for project "my_project" with options "-i cucumber"
|
100
91
|
Then does invoke generator "install_test_unit"
|
101
92
|
And does invoke generator "install_cucumber"
|
@@ -103,7 +94,6 @@ Feature: Can run "newgem" to create RubyGem scaffolds
|
|
103
94
|
And Rakefile can display tasks successfully
|
104
95
|
|
105
96
|
Scenario: Run newgem to pull in defaults from ~/.newgem.yml file and no argument options
|
106
|
-
Given a safe folder
|
107
97
|
And ~/.newgem.yml contains {"default" => "-T rspec -i cucumber"}
|
108
98
|
When newgem is executed for project "my_project" with options ""
|
109
99
|
Then does invoke generator "install_rspec"
|
@@ -113,7 +103,6 @@ Feature: Can run "newgem" to create RubyGem scaffolds
|
|
113
103
|
And Rakefile can display tasks successfully
|
114
104
|
|
115
105
|
Scenario: Run newgem to pull in defaults from ~/.newgem.yml file and merge with runtime args
|
116
|
-
Given a safe folder
|
117
106
|
And ~/.newgem.yml contains {"default" => "-T rspec -i cucumber"}
|
118
107
|
When newgem is executed for project "my_project" with options "-i website"
|
119
108
|
Then does invoke generator "install_rspec"
|
@@ -123,7 +112,6 @@ Feature: Can run "newgem" to create RubyGem scaffolds
|
|
123
112
|
And Rakefile can display tasks successfully
|
124
113
|
|
125
114
|
Scenario: Run newgem and show current version number
|
126
|
-
Given a safe folder
|
127
115
|
When newgem is executed only with options "--version"
|
128
116
|
Then shows version number
|
129
117
|
|
@@ -4,7 +4,6 @@ Given /^default env variables setup for name and email$/ do
|
|
4
4
|
end
|
5
5
|
|
6
6
|
Given /^an existing newgem scaffold \[called "(.*)"\]/ do |project_name|
|
7
|
-
Given "a safe folder"
|
8
7
|
newgem = File.expand_path(File.dirname(__FILE__) + "/../../bin/newgem")
|
9
8
|
setup_active_project_folder project_name
|
10
9
|
in_tmp_folder do
|
@@ -15,7 +14,6 @@ Given /^an existing newgem scaffold \[called "(.*)"\]/ do |project_name|
|
|
15
14
|
end
|
16
15
|
|
17
16
|
Given /^an existing newgem scaffold using options "(.*)" \[called "(.*)"\]/ do |arguments, project_name|
|
18
|
-
Given "a safe folder"
|
19
17
|
newgem = File.expand_path(File.dirname(__FILE__) + "/../../bin/newgem")
|
20
18
|
setup_active_project_folder project_name
|
21
19
|
in_tmp_folder do
|
@@ -1,13 +1,4 @@
|
|
1
|
-
Given /^a safe folder/ do
|
2
|
-
FileUtils.rm_rf @tmp_root = File.dirname(__FILE__) + "/../../tmp"
|
3
|
-
FileUtils.mkdir_p @tmp_root
|
4
|
-
FileUtils.mkdir_p @home_path = File.expand_path(File.join(@tmp_root, "home"))
|
5
|
-
@lib_path = File.expand_path(File.dirname(__FILE__) + '/../../lib')
|
6
|
-
Given %Q{env variable $HOME set to "#{@home_path}"}
|
7
|
-
end
|
8
|
-
|
9
1
|
Given /^this project is active project folder/ do
|
10
|
-
Given "a safe folder"
|
11
2
|
@active_project_folder = File.expand_path(File.dirname(__FILE__) + "/../..")
|
12
3
|
end
|
13
4
|
|
@@ -1,3 +1,11 @@
|
|
1
|
+
Given /^I enable hoe plugin "([^\"]*)"$/ do |plugin|
|
2
|
+
in_project_folder do
|
3
|
+
rakefile = File.read('Rakefile')
|
4
|
+
rakefile.gsub!(/^#\s*(Hoe.plugin :#{plugin})/, '\1')
|
5
|
+
File.open("Rakefile", "w") { |file| file << rakefile }
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
1
9
|
Then /^gemspec builds the RubyGem successfully$/ do
|
2
10
|
@stdout = File.expand_path(File.join(@tmp_root, "rake.out"))
|
3
11
|
in_project_folder do
|
data/features/support/env.rb
CHANGED
@@ -7,17 +7,13 @@ require 'pp'
|
|
7
7
|
require 'fileutils'
|
8
8
|
require 'rubygems' unless ENV['NO_RUBYGEMS']
|
9
9
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
# Cucumber::Rails.use_transactional_fixtures
|
18
|
-
#
|
19
|
-
# # Comment out the next line if you're not using RSpec's matchers (should / should_not) in your steps.
|
20
|
-
# require 'cucumber/rails/rspec'
|
10
|
+
Before do
|
11
|
+
@tmp_root = File.dirname(__FILE__) + "/../../tmp"
|
12
|
+
@home_path = File.expand_path(File.join(@tmp_root, "home"))
|
13
|
+
FileUtils.rm_rf @tmp_root
|
14
|
+
FileUtils.mkdir_p @home_path
|
15
|
+
ENV['HOME'] = @home_path
|
16
|
+
end
|
21
17
|
|
22
18
|
# code from test/test_generator_helper.rb
|
23
19
|
TMP_ROOT = File.dirname(__FILE__) + "/tmp" unless defined?(TMP_ROOT)
|
@@ -0,0 +1,22 @@
|
|
1
|
+
##
|
2
|
+
# Cucumber plugin for hoe.
|
3
|
+
#
|
4
|
+
# === Tasks Provided:
|
5
|
+
#
|
6
|
+
# features:: Run cucumber feature
|
7
|
+
|
8
|
+
module Hoe::Cucumberfeatures
|
9
|
+
|
10
|
+
def define_cucumberfeatures_tasks
|
11
|
+
begin
|
12
|
+
gem 'cucumber'
|
13
|
+
require 'cucumber/rake/task'
|
14
|
+
|
15
|
+
Cucumber::Rake::Task.new(:features) do |t|
|
16
|
+
t.cucumber_opts = "--format progress"
|
17
|
+
end
|
18
|
+
rescue LoadError => e
|
19
|
+
p e
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
data/lib/hoe/manifest.rb
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
##
|
2
|
+
# Manifest plugin for hoe.
|
3
|
+
#
|
4
|
+
# === Tasks Provided:
|
5
|
+
#
|
6
|
+
# manifest:: Recreate the Manifest.txt
|
7
|
+
|
8
|
+
module Hoe::Manifest
|
9
|
+
|
10
|
+
##
|
11
|
+
# Define tasks for plugin.
|
12
|
+
def define_manifest_tasks
|
13
|
+
desc 'Recreate Manifest.txt to include ALL files to be deployed'
|
14
|
+
task :manifest => :clean do
|
15
|
+
require 'find'
|
16
|
+
files = []
|
17
|
+
with_config do |config, _|
|
18
|
+
exclusions = config["exclude"]
|
19
|
+
abort "exclude entry missing from .hoerc. Aborting." if exclusions.nil?
|
20
|
+
Find.find '.' do |path|
|
21
|
+
next unless File.file? path
|
22
|
+
next if path =~ exclusions
|
23
|
+
files << path[2..-1]
|
24
|
+
end
|
25
|
+
files = files.sort.join "\n"
|
26
|
+
File.open 'Manifest.txt', 'w' do |fp| fp.puts files end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
data/lib/hoe/newgem.rb
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
##
|
2
|
+
# Gemspec plugin for hoe.
|
3
|
+
#
|
4
|
+
# === Tasks Provided:
|
5
|
+
#
|
6
|
+
# gemspec:: Generate the gemspec file
|
7
|
+
# release
|
8
|
+
|
9
|
+
Hoe.plugin :manifest
|
10
|
+
|
11
|
+
module Hoe::Newgem
|
12
|
+
def initialize_newgem
|
13
|
+
require(File.dirname(__FILE__) + "/../newgem")
|
14
|
+
require 'newgem/tasks'
|
15
|
+
|
16
|
+
self.clean_globs |= %w[**/.DS_Store tmp *.log]
|
17
|
+
path = (self.rubyforge_name == self.name) ? self.rubyforge_name : "\#{self.rubyforge_name}/\#{self.name}"
|
18
|
+
self.remote_rdoc_dir = File.join(path.gsub(/^#{self.rubyforge_name}\/?/,''), 'rdoc')
|
19
|
+
self.rsync_args = '-av --delete --ignore-errors'
|
20
|
+
self.readme_file = "README.rdoc"
|
21
|
+
end
|
22
|
+
|
23
|
+
# Define +gemspec+ task if not already defined
|
24
|
+
def define_newgem_tasks
|
25
|
+
unless self.extra_dev_deps.find { |dep| dep.first == 'newgem' }
|
26
|
+
require File.dirname(__FILE__) + '/../newgem'
|
27
|
+
self.extra_dev_deps ||= []
|
28
|
+
self.extra_dev_deps << ['newgem', ">= #{::Newgem::VERSION}"]
|
29
|
+
end
|
30
|
+
|
31
|
+
return if Rake::Task.tasks.find { |t| t.name == 'gemspec' }
|
32
|
+
desc "Generate a #{name}.gemspec file"
|
33
|
+
task :gemspec do
|
34
|
+
File.open("#{name}.gemspec", "w") do |file|
|
35
|
+
file.puts spec.to_ruby
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
task :release do
|
40
|
+
puts <<-EOS.gsub(/^ /,'')
|
41
|
+
Remember to create tag your release; eg for Git:
|
42
|
+
git tag REL-#{$hoe.version}
|
43
|
+
|
44
|
+
Announce your release on RubyForge News:
|
45
|
+
rake post_news
|
46
|
+
EOS
|
47
|
+
end
|
48
|
+
|
49
|
+
task :check_version do
|
50
|
+
unless ENV['VERSION']
|
51
|
+
puts 'Must pass a VERSION=x.y.z release version'
|
52
|
+
exit
|
53
|
+
end
|
54
|
+
unless ENV['VERSION'] == $hoe.version
|
55
|
+
puts "Please update your lib/#{$hoe.name}.rb to match the release version, currently #{$hoe.version}"
|
56
|
+
exit
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
desc 'Install the package as a gem, without generating documentation(ri/rdoc)'
|
61
|
+
task :install_gem_no_doc => [:clean, :package] do
|
62
|
+
sh "#{'sudo ' unless Hoe::WINDOZE }gem install pkg/*.gem --no-rdoc --no-ri"
|
63
|
+
end
|
64
|
+
|
65
|
+
task :ruby_env do
|
66
|
+
$ruby_app = if RUBY_PLATFORM =~ /java/
|
67
|
+
"jruby"
|
68
|
+
else
|
69
|
+
"ruby"
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
end
|
74
|
+
end
|