newgem 0.29.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +15 -1
- data/Manifest.txt +7 -22
- data/README.rdoc +55 -33
- data/Rakefile +22 -7
- data/app_generators/newgem/newgem_generator.rb +23 -23
- data/app_generators/newgem/templates/Rakefile +27 -3
- data/app_generators/newgem/templates/lib/module.rb +1 -1
- data/bin/newgem +12 -2
- data/config/website.yml +2 -0
- data/features/development.feature +22 -0
- data/features/executable_generator.feature +6 -6
- data/features/expected_outputs/newgem.out +2 -9
- data/features/install_cucumber.feature +11 -0
- data/features/install_website.feature +13 -0
- data/features/newgem_cli.feature +60 -0
- data/features/steps/cli.rb +125 -36
- data/features/steps/env.rb +4 -2
- data/lib/newgem/support/tasks.rb +10 -0
- data/lib/newgem/tasks.rb +1 -0
- data/lib/newgem.rb +5 -5
- data/newgem_generators/install_website/install_website_generator.rb +12 -9
- data/newgem_generators/install_website/templates/config/website.yml.sample.erb +2 -0
- data/newgem_generators/install_website/templates/script/txt2html +5 -16
- data/newgem_generators/install_website/templates/tasks/website.rake +34 -4
- data/rubygems_generators/executable/templates/test/test_cli.rb.erb +1 -1
- data/script/txt2html +5 -16
- data/tasks/deployment.rake +5 -6
- data/tasks/website.rake +34 -6
- data/test/test_install_website_generator.rb +1 -0
- data/test/test_newgem_generator.rb +0 -10
- data/website/index.html +27 -22
- data/website/index.txt +30 -19
- data/website/rubyforge.html +2 -2
- data/website/version.js +0 -4
- metadata +35 -67
- data/Todo.txt +0 -4
- data/app_generators/newgem/templates/config/hoe.rb +0 -82
- data/app_generators/newgem/templates/config/requirements.rb +0 -15
- data/app_generators/newgem/templates/lib/version.rb +0 -10
- data/app_generators/newgem/templates/setup.rb +0 -1585
- data/app_generators/newgem/templates/tasks/deployment.rake +0 -34
- data/app_generators/newgem/templates/tasks/environment.rake +0 -7
- data/app_generators/newgem/templates/tasks/website.rake +0 -9
- data/config/hoe.rb +0 -62
- data/features/cli.feature +0 -28
- data/features/steps/executable_generator.rb +0 -0
- data/lib/newgem/version.rb +0 -9
- data/rubygems_generators/install_rspec_stories/USAGE +0 -5
- data/rubygems_generators/install_rspec_stories/install_rspec_stories_generator.rb +0 -54
- data/rubygems_generators/install_rspec_stories/templates/all.rb +0 -8
- data/rubygems_generators/install_rspec_stories/templates/steps.rb +0 -13
- data/rubygems_generators/install_rspec_stories/templates/story.story +0 -9
- data/script/txt2html.rb +0 -70
- data/script/txt2js +0 -59
- data/setup.rb +0 -1585
- data/tasks/generator_report.rake +0 -19
- data/test/test_install_rspec_stories_generator.rb +0 -45
data/features/steps/cli.rb
CHANGED
@@ -1,40 +1,82 @@
|
|
1
|
-
Given %r{^a safe folder
|
2
|
-
$tmp_root = File.dirname(__FILE__) + "/../../tmp"
|
3
|
-
FileUtils.rm_rf $tmp_root
|
1
|
+
Given %r{^a safe folder} do
|
2
|
+
FileUtils.rm_rf $tmp_root = File.dirname(__FILE__) + "/../../tmp"
|
4
3
|
FileUtils.mkdir_p $tmp_root
|
5
4
|
end
|
6
5
|
|
6
|
+
Given /^this project is active project folder/ do
|
7
|
+
FileUtils.rm_rf $tmp_root = File.dirname(__FILE__) + "/../../tmp"
|
8
|
+
FileUtils.mkdir_p $tmp_root
|
9
|
+
$active_project_folder = File.expand_path(File.dirname(__FILE__) + "/../..")
|
10
|
+
end
|
11
|
+
|
12
|
+
Given /^env variable \$([\w_]+) set to '(.*)'/ do |env_var, value|
|
13
|
+
ENV[env_var] = value
|
14
|
+
end
|
15
|
+
|
16
|
+
def force_local_newgem_priority(project_name)
|
17
|
+
rakefile = File.read(File.join(project_name, 'Rakefile'))
|
18
|
+
File.open(File.join(project_name, 'Rakefile'), "w+") do |f|
|
19
|
+
f << "$:.unshift('#{File.expand_path(File.dirname(__FILE__) + '/../../lib')}')\n"
|
20
|
+
f << rakefile
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
7
24
|
Given %r{^an existing newgem scaffold \[called '(.*)'\]$} do |project_name|
|
8
25
|
# TODO this is a combo of "a safe folder" and "newgem is executed ..." steps; refactor
|
9
|
-
$tmp_root = File.dirname(__FILE__) + "/../../tmp"
|
10
|
-
FileUtils.rm_rf $tmp_root
|
26
|
+
FileUtils.rm_rf $tmp_root = File.dirname(__FILE__) + "/../../tmp"
|
11
27
|
FileUtils.mkdir_p $tmp_root
|
12
28
|
newgem = File.expand_path(File.dirname(__FILE__) + "/../../bin/newgem")
|
13
29
|
FileUtils.chdir $tmp_root do
|
14
|
-
|
15
|
-
system "ruby #{newgem} #{project_name} > #{
|
30
|
+
@stdout = "newgem.out"
|
31
|
+
system "ruby #{newgem} #{project_name} > #{@stdout}"
|
32
|
+
force_local_newgem_priority project_name
|
33
|
+
end
|
34
|
+
$active_project_folder = File.join($tmp_root, project_name)
|
35
|
+
$project_name = project_name
|
36
|
+
end
|
37
|
+
|
38
|
+
Given /^project website configuration for safe folder on local machine$/ do
|
39
|
+
$remote_folder = File.expand_path(File.join($tmp_root, 'website'))
|
40
|
+
FileUtils.rm_rf $remote_folder
|
41
|
+
FileUtils.mkdir_p $remote_folder
|
42
|
+
FileUtils.chdir $active_project_folder do
|
43
|
+
FileUtils.mkdir_p 'config'
|
44
|
+
# config_yml = { "host" => "localhost", "remote_dir" => $remote_folder }.to_yaml
|
45
|
+
config_yml = { "remote_dir" => $remote_folder }.to_yaml
|
46
|
+
config_path = File.join('config', 'website.yml')
|
47
|
+
File.open(config_path, "w") { |io| io << config_yml }
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
Given /^'(.*)' folder is deleted/ do |folder|
|
52
|
+
FileUtils.chdir $active_project_folder do
|
53
|
+
FileUtils.rm_rf folder
|
16
54
|
end
|
17
|
-
@project_name = project_name
|
18
55
|
end
|
19
56
|
|
20
57
|
When %r{^newgem is executed for project '(.*)' with no options$} do |project_name|
|
21
58
|
newgem = File.expand_path(File.dirname(__FILE__) + "/../../bin/newgem")
|
59
|
+
$active_project_folder = File.expand_path(File.join($tmp_root, project_name))
|
60
|
+
$project_name = project_name
|
22
61
|
FileUtils.chdir $tmp_root do
|
23
|
-
@
|
24
|
-
system "ruby #{newgem} #{project_name} > #{@
|
62
|
+
@stdout = "newgem.out"
|
63
|
+
system "ruby #{newgem} #{project_name} > #{@stdout}"
|
64
|
+
force_local_newgem_priority project_name
|
25
65
|
end
|
26
66
|
end
|
27
67
|
|
28
68
|
When %r{^newgem is executed for project '(.*)' with options '(.*)'$} do |project_name, arguments|
|
29
69
|
newgem = File.expand_path(File.dirname(__FILE__) + "/../../bin/newgem")
|
70
|
+
$project_name = project_name
|
30
71
|
FileUtils.chdir $tmp_root do
|
31
|
-
@
|
32
|
-
system "ruby #{newgem} #{arguments} #{project_name} > #{@
|
72
|
+
@stdout = "newgem.out"
|
73
|
+
system "ruby #{newgem} #{arguments} #{project_name} > #{@stdout}"
|
74
|
+
$active_project_folder = File.join($tmp_root, project_name)
|
33
75
|
end
|
34
76
|
end
|
35
77
|
|
36
78
|
When %r{^'(.*)' generator is invoked with arguments '(.*)'$} do |generator, arguments|
|
37
|
-
FileUtils.chdir(
|
79
|
+
FileUtils.chdir($active_project_folder) do
|
38
80
|
if Object.const_defined?("APP_ROOT")
|
39
81
|
APP_ROOT.replace(FileUtils.pwd)
|
40
82
|
else
|
@@ -45,60 +87,107 @@ When %r{^'(.*)' generator is invoked with arguments '(.*)'$} do |generator, argu
|
|
45
87
|
end
|
46
88
|
|
47
89
|
When /^run executable '(.*)' with arguments '(.*)'$/ do |executable, arguments|
|
48
|
-
|
49
|
-
|
90
|
+
@stdout = File.expand_path(File.join($tmp_root, "executable.out"))
|
91
|
+
FileUtils.chdir($active_project_folder) do
|
50
92
|
system "ruby #{executable} #{arguments} > #{@stdout}"
|
51
93
|
end
|
52
94
|
end
|
53
95
|
|
54
96
|
When /^run unit tests for test file '(.*)'$/ do |test_file|
|
55
|
-
@
|
56
|
-
FileUtils.chdir(
|
57
|
-
system "ruby #{test_file} > #{@
|
97
|
+
@stdout = File.expand_path(File.join($tmp_root, "tests.out"))
|
98
|
+
FileUtils.chdir($active_project_folder) do
|
99
|
+
system "ruby #{test_file} > #{@stdout}"
|
58
100
|
end
|
59
101
|
end
|
60
102
|
|
61
|
-
|
62
|
-
|
103
|
+
When /^task 'rake (.*)' is invoked$/ do |task|
|
104
|
+
@stdout = File.expand_path(File.join($tmp_root, "tests.out"))
|
105
|
+
FileUtils.chdir($active_project_folder) do
|
106
|
+
system "rake #{task} > #{@stdout} 2> #{@stdout}"
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
Then %r{^folder '(.*)' is created} do |folder|
|
111
|
+
FileUtils.chdir $active_project_folder do
|
63
112
|
File.exists?(folder).should be_true
|
64
113
|
end
|
65
114
|
end
|
66
115
|
|
67
|
-
Then %r{^
|
68
|
-
FileUtils.chdir $
|
69
|
-
File.exists?(
|
116
|
+
Then %r{^remote folder '(.*)' is created} do |folder|
|
117
|
+
FileUtils.chdir $remote_folder do
|
118
|
+
File.exists?(folder).should be_true
|
70
119
|
end
|
71
120
|
end
|
72
121
|
|
73
|
-
Then %r{^
|
74
|
-
|
75
|
-
|
76
|
-
|
122
|
+
Then %r{^file '(.*)' (is|is not) created} do |file, is|
|
123
|
+
FileUtils.chdir $active_project_folder do
|
124
|
+
File.exists?(file).should(is == 'is' ? be_true : be_false)
|
125
|
+
end
|
77
126
|
end
|
78
127
|
|
79
|
-
Then %r{^
|
80
|
-
|
81
|
-
|
128
|
+
Then %r{^remote file '(.*)' (is|is not) created} do |file, is|
|
129
|
+
FileUtils.chdir $remote_folder do
|
130
|
+
File.exists?(file).should(is == 'is' ? be_true : be_false)
|
131
|
+
end
|
82
132
|
end
|
83
133
|
|
84
|
-
Then
|
85
|
-
|
86
|
-
|
134
|
+
Then /^file matching '(.*)' is created$/ do |pattern|
|
135
|
+
FileUtils.chdir $active_project_folder do
|
136
|
+
Dir[pattern].should_not be_empty
|
137
|
+
end
|
87
138
|
end
|
88
139
|
|
89
|
-
Then
|
140
|
+
Then %r{^output same as contents of '(.*)'$} do |file|
|
141
|
+
expected_output = File.read(File.join(File.dirname(__FILE__) + "/../expected_outputs", file))
|
90
142
|
actual_output = File.read(File.dirname(__FILE__) + "/../../tmp/#{@stdout}")
|
143
|
+
actual_output.should == expected_output
|
144
|
+
end
|
145
|
+
|
146
|
+
Then %r{^(does|does not) invoke generator '(.*)'$} do |does_invoke, generator|
|
147
|
+
actual_output = File.read(File.dirname(__FILE__) + "/../../tmp/#{@stdout}")
|
148
|
+
does_invoke == "does" ?
|
149
|
+
actual_output.should(match(/dependency\s+#{generator}/)) :
|
150
|
+
actual_output.should_not(match(/dependency\s+#{generator}/))
|
151
|
+
end
|
152
|
+
|
153
|
+
Then /^help options '(.*)' and '(.*)' are displayed$/ do |opt1, opt2|
|
154
|
+
actual_output = File.read(@stdout)
|
91
155
|
actual_output.should match(/#{opt1}/)
|
92
156
|
actual_output.should match(/#{opt2}/)
|
93
157
|
end
|
94
158
|
|
95
159
|
Then /^output matches \/(.*)\/$/ do |regex|
|
96
|
-
actual_output = File.read(
|
160
|
+
actual_output = File.read(@stdout)
|
97
161
|
actual_output.should match(/#{regex}/)
|
98
162
|
end
|
99
163
|
|
100
164
|
Then /^all (\d+) tests pass$/ do |expected_test_count|
|
101
165
|
expected = %r{^#{expected_test_count} tests, \d+ assertions, 0 failures, 0 errors}
|
102
|
-
actual_output = File.read(@
|
166
|
+
actual_output = File.read(@stdout)
|
103
167
|
actual_output.should match(expected)
|
104
168
|
end
|
169
|
+
|
170
|
+
Then /^yaml file '(.*)' contains (\{.*\})/ do |file, yaml|
|
171
|
+
FileUtils.chdir $active_project_folder do
|
172
|
+
yaml = eval yaml
|
173
|
+
YAML.load(File.read(file)).should == yaml
|
174
|
+
end
|
175
|
+
end
|
176
|
+
|
177
|
+
Then /^gem spec key '(.*)' contains \/(.*)\/$/ do |key, regex|
|
178
|
+
FileUtils.chdir $active_project_folder do
|
179
|
+
gem_file = Dir["pkg/*.gem"].first
|
180
|
+
gem_spec = Gem::Specification.from_yaml(`gem spec #{gem_file}`)
|
181
|
+
spec_value = gem_spec.send(key.to_sym)
|
182
|
+
spec_value.to_s.should match(/#{regex}/)
|
183
|
+
end
|
184
|
+
end
|
185
|
+
|
186
|
+
Then /^Rakefile can display tasks successfully$/ do
|
187
|
+
@stdout = File.expand_path(File.join($tmp_root, "rakefile.out"))
|
188
|
+
FileUtils.chdir($active_project_folder) do
|
189
|
+
system "rake -T > #{@stdout} 2> #{@stdout}"
|
190
|
+
end
|
191
|
+
actual_output = File.read(@stdout)
|
192
|
+
actual_output.should match(/^rake\s+\w+\s+#\s.*/)
|
193
|
+
end
|
data/features/steps/env.rb
CHANGED
@@ -1,9 +1,11 @@
|
|
1
1
|
require File.dirname(__FILE__) + "/../../lib/newgem"
|
2
2
|
|
3
3
|
require 'cucumber'
|
4
|
+
require 'spec'
|
4
5
|
|
5
|
-
require
|
6
|
-
require
|
6
|
+
require 'pp'
|
7
|
+
require 'fileutils'
|
8
|
+
require 'rubygems'
|
7
9
|
|
8
10
|
# Following lines from original Rails cucumber generator.
|
9
11
|
# Not sure how to translate/reuse etc yet.
|
data/lib/newgem/tasks.rb
CHANGED
data/lib/newgem.rb
CHANGED
@@ -11,39 +11,42 @@ class InstallWebsiteGenerator < RubiGen::Base
|
|
11
11
|
:theme => 'plain_theme'
|
12
12
|
|
13
13
|
attr_reader :gem_name, :module_name
|
14
|
-
attr_reader :author, :email, :theme
|
14
|
+
attr_reader :author, :email, :theme, :rubyforge_username
|
15
15
|
|
16
16
|
def initialize(runtime_args, runtime_options = {})
|
17
17
|
super
|
18
|
-
@destination_root
|
19
|
-
@gem_name
|
20
|
-
|
21
|
-
@
|
18
|
+
@destination_root = File.expand_path(destination_root)
|
19
|
+
@gem_name = base_name
|
20
|
+
@module_name = @gem_name.camelcase
|
21
|
+
@rubyforge_username = ENV['RUBYFORGE_USERNAME'].nil? || ENV['RUBYFORGE_USERNAME'].empty? ? 'unknown' : ENV['RUBYFORGE_USERNAME']
|
22
22
|
extract_options
|
23
23
|
end
|
24
24
|
|
25
25
|
def manifest
|
26
|
-
script_options = { :chmod => 0755, :shebang => options[:shebang] == DEFAULT_SHEBANG ? nil : options[:shebang] }
|
27
26
|
windows = (RUBY_PLATFORM =~ /dos|win32|cygwin/i) || (RUBY_PLATFORM =~ /(:?mswin|mingw)/)
|
27
|
+
script_options = { :chmod => 0755, :shebang => options[:shebang] == DEFAULT_SHEBANG ? nil : options[:shebang] }
|
28
28
|
|
29
29
|
record do |m|
|
30
30
|
# Ensure appropriate folder(s) exists
|
31
31
|
m.directory 'website/javascripts'
|
32
32
|
m.directory 'website/stylesheets'
|
33
|
+
m.directory 'config'
|
33
34
|
m.directory 'script'
|
34
35
|
m.directory 'tasks'
|
35
36
|
|
36
37
|
# Website
|
37
38
|
m.template_copy_each %w( index.txt index.html ), "website"
|
38
39
|
|
40
|
+
m.template "config/website.yml.sample.erb", "config/website.yml.sample"
|
41
|
+
|
42
|
+
# m.file_copy_each %w[ website.rake ], "tasks"
|
43
|
+
|
39
44
|
%w( txt2html ).each do |file|
|
40
45
|
m.template "script/#{file}", "script/#{file}", script_options
|
41
46
|
m.template "script/win_script.cmd", "script/#{file}.cmd",
|
42
47
|
:assigns => { :filename => file } if windows
|
43
48
|
end
|
44
49
|
|
45
|
-
m.file_copy_each %w[ website.rake ], "tasks"
|
46
|
-
|
47
50
|
m.dependency theme, [], :destination => destination_root
|
48
51
|
end
|
49
52
|
end
|
@@ -90,4 +93,4 @@ EOS
|
|
90
93
|
end
|
91
94
|
end
|
92
95
|
|
93
|
-
end
|
96
|
+
end
|
@@ -1,27 +1,16 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
require 'rubygems'
|
7
|
-
begin
|
8
|
-
require 'newgem'
|
9
|
-
require 'rubyforge'
|
10
|
-
rescue LoadError
|
11
|
-
puts "\n\nGenerating the website requires the newgem RubyGem"
|
12
|
-
puts "Install: gem install newgem\n\n"
|
13
|
-
exit(1)
|
14
|
-
end
|
3
|
+
load File.dirname(__FILE__) + "/../Rakefile"
|
4
|
+
require 'rubyforge'
|
15
5
|
require 'redcloth'
|
16
6
|
require 'syntax/convertors/html'
|
17
7
|
require 'erb'
|
18
|
-
require File.dirname(__FILE__) + "/../lib/#{GEM_NAME}/version.rb"
|
19
8
|
|
20
|
-
|
21
|
-
|
9
|
+
download = "http://rubyforge.org/projects/#{$hoe.rubyforge_name}"
|
10
|
+
version = $hoe.version
|
22
11
|
|
23
12
|
def rubyforge_project_id
|
24
|
-
RubyForge.new.configure.autoconfig["group_ids"][
|
13
|
+
RubyForge.new.configure.autoconfig["group_ids"][$hoe.rubyforge_name]
|
25
14
|
end
|
26
15
|
|
27
16
|
class Fixnum
|
@@ -1,3 +1,21 @@
|
|
1
|
+
require 'yaml'
|
2
|
+
|
3
|
+
def website_config
|
4
|
+
unless @website_config
|
5
|
+
begin
|
6
|
+
@website_config = YAML.load(File.read("config/website.yml"))
|
7
|
+
rescue
|
8
|
+
puts <<-EOS
|
9
|
+
To upload your website to a host, you need to configure
|
10
|
+
config/website.yml. See config/website.yml.sample for
|
11
|
+
an example.
|
12
|
+
EOS
|
13
|
+
exit
|
14
|
+
end
|
15
|
+
end
|
16
|
+
@website_config
|
17
|
+
end
|
18
|
+
|
1
19
|
desc 'Generate website files'
|
2
20
|
task :website_generate => :ruby_env do
|
3
21
|
(Dir['website/**/*.txt'] - Dir['website/version*.txt']).each do |txt|
|
@@ -7,10 +25,22 @@ end
|
|
7
25
|
|
8
26
|
desc 'Upload website files to rubyforge'
|
9
27
|
task :website_upload do
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
28
|
+
local_dir = 'website'
|
29
|
+
host = website_config["host"]
|
30
|
+
host = host ? "#{host}:" : ""
|
31
|
+
remote_dir = website_config["remote_dir"]
|
32
|
+
sh %{rsync -aCv #{local_dir}/ #{host}#{remote_dir}}
|
33
|
+
end
|
34
|
+
|
35
|
+
remove_task :publish_docs # recreate hoe's rubyforge specific version
|
36
|
+
|
37
|
+
desc 'Publish RDoc to RubyForge.'
|
38
|
+
task :publish_docs => [:clean, :docs] do
|
39
|
+
local_dir = 'doc'
|
40
|
+
host = website_config["host"]
|
41
|
+
host = host ? "#{host}:" : ""
|
42
|
+
remote_dir = File.join(website_config["remote_dir"], "doc")
|
43
|
+
sh %{rsync -aCv #{local_dir}/ #{host}#{remote_dir}}
|
14
44
|
end
|
15
45
|
|
16
46
|
desc 'Generate and upload website files'
|
data/script/txt2html
CHANGED
@@ -1,27 +1,16 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
require 'rubygems'
|
7
|
-
begin
|
8
|
-
require 'newgem'
|
9
|
-
require 'rubyforge'
|
10
|
-
rescue LoadError
|
11
|
-
puts "\n\nGenerating the website requires the newgem RubyGem"
|
12
|
-
puts "Install: gem install newgem\n\n"
|
13
|
-
exit(1)
|
14
|
-
end
|
3
|
+
load File.dirname(__FILE__) + "/../Rakefile"
|
4
|
+
require 'rubyforge'
|
15
5
|
require 'redcloth'
|
16
6
|
require 'syntax/convertors/html'
|
17
7
|
require 'erb'
|
18
|
-
require File.dirname(__FILE__) + "/../lib/#{GEM_NAME}/version.rb"
|
19
8
|
|
20
|
-
|
21
|
-
|
9
|
+
download = "http://rubyforge.org/projects/#{$hoe.rubyforge_name}"
|
10
|
+
version = $hoe.version
|
22
11
|
|
23
12
|
def rubyforge_project_id
|
24
|
-
RubyForge.new.configure.autoconfig["group_ids"][
|
13
|
+
RubyForge.new.configure.autoconfig["group_ids"][$hoe.rubyforge_name]
|
25
14
|
end
|
26
15
|
|
27
16
|
class Fixnum
|
data/tasks/deployment.rake
CHANGED
@@ -1,7 +1,6 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
puts "
|
4
|
-
puts " git tag REL-#{VERS}"
|
1
|
+
task :release do
|
2
|
+
puts "Remember to create tag your release; eg for Git:"
|
3
|
+
puts " git tag REL-#{$hoe.version}"
|
5
4
|
end
|
6
5
|
|
7
6
|
desc 'Runs tasks website_generate and install_gem as a local deployment of the gem'
|
@@ -12,8 +11,8 @@ task :check_version do
|
|
12
11
|
puts 'Must pass a VERSION=x.y.z release version'
|
13
12
|
exit
|
14
13
|
end
|
15
|
-
unless ENV['VERSION'] ==
|
16
|
-
puts "Please update your version.rb to match the release version, currently #{
|
14
|
+
unless ENV['VERSION'] == $hoe.version
|
15
|
+
puts "Please update your version.rb to match the release version, currently #{$hoe.version}"
|
17
16
|
exit
|
18
17
|
end
|
19
18
|
end
|
data/tasks/website.rake
CHANGED
@@ -1,18 +1,46 @@
|
|
1
|
+
require 'yaml'
|
2
|
+
|
3
|
+
def website_config
|
4
|
+
unless @website_config
|
5
|
+
begin
|
6
|
+
@website_config = YAML.load(File.read("config/website.yml"))
|
7
|
+
rescue
|
8
|
+
puts <<-EOS
|
9
|
+
To upload your website to a host, you need to configure
|
10
|
+
config/website.yml. See config/website.yml.sample for
|
11
|
+
an example.
|
12
|
+
EOS
|
13
|
+
exit
|
14
|
+
end
|
15
|
+
end
|
16
|
+
@website_config
|
17
|
+
end
|
18
|
+
|
1
19
|
desc 'Generate website files'
|
2
20
|
task :website_generate => :ruby_env do
|
3
21
|
(Dir['website/**/*.txt'] - Dir['website/version*.txt']).each do |txt|
|
4
22
|
sh %{ #{RUBY_APP} script/txt2html #{txt} > #{txt.gsub(/txt$/,'html')} }
|
5
23
|
end
|
6
|
-
sh %{ #{RUBY_APP} script/txt2js website/version.txt > website/version.js }
|
7
|
-
sh %{ #{RUBY_APP} script/txt2js website/version-raw.txt > website/version-raw.js }
|
8
24
|
end
|
9
25
|
|
10
26
|
desc 'Upload website files to rubyforge'
|
11
27
|
task :website_upload do
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
28
|
+
local_dir = 'website'
|
29
|
+
host = website_config["host"]
|
30
|
+
host = host ? "#{host}:" : ""
|
31
|
+
remote_dir = website_config["remote_dir"]
|
32
|
+
sh %{rsync -aCv #{local_dir}/ #{host}#{remote_dir}}
|
33
|
+
end
|
34
|
+
|
35
|
+
remove_task :publish_docs # recreate hoe's rubyforge specific version
|
36
|
+
|
37
|
+
desc 'Publish RDoc to RubyForge.'
|
38
|
+
task :publish_docs => [:clean, :docs] do
|
39
|
+
local_dir = 'doc'
|
40
|
+
host = website_config["host"]
|
41
|
+
host = host ? "#{host}:" : ""
|
42
|
+
remote_dir = File.join(website_config["remote_dir"], "rdoc")
|
43
|
+
sh %{rsync -aCv #{local_dir}/ #{host}#{remote_dir}}
|
16
44
|
end
|
17
45
|
|
18
46
|
desc 'Generate and upload website files'
|
@@ -18,6 +18,7 @@ class TestInstallWebsiteGenerator < Test::Unit::TestCase
|
|
18
18
|
%w[index.txt index.html template.html.erb stylesheets/screen.css javascripts/rounded_corners_lite.inc.js].each do |file|
|
19
19
|
assert_generated_file("website/#{file}")
|
20
20
|
end
|
21
|
+
assert_generated_file("config/website.yml.sample")
|
21
22
|
assert_generated_file("script/txt2html")
|
22
23
|
assert_generated_file("tasks/website.rake")
|
23
24
|
end
|
@@ -16,7 +16,6 @@ class TestNewgemGenerator < Test::Unit::TestCase
|
|
16
16
|
def test_newgem
|
17
17
|
run_generator('newgem', [APP_ROOT], sources)
|
18
18
|
|
19
|
-
assert_directory_exists "config"
|
20
19
|
assert_directory_exists "lib"
|
21
20
|
assert_directory_exists "tasks"
|
22
21
|
assert_directory_exists "test"
|
@@ -25,12 +24,7 @@ class TestNewgemGenerator < Test::Unit::TestCase
|
|
25
24
|
assert_generated_file(file)
|
26
25
|
end
|
27
26
|
|
28
|
-
%w[hoe.rb requirements.rb].each do |file|
|
29
|
-
assert_generated_file("config/#{file}")
|
30
|
-
end
|
31
|
-
|
32
27
|
assert_generated_file("lib/#{gem_name}.rb")
|
33
|
-
assert_generated_file("lib/#{gem_name}/version.rb")
|
34
28
|
|
35
29
|
["test_helper.rb", "test_#{gem_name}.rb"].each do |file|
|
36
30
|
assert_generated_file("test/#{file}")
|
@@ -42,10 +36,6 @@ class TestNewgemGenerator < Test::Unit::TestCase
|
|
42
36
|
|
43
37
|
assert_generated_module("lib/#{gem_name}")
|
44
38
|
|
45
|
-
%w[deployment environment website].each do |file|
|
46
|
-
assert_generated_file("tasks/#{file}.rake")
|
47
|
-
end
|
48
|
-
|
49
39
|
assert_manifest_complete
|
50
40
|
end
|
51
41
|
|