newgem 0.11.0 → 0.13.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +42 -0
- data/Manifest.txt +84 -17
- data/README.txt +3 -2
- data/Rakefile +4 -106
- data/Todo.txt +1 -1
- data/app_generators/newgem/newgem_generator.rb +172 -0
- data/{templates → app_generators/newgem/templates}/History.txt +1 -1
- data/{templates → app_generators/newgem/templates}/License.txt +1 -1
- data/app_generators/newgem/templates/README.txt +1 -0
- data/app_generators/newgem/templates/Rakefile +4 -0
- data/{templates → app_generators/newgem/templates}/app.rb +3 -3
- data/app_generators/newgem/templates/config/hoe.rb +73 -0
- data/app_generators/newgem/templates/config/requirements.rb +17 -0
- data/app_generators/newgem/templates/empty.log +0 -0
- data/app_generators/newgem/templates/module.rb +5 -0
- data/app_generators/newgem/templates/script/destroy +14 -0
- data/app_generators/newgem/templates/script/generate +14 -0
- data/{templates → app_generators/newgem/templates}/setup.rb +0 -0
- data/{templates → app_generators/newgem/templates}/spec.opts +0 -0
- data/{templates → app_generators/newgem/templates}/spec.rb +0 -0
- data/app_generators/newgem/templates/tasks/deployment.rake +27 -0
- data/app_generators/newgem/templates/tasks/environment.rake +7 -0
- data/app_generators/newgem/templates/tasks/website.rake +9 -0
- data/{templates → app_generators/newgem/templates}/test.rb +1 -1
- data/app_generators/newgem/templates/test_helper.rb +2 -0
- data/app_generators/newgem/templates/version.rb +9 -0
- data/bin/newgem +9 -272
- data/bundles/RubyGem.tmbundle/Snippets/History header trunk.tmSnippet +18 -0
- data/bundles/RubyGem.tmbundle/Snippets/History header.tmSnippet +18 -0
- data/bundles/RubyGem.tmbundle/Syntaxes/Rdoc.tmLanguage +70 -0
- data/bundles/RubyGem.tmbundle/info.plist +16 -0
- data/config/hoe.rb +48 -0
- data/config/svn_branch.rb +15 -0
- data/lib/newgem.rb +2 -3
- data/lib/newgem/quick_template.rb +28 -0
- data/lib/newgem/tasks.rb +1 -0
- data/lib/newgem/version.rb +1 -1
- data/newgem_generators/install_website/USAGE +5 -0
- data/newgem_generators/install_website/install_website_generator.rb +76 -0
- data/{templates/scripts → newgem_generators/install_website/templates/script}/txt2html +15 -8
- data/newgem_generators/install_website/templates/tasks/website.rake +17 -0
- data/{templates → newgem_generators/install_website/templates}/website/index.html +2 -2
- data/newgem_generators/install_website/templates/website/index.txt +39 -0
- data/newgem_theme_generators/plain/USAGE +5 -0
- data/newgem_theme_generators/plain/plain_generator.rb +54 -0
- data/{templates → newgem_theme_generators/plain/templates}/website/javascripts/rounded_corners_lite.inc.js +0 -0
- data/{templates → newgem_theme_generators/plain/templates}/website/stylesheets/screen.css +0 -0
- data/{templates → newgem_theme_generators/plain/templates}/website/template.rhtml +6 -6
- data/rubygems_generators/application_generator/USAGE +28 -0
- data/rubygems_generators/application_generator/application_generator_generator.rb +58 -0
- data/rubygems_generators/application_generator/templates/bin +12 -0
- data/rubygems_generators/application_generator/templates/generator.rb +51 -0
- data/rubygems_generators/application_generator/templates/readme +24 -0
- data/rubygems_generators/application_generator/templates/test.rb +43 -0
- data/rubygems_generators/application_generator/templates/test_generator_helper.rb +19 -0
- data/rubygems_generators/application_generator/templates/usage +5 -0
- data/rubygems_generators/component_generator/USAGE +29 -0
- data/rubygems_generators/component_generator/component_generator_generator.rb +52 -0
- data/rubygems_generators/component_generator/templates/generator.rb +51 -0
- data/rubygems_generators/component_generator/templates/readme +28 -0
- data/rubygems_generators/component_generator/templates/test.rb +43 -0
- data/rubygems_generators/component_generator/templates/test_generator_helper.rb +19 -0
- data/rubygems_generators/component_generator/templates/usage +5 -0
- data/rubygems_generators/executable/executable_generator.rb +53 -0
- data/rubygems_generators/executable/templates/app.rb +44 -0
- data/rubygems_generators/install_jruby/USAGE +5 -0
- data/rubygems_generators/install_jruby/install_jruby_generator.rb +48 -0
- data/rubygems_generators/install_jruby/templates/tasks/jruby.rake +7 -0
- data/rubygems_generators/install_rspec/USAGE +5 -0
- data/rubygems_generators/install_rspec/install_rspec_generator.rb +55 -0
- data/rubygems_generators/install_rspec/templates/spec.rb +11 -0
- data/rubygems_generators/install_rspec/templates/spec/spec.opts +1 -0
- data/rubygems_generators/install_rspec/templates/spec/spec_helper.rb +7 -0
- data/rubygems_generators/install_rspec/templates/tasks/rspec.rake +21 -0
- data/script/destroy +14 -0
- data/script/generate +14 -0
- data/{scripts → script}/txt2html +3 -3
- data/{scripts → script}/txt2js +0 -0
- data/tasks/bundles.rake +12 -0
- data/tasks/deployment.rake +27 -0
- data/tasks/environment.rake +7 -0
- data/tasks/website.rake +19 -0
- data/test/test_application_generator_generator.rb +60 -0
- data/test/test_executable_generator.rb +28 -0
- data/test/test_generate_component_generator.rb +67 -0
- data/test/test_generator_helper.rb +19 -0
- data/test/test_install_jruby_generator.rb +29 -0
- data/test/test_install_rspec_generator.rb +33 -0
- data/test/test_install_website_generator.rb +50 -0
- data/test/test_newgem_generator.rb +120 -0
- data/test/test_plain_generator.rb +37 -0
- data/website/images/beginning-ruby.jpg +0 -0
- data/website/index.html +8 -6
- data/website/index.txt +4 -2
- data/website/rubyforge.html +3 -3
- data/website/version-raw.js +1 -1
- data/website/version.js +1 -1
- metadata +111 -27
- data/templates/Manifest.txt +0 -15
- data/templates/Rakefile +0 -123
- data/templates/website/index.txt +0 -38
- data/test/test_svn.rb +0 -13
@@ -0,0 +1,27 @@
|
|
1
|
+
desc 'Release the website and new gem version'
|
2
|
+
task :deploy => [:check_version, :generator_report, :website, :release] do
|
3
|
+
puts "Remember to create SVN tag:"
|
4
|
+
puts "svn copy svn+ssh://#{RUBYFORGE_USERNAME}@rubyforge.org/var/svn/#{PATH}/trunk " +
|
5
|
+
"svn+ssh://#{RUBYFORGE_USERNAME}@rubyforge.org/var/svn/#{PATH}/tags/REL-#{VERS} "
|
6
|
+
puts "Suggested comment:"
|
7
|
+
puts "Tagging release #{CHANGES}"
|
8
|
+
end
|
9
|
+
|
10
|
+
desc 'Runs tasks website_generate and install_gem as a local deployment of the gem'
|
11
|
+
task :local_deploy => [:generator_report, :website_generate, :install_gem]
|
12
|
+
|
13
|
+
task :check_version do
|
14
|
+
unless ENV['VERSION']
|
15
|
+
puts 'Must pass a VERSION=x.y.z release version'
|
16
|
+
exit
|
17
|
+
end
|
18
|
+
unless ENV['VERSION'] == VERS
|
19
|
+
puts "Please update your version.rb to match the release version, currently #{VERS}"
|
20
|
+
exit
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
desc 'Install the package as a gem, without generating documentation(ri/rdoc)'
|
25
|
+
task :install_gem_no_doc => [:clean, :package] do
|
26
|
+
sh "#{'sudo ' unless Hoe::WINDOZE }gem install pkg/*.gem --no-rdoc --no-ri"
|
27
|
+
end
|
data/tasks/website.rake
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
desc 'Generate website files'
|
2
|
+
task :website_generate => :ruby_env do
|
3
|
+
(Dir['website/**/*.txt'] - Dir['website/version*.txt']).each do |txt|
|
4
|
+
sh %{ #{RUBY_APP} script/txt2html #{txt} > #{txt.gsub(/txt$/,'html')} }
|
5
|
+
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
|
+
end
|
9
|
+
|
10
|
+
desc 'Upload website files to rubyforge'
|
11
|
+
task :website_upload do
|
12
|
+
host = "#{RUBYFORGE_USERNAME}@rubyforge.org"
|
13
|
+
remote_dir = "/var/www/gforge-projects/#{RUBYFORGE_PROJECT}/"
|
14
|
+
local_dir = 'website'
|
15
|
+
sh %{rsync -aCv #{local_dir}/ #{host}:#{remote_dir}}
|
16
|
+
end
|
17
|
+
|
18
|
+
desc 'Generate and upload website files'
|
19
|
+
task :website => [:website_generate, :website_upload, :publish_docs]
|
@@ -0,0 +1,60 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), "test_generator_helper.rb")
|
2
|
+
|
3
|
+
class TestApplicationGeneratorGenerator < Test::Unit::TestCase
|
4
|
+
include RubiGen::GeneratorTestHelper
|
5
|
+
|
6
|
+
def setup
|
7
|
+
bare_setup
|
8
|
+
end
|
9
|
+
|
10
|
+
def teardown
|
11
|
+
bare_teardown
|
12
|
+
end
|
13
|
+
|
14
|
+
# Some generator-related assertions:
|
15
|
+
# assert_generated_file(name, &block) # block passed the file contents
|
16
|
+
# assert_directory_exists(name)
|
17
|
+
# assert_generated_class(name, &block)
|
18
|
+
# assert_generated_module(name, &block)
|
19
|
+
# assert_generated_test_for(name, &block)
|
20
|
+
# The assert_generated_(class|module|test_for) &block is passed the body of the class/module within the file
|
21
|
+
# assert_has_method(body, *methods) # check that the body has a list of methods (methods with parentheses not supported yet)
|
22
|
+
#
|
23
|
+
# Other helper methods are:
|
24
|
+
# app_root_files - put this in teardown to show files generated by the test method (e.g. p app_root_files)
|
25
|
+
# bare_setup - place this in setup method to create the APP_ROOT folder for each test
|
26
|
+
# bare_teardown - place this in teardown method to destroy the TMP_ROOT or APP_ROOT folder after each test
|
27
|
+
|
28
|
+
def test_generator_without_options
|
29
|
+
name = "mygen"
|
30
|
+
run_generator('application_generator', [name], sources)
|
31
|
+
|
32
|
+
assert_directory_exists "app_generators"
|
33
|
+
assert_directory_exists "app_generators/#{name}"
|
34
|
+
assert_directory_exists "app_generators/#{name}/templates"
|
35
|
+
assert_generated_file "app_generators/#{name}/USAGE"
|
36
|
+
assert_generated_class "app_generators/#{name}/#{name}_generator" do |body|
|
37
|
+
assert_has_method "manifest"
|
38
|
+
end
|
39
|
+
assert_generated_test_for("#{name}_generator") do |body|
|
40
|
+
assert_has_method body, "setup"
|
41
|
+
assert_has_method body, "teardown"
|
42
|
+
assert_has_method body, "test_generator_without_options"
|
43
|
+
assert_has_method body, "sources"
|
44
|
+
assert_has_method body, "generator_path"
|
45
|
+
end
|
46
|
+
|
47
|
+
assert_directory_exists "bin"
|
48
|
+
assert_generated_file "bin/#{name}"
|
49
|
+
end
|
50
|
+
|
51
|
+
private
|
52
|
+
def sources
|
53
|
+
[RubiGen::PathSource.new(:test, File.join(File.dirname(__FILE__),"..", generator_path))
|
54
|
+
]
|
55
|
+
end
|
56
|
+
|
57
|
+
def generator_path
|
58
|
+
"rubygems_generators"
|
59
|
+
end
|
60
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), "test_generator_helper.rb")
|
2
|
+
|
3
|
+
class TestExecutableGenerator < Test::Unit::TestCase
|
4
|
+
include RubiGen::GeneratorTestHelper
|
5
|
+
|
6
|
+
def setup
|
7
|
+
rubygems_setup
|
8
|
+
end
|
9
|
+
|
10
|
+
def teardown
|
11
|
+
rubygems_teardown
|
12
|
+
end
|
13
|
+
|
14
|
+
def test_generator_without_options
|
15
|
+
app_name = "myapp"
|
16
|
+
run_generator('executable', [app_name], sources)
|
17
|
+
assert_generated_file("bin/#{app_name}")
|
18
|
+
end
|
19
|
+
|
20
|
+
def sources
|
21
|
+
[RubiGen::PathSource.new(:test, File.join(File.dirname(__FILE__),"..", generator_path))
|
22
|
+
]
|
23
|
+
end
|
24
|
+
|
25
|
+
def generator_path
|
26
|
+
"rubygems_generators"
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), "test_generator_helper.rb")
|
2
|
+
|
3
|
+
class TestGenerateComponentGenerator < Test::Unit::TestCase
|
4
|
+
include RubiGen::GeneratorTestHelper
|
5
|
+
|
6
|
+
def setup
|
7
|
+
rubygems_setup
|
8
|
+
end
|
9
|
+
|
10
|
+
def teardown
|
11
|
+
rubygems_teardown
|
12
|
+
end
|
13
|
+
|
14
|
+
def test_generator_without_options
|
15
|
+
app_name = "myapp"
|
16
|
+
run_generator('component_generator', [app_name], sources)
|
17
|
+
assert_generated_file("generators/#{app_name}/#{app_name}_generator.rb")
|
18
|
+
assert_generated_file("generators/#{app_name}/USAGE")
|
19
|
+
assert_generated_file("test/test_#{app_name}_generator.rb")
|
20
|
+
assert_generated_file("test/test_generator_helper.rb")
|
21
|
+
assert_directory_exists("generators/#{app_name}/templates")
|
22
|
+
assert_generated_class("generators/#{app_name}/#{app_name}_generator") do |body|
|
23
|
+
# assert_has_method body, "initialize" # as_has_m cannot pickup initialize(...) only initialize
|
24
|
+
assert_has_method body, "manifest"
|
25
|
+
end
|
26
|
+
assert_generated_class("test/test_#{app_name}_generator") do |body|
|
27
|
+
assert_has_method body, "setup"
|
28
|
+
assert_has_method body, "teardown"
|
29
|
+
assert_has_method body, "test_generator_without_options"
|
30
|
+
assert_has_method body, "sources"
|
31
|
+
assert_has_method body, "generator_path"
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def test_generator_with_generator_type
|
36
|
+
app_name = "myapp"
|
37
|
+
gen_type = "fooapp"
|
38
|
+
run_generator('component_generator', [app_name, gen_type], sources)
|
39
|
+
|
40
|
+
assert_generated_file "#{gen_type}_generators/#{app_name}/#{app_name}_generator.rb"
|
41
|
+
assert_generated_file "#{gen_type}_generators/#{app_name}/USAGE"
|
42
|
+
assert_generated_file "test/test_#{app_name}_generator.rb"
|
43
|
+
assert_generated_file "test/test_generator_helper.rb"
|
44
|
+
assert_directory_exists "#{gen_type}_generators/#{app_name}/templates"
|
45
|
+
assert_generated_class "#{gen_type}_generators/#{app_name}/#{app_name}_generator" do |body|
|
46
|
+
# assert_has_method body, "initialize" # as_has_m cannot pickup initialize(...) only initialize
|
47
|
+
assert_has_method body, "manifest"
|
48
|
+
end
|
49
|
+
assert_generated_class "test/test_#{app_name}_generator" do |body|
|
50
|
+
assert_has_method body, "setup"
|
51
|
+
assert_has_method body, "teardown"
|
52
|
+
assert_has_method body, "test_generator_without_options"
|
53
|
+
assert_has_method body, "sources"
|
54
|
+
assert_has_method body, "generator_path"
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
private
|
59
|
+
def sources
|
60
|
+
[RubiGen::PathSource.new(:test, File.join(File.dirname(__FILE__),"../#{generator_path}"))
|
61
|
+
]
|
62
|
+
end
|
63
|
+
|
64
|
+
def generator_path
|
65
|
+
"rubygems_generators"
|
66
|
+
end
|
67
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/test_helper'
|
2
|
+
require 'fileutils'
|
3
|
+
|
4
|
+
# Must set before requiring generator libs.
|
5
|
+
TMP_ROOT = File.dirname(__FILE__) + "/tmp" unless defined?(TMP_ROOT)
|
6
|
+
app_root = File.join(TMP_ROOT, "myproject")
|
7
|
+
if defined?(APP_ROOT)
|
8
|
+
APP_ROOT.replace(app_root)
|
9
|
+
else
|
10
|
+
APP_ROOT = app_root
|
11
|
+
end
|
12
|
+
|
13
|
+
begin
|
14
|
+
require 'rubigen'
|
15
|
+
rescue LoadError
|
16
|
+
require 'rubygems'
|
17
|
+
require 'rubigen'
|
18
|
+
end
|
19
|
+
require 'rubigen/helpers/generator_test_helper'
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), "test_generator_helper.rb")
|
2
|
+
|
3
|
+
class TestInstallJrubyGenerator < Test::Unit::TestCase
|
4
|
+
include RubiGen::GeneratorTestHelper
|
5
|
+
|
6
|
+
def setup
|
7
|
+
# see rubygems_setup
|
8
|
+
end
|
9
|
+
|
10
|
+
def teardown
|
11
|
+
# see rubygems_teardown
|
12
|
+
end
|
13
|
+
|
14
|
+
def test_generator_without_options
|
15
|
+
name = "myapp"
|
16
|
+
run_generator('install_jruby', [name], sources)
|
17
|
+
assert_generated_file("tasks/jruby.rake")
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
def sources
|
22
|
+
[RubiGen::PathSource.new(:test, File.join(File.dirname(__FILE__),"..", generator_path))
|
23
|
+
]
|
24
|
+
end
|
25
|
+
|
26
|
+
def generator_path
|
27
|
+
"rubygems_generators"
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), "test_generator_helper.rb")
|
2
|
+
|
3
|
+
class TestInstallRspecGenerator < Test::Unit::TestCase
|
4
|
+
include RubiGen::GeneratorTestHelper
|
5
|
+
|
6
|
+
def setup
|
7
|
+
rubygems_setup
|
8
|
+
end
|
9
|
+
|
10
|
+
def teardown
|
11
|
+
rubygems_teardown
|
12
|
+
end
|
13
|
+
|
14
|
+
def test_generator_without_options
|
15
|
+
name = File.basename(File.expand_path(APP_ROOT))
|
16
|
+
run_generator('install_rspec', [name], sources)
|
17
|
+
assert_directory_exists("spec")
|
18
|
+
assert_directory_exists("tasks")
|
19
|
+
assert_generated_file("spec/#{name}_spec.rb")
|
20
|
+
assert_generated_file("spec/spec_helper.rb")
|
21
|
+
assert_generated_file("tasks/rspec.rake")
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
def sources
|
26
|
+
[RubiGen::PathSource.new(:test, File.join(File.dirname(__FILE__),"..", generator_path))
|
27
|
+
]
|
28
|
+
end
|
29
|
+
|
30
|
+
def generator_path
|
31
|
+
"rubygems_generators"
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), "test_generator_helper.rb")
|
2
|
+
|
3
|
+
class TestInstallWebsiteGenerator < Test::Unit::TestCase
|
4
|
+
include RubiGen::GeneratorTestHelper
|
5
|
+
|
6
|
+
def setup
|
7
|
+
rubygems_setup
|
8
|
+
end
|
9
|
+
|
10
|
+
def teardown
|
11
|
+
rubygems_teardown
|
12
|
+
end
|
13
|
+
|
14
|
+
def test_generator_without_options
|
15
|
+
name = "myapp"
|
16
|
+
run_generator(generator_name, ['.'], sources)
|
17
|
+
|
18
|
+
%w[index.txt index.html template.rhtml stylesheets/screen.css javascripts/rounded_corners_lite.inc.js].each do |file|
|
19
|
+
assert_generated_file("website/#{file}")
|
20
|
+
end
|
21
|
+
assert_generated_file("script/txt2html")
|
22
|
+
assert_generated_file("tasks/website.rake")
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_generator_in_subfolder
|
26
|
+
name = "myapp"
|
27
|
+
subfolder = "subfolder"
|
28
|
+
run_generator(generator_name, ['.'], sources, {:destination => "#{APP_ROOT}/#{subfolder}"})
|
29
|
+
|
30
|
+
%w[index.txt index.html stylesheets/screen.css javascripts/rounded_corners_lite.inc.js].each do |file|
|
31
|
+
assert_generated_file("#{subfolder}/website/#{file}")
|
32
|
+
end
|
33
|
+
assert_generated_file("#{subfolder}/script/txt2html")
|
34
|
+
end
|
35
|
+
|
36
|
+
private
|
37
|
+
def sources
|
38
|
+
[ RubiGen::PathSource.new(:test, File.join(File.dirname(__FILE__),"..", generator_path)),
|
39
|
+
RubiGen::PathSource.new(:test, File.join(File.dirname(__FILE__), "..", "newgem_theme_generators"))
|
40
|
+
]
|
41
|
+
end
|
42
|
+
|
43
|
+
def generator_path
|
44
|
+
"newgem_generators"
|
45
|
+
end
|
46
|
+
|
47
|
+
def generator_name
|
48
|
+
'install_website'
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,120 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), "test_generator_helper.rb")
|
2
|
+
|
3
|
+
class TestNewgemGenerator < Test::Unit::TestCase
|
4
|
+
include RubiGen::GeneratorTestHelper
|
5
|
+
|
6
|
+
attr_reader :gem_name
|
7
|
+
def setup
|
8
|
+
bare_setup
|
9
|
+
@gem_name = File.basename(File.expand_path(APP_ROOT))
|
10
|
+
end
|
11
|
+
|
12
|
+
def teardown
|
13
|
+
bare_teardown
|
14
|
+
end
|
15
|
+
|
16
|
+
def test_newgem
|
17
|
+
run_generator('newgem', [APP_ROOT], sources)
|
18
|
+
|
19
|
+
assert_directory_exists "config"
|
20
|
+
assert_directory_exists "lib"
|
21
|
+
assert_directory_exists "log"
|
22
|
+
assert_directory_exists "tasks"
|
23
|
+
assert_directory_exists "test"
|
24
|
+
|
25
|
+
%w[Rakefile README.txt History.txt License.txt Manifest.txt].each do |file|
|
26
|
+
assert_generated_file(file)
|
27
|
+
end
|
28
|
+
|
29
|
+
%w[hoe.rb requirements.rb].each do |file|
|
30
|
+
assert_generated_file("config/#{file}")
|
31
|
+
end
|
32
|
+
|
33
|
+
assert_generated_file("lib/#{gem_name}.rb")
|
34
|
+
assert_generated_file("lib/#{gem_name}/version.rb")
|
35
|
+
|
36
|
+
["test_helper.rb", "test_#{gem_name}.rb"].each do |file|
|
37
|
+
assert_generated_file("test/#{file}")
|
38
|
+
end
|
39
|
+
|
40
|
+
%w[generate destroy].each do |file|
|
41
|
+
assert_generated_file("script/#{file}")
|
42
|
+
end
|
43
|
+
|
44
|
+
assert_generated_module("lib/#{gem_name}")
|
45
|
+
|
46
|
+
%w[deployment environment website].each do |file|
|
47
|
+
assert_generated_file("tasks/#{file}.rake")
|
48
|
+
end
|
49
|
+
|
50
|
+
assert_manifest_complete
|
51
|
+
end
|
52
|
+
|
53
|
+
def test_newgem_with_website
|
54
|
+
run_generator('newgem', [APP_ROOT], sources, {:website => true})
|
55
|
+
|
56
|
+
%w[txt2html].each do |file|
|
57
|
+
assert_generated_file("script/#{file}")
|
58
|
+
end
|
59
|
+
|
60
|
+
%w[index.txt index.html template.rhtml stylesheets/screen.css javascripts/rounded_corners_lite.inc.js].each do |file|
|
61
|
+
assert_generated_file("website/#{file}")
|
62
|
+
end
|
63
|
+
|
64
|
+
assert_manifest_complete
|
65
|
+
end
|
66
|
+
|
67
|
+
def test_newgem_with_executable
|
68
|
+
@executables = ["some_executable", "another"]
|
69
|
+
run_generator('newgem', [APP_ROOT], sources, {:bin_name => @executables.join(',')})
|
70
|
+
|
71
|
+
@executables.each do |exec|
|
72
|
+
assert_generated_file("bin/#{exec}")
|
73
|
+
end
|
74
|
+
|
75
|
+
assert_manifest_complete
|
76
|
+
end
|
77
|
+
|
78
|
+
def test_newgem_with_rspec
|
79
|
+
run_generator('newgem', [APP_ROOT], sources, {:test_framework => "rspec"})
|
80
|
+
|
81
|
+
assert_directory_exists("spec")
|
82
|
+
assert_directory_exists("tasks")
|
83
|
+
assert_generated_file("spec/#{gem_name}_spec.rb")
|
84
|
+
assert_generated_file("spec/spec_helper.rb")
|
85
|
+
assert_generated_file("tasks/rspec.rake")
|
86
|
+
|
87
|
+
assert_manifest_complete
|
88
|
+
end
|
89
|
+
|
90
|
+
def test_newgem_with_jruby
|
91
|
+
run_generator('newgem', [APP_ROOT], sources, {:jruby => true})
|
92
|
+
|
93
|
+
assert_directory_exists("tasks")
|
94
|
+
assert_generated_file("tasks/jruby.rake")
|
95
|
+
|
96
|
+
assert_manifest_complete
|
97
|
+
end
|
98
|
+
|
99
|
+
private
|
100
|
+
def sources
|
101
|
+
[ RubiGen::PathSource.new(:test, File.join(File.dirname(__FILE__),"..", generator_path)),
|
102
|
+
RubiGen::PathSource.new(:test, File.join(File.dirname(__FILE__), "..", "newgem_generators")),
|
103
|
+
RubiGen::PathSource.new(:test, File.join(File.dirname(__FILE__), "..", "newgem_theme_generators")),
|
104
|
+
RubiGen::PathSource.new(:test, File.join(File.dirname(__FILE__), "..", "rubygems_generators"))
|
105
|
+
]
|
106
|
+
end
|
107
|
+
|
108
|
+
def generator_path
|
109
|
+
"app_generators"
|
110
|
+
end
|
111
|
+
|
112
|
+
def assert_manifest_complete
|
113
|
+
files = app_root_files.sort
|
114
|
+
files.reject! { |file| File.directory?(file) }
|
115
|
+
files.map! { |path| path.sub("#{APP_ROOT}/","") }
|
116
|
+
files.reject! { |file| /^#{APP_ROOT}/ =~ file }
|
117
|
+
manifest_files = File.open("#{APP_ROOT}/Manifest.txt","r") { |f| f.readlines.map { |line| line.strip } }
|
118
|
+
assert_equal(files, manifest_files)
|
119
|
+
end
|
120
|
+
end
|