newgem 0.20.0 → 0.20.1

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,3 +1,12 @@
1
+ == 0.20.1 2008-03-30
2
+
3
+ * extconf generator
4
+ * creates test/test_#{name}_extn.rb test file
5
+ * creates .autotest file for *.c -> test/test_*_extn.rb
6
+ * failed compilation destroyes *.o/so/bundle/dll files so tests fail too
7
+ * USAGE has docco on files to ignore in SCM + hoe
8
+ * requirements.rb no longer loads main lib file; no idea why it did it before
9
+
1
10
  == 0.20.0 2008-03-30
2
11
 
3
12
  * extconf generator - for C-extensions
data/Manifest.txt CHANGED
@@ -69,10 +69,13 @@ rubygems_generators/executable/executable_generator.rb
69
69
  rubygems_generators/executable/templates/app.rb
70
70
  rubygems_generators/extconf/USAGE
71
71
  rubygems_generators/extconf/extconf_generator.rb
72
- rubygems_generators/extconf/templates/ext/c_file.c
73
- rubygems_generators/extconf/templates/ext/extconf.rb
72
+ rubygems_generators/extconf/templates/README.txt
73
+ rubygems_generators/extconf/templates/autotest.rb
74
+ rubygems_generators/extconf/templates/ext/c_file.c.erb
75
+ rubygems_generators/extconf/templates/ext/extconf.rb.erb
74
76
  rubygems_generators/extconf/templates/tasks/extconf.rake
75
77
  rubygems_generators/extconf/templates/tasks/extconf_name.rake
78
+ rubygems_generators/extconf/templates/test/test.rb.erb
76
79
  rubygems_generators/install_jruby/USAGE
77
80
  rubygems_generators/install_jruby/install_jruby_generator.rb
78
81
  rubygems_generators/install_jruby/templates/tasks/jruby.rake
@@ -13,5 +13,3 @@ require 'rubygems'
13
13
  end
14
14
 
15
15
  $:.unshift(File.join(File.dirname(__FILE__), %w[.. lib]))
16
-
17
- require '<%= gem_name %>'
@@ -2,7 +2,7 @@ module Newgem #:nodoc:
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 0
4
4
  MINOR = 20
5
- TINY = 0
5
+ TINY = 1
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
@@ -1,5 +1,27 @@
1
1
  Description:
2
+ Creates a C-extension via extconf.
3
+
4
+ The extension be automatically built before running tests,
5
+ and will be built when the RubyGem is installed by users.
6
+
7
+ Usage:
8
+ #{$0} #{spec.name} name
9
+
10
+ rake compile - builds the extensions
11
+ rake - runs your tests, AFTER building your extensions
2
12
 
13
+ Important:
14
+ You may want to add the following pattern matches to your
15
+ SCM ignore list (e.g. .gitignore file):
3
16
 
4
- Usage:
17
+ Makefile
18
+ *.o
19
+ *.bundle
20
+ *.so
21
+ *.dll
22
+ pkg
23
+ doc
24
+ .DS_Store
5
25
 
26
+ Also, in your ~/.hoerc file ADD the following exclusions:
27
+ exclude: !ruby/regexp /tmp$|CVS|\.svn|_darcs|\.git|local/.*\.rb$|Makefile|.*\.o$|.*\.bundle$|.*\.so$|.*\.dll$/
@@ -2,12 +2,14 @@ class ExtconfGenerator < RubiGen::Base
2
2
 
3
3
  default_options :author => nil
4
4
 
5
- attr_reader :name
5
+ attr_reader :name, :module_name, :test_module_name
6
6
 
7
7
  def initialize(runtime_args, runtime_options = {})
8
8
  super
9
9
  usage if args.empty?
10
10
  @name = args.shift
11
+ @module_name = name.camelcase
12
+ @test_module_name = @module_name + "Extn"
11
13
  extract_options
12
14
  end
13
15
 
