newgem 0.15.0 → 0.16.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +8 -0
- data/Manifest.txt +11 -1
- data/app_generators/newgem/newgem_generator.rb +3 -1
- data/app_generators/newgem/templates/config/hoe.rb +2 -2
- data/app_generators/newgem/templates/{empty.log → empty_log} +0 -0
- data/app_generators/newgem_simple/USAGE +5 -0
- data/app_generators/newgem_simple/newgem_simple_generator.rb +69 -0
- data/app_generators/newgem_simple/templates/LICENSE +20 -0
- data/app_generators/newgem_simple/templates/README +4 -0
- data/app_generators/newgem_simple/templates/Rakefile +37 -0
- data/app_generators/newgem_simple/templates/TODO +4 -0
- data/app_generators/newgem_simple/templates/lib/templates.rb +0 -0
- data/app_generators/newgem_simple/templates/spec/spec_helper.rb +2 -0
- data/app_generators/newgem_simple/templates/spec/templates_spec.rb.erb +7 -0
- data/bin/newgem +6 -2
- data/lib/newgem/version.rb +1 -1
- data/test/test_newgem_simple_generator.rb +52 -0
- data/website/index.html +2 -2
- data/website/rubyforge.html +2 -2
- data/website/version-raw.js +1 -1
- data/website/version.js +1 -1
- metadata +14 -3
data/History.txt
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
== 0.16 2006-11-11
|
2
|
+
|
3
|
+
* Added a newgem_simple_generator to support the creation of a skinny gem
|
4
|
+
skeleton [thx wycats]
|
5
|
+
* Added '.git*' to default list of ignored files by hoe
|
6
|
+
* Cleaned the history join string to make proper \n instead of \\n
|
7
|
+
* Checked in empty_log as empty.log was being ignored by svn
|
8
|
+
|
1
9
|
== 0.15.0 2007-11-05
|
2
10
|
|
3
11
|
* Promoted 'application_generator' and 'component_generator' to Rubigen
|
data/Manifest.txt
CHANGED
@@ -12,7 +12,7 @@ app_generators/newgem/templates/Rakefile
|
|
12
12
|
app_generators/newgem/templates/app.rb
|
13
13
|
app_generators/newgem/templates/config/hoe.rb
|
14
14
|
app_generators/newgem/templates/config/requirements.rb
|
15
|
-
app_generators/newgem/templates/
|
15
|
+
app_generators/newgem/templates/empty_log
|
16
16
|
app_generators/newgem/templates/module.rb
|
17
17
|
app_generators/newgem/templates/readme
|
18
18
|
app_generators/newgem/templates/setup.rb
|
@@ -24,6 +24,15 @@ app_generators/newgem/templates/tasks/website.rake
|
|
24
24
|
app_generators/newgem/templates/test.rb
|
25
25
|
app_generators/newgem/templates/test_helper.rb
|
26
26
|
app_generators/newgem/templates/version.rb
|
27
|
+
app_generators/newgem_simple/USAGE
|
28
|
+
app_generators/newgem_simple/newgem_simple_generator.rb
|
29
|
+
app_generators/newgem_simple/templates/LICENSE
|
30
|
+
app_generators/newgem_simple/templates/README
|
31
|
+
app_generators/newgem_simple/templates/Rakefile
|
32
|
+
app_generators/newgem_simple/templates/TODO
|
33
|
+
app_generators/newgem_simple/templates/lib/templates.rb
|
34
|
+
app_generators/newgem_simple/templates/spec/spec_helper.rb
|
35
|
+
app_generators/newgem_simple/templates/spec/templates_spec.rb.erb
|
27
36
|
bin/newgem
|
28
37
|
bundles/RubyGem.tmbundle/Snippets/History header trunk.tmSnippet
|
29
38
|
bundles/RubyGem.tmbundle/Snippets/History header.tmSnippet
|
@@ -79,6 +88,7 @@ test/test_install_jruby_generator.rb
|
|
79
88
|
test/test_install_rspec_generator.rb
|
80
89
|
test/test_install_website_generator.rb
|
81
90
|
test/test_newgem_generator.rb
|
91
|
+
test/test_newgem_simple_generator.rb
|
82
92
|
test/test_plain_theme_generator.rb
|
83
93
|
website/images/beginning-ruby.jpg
|
84
94
|
website/index.html
|
@@ -59,7 +59,7 @@ class NewgemGenerator < RubiGen::Base
|
|
59
59
|
m.template_copy_each %w( hoe.rb requirements.rb ), "config"
|
60
60
|
|
61
61
|
%w(debug).each { |file|
|
62
|
-
m.file "
|
62
|
+
m.file "empty_log", "log/#{file}.log", :chmod => 0666
|
63
63
|
}
|
64
64
|
|
65
65
|
# Tasks
|
@@ -134,6 +134,8 @@ EOS
|
|
134
134
|
"Default: 0.0.1") { |options[:version]| }
|
135
135
|
opts.on("-W", "--website-disable",
|
136
136
|
"Disables the generation of the website for your RubyGem.") { |options[:disable_website]| }
|
137
|
+
opts.on("--simple",
|
138
|
+
"Creates a simple RubyGems scaffold.") { |x| }
|
137
139
|
end
|
138
140
|
|
139
141
|
def extract_options
|
@@ -55,10 +55,10 @@ hoe = Hoe.new(GEM_NAME, VERS) do |p|
|
|
55
55
|
p.url = HOMEPATH
|
56
56
|
p.rubyforge_name = RUBYFORGE_PROJECT if RUBYFORGE_PROJECT
|
57
57
|
p.test_globs = ["test/**/test_*.rb"]
|
58
|
-
p.clean_globs |= ['**/.*.sw?', '*.gem', '.config', '**/.DS_Store'] #An array of file patterns to delete on clean.
|
58
|
+
p.clean_globs |= ['**/.*.sw?', '*.gem', '.config', '**/.DS_Store', '.git*'] #An array of file patterns to delete on clean.
|
59
59
|
|
60
60
|
# == Optional
|
61
|
-
p.changes = p.paragraphs_of("History.txt", 0..1).join("
|
61
|
+
p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
|
62
62
|
#p.extra_deps = [] # An array of rubygem dependencies [name, version], e.g. [ ['active_support', '>= 1.3.1'] ]
|
63
63
|
<% if is_jruby %>
|
64
64
|
# JRuby gem created, e.g. <%= gem_name %>-X.Y.Z-jruby.gem
|
File without changes
|
@@ -0,0 +1,69 @@
|
|
1
|
+
class NewgemSimpleGenerator < RubiGen::Base
|
2
|
+
|
3
|
+
DEFAULT_SHEBANG = File.join(Config::CONFIG['bindir'],
|
4
|
+
Config::CONFIG['ruby_install_name'])
|
5
|
+
|
6
|
+
default_options :author => nil
|
7
|
+
|
8
|
+
attr_reader :name
|
9
|
+
|
10
|
+
def initialize(runtime_args, runtime_options = {})
|
11
|
+
super
|
12
|
+
usage if args.empty?
|
13
|
+
@destination_root = File.expand_path(args.shift)
|
14
|
+
@name = base_name
|
15
|
+
extract_options
|
16
|
+
end
|
17
|
+
|
18
|
+
def manifest
|
19
|
+
record do |m|
|
20
|
+
# Ensure appropriate folder(s) exists
|
21
|
+
m.directory ''
|
22
|
+
BASEDIRS.each { |path| m.directory path }
|
23
|
+
|
24
|
+
# Create stubs
|
25
|
+
# m.template "template.rb", "some_file_after_erb.rb"
|
26
|
+
m.file "lib/templates.rb", "lib/#{name}.rb"
|
27
|
+
m.template "spec/templates_spec.rb.erb", "spec/#{name}_spec.rb"
|
28
|
+
|
29
|
+
%w[ LICENSE Rakefile README TODO spec/spec_helper.rb ].each {|file| m.file file, file }
|
30
|
+
|
31
|
+
m.dependency "install_rubigen_scripts", [destination_root, 'newgem_simple'],
|
32
|
+
:shebang => options[:shebang], :collision => :force
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
protected
|
37
|
+
def banner
|
38
|
+
<<-EOS
|
39
|
+
Creates a simple RubyGems scaffold.
|
40
|
+
|
41
|
+
USAGE: #{spec.name} name --simple"
|
42
|
+
EOS
|
43
|
+
end
|
44
|
+
|
45
|
+
def add_options!(opts)
|
46
|
+
opts.separator ''
|
47
|
+
opts.separator 'Options:'
|
48
|
+
# For each option below, place the default
|
49
|
+
# at the top of the file next to "default_options"
|
50
|
+
# opts.on("-a", "--author=\"Your Name\"", String,
|
51
|
+
# "Some comment about this option",
|
52
|
+
# "Default: none") { |options[:author]| }
|
53
|
+
opts.on("-v", "--version", "Show the #{File.basename($0)} version number and quit.")
|
54
|
+
end
|
55
|
+
|
56
|
+
def extract_options
|
57
|
+
# for each option, extract it into a local variable (and create an "attr_reader :author" at the top)
|
58
|
+
# Templates can access these value via the attr_reader-generated methods, but not the
|
59
|
+
# raw instance variable value.
|
60
|
+
# @author = options[:author]
|
61
|
+
end
|
62
|
+
|
63
|
+
# Installation skeleton. Intermediate directories are automatically
|
64
|
+
# created so don't sweat their absence here.
|
65
|
+
BASEDIRS = %w(
|
66
|
+
lib
|
67
|
+
spec
|
68
|
+
)
|
69
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2007 YOUR NAME
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake/gempackagetask'
|
3
|
+
|
4
|
+
GEM = "new_gem"
|
5
|
+
VERSION = "0.0.1"
|
6
|
+
AUTHOR = "Your Name"
|
7
|
+
EMAIL = "Your Email"
|
8
|
+
HOMEPAGE = "http://example.com"
|
9
|
+
SUMMARY = "A gem that provides..."
|
10
|
+
|
11
|
+
spec = Gem::Specification.new do |s|
|
12
|
+
s.name = GEM
|
13
|
+
s.version = VERSION
|
14
|
+
s.platform = Gem::Platform::RUBY
|
15
|
+
s.has_rdoc = true
|
16
|
+
s.extra_rdoc_files = ["README", "LICENSE", 'TODO']
|
17
|
+
s.summary = SUMMARY
|
18
|
+
s.description = s.summary
|
19
|
+
s.author = AUTHOR
|
20
|
+
s.email = EMAIL
|
21
|
+
s.homepage = HOMEPAGE
|
22
|
+
|
23
|
+
# Uncomment this to add a dependency
|
24
|
+
# s.add_dependency "foo"
|
25
|
+
|
26
|
+
s.require_path = 'lib'
|
27
|
+
s.autorequire = GEM
|
28
|
+
s.files = %w(LICENSE README Rakefile TODO) + Dir.glob("{lib,specs}/**/*")
|
29
|
+
end
|
30
|
+
|
31
|
+
Rake::GemPackageTask.new(spec) do |pkg|
|
32
|
+
pkg.gem_spec = spec
|
33
|
+
end
|
34
|
+
|
35
|
+
task :install => [:package] do
|
36
|
+
sh %{sudo gem install pkg/#{GEM}-#{VERSION}}
|
37
|
+
end
|
File without changes
|
data/bin/newgem
CHANGED
@@ -7,7 +7,11 @@ if %w(-v --version).include? ARGV.first
|
|
7
7
|
exit(0)
|
8
8
|
end
|
9
9
|
|
10
|
-
|
11
10
|
require 'rubigen/scripts/generate'
|
12
11
|
RubiGen::Base.use_application_sources! :rubygems, :newgem, :newgem_theme
|
13
|
-
|
12
|
+
|
13
|
+
if ARGV.delete "--simple"
|
14
|
+
RubiGen::Scripts::Generate.new.run(ARGV, :generator => 'newgem_simple')
|
15
|
+
else
|
16
|
+
RubiGen::Scripts::Generate.new.run(ARGV, :generator => 'newgem')
|
17
|
+
end
|
data/lib/newgem/version.rb
CHANGED
@@ -0,0 +1,52 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), "test_generator_helper.rb")
|
2
|
+
|
3
|
+
class TestNewgemSimpleGenerator < 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
|
+
run_generator('newgem_simple', [APP_ROOT], sources)
|
30
|
+
assert_directory_exists "lib"
|
31
|
+
assert_generated_file "lib/#{PROJECT_NAME}.rb"
|
32
|
+
assert_directory_exists "spec"
|
33
|
+
assert_generated_file "spec/spec_helper.rb"
|
34
|
+
assert_generated_file "spec/#{PROJECT_NAME}_spec.rb" do |file|
|
35
|
+
file =~ /describe "#{PROJECT_NAME}" do/
|
36
|
+
end
|
37
|
+
assert_generated_file "LICENSE"
|
38
|
+
assert_generated_file "Rakefile"
|
39
|
+
assert_generated_file "README"
|
40
|
+
assert_generated_file "TODO"
|
41
|
+
end
|
42
|
+
|
43
|
+
private
|
44
|
+
def sources
|
45
|
+
[RubiGen::PathSource.new(:test, File.join(File.dirname(__FILE__),"..", generator_path))
|
46
|
+
]
|
47
|
+
end
|
48
|
+
|
49
|
+
def generator_path
|
50
|
+
"app_generators"
|
51
|
+
end
|
52
|
+
end
|
data/website/index.html
CHANGED
@@ -33,7 +33,7 @@
|
|
33
33
|
<h1>New Gem Generator</h1>
|
34
34
|
<div id="version"> <!-- class="clickable" onclick='document.location = ""; return true' -->
|
35
35
|
<p>Get Version</p>
|
36
|
-
<a href="" class="numbers">0.
|
36
|
+
<a href="" class="numbers">0.16.0</a>
|
37
37
|
<p>Featured in</p>
|
38
38
|
<a href="http://www.amazon.com/gp/redirect.html?ie=UTF8&location=http%3A%2F%2Fwww.amazon.com%2FBeginning-Ruby-Novice-Professional-Experts%2Fdp%2F1590597664%2F&tag=drnic-20&linkCode=ur2&camp=1789&creative=9325" class="book"><img src="images/beginning-ruby.jpg" /></a>
|
39
39
|
</div>
|
@@ -336,7 +336,7 @@ other stories and things.</p>
|
|
336
336
|
|
337
337
|
<p>Comments are welcome. Send an email to <a href="mailto:drnicwilliams@gmail.com">Dr Nic Williams</a>.</p>
|
338
338
|
<p class="coda">
|
339
|
-
<a href="mailto:drnicwilliams@gmail.com">Dr Nic</a>,
|
339
|
+
<a href="mailto:drnicwilliams@gmail.com">Dr Nic</a>, 17th October 2007<br>
|
340
340
|
Theme extended from <a href="http://rb2js.rubyforge.org/">Paul Battley</a>
|
341
341
|
</p>
|
342
342
|
</div>
|
data/website/rubyforge.html
CHANGED
@@ -33,7 +33,7 @@
|
|
33
33
|
<h1>New Gem Generator</h1>
|
34
34
|
<div id="version"> <!-- class="clickable" onclick='document.location = ""; return true' -->
|
35
35
|
<p>Get Version</p>
|
36
|
-
<a href="" class="numbers">0.
|
36
|
+
<a href="" class="numbers">0.16.0</a>
|
37
37
|
<p>Featured in</p>
|
38
38
|
<a href="http://www.amazon.com/gp/redirect.html?ie=UTF8&location=http%3A%2F%2Fwww.amazon.com%2FBeginning-Ruby-Novice-Professional-Experts%2Fdp%2F1590597664%2F&tag=drnic-20&linkCode=ur2&camp=1789&creative=9325" class="book"><img src="images/beginning-ruby.jpg" /></a>
|
39
39
|
</div>
|
@@ -263,7 +263,7 @@ OPTIONS
|
|
263
263
|
specify whether release_notes/changes are preformatted
|
264
264
|
</pre>
|
265
265
|
<p class="coda">
|
266
|
-
<a href="mailto:drnicwilliams@gmail.com">Dr Nic</a>,
|
266
|
+
<a href="mailto:drnicwilliams@gmail.com">Dr Nic</a>, 24th June 2007<br>
|
267
267
|
Theme extended from <a href="http://rb2js.rubyforge.org/">Paul Battley</a>
|
268
268
|
</p>
|
269
269
|
</div>
|
data/website/version-raw.js
CHANGED
data/website/version.js
CHANGED
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.4.3
|
|
3
3
|
specification_version: 1
|
4
4
|
name: newgem
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.
|
7
|
-
date: 2007-11-
|
6
|
+
version: 0.16.0
|
7
|
+
date: 2007-11-12 00:00:00 +10:00
|
8
8
|
summary: Make your own gems at home
|
9
9
|
require_paths:
|
10
10
|
- lib
|
@@ -43,7 +43,7 @@ files:
|
|
43
43
|
- app_generators/newgem/templates/app.rb
|
44
44
|
- app_generators/newgem/templates/config/hoe.rb
|
45
45
|
- app_generators/newgem/templates/config/requirements.rb
|
46
|
-
- app_generators/newgem/templates/
|
46
|
+
- app_generators/newgem/templates/empty_log
|
47
47
|
- app_generators/newgem/templates/module.rb
|
48
48
|
- app_generators/newgem/templates/readme
|
49
49
|
- app_generators/newgem/templates/setup.rb
|
@@ -55,6 +55,15 @@ files:
|
|
55
55
|
- app_generators/newgem/templates/test.rb
|
56
56
|
- app_generators/newgem/templates/test_helper.rb
|
57
57
|
- app_generators/newgem/templates/version.rb
|
58
|
+
- app_generators/newgem_simple/USAGE
|
59
|
+
- app_generators/newgem_simple/newgem_simple_generator.rb
|
60
|
+
- app_generators/newgem_simple/templates/LICENSE
|
61
|
+
- app_generators/newgem_simple/templates/README
|
62
|
+
- app_generators/newgem_simple/templates/Rakefile
|
63
|
+
- app_generators/newgem_simple/templates/TODO
|
64
|
+
- app_generators/newgem_simple/templates/lib/templates.rb
|
65
|
+
- app_generators/newgem_simple/templates/spec/spec_helper.rb
|
66
|
+
- app_generators/newgem_simple/templates/spec/templates_spec.rb.erb
|
58
67
|
- bin/newgem
|
59
68
|
- bundles/RubyGem.tmbundle/Snippets/History header trunk.tmSnippet
|
60
69
|
- bundles/RubyGem.tmbundle/Snippets/History header.tmSnippet
|
@@ -110,6 +119,7 @@ files:
|
|
110
119
|
- test/test_install_rspec_generator.rb
|
111
120
|
- test/test_install_website_generator.rb
|
112
121
|
- test/test_newgem_generator.rb
|
122
|
+
- test/test_newgem_simple_generator.rb
|
113
123
|
- test/test_plain_theme_generator.rb
|
114
124
|
- website/images/beginning-ruby.jpg
|
115
125
|
- website/index.html
|
@@ -132,6 +142,7 @@ test_files:
|
|
132
142
|
- test/test_install_rspec_generator.rb
|
133
143
|
- test/test_install_website_generator.rb
|
134
144
|
- test/test_newgem_generator.rb
|
145
|
+
- test/test_newgem_simple_generator.rb
|
135
146
|
- test/test_plain_theme_generator.rb
|
136
147
|
rdoc_options:
|
137
148
|
- --main
|