newgem 0.19.1 → 0.20.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +5 -0
- data/Manifest.txt +7 -0
- data/app_generators/newgem/templates/config/hoe.rb +4 -4
- data/lib/newgem/version.rb +2 -2
- data/rubygems_generators/extconf/USAGE +5 -0
- data/rubygems_generators/extconf/extconf_generator.rb +57 -0
- data/rubygems_generators/extconf/templates/ext/c_file.c +8 -0
- data/rubygems_generators/extconf/templates/ext/extconf.rb +5 -0
- data/rubygems_generators/extconf/templates/tasks/extconf.rake +13 -0
- data/rubygems_generators/extconf/templates/tasks/extconf_name.rake +38 -0
- data/script/destroy +0 -0
- data/script/generate +0 -0
- data/script/txt2html +0 -0
- data/script/txt2js +0 -0
- data/test/test_extconf_generator.rb +48 -0
- data/website/index.html +1 -1
- data/website/rubyforge.html +2 -2
- data/website/version-raw.js +1 -1
- data/website/version.js +1 -1
- metadata +11 -3
data/History.txt
CHANGED
data/Manifest.txt
CHANGED
@@ -67,6 +67,12 @@ newgem_theme_generators/plain_theme/templates/website/template.rhtml
|
|
67
67
|
rubygems_generators/executable/USAGE
|
68
68
|
rubygems_generators/executable/executable_generator.rb
|
69
69
|
rubygems_generators/executable/templates/app.rb
|
70
|
+
rubygems_generators/extconf/USAGE
|
71
|
+
rubygems_generators/extconf/extconf_generator.rb
|
72
|
+
rubygems_generators/extconf/templates/ext/c_file.c
|
73
|
+
rubygems_generators/extconf/templates/ext/extconf.rb
|
74
|
+
rubygems_generators/extconf/templates/tasks/extconf.rake
|
75
|
+
rubygems_generators/extconf/templates/tasks/extconf_name.rake
|
70
76
|
rubygems_generators/install_jruby/USAGE
|
71
77
|
rubygems_generators/install_jruby/install_jruby_generator.rb
|
72
78
|
rubygems_generators/install_jruby/templates/tasks/jruby.rake
|
@@ -88,6 +94,7 @@ tasks/environment.rake
|
|
88
94
|
tasks/generator_report.rake
|
89
95
|
tasks/website.rake
|
90
96
|
test/test_executable_generator.rb
|
97
|
+
test/test_extconf_generator.rb
|
91
98
|
test/test_generator_helper.rb
|
92
99
|
test/test_helper.rb
|
93
100
|
test/test_install_jruby_generator.rb
|
@@ -47,7 +47,7 @@ end
|
|
47
47
|
|
48
48
|
# Generate all the Rake tasks
|
49
49
|
# Run 'rake -T' to see list of generated tasks (from gem root directory)
|
50
|
-
hoe = Hoe.new(GEM_NAME, VERS) do |p|
|
50
|
+
$hoe = Hoe.new(GEM_NAME, VERS) do |p|
|
51
51
|
p.developer(AUTHOR, EMAIL)
|
52
52
|
p.description = DESCRIPTION
|
53
53
|
p.summary = DESCRIPTION
|
@@ -67,7 +67,7 @@ hoe = Hoe.new(GEM_NAME, VERS) do |p|
|
|
67
67
|
<% end %>
|
68
68
|
end
|
69
69
|
|
70
|
-
CHANGES = hoe.paragraphs_of('History.txt', 0..1).join("\\n\\n")
|
70
|
+
CHANGES = $hoe.paragraphs_of('History.txt', 0..1).join("\\n\\n")
|
71
71
|
PATH = (RUBYFORGE_PROJECT == GEM_NAME) ? RUBYFORGE_PROJECT : "#{RUBYFORGE_PROJECT}/#{GEM_NAME}"
|
72
|
-
hoe.remote_rdoc_dir = File.join(PATH.gsub(/^#{RUBYFORGE_PROJECT}\/?/,''), 'rdoc')
|
73
|
-
hoe.rsync_args = '-av --delete --ignore-errors'
|
72
|
+
$hoe.remote_rdoc_dir = File.join(PATH.gsub(/^#{RUBYFORGE_PROJECT}\/?/,''), 'rdoc')
|
73
|
+
$hoe.rsync_args = '-av --delete --ignore-errors'
|
data/lib/newgem/version.rb
CHANGED
@@ -0,0 +1,57 @@
|
|
1
|
+
class ExtconfGenerator < RubiGen::Base
|
2
|
+
|
3
|
+
default_options :author => nil
|
4
|
+
|
5
|
+
attr_reader :name
|
6
|
+
|
7
|
+
def initialize(runtime_args, runtime_options = {})
|
8
|
+
super
|
9
|
+
usage if args.empty?
|
10
|
+
@name = args.shift
|
11
|
+
extract_options
|
12
|
+
end
|
13
|
+
|
14
|
+
def manifest
|
15
|
+
record do |m|
|
16
|
+
# Ensure appropriate folder(s) exists
|
17
|
+
m.directory "ext/#{name}"
|
18
|
+
m.directory "tasks/extconf"
|
19
|
+
|
20
|
+
# Create stubs
|
21
|
+
m.template "ext/c_file.c", "ext/#{name}/#{name}.c"
|
22
|
+
m.template "ext/extconf.rb", "ext/#{name}/extconf.rb"
|
23
|
+
m.file "tasks/extconf.rake", "tasks/extconf.rake"
|
24
|
+
m.file "tasks/extconf_name.rake", "tasks/extconf/#{name}.rake"
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
protected
|
29
|
+
def banner
|
30
|
+
<<-EOS
|
31
|
+
Creates a C-extension via extconf.
|
32
|
+
|
33
|
+
The extension be automatically built before running tests,
|
34
|
+
and will be built when the RubyGem is installed by users.
|
35
|
+
|
36
|
+
USAGE: #{$0} #{spec.name} name
|
37
|
+
EOS
|
38
|
+
end
|
39
|
+
|
40
|
+
def add_options!(opts)
|
41
|
+
# opts.separator ''
|
42
|
+
# opts.separator 'Options:'
|
43
|
+
# For each option below, place the default
|
44
|
+
# at the top of the file next to "default_options"
|
45
|
+
# opts.on("-a", "--author=\"Your Name\"", String,
|
46
|
+
# "Some comment about this option",
|
47
|
+
# "Default: none") { |options[:author]| }
|
48
|
+
# opts.on("-v", "--version", "Show the #{File.basename($0)} version number and quit.")
|
49
|
+
end
|
50
|
+
|
51
|
+
def extract_options
|
52
|
+
# for each option, extract it into a local variable (and create an "attr_reader :author" at the top)
|
53
|
+
# Templates can access these value via the attr_reader-generated methods, but not the
|
54
|
+
# raw instance variable value.
|
55
|
+
# @author = options[:author]
|
56
|
+
end
|
57
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
namespace :extconf do
|
2
|
+
desc "Compiles the Ruby extension"
|
3
|
+
task :compile
|
4
|
+
end
|
5
|
+
|
6
|
+
task :compile => "extconf:compile"
|
7
|
+
|
8
|
+
task :test => :compile
|
9
|
+
|
10
|
+
BIN = "*.{bundle,jar,so,obj,pdb,lib,def,exp}"
|
11
|
+
$hoe.clean_globs |= ["ext/**/#{BIN}", "lib/**/#{BIN}", 'ext/**/Makefile']
|
12
|
+
$hoe.spec.require_paths = Dir['{lib,ext/*}']
|
13
|
+
$hoe.spec.extensions = FileList["ext/**/extconf.rb"].to_a
|
@@ -0,0 +1,38 @@
|
|
1
|
+
namespace :extconf do
|
2
|
+
extension = File.basename(__FILE__, '.rake')
|
3
|
+
|
4
|
+
ext = "ext/#{extension}"
|
5
|
+
ext_so = "#{ext}/#{extension}.#{Config::CONFIG['DLEXT']}"
|
6
|
+
ext_files = FileList[
|
7
|
+
"#{ext}/*.c",
|
8
|
+
"#{ext}/*.h",
|
9
|
+
"#{ext}/*.rl",
|
10
|
+
"#{ext}/extconf.rb",
|
11
|
+
"#{ext}/Makefile",
|
12
|
+
# "lib"
|
13
|
+
]
|
14
|
+
|
15
|
+
|
16
|
+
task :compile => extension do
|
17
|
+
if Dir.glob("**/#{extension}.*").length == 0
|
18
|
+
STDERR.puts "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
|
19
|
+
STDERR.puts "Gem actually failed to build. Your system is"
|
20
|
+
STDERR.puts "NOT configured properly to build #{GEM_NAME}."
|
21
|
+
STDERR.puts "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
|
22
|
+
exit(1)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
desc "Builds just the #{extension} extension"
|
27
|
+
task extension.to_sym => ["#{ext}/Makefile", ext_so ]
|
28
|
+
|
29
|
+
file "#{ext}/Makefile" => ["#{ext}/extconf.rb"] do
|
30
|
+
Dir.chdir(ext) do ruby "extconf.rb" end
|
31
|
+
end
|
32
|
+
|
33
|
+
file ext_so => ext_files do
|
34
|
+
Dir.chdir(ext) do
|
35
|
+
sh(PLATFORM =~ /win32/ ? 'nmake' : 'make')
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
data/script/destroy
CHANGED
File without changes
|
data/script/generate
CHANGED
File without changes
|
data/script/txt2html
CHANGED
File without changes
|
data/script/txt2js
CHANGED
File without changes
|
@@ -0,0 +1,48 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), "test_generator_helper.rb")
|
2
|
+
|
3
|
+
class TestExtconfGenerator < 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 = "myext"
|
30
|
+
run_generator('extconf', [name], sources)
|
31
|
+
assert_directory_exists("ext/myext")
|
32
|
+
assert_directory_exists("tasks/extconf")
|
33
|
+
assert_generated_file("ext/myext/extconf.rb")
|
34
|
+
assert_generated_file("ext/myext/myext.c")
|
35
|
+
assert_generated_file("tasks/extconf.rake")
|
36
|
+
assert_generated_file("tasks/extconf/myext.rake")
|
37
|
+
end
|
38
|
+
|
39
|
+
private
|
40
|
+
def sources
|
41
|
+
[RubiGen::PathSource.new(:test, File.join(File.dirname(__FILE__),"..", generator_path))
|
42
|
+
]
|
43
|
+
end
|
44
|
+
|
45
|
+
def generator_path
|
46
|
+
"rubygems_generators"
|
47
|
+
end
|
48
|
+
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.20.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>
|
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.20.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>, 4th March 2008<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
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: newgem
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.20.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dr Nic Williams
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-03-
|
12
|
+
date: 2008-03-29 23:00:00 +01:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -158,6 +158,12 @@ files:
|
|
158
158
|
- rubygems_generators/executable/USAGE
|
159
159
|
- rubygems_generators/executable/executable_generator.rb
|
160
160
|
- rubygems_generators/executable/templates/app.rb
|
161
|
+
- rubygems_generators/extconf/USAGE
|
162
|
+
- rubygems_generators/extconf/extconf_generator.rb
|
163
|
+
- rubygems_generators/extconf/templates/ext/c_file.c
|
164
|
+
- rubygems_generators/extconf/templates/ext/extconf.rb
|
165
|
+
- rubygems_generators/extconf/templates/tasks/extconf.rake
|
166
|
+
- rubygems_generators/extconf/templates/tasks/extconf_name.rake
|
161
167
|
- rubygems_generators/install_jruby/USAGE
|
162
168
|
- rubygems_generators/install_jruby/install_jruby_generator.rb
|
163
169
|
- rubygems_generators/install_jruby/templates/tasks/jruby.rake
|
@@ -179,6 +185,7 @@ files:
|
|
179
185
|
- tasks/generator_report.rake
|
180
186
|
- tasks/website.rake
|
181
187
|
- test/test_executable_generator.rb
|
188
|
+
- test/test_extconf_generator.rb
|
182
189
|
- test/test_generator_helper.rb
|
183
190
|
- test/test_helper.rb
|
184
191
|
- test/test_install_jruby_generator.rb
|
@@ -223,12 +230,13 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
223
230
|
requirements: []
|
224
231
|
|
225
232
|
rubyforge_project: newgem
|
226
|
-
rubygems_version: 1.0
|
233
|
+
rubygems_version: 1.1.0
|
227
234
|
signing_key:
|
228
235
|
specification_version: 2
|
229
236
|
summary: Make your own gems at home
|
230
237
|
test_files:
|
231
238
|
- test/test_executable_generator.rb
|
239
|
+
- test/test_extconf_generator.rb
|
232
240
|
- test/test_generator_helper.rb
|
233
241
|
- test/test_helper.rb
|
234
242
|
- test/test_install_jruby_generator.rb
|