@@ -16,19 +18,24 @@ class ExtconfGenerator < RubiGen::Base
16
18
  # Ensure appropriate folder(s) exists
17
19
  m.directory "ext/#{name}"
18
20
  m.directory "tasks/extconf"
21
+ m.directory "test"
19
22
 
20
23
  # 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.template "ext/c_file.c.erb", "ext/#{name}/#{name}.c"
25
+ m.template "ext/extconf.rb.erb", "ext/#{name}/extconf.rb"
26
+ m.template "test/test.rb.erb", "test/test_#{name}_extn.rb"
27
+ m.file "tasks/extconf.rake", "tasks/extconf.rake"
24
28
  m.file "tasks/extconf_name.rake", "tasks/extconf/#{name}.rake"
29
+
30
+ m.file "autotest.rb", ".autotest"
31
+ m.readme "README.txt"
25
32
  end
26
33
  end
27
34
 
28
35
  protected
29
36
  def banner
30
37
  <<-EOS
31
- Creates a C-extension via extconf.
38
+ Creates a C-extension via extconf.
32
39
 
33
40
  The extension be automatically built before running tests,
34
41
  and will be built when the RubyGem is installed by users.
@@ -0,0 +1,15 @@
1
+ Important:
2
+ You may want to add the following pattern matches to your
3
+ SCM ignore list (e.g. .gitignore file):
4
+
5
+ Makefile
6
+ *.o
7
+ *.bundle
8
+ *.so
9
+ *.dll
10
+ pkg
11
+ doc
12
+ .DS_Store
13
+
14
+ Also, in your ~/.hoerc file ADD the following exclusions:
15
+ exclude: !ruby/regexp /tmp$|CVS|\.svn|_darcs|\.git|local/.*\.rb$|Makefile|.*\.o$|.*\.bundle$|.*\.so$|.*\.dll$/
@@ -0,0 +1,9 @@
1
+ Autotest.add_hook :initialize do |at|
2
+ at.add_mapping(/ext\/.*\/(.*)\.[ch]/) do |_, m|
3
+ ["test/test_#{m[1]}_extn.rb"]
4
+ end
5
+ end
6
+
7
+ Autotest.add_hook :run_command do |at|
8
+ system "rake compile"
9
+ end
@@ -14,7 +14,7 @@ namespace :extconf do
14
14
 
15
15
 
16
16
  task :compile => extension do
17
- if Dir.glob("**/#{extension}.*").length == 0
17
+ if Dir.glob("**/#{extension}.{o,so,dll}").length == 0
18
18
  STDERR.puts "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
19
19
  STDERR.puts "Gem actually failed to build. Your system is"
20
20
  STDERR.puts "NOT configured properly to build #{GEM_NAME}."
@@ -32,7 +32,12 @@ namespace :extconf do
32
32
 
33
33
  file ext_so => ext_files do
34
34
  Dir.chdir(ext) do
35
- sh(PLATFORM =~ /win32/ ? 'nmake' : 'make')
35
+ sh(PLATFORM =~ /win32/ ? 'nmake' : 'make') do |ok, res|
36
+ if !ok
37
+ require "fileutils"
38
+ FileUtils.rm Dir.glob('*.{so,o,dll,bundle}')
39
+ end
40
+ end
36
41
  end
37
42
  end
38
43
  end
@@ -0,0 +1,10 @@
1
+ require "test/unit"
2
+
3
+ $:.unshift File.dirname(__FILE__) + "/../ext/<%= name %>"
4
+ require "<%= name %>.so"
5
+
6
+ class Test<%= test_module_name %> < Test::Unit::TestCase
7
+ def test_truth
8
+ assert true
9
+ end
10
+ end
@@ -6,11 +6,11 @@ class TestExtconfGenerator < Test::Unit::TestCase
6
6
  def setup
7
7
  bare_setup
8
8
  end
9
-
9
+
10
10
  def teardown
11
11
  bare_teardown
12
12
  end
