newgem 0.24.0 → 0.25.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/History.txt CHANGED
@@ -1,3 +1,9 @@
1
+ == 0.25.0 2008-06-19
2
+
3
+ * newgem: added --project option to allow a different Rubyforge [Yossef Mendelssohn]
4
+ * newgem: README contains generated year + name for license section [Yossef Mendelssohn]
5
+ * updated copyright in license
6
+
1
7
  == 0.24.0 2008-06-17
2
8
 
3
9
  * Refactored generated tests into install_test_unit, so rspec users don't get test folder
data/License.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2006-2007 Dr Nic Williams
1
+ Copyright (c) 2006-2008 Dr Nic Williams
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.txt CHANGED
@@ -75,7 +75,7 @@ Alternately, download the gem and install manually.
75
75
 
76
76
  (The MIT License)
77
77
 
78
- Copyright (c) 2008 FIX
78
+ Copyright (c) 2006-2008 Dr Nic Williams
79
79
 
80
80
  Permission is hereby granted, free of charge, to any person obtaining
81
81
  a copy of this software and associated documentation files (the
@@ -16,7 +16,7 @@ class NewgemGenerator < RubiGen::Base
16
16
  :version => '0.0.1'
17
17
 
18
18
 
19
- attr_reader :gem_name, :module_name
19
+ attr_reader :gem_name, :module_name, :project_name
20
20
  attr_reader :version, :version_str, :author, :email
21
21
 
22
22
  # extensions/option
@@ -32,6 +32,7 @@ class NewgemGenerator < RubiGen::Base
32
32
  @destination_root = File.expand_path(args.shift)
33
33
  @gem_name = base_name
34
34
  @module_name = gem_name.camelize
35
+ @project_name = @gem_name
35
36
  extract_options
36
37
  end
37
38
 
@@ -123,6 +124,9 @@ EOS
123
124
  opts.on("-a", "--author=PATH", String,
124
125
  "Your name to be inserted into generated files.",
125
126
  "Default: ~/.rubyforge/user-config.yml[user_name]") { |x| options[:author] = x }
127
+ opts.on("-p", "--project=PROJECT", String,
128
+ "Rubyforge project name for the gem you are creating.",
129
+ "Default: same as gem name") { |x| options[:project] = x }
126
130
  opts.on("-r", "--ruby=path", String,
127
131
  "Path to the Ruby binary of your choice (otherwise scripts use env, dispatchers current path).",
128
132
  "Default: #{DEFAULT_SHEBANG}") { |x| options[:shebang] = x }
@@ -155,6 +159,7 @@ EOS
155
159
 
156
160
  @test_framework = options[:test_framework] || "test::unit"
157
161
  @is_jruby = options[:jruby]
162
+ @project_name = options[:project] if options.include?(:project)
158
163
  end
159
164
 
160
165
  # Installation skeleton. Intermediate directories are automatically
@@ -1,5 +1,5 @@
1
1
 
2
- For more information on <%= gem_name %>, see http://<%= gem_name %>.rubyforge.org
2
+ For more information on <%= gem_name %>, see http://<%= project_name %>.rubyforge.org
3
3
 
4
4
  NOTE: Change this information in PostInstall.txt
5
5
  You can also delete it if you don't want it.
@@ -26,7 +26,7 @@ FIX (describe your package)
26
26
 
27
27
  (The MIT License)
28
28
 
29
- Copyright (c) 2008 FIX
29
+ Copyright (c) <%= Time.now.year %> <%= author %>
30
30
 
31
31
  Permission is hereby granted, free of charge, to any person obtaining
32
32
  a copy of this software and associated documentation files (the
@@ -4,7 +4,7 @@ AUTHOR = '<%= author %>' # can also be an array of Authors
4
4
  EMAIL = "<%= email %>"
5
5
  DESCRIPTION = "description of gem"
6
6
  GEM_NAME = '<%= gem_name %>' # what ppl will type to install your gem
7
- RUBYFORGE_PROJECT = '<%= gem_name %>' # The unix name for your project
7
+ RUBYFORGE_PROJECT = '<%= project_name %>' # The unix name for your project
8
8
  HOMEPATH = "http://#{RUBYFORGE_PROJECT}.rubyforge.org"
9
9
  DOWNLOAD_PATH = "http://rubyforge.org/projects/#{RUBYFORGE_PROJECT}"
10
10
  EXTRA_DEPENDENCIES = [
@@ -13,7 +13,7 @@ module Newgem
13
13
  end
14
14
 
15
15
  def rubyforge
16
- @rubyforge ||= RubyForge.new(::RubyForge::CONFIG_F)
16
+ @rubyforge ||= RubyForge.new(::RubyForge::CONFIG_F).configure
17
17
  end
18
18
 
19
19
  end
@@ -1,7 +1,7 @@
1
1
  module Newgem
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 0
4
- MINOR = 24
4
+ MINOR = 25
5
5
  TINY = 0
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
@@ -112,6 +112,36 @@ class TestNewgemGenerator < Test::Unit::TestCase
112
112
  generator = run_generator('newgem', [app_root], sources)
113
113
  assert_equal(expected_gem_name, generator.gem_name)
114
114
  end
115
+
116
+ def test_gem_name_should_come_from_project
117
+ gen = build_generator('newgem', [APP_ROOT], sources, {})
118
+ assert_equal 'myproject', gen.gem_name
119
+ end
120
+
121
+ def test_module_name_should_come_from_gem_name
122
+ gen = build_generator('newgem', [APP_ROOT], sources, {})
123
+ assert_equal 'Myproject', gen.module_name
124
+ end
125
+
126
+ def test_project_name_should_default_to_gem_name
127
+ gen = build_generator('newgem', [APP_ROOT], sources, {})
128
+ assert_equal 'myproject', gen.project_name
129
+ end
130
+
131
+ def test_project_name_can_be_overriden
132
+ gen = build_generator('newgem', [APP_ROOT], sources, { :project => 'my_other_project' })
133
+ assert_equal 'my_other_project', gen.project_name
134
+ end
135
+
136
+ def test_gem_name_does_not_change_if_project_name_is_overriden
137
+ gen = build_generator('newgem', [APP_ROOT], sources, { :project => 'my_other_project' })
138
+ assert_equal 'myproject', gen.gem_name
139
+ end
140
+
141
+ def test_module_name_does_not_change_if_project_name_is_overriden
142
+ gen = build_generator('newgem', [APP_ROOT], sources, { :project => 'my_other_project' })
143
+ assert_equal 'Myproject', gen.module_name
144
+ end
115
145
 
116
146
  private
117
147
  def sources
@@ -0,0 +1,66 @@
1
+ require File.join(File.dirname(__FILE__), "test_helper.rb")
2
+ require 'newgem/rubyforge'
3
+
4
+ class TestRubyforge < Test::Unit::TestCase
5
+
6
+ def set_rubyforge_home(dir)
7
+ RubyForge.send(:remove_const, :HOME) if RubyForge.const_defined?(:HOME)
8
+ RubyForge.send(:remove_const, :CONFIG_D) if RubyForge.const_defined?(:CONFIG_D)
9
+ RubyForge.send(:remove_const, :CONFIG_F) if RubyForge.const_defined?(:CONFIG_F)
10
+
11
+ RubyForge.const_set(:HOME, dir)
12
+ RubyForge.const_set(:CONFIG_D, File.join(dir, '.rubyforge'))
13
+ RubyForge.const_set(:CONFIG_F, File.join(dir, '.rubyforge', 'user-config.yml'))
14
+ end
15
+
16
+ def test_full_name_should_be_placeholder_if_nothing_found
17
+ set_rubyforge_home('/tmp')
18
+ ENV.delete('NAME')
19
+ assert_equal 'FIXME full name', Newgem::Rubyforge.new.full_name
20
+ end
21
+
22
+ def test_email_should_be_placeholder_if_nothing_found
23
+ set_rubyforge_home('/tmp')
24
+ ENV.delete('EMAIL')
25
+ assert_equal 'FIXME email', Newgem::Rubyforge.new.email
26
+ end
27
+
28
+ def test_github_username_should_be_placeholder_if_nothing_found
29
+ set_rubyforge_home('/tmp')
30
+ ENV.delete('GITHUB_USERNAME')
31
+ assert_equal 'GITHUB_USERNAME', Newgem::Rubyforge.new.github_username
32
+ end
33
+
34
+ def test_full_name_should_come_from_environment
35
+ set_rubyforge_home('/tmp')
36
+ ENV['NAME'] = 'Environment Fullname'
37
+ assert_equal 'Environment Fullname', Newgem::Rubyforge.new.full_name
38
+ end
39
+
40
+ def test_email_should_come_from_environment
41
+ set_rubyforge_home('/tmp')
42
+ ENV['EMAIL'] = 'env@email.com'
43
+ assert_equal 'env@email.com', Newgem::Rubyforge.new.email
44
+ end
45
+
46
+ def test_github_username_should_come_from_environment
47
+ set_rubyforge_home('/tmp')
48
+ ENV['GITHUB_USERNAME'] = 'ghuser'
49
+ assert_equal 'ghuser', Newgem::Rubyforge.new.github_username
50
+ end
51
+
52
+ def test_full_name_should_come_from_user_config
53
+ set_rubyforge_home File.join(File.dirname(__FILE__), 'fixtures', 'home')
54
+ assert_equal 'Fullname McDeveloper', Newgem::Rubyforge.new.full_name
55
+ end
56
+
57
+ def test_email_should_come_from_user_config
58
+ set_rubyforge_home File.join(File.dirname(__FILE__), 'fixtures', 'home')
59
+ assert_equal 'firstlast@newgem.tld', Newgem::Rubyforge.new.email
60
+ end
61
+
62
+ def test_github_username_should_come_from_user_config
63
+ set_rubyforge_home File.join(File.dirname(__FILE__), 'fixtures', 'home')
64
+ assert_equal 'githubbahubba', Newgem::Rubyforge.new.github_username
65
+ end
66
+ 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 = "http://rubyforge.org/projects/newgem"; return true' -->
35
35
  <p>Get Version</p>
36
- <a href="http://rubyforge.org/projects/newgem" class="numbers">0.24.0</a>
36
+ <a href="http://rubyforge.org/projects/newgem" class="numbers">0.25.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>
@@ -33,7 +33,7 @@
33
33
  <h1>New Gem Generator</h1>
34
34
  <div id="version"> <!-- class="clickable" onclick='document.location = "http://rubyforge.org/projects/newgem"; return true' -->
35
35
  <p>Get Version</p>
36
- <a href="http://rubyforge.org/projects/newgem" class="numbers">0.24.0</a>
36
+ <a href="http://rubyforge.org/projects/newgem" class="numbers">0.25.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>
@@ -1,3 +1,3 @@
1
1
  // Announcement JS file
2
- var version = "0.24.0";
2
+ var version = "0.25.0";
3
3
  MagicAnnouncement.show('compositekeys', version);
data/website/version.js CHANGED
@@ -1,4 +1,4 @@
1
1
  // Version JS file
2
- var version = "0.24.0";
2
+ var version = "0.25.0";
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.24.0
4
+ version: 0.25.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-06-17 00:00:00 +10:00
12
+ date: 2008-06-19 00:00:00 +10:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -279,3 +279,4 @@ test_files:
279
279
  - test/test_newgem_generator.rb
280
280
  - test/test_newgem_simple_generator.rb
281
281
  - test/test_plain_theme_generator.rb
282
+ - test/test_rubyforge.rb