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
data/History.txt
CHANGED
@@ -1,3 +1,45 @@
|
|
1
|
+
== 0.13.0 2007-08-20
|
2
|
+
|
3
|
+
* HIGHLIGHT - RubiGen integration - using a Rails-like generator
|
4
|
+
* Now, each RubyGem has script/generate to access Rails-like generators too!!!
|
5
|
+
* newgem can be run ontop of existing RubyGems and all is not destroyed!
|
6
|
+
* Various included generators (application_generator, component_generator)
|
7
|
+
* Website creation is now a generator, and is optionally included via newgem -w
|
8
|
+
* Rspec support is now a generator, and is optionally included via newgem -t rspec
|
9
|
+
* JRuby support is now a generator, and is optionally included via newgem -j
|
10
|
+
* The Rakefile is now <5 lines - all config is in config/hoe.rb
|
11
|
+
* Generated gems:
|
12
|
+
* Started to add jruby specific features (-j option)
|
13
|
+
* Gems named xxx-1.2.3-jruby.gem
|
14
|
+
* Includes: require 'java'
|
15
|
+
* Add link to website for Using New Gem on Windows (without cygwin) [thx Jorge Cangas]
|
16
|
+
* index.txt "email me" now refers to forum url as well
|
17
|
+
* NewGem
|
18
|
+
* An error message is shown if Hoe gem isn't available when running rake on the gem
|
19
|
+
* Lots of tasks refactored into /tasks folder
|
20
|
+
* How To UPGRADE
|
21
|
+
* NOTE: We've never had a "How to Upgrade" before! :)
|
22
|
+
* Copy your Rakefile to Rakefile.old (to retain your configuration)
|
23
|
+
* Run: newgem .
|
24
|
+
* Press 'a' to allow all changes.
|
25
|
+
* Open config/hoe.rb
|
26
|
+
* Replace this with the equivalent lines/details from Rakefile.old
|
27
|
+
* Test all is well with "rake -T" and "rake check_manifest" (the manifest should have
|
28
|
+
been rebuilt by 'newgem .')
|
29
|
+
|
30
|
+
== 0.12.0 2007-06-24
|
31
|
+
|
32
|
+
* 2 major enhancement
|
33
|
+
* Using Erb for templates [thx http://snippets.dzone.com/posts/show/1723]
|
34
|
+
* RubyGem.tmbundle for TextMate - to install go to gem folder and run "rake bundles:tm"
|
35
|
+
* 1 minor enhancement
|
36
|
+
* -V option shows current newgem version [thx Gert Goet]
|
37
|
+
* Hoe#extra_deps permanently changes @extra_deps [thx MIYAMUKO Katsuyuki]
|
38
|
+
* Dev improvements
|
39
|
+
* Imports svn_branch for svn rake tasks
|
40
|
+
* Minor website changes
|
41
|
+
* Added link to Topfunky's tutorial on Hoe
|
42
|
+
|
1
43
|
== 0.11.0
|
2
44
|
|
3
45
|
* 1 major enhancement
|
data/Manifest.txt
CHANGED
@@ -4,31 +4,98 @@ Manifest.txt
|
|
4
4
|
README.txt
|
5
5
|
Rakefile
|
6
6
|
Todo.txt
|
7
|
+
app_generators/newgem/newgem_generator.rb
|
8
|
+
app_generators/newgem/templates/History.txt
|
9
|
+
app_generators/newgem/templates/License.txt
|
10
|
+
app_generators/newgem/templates/README.txt
|
11
|
+
app_generators/newgem/templates/Rakefile
|
12
|
+
app_generators/newgem/templates/app.rb
|
13
|
+
app_generators/newgem/templates/config/hoe.rb
|
14
|
+
app_generators/newgem/templates/config/requirements.rb
|
15
|
+
app_generators/newgem/templates/empty.log
|
16
|
+
app_generators/newgem/templates/module.rb
|
17
|
+
app_generators/newgem/templates/script/destroy
|
18
|
+
app_generators/newgem/templates/script/generate
|
19
|
+
app_generators/newgem/templates/setup.rb
|
20
|
+
app_generators/newgem/templates/spec.opts
|
21
|
+
app_generators/newgem/templates/spec.rb
|
22
|
+
app_generators/newgem/templates/tasks/deployment.rake
|
23
|
+
app_generators/newgem/templates/tasks/environment.rake
|
24
|
+
app_generators/newgem/templates/tasks/website.rake
|
25
|
+
app_generators/newgem/templates/test.rb
|
26
|
+
app_generators/newgem/templates/test_helper.rb
|
27
|
+
app_generators/newgem/templates/version.rb
|
7
28
|
bin/newgem
|
29
|
+
bundles/RubyGem.tmbundle/Snippets/History header trunk.tmSnippet
|
30
|
+
bundles/RubyGem.tmbundle/Snippets/History header.tmSnippet
|
31
|
+
bundles/RubyGem.tmbundle/Syntaxes/Rdoc.tmLanguage
|
32
|
+
bundles/RubyGem.tmbundle/info.plist
|
33
|
+
config/hoe.rb
|
34
|
+
config/svn_branch.rb
|
8
35
|
install.rb
|
9
36
|
lib/newgem.rb
|
37
|
+
lib/newgem/quick_template.rb
|
10
38
|
lib/newgem/rubyforge.rb
|
39
|
+
lib/newgem/tasks.rb
|
11
40
|
lib/newgem/version.rb
|
12
|
-
|
13
|
-
|
41
|
+
newgem_generators/install_website/USAGE
|
42
|
+
newgem_generators/install_website/install_website_generator.rb
|
43
|
+
newgem_generators/install_website/templates/script/txt2html
|
44
|
+
newgem_generators/install_website/templates/tasks/website.rake
|
45
|
+
newgem_generators/install_website/templates/website/index.html
|
46
|
+
newgem_generators/install_website/templates/website/index.txt
|
47
|
+
newgem_theme_generators/plain/USAGE
|
48
|
+
newgem_theme_generators/plain/plain_generator.rb
|
49
|
+
newgem_theme_generators/plain/templates/website/javascripts/rounded_corners_lite.inc.js
|
50
|
+
newgem_theme_generators/plain/templates/website/stylesheets/screen.css
|
51
|
+
newgem_theme_generators/plain/templates/website/template.rhtml
|
52
|
+
rubygems_generators/application_generator/USAGE
|
53
|
+
rubygems_generators/application_generator/application_generator_generator.rb
|
54
|
+
rubygems_generators/application_generator/templates/bin
|
55
|
+
rubygems_generators/application_generator/templates/generator.rb
|
56
|
+
rubygems_generators/application_generator/templates/readme
|
57
|
+
rubygems_generators/application_generator/templates/test.rb
|
58
|
+
rubygems_generators/application_generator/templates/test_generator_helper.rb
|
59
|
+
rubygems_generators/application_generator/templates/usage
|
60
|
+
rubygems_generators/component_generator/USAGE
|
61
|
+
rubygems_generators/component_generator/component_generator_generator.rb
|
62
|
+
rubygems_generators/component_generator/templates/generator.rb
|
63
|
+
rubygems_generators/component_generator/templates/readme
|
64
|
+
rubygems_generators/component_generator/templates/test.rb
|
65
|
+
rubygems_generators/component_generator/templates/test_generator_helper.rb
|
66
|
+
rubygems_generators/component_generator/templates/usage
|
67
|
+
rubygems_generators/executable/executable_generator.rb
|
68
|
+
rubygems_generators/executable/templates/app.rb
|
69
|
+
rubygems_generators/install_jruby/USAGE
|
70
|
+
rubygems_generators/install_jruby/install_jruby_generator.rb
|
71
|
+
rubygems_generators/install_jruby/templates/tasks/jruby.rake
|
72
|
+
rubygems_generators/install_rspec/USAGE
|
73
|
+
rubygems_generators/install_rspec/install_rspec_generator.rb
|
74
|
+
rubygems_generators/install_rspec/templates/spec.rb
|
75
|
+
rubygems_generators/install_rspec/templates/spec/spec.opts
|
76
|
+
rubygems_generators/install_rspec/templates/spec/spec_helper.rb
|
77
|
+
rubygems_generators/install_rspec/templates/tasks/rspec.rake
|
78
|
+
script/destroy
|
79
|
+
script/generate
|
80
|
+
script/txt2html
|
81
|
+
script/txt2js
|
14
82
|
setup.rb
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
templates/spec.rb
|
24
|
-
templates/test.rb
|
25
|
-
templates/website/index.html
|
26
|
-
templates/website/index.txt
|
27
|
-
templates/website/javascripts/rounded_corners_lite.inc.js
|
28
|
-
templates/website/stylesheets/screen.css
|
29
|
-
templates/website/template.rhtml
|
83
|
+
tasks/bundles.rake
|
84
|
+
tasks/deployment.rake
|
85
|
+
tasks/environment.rake
|
86
|
+
tasks/website.rake
|
87
|
+
test/test_application_generator_generator.rb
|
88
|
+
test/test_executable_generator.rb
|
89
|
+
test/test_generate_component_generator.rb
|
90
|
+
test/test_generator_helper.rb
|
30
91
|
test/test_helper.rb
|
92
|
+
test/test_install_jruby_generator.rb
|
93
|
+
test/test_install_rspec_generator.rb
|
94
|
+
test/test_install_website_generator.rb
|
31
95
|
test/test_newgem.rb
|
96
|
+
test/test_newgem_generator.rb
|
97
|
+
test/test_plain_generator.rb
|
98
|
+
website/images/beginning-ruby.jpg
|
32
99
|
website/index.html
|
33
100
|
website/index.txt
|
34
101
|
website/javascripts/rounded_corners_lite.inc.js
|
data/README.txt
CHANGED
@@ -28,7 +28,7 @@ creating: wizzo
|
|
28
28
|
creating: wizzo/CHANGELOG.txt
|
29
29
|
creating: wizzo/README.txt
|
30
30
|
creating: wizzo/lib
|
31
|
-
creating: wizzo/
|
31
|
+
creating: wizzo/script
|
32
32
|
creating: wizzo/website
|
33
33
|
creating: wizzo/website/javascripts
|
34
34
|
creating: wizzo/website/stylesheets
|
@@ -44,7 +44,8 @@ creating: wizzo/setup.rb
|
|
44
44
|
creating: wizzo/Rakefile
|
45
45
|
creating: wizzo/Manifest.txt
|
46
46
|
creating: wizzo/History.txt
|
47
|
-
creating: wizzo/
|
47
|
+
creating: wizzo/script/generate
|
48
|
+
creating: wizzo/script/txt2html
|
48
49
|
creating: wizzo/website/index.txt
|
49
50
|
creating: wizzo/website/template.rhtml
|
50
51
|
copying: wizzo/website/javascripts/rounded_corners_lite.inc.js
|
data/Rakefile
CHANGED
@@ -1,113 +1,11 @@
|
|
1
1
|
require 'rubygems'
|
2
2
|
require 'rake'
|
3
3
|
require 'rake/clean'
|
4
|
-
require 'rake/testtask'
|
5
|
-
require 'rake/packagetask'
|
6
|
-
require 'rake/gempackagetask'
|
7
|
-
require 'rake/rdoctask'
|
8
|
-
require 'rake/contrib/rubyforgepublisher'
|
9
4
|
require 'fileutils'
|
10
|
-
require 'hoe'
|
11
5
|
include FileUtils
|
12
|
-
require File.join(File.dirname(__FILE__), 'lib', 'newgem', 'version')
|
13
6
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
config = YAML.load(File.read(File.expand_path("~/.rubyforge/user-config.yml")))
|
19
|
-
RUBYFORGE_USERNAME = config["username"]
|
20
|
-
RUBYFORGE_PROJECT = "newgem"
|
21
|
-
HOMEPATH = "http://#{RUBYFORGE_PROJECT}.rubyforge.org"
|
22
|
-
DOWNLOAD_PATH = "http://rubyforge.org/projects/#{RUBYFORGE_PROJECT}"
|
7
|
+
$:.unshift 'lib'
|
8
|
+
require 'config/hoe' # setup Hoe + all gem configuration
|
9
|
+
require 'config/svn_branch' # install svn_branch tasks if gem available
|
10
|
+
require 'newgem/tasks' # load /tasks/*.rake
|
23
11
|
|
24
|
-
REV = nil #File.read(".svn/entries")[/committed-rev="(\d+)"/, 1] rescue nil
|
25
|
-
# REV = `svn info`.each {|line| if line =~ /^Revision:/ then k,v = line.split(': '); break v.chomp; else next; end} rescue nil
|
26
|
-
VERS = Newgem::VERSION::STRING + (REV ? ".#{REV}" : "")
|
27
|
-
CLEAN.include ['**/.*.sw?', '*.gem', '.config', '**/.DS_Store']
|
28
|
-
RDOC_OPTS = ['--quiet', '--title', "newgem documentation",
|
29
|
-
"--opname", "index.html",
|
30
|
-
"--line-numbers",
|
31
|
-
"--main", "README",
|
32
|
-
"--inline-source"]
|
33
|
-
|
34
|
-
# Generate all the Rake tasks
|
35
|
-
# Run 'rake -T' to see list of generated tasks (from gem root directory)
|
36
|
-
hoe = Hoe.new(GEM_NAME, VERS) do |p|
|
37
|
-
p.author = AUTHOR
|
38
|
-
p.description = DESCRIPTION
|
39
|
-
p.email = EMAIL
|
40
|
-
p.summary = DESCRIPTION
|
41
|
-
p.url = HOMEPATH
|
42
|
-
p.rubyforge_name = RUBYFORGE_PROJECT if RUBYFORGE_PROJECT
|
43
|
-
p.test_globs = ["test/**/test*.rb"]
|
44
|
-
p.clean_globs |= CLEAN #An array of file patterns to delete on clean.
|
45
|
-
|
46
|
-
# == Optional
|
47
|
-
p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
|
48
|
-
p.extra_deps = [
|
49
|
-
['hoe', '>=1.2.1'],
|
50
|
-
['RedCloth','>=3.0.4'],
|
51
|
-
['syntax','>=1.0.0'],
|
52
|
-
['activesupport','>=1.4.2']
|
53
|
-
]
|
54
|
-
#p.spec_extras - A hash of extra values to set in the gemspec.
|
55
|
-
end
|
56
|
-
|
57
|
-
CHANGES = hoe.paragraphs_of('History.txt', 0..1).join("\n\n")
|
58
|
-
PATH = (RUBYFORGE_PROJECT == GEM_NAME) ? RUBYFORGE_PROJECT : "\#{RUBYFORGE_PROJECT}/\#{GEM_NAME}"
|
59
|
-
hoe.remote_rdoc_dir = File.join(PATH.gsub(/^#{RUBYFORGE_PROJECT}\/?/,''), 'rdoc')
|
60
|
-
|
61
|
-
desc 'Generate website files'
|
62
|
-
task :website_generate => :load_consts do
|
63
|
-
(Dir['website/**/*.txt'] - Dir['website/version*.txt']).each do |txt|
|
64
|
-
sh %{ ruby scripts/txt2html #{txt} > #{txt.gsub(/txt$/,'html')} }
|
65
|
-
end
|
66
|
-
sh %{ ruby scripts/txt2js website/version.txt > website/version.js }
|
67
|
-
sh %{ ruby scripts/txt2js website/version-raw.txt > website/version-raw.js }
|
68
|
-
end
|
69
|
-
|
70
|
-
desc 'Upload website files to rubyforge'
|
71
|
-
task :website_upload do
|
72
|
-
config = YAML.load(File.read(File.expand_path("~/.rubyforge/user-config.yml")))
|
73
|
-
host = "#{config["username"]}@rubyforge.org"
|
74
|
-
remote_dir = "/var/www/gforge-projects/#{RUBYFORGE_PROJECT}/"
|
75
|
-
local_dir = 'website'
|
76
|
-
sh %{rsync -aCv #{local_dir}/ #{host}:#{remote_dir}}
|
77
|
-
end
|
78
|
-
|
79
|
-
desc 'Generate and upload website files'
|
80
|
-
task :website => [:website_generate, :website_upload, :publish_docs]
|
81
|
-
|
82
|
-
task :load_consts do
|
83
|
-
ENV['AUTHOR'] = AUTHOR
|
84
|
-
ENV['EMAIL'] = EMAIL
|
85
|
-
ENV['DESCRIPTION'] = DESCRIPTION
|
86
|
-
ENV['GEM_NAME'] = GEM_NAME
|
87
|
-
ENV['RUBYFORGE_PROJECT'] = RUBYFORGE_PROJECT
|
88
|
-
ENV['HOMEPATH'] = HOMEPATH
|
89
|
-
ENV['DOWNLOAD_PATH'] = DOWNLOAD_PATH
|
90
|
-
end
|
91
|
-
|
92
|
-
desc 'Release the website and new gem version'
|
93
|
-
task :deploy => [:check_version, :website, :release] do
|
94
|
-
puts "Remember to create SVN tag:"
|
95
|
-
puts "svn copy svn+ssh://#{RUBYFORGE_USERNAME}@rubyforge.org/var/svn/#{PATH}/trunk " +
|
96
|
-
"svn+ssh://#{RUBYFORGE_USERNAME}@rubyforge.org/var/svn/#{PATH}/tags/REL-#{VERS} "
|
97
|
-
puts "Suggested comment:"
|
98
|
-
puts "Tagging release #{CHANGES}"
|
99
|
-
end
|
100
|
-
|
101
|
-
desc 'Runs tasks website_generate and install_gem as a local deployment of the gem'
|
102
|
-
task :local_deploy => [:website_generate, :install_gem]
|
103
|
-
|
104
|
-
task :check_version do
|
105
|
-
unless ENV['VERSION']
|
106
|
-
puts 'Must pass a VERSION=x.y.z release version'
|
107
|
-
exit
|
108
|
-
end
|
109
|
-
unless ENV['VERSION'] == VERS
|
110
|
-
puts "Please update your version.rb to match the release version, currently #{VERS}"
|
111
|
-
exit
|
112
|
-
end
|
113
|
-
end
|
data/Todo.txt
CHANGED
@@ -1,4 +1,4 @@
|
|
1
1
|
== Todo list
|
2
2
|
* can generate rspec default tests (or still test::unit tests) using --with-test=rspec [thx Robby Russell]
|
3
3
|
* website components are now optional (-w/--no-website)
|
4
|
-
*
|
4
|
+
* release name generator ("red moom", "flying leopard")
|
@@ -0,0 +1,172 @@
|
|
1
|
+
require 'rbconfig'
|
2
|
+
|
3
|
+
class NewgemGenerator < RubiGen::Base
|
4
|
+
DEFAULT_SHEBANG = File.join(Config::CONFIG['bindir'],
|
5
|
+
Config::CONFIG['ruby_install_name'])
|
6
|
+
|
7
|
+
default_options :shebang => DEFAULT_SHEBANG,
|
8
|
+
:bin_name => nil,
|
9
|
+
:email => nil,
|
10
|
+
:author => nil,
|
11
|
+
:import_path => nil,
|
12
|
+
:jruby => nil,
|
13
|
+
:test_framework => 'test::unit',
|
14
|
+
:version => '0.0.1',
|
15
|
+
:website => false
|
16
|
+
|
17
|
+
|
18
|
+
attr_reader :gem_name, :module_name
|
19
|
+
attr_reader :version, :version_str, :author, :email
|
20
|
+
|
21
|
+
# extensions/option
|
22
|
+
attr_reader :test_framework
|
23
|
+
attr_reader :bin_names_list
|
24
|
+
attr_reader :website
|
25
|
+
attr_reader :manifest
|
26
|
+
attr_reader :is_jruby
|
27
|
+
|
28
|
+
def initialize(runtime_args, runtime_options = {})
|
29
|
+
super
|
30
|
+
usage if args.empty?
|
31
|
+
@destination_root = args.shift
|
32
|
+
@gem_name = File.basename(File.expand_path(@destination_root))
|
33
|
+
@module_name = gem_name.camelize
|
34
|
+
extract_options
|
35
|
+
end
|
36
|
+
|
37
|
+
def manifest
|
38
|
+
# Use /usr/bin/env if no special shebang was specified
|
39
|
+
script_options = { :chmod => 0755, :shebang => options[:shebang] == DEFAULT_SHEBANG ? nil : options[:shebang] }
|
40
|
+
dispatcher_options = { :chmod => 0755, :shebang => options[:shebang] }
|
41
|
+
windows = (RUBY_PLATFORM =~ /dos|win32|cygwin/i) || (RUBY_PLATFORM =~ /(:?mswin|mingw)/)
|
42
|
+
|
43
|
+
record do |m|
|
44
|
+
# Root directory and all subdirectories.
|
45
|
+
m.directory ''
|
46
|
+
BASEDIRS.each { |path| m.directory path }
|
47
|
+
|
48
|
+
m.directory "lib/#{gem_name}"
|
49
|
+
|
50
|
+
# Root
|
51
|
+
m.template_copy_each %w( History.txt License.txt Rakefile README.txt )
|
52
|
+
m.file_copy_each %w( setup.rb )
|
53
|
+
|
54
|
+
# Default module for app
|
55
|
+
m.template "module.rb", "lib/#{gem_name}.rb"
|
56
|
+
m.template "version.rb", "lib/#{gem_name}/version.rb"
|
57
|
+
|
58
|
+
# Config
|
59
|
+
m.template_copy_each %w( hoe.rb requirements.rb ), "config"
|
60
|
+
|
61
|
+
# Scripts
|
62
|
+
%w( generate destroy ).each do |file|
|
63
|
+
m.template "script/#{file}", "script/#{file}", script_options
|
64
|
+
m.template "script/win_script.cmd", "script/#{file}.cmd",
|
65
|
+
:assigns => { :filename => file } if windows
|
66
|
+
end
|
67
|
+
|
68
|
+
%w(debug).each { |file|
|
69
|
+
m.file "empty.log", "log/#{file}.log", :chmod => 0666
|
70
|
+
}
|
71
|
+
|
72
|
+
# Tasks
|
73
|
+
m.file_copy_each %w( deployment.rake environment.rake website.rake ), "tasks"
|
74
|
+
|
75
|
+
# Selecting a test framework
|
76
|
+
case test_framework
|
77
|
+
when "test::unit"
|
78
|
+
m.template "test_helper.rb", "test/test_helper.rb"
|
79
|
+
m.template "test.rb", "test/test_#{gem_name}.rb"
|
80
|
+
when "rspec"
|
81
|
+
m.dependency "install_rspec", [gem_name], :destination => destination_root
|
82
|
+
end
|
83
|
+
|
84
|
+
# Website
|
85
|
+
m.dependency "install_website", [gem_name],
|
86
|
+
:author => author, :email => email, :destination => destination_root if website
|
87
|
+
|
88
|
+
# JRuby
|
89
|
+
m.dependency "install_jruby", [gem_name], :destination => destination_root if is_jruby
|
90
|
+
|
91
|
+
# Executables
|
92
|
+
for bin_name in bin_names_list
|
93
|
+
m.dependency "executable", [bin_name], :destination => destination_root
|
94
|
+
end
|
95
|
+
|
96
|
+
m.write_manifest "Manifest.txt"
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
protected
|
101
|
+
def banner
|
102
|
+
<<-EOS
|
103
|
+
Take any library or Rails plugin or command line application,
|
104
|
+
gemify it, and easily share it with the Ruby world.
|
105
|
+
|
106
|
+
Usage: #{File.basename $0} /path/to/your/app [options]"
|
107
|
+
EOS
|
108
|
+
end
|
109
|
+
|
110
|
+
def add_options!(opts)
|
111
|
+
opts.separator ''
|
112
|
+
opts.separator 'Options:'
|
113
|
+
opts.on("-b", "--bin-name=BIN_NAME[,BIN_NAME2]", String,
|
114
|
+
"Sets up executable scripts in the bin folder.",
|
115
|
+
"Default: none") { |options[:bin_name]| }
|
116
|
+
opts.on("-e", "--email=PATH", String,
|
117
|
+
"Your email to be inserted into generated files.",
|
118
|
+
"Default: ~/.rubyforge/user-config.yml[email]") { |options[:email]| }
|
119
|
+
# TODO --import_path
|
120
|
+
# opts.on("-i", "--import_path=PATH", String,
|
121
|
+
# "Path where your files could be copied from.",
|
122
|
+
# "Default: none") { |options[:import_path]| }
|
123
|
+
opts.on("-j", "--jruby",
|
124
|
+
"Use if gem is for jruby.") { |options[:jruby]| }
|
125
|
+
opts.on("-a", "--author=PATH", String,
|
126
|
+
"Your name to be inserted into generated files.",
|
127
|
+
"Default: ~/.rubyforge/user-config.yml[user_name]") { |options[:author]| }
|
128
|
+
opts.on("-r", "--ruby=path", String,
|
129
|
+
"Path to the Ruby binary of your choice (otherwise scripts use env, dispatchers current path).",
|
130
|
+
"Default: #{DEFAULT_SHEBANG}") { |v| options[:shebang] = v }
|
131
|
+
opts.on("-T", "--test-with=TEST_FRAMEWORK", String,
|
132
|
+
"Select your preferred testing framework.",
|
133
|
+
"Options: test::unit (default), rspec.") { |options[:test_framework]| }
|
134
|
+
opts.on("-v", "--version", "Show the #{File.basename($0)} version number and quit.")
|
135
|
+
opts.on("-V", "--set-version=YOUR_VERSION", String,
|
136
|
+
"Version of the gem you are creating.",
|
137
|
+
"Default: 0.0.1") { |options[:version]| }
|
138
|
+
opts.on("-w", "--website",
|
139
|
+
"Includes a website for your RubyGem.") { |options[:website]| }
|
140
|
+
end
|
141
|
+
|
142
|
+
def extract_options
|
143
|
+
@version = options[:version].to_s.split(/\./)
|
144
|
+
@version_str = @version.join('.')
|
145
|
+
@author = options[:author]
|
146
|
+
@email = options[:email]
|
147
|
+
unless @author && @email
|
148
|
+
require 'newgem/rubyforge'
|
149
|
+
rubyforge_config = Newgem::Rubyforge.new
|
150
|
+
@author ||= rubyforge_config.full_name
|
151
|
+
@email ||= rubyforge_config.email
|
152
|
+
end
|
153
|
+
@bin_names_list = (options[:bin_name] || "").split(',')
|
154
|
+
@website = options[:website]
|
155
|
+
|
156
|
+
@test_framework = options[:test_framework] || "test::unit"
|
157
|
+
@is_jruby = options[:jruby]
|
158
|
+
end
|
159
|
+
|
160
|
+
# Installation skeleton. Intermediate directories are automatically
|
161
|
+
# created so don't sweat their absence here.
|
162
|
+
BASEDIRS = %w(
|
163
|
+
config
|
164
|
+
doc
|
165
|
+
lib
|
166
|
+
log
|
167
|
+
script
|
168
|
+
tasks
|
169
|
+
test
|
170
|
+
tmp
|
171
|
+
)
|
172
|
+
end
|