13
-
13
+
14
14
  # Some generator-related assertions:
15
15
  # assert_generated_file(name, &block) # block passed the file contents
16
16
  # assert_directory_exists(name)
@@ -24,24 +24,26 @@ class TestExtconfGenerator < Test::Unit::TestCase
24
24
  # app_root_files - put this in teardown to show files generated by the test method (e.g. p app_root_files)
25
25
  # bare_setup - place this in setup method to create the APP_ROOT folder for each test
26
26
  # bare_teardown - place this in teardown method to destroy the TMP_ROOT or APP_ROOT folder after each test
27
-
27
+
28
28
  def test_generator_without_options
29
- name = "myext"
29
+ name = "my_ext"
30
30
  run_generator('extconf', [name], sources)
31
- assert_directory_exists("ext/myext")
31
+ assert_directory_exists("ext/my_ext")
32
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")
33
+ assert_generated_file("ext/my_ext/extconf.rb")
34
+ assert_generated_file("ext/my_ext/my_ext.c")
35
+ assert_generated_file("tasks/extconf.rake")
36
+ assert_generated_file("tasks/extconf/my_ext.rake")
37
+ assert_generated_file("test/test_my_ext_extn.rb")
38
+ assert_generated_file(".autotest")
37
39
  end
38
-
40
+
39
41
  private
40
42
  def sources
41
43
  [RubiGen::PathSource.new(:test, File.join(File.dirname(__FILE__),"..", generator_path))
42
44
  ]
43
45
  end
44
-
46
+
45
47
  def generator_path
46
48
  "rubygems_generators"
47
49
  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.20.0</a>
36
+ <a href="" class="numbers">0.20.1</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>
@@ -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.20.0</a>
36
+ <a href="" class="numbers">0.20.1</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>
@@ -1,3 +1,3 @@
1
1
  // Announcement JS file
2
- var version = "0.20.0";
2
+ var version = "0.20.1";
3
3
  MagicAnnouncement.show('compositekeys', version);
data/website/version.js CHANGED
@@ -1,4 +1,4 @@
1
1
  // Version JS file
2
- var version = "0.20.0";
2
+ var version = "0.20.1";
3
3
 
4
4
  document.write(" - " + version);
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.20.0
4
+ version: 0.20.1
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-29 23:00:00 +01:00
12
+ date: 2008-03-31 00:00:00 +02:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -84,6 +84,7 @@ extra_rdoc_files:
84
84
  - app_generators/newgem/templates/README.txt
85
85
  - newgem_generators/install_website/templates/website/index.txt
86
86
  - newgem_theme_generators/long_box_theme/templates/website/index.txt
87
+ - rubygems_generators/extconf/templates/README.txt
87
88
  - website/index.txt
88
89
  - website/rubyforge.txt
89
90
  - website/version-raw.txt
@@ -160,10 +161,13 @@ files:
160
161
  - rubygems_generators/executable/templates/app.rb
161
162
  - rubygems_generators/extconf/USAGE
162
163
  - rubygems_generators/extconf/extconf_generator.rb
163
- - rubygems_generators/extconf/templates/ext/c_file.c
164
- - rubygems_generators/extconf/templates/ext/extconf.rb
164
+ - rubygems_generators/extconf/templates/README.txt
165
+ - rubygems_generators/extconf/templates/autotest.rb
166
+ - rubygems_generators/extconf/templates/ext/c_file.c.erb
167
+ - rubygems_generators/extconf/templates/ext/extconf.rb.erb
165
168
  - rubygems_generators/extconf/templates/tasks/extconf.rake
166
169
  - rubygems_generators/extconf/templates/tasks/extconf_name.rake
170
+ - rubygems_generators/extconf/templates/test/test.rb.erb
167
171
  - rubygems_generators/install_jruby/USAGE
168
172
  - rubygems_generators/install_jruby/install_jruby_generator.rb
169
173
  - rubygems_generators/install_jruby/templates/tasks/jruby.rake