newgem 0.25.0 → 0.27.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +12 -0
- data/Manifest.txt +6 -5
- data/{README.txt → README.rdoc} +30 -30
- data/app_generators/newgem/newgem_generator.rb +5 -5
- data/app_generators/newgem/templates/{README.txt → README.rdoc} +0 -0
- data/app_generators/newgem/templates/lib/version.rb +1 -0
- data/app_generators/newgem_simple/newgem_simple_generator.rb +1 -1
- data/app_generators/newgem_simple/templates/README.rdoc +3 -0
- data/app_generators/newgem_simple/templates/Rakefile +11 -1
- data/config/hoe.rb +8 -8
- data/lib/newgem/version.rb +1 -1
- data/newgem_generators/install_website/templates/script/txt2html +1 -1
- data/script/txt2html +1 -1
- data/test/fixtures/home/.rubyforge/auto-config.yml +54 -0
- data/test/fixtures/home/.rubyforge/user-config.yml +23 -0
- data/test/test_newgem_generator.rb +1 -1
- data/test/test_newgem_simple_generator.rb +1 -1
- data/website/index.html +116 -249
- data/website/index.txt +1 -1
- data/website/rubyforge.html +62 -98
- data/website/stylesheets/screen.css +20 -1
- data/website/template.html.erb +26 -5
- data/website/version-raw.js +1 -1
- data/website/version.js +1 -1
- metadata +16 -14
- data/License.txt +0 -20
- data/app_generators/newgem/templates/License.txt +0 -20
- data/app_generators/newgem_simple/templates/README +0 -4
data/History.txt
CHANGED
@@ -1,3 +1,15 @@
|
|
1
|
+
== 0.27.0 2008-09-20
|
2
|
+
|
3
|
+
* Remove License.txt as its contents are in README (newgem + generator)
|
4
|
+
* RedCloth dependency - changed to new 4.0.0 version which is apparently new a shiny + fast
|
5
|
+
* Load RubyForge autoconfig correctly
|
6
|
+
* Integrate twitter search for 'newgem' on website
|
7
|
+
|
8
|
+
== 0.26.0 2008-06-21 NEVER RELEASED
|
9
|
+
|
10
|
+
* README.rdoc is the name of generated and internal README root files, since github makes them look pretty
|
11
|
+
* RedCloth dependency - changed to =3.0.3 as 3.0.4 is dodgy apparently [Roger Pack]
|
12
|
+
|
1
13
|
== 0.25.0 2008-06-19
|
2
14
|
|
3
15
|
* newgem: added --project option to allow a different Rubyforge [Yossef Mendelssohn]
|
data/Manifest.txt
CHANGED
@@ -1,15 +1,13 @@
|
|
1
1
|
History.txt
|
2
|
-
License.txt
|
3
2
|
Manifest.txt
|
4
3
|
PostInstall.txt
|
5
|
-
README.
|
4
|
+
README.rdoc
|
6
5
|
Rakefile
|
7
6
|
Todo.txt
|
8
7
|
app_generators/newgem/newgem_generator.rb
|
9
8
|
app_generators/newgem/templates/History.txt
|
10
|
-
app_generators/newgem/templates/License.txt
|
11
9
|
app_generators/newgem/templates/PostInstall.txt
|
12
|
-
app_generators/newgem/templates/README.
|
10
|
+
app_generators/newgem/templates/README.rdoc
|
13
11
|
app_generators/newgem/templates/Rakefile
|
14
12
|
app_generators/newgem/templates/config/hoe.rb
|
15
13
|
app_generators/newgem/templates/config/requirements.rb
|
@@ -25,7 +23,7 @@ app_generators/newgem/templates/tasks/website.rake
|
|
25
23
|
app_generators/newgem_simple/USAGE
|
26
24
|
app_generators/newgem_simple/newgem_simple_generator.rb
|
27
25
|
app_generators/newgem_simple/templates/LICENSE
|
28
|
-
app_generators/newgem_simple/templates/README
|
26
|
+
app_generators/newgem_simple/templates/README.rdoc
|
29
27
|
app_generators/newgem_simple/templates/Rakefile
|
30
28
|
app_generators/newgem_simple/templates/TODO
|
31
29
|
app_generators/newgem_simple/templates/lib/templates.rb
|
@@ -101,6 +99,8 @@ tasks/deployment.rake
|
|
101
99
|
tasks/environment.rake
|
102
100
|
tasks/generator_report.rake
|
103
101
|
tasks/website.rake
|
102
|
+
test/fixtures/home/.rubyforge/auto-config.yml
|
103
|
+
test/fixtures/home/.rubyforge/user-config.yml
|
104
104
|
test/test_executable_generator.rb
|
105
105
|
test/test_extconf_generator.rb
|
106
106
|
test/test_generator_helper.rb
|
@@ -113,6 +113,7 @@ test/test_install_website_generator.rb
|
|
113
113
|
test/test_newgem_generator.rb
|
114
114
|
test/test_newgem_simple_generator.rb
|
115
115
|
test/test_plain_theme_generator.rb
|
116
|
+
test/test_rubyforge.rb
|
116
117
|
website/images/beginning-ruby.jpg
|
117
118
|
website/index.html
|
118
119
|
website/index.txt
|
data/{README.txt → README.rdoc}
RENAMED
@@ -14,36 +14,36 @@ Within this gem, you get one thing - <code>newgem</code> - an executable to crea
|
|
14
14
|
|
15
15
|
Go to the folder where you want to create your new gem folder structure, and run the <code>newgem</code> command to generate your gem scaffolding.
|
16
16
|
|
17
|
-
|
18
|
-
$ newgem wizzo
|
19
|
-
creating: wizzo
|
20
|
-
creating: wizzo/CHANGELOG.txt
|
21
|
-
creating: wizzo/README.txt
|
22
|
-
creating: wizzo/lib
|
23
|
-
creating: wizzo/script
|
24
|
-
creating: wizzo/website
|
25
|
-
creating: wizzo/website/javascripts
|
26
|
-
creating: wizzo/website/stylesheets
|
27
|
-
creating: wizzo/lib/wizzo
|
28
|
-
creating: wizzo/lib/wizzo.rb
|
29
|
-
creating: wizzo/lib/wizzo/version.rb
|
30
|
-
creating: wizzo/bin
|
31
|
-
creating: wizzo/test
|
32
|
-
creating: wizzo/test/test_helper.rb
|
33
|
-
creating: wizzo/test/test_wizzo.rb
|
34
|
-
creating: wizzo/examples
|
35
|
-
creating: wizzo/setup.rb
|
36
|
-
creating: wizzo/Rakefile
|
37
|
-
creating: wizzo/Manifest.txt
|
38
|
-
creating: wizzo/History.txt
|
39
|
-
creating: wizzo/script/generate
|
40
|
-
creating: wizzo/script/txt2html
|
41
|
-
creating: wizzo/website/index.txt
|
42
|
-
creating: wizzo/website/template.html.erb
|
43
|
-
copying: wizzo/website/javascripts/rounded_corners_lite.inc.js
|
44
|
-
copying: wizzo/website/stylesheets/screen.css
|
45
|
-
NOW - update wizzo/Rakefile with gem description, etc
|
46
|
-
|
17
|
+
cd ~/ruby_projects
|
18
|
+
$ newgem wizzo
|
19
|
+
creating: wizzo
|
20
|
+
creating: wizzo/CHANGELOG.txt
|
21
|
+
creating: wizzo/README.txt
|
22
|
+
creating: wizzo/lib
|
23
|
+
creating: wizzo/script
|
24
|
+
creating: wizzo/website
|
25
|
+
creating: wizzo/website/javascripts
|
26
|
+
creating: wizzo/website/stylesheets
|
27
|
+
creating: wizzo/lib/wizzo
|
28
|
+
creating: wizzo/lib/wizzo.rb
|
29
|
+
creating: wizzo/lib/wizzo/version.rb
|
30
|
+
creating: wizzo/bin
|
31
|
+
creating: wizzo/test
|
32
|
+
creating: wizzo/test/test_helper.rb
|
33
|
+
creating: wizzo/test/test_wizzo.rb
|
34
|
+
creating: wizzo/examples
|
35
|
+
creating: wizzo/setup.rb
|
36
|
+
creating: wizzo/Rakefile
|
37
|
+
creating: wizzo/Manifest.txt
|
38
|
+
creating: wizzo/History.txt
|
39
|
+
creating: wizzo/script/generate
|
40
|
+
creating: wizzo/script/txt2html
|
41
|
+
creating: wizzo/website/index.txt
|
42
|
+
creating: wizzo/website/template.html.erb
|
43
|
+
copying: wizzo/website/javascripts/rounded_corners_lite.inc.js
|
44
|
+
copying: wizzo/website/stylesheets/screen.css
|
45
|
+
NOW - update wizzo/Rakefile with gem description, etc
|
46
|
+
|
47
47
|
|
48
48
|
As of 0.10.0 - you can generate test::unit or rspec test stubs via the -t, --test-with options
|
49
49
|
|
@@ -12,7 +12,7 @@ class NewgemGenerator < RubiGen::Base
|
|
12
12
|
:import_path => nil,
|
13
13
|
:jruby => nil,
|
14
14
|
:disable_website => nil,
|
15
|
-
:test_framework => '
|
15
|
+
:test_framework => 'test_unit',
|
16
16
|
:version => '0.0.1'
|
17
17
|
|
18
18
|
|
@@ -49,7 +49,7 @@ class NewgemGenerator < RubiGen::Base
|
|
49
49
|
m.directory "lib/#{gem_name}"
|
50
50
|
|
51
51
|
# Root
|
52
|
-
m.template_copy_each %w( History.txt
|
52
|
+
m.template_copy_each %w( History.txt Rakefile README.rdoc PostInstall.txt )
|
53
53
|
m.file_copy_each %w( setup.rb )
|
54
54
|
|
55
55
|
# Default module for app
|
@@ -64,7 +64,7 @@ class NewgemGenerator < RubiGen::Base
|
|
64
64
|
|
65
65
|
# Selecting a test framework
|
66
66
|
case test_framework
|
67
|
-
when "
|
67
|
+
when "test_unit"
|
68
68
|
m.dependency "install_test_unit", [gem_name], :destination => destination_root, :collision => :force
|
69
69
|
when "rspec"
|
70
70
|
m.dependency "install_rspec", [gem_name], :destination => destination_root, :collision => :force
|
@@ -132,7 +132,7 @@ EOS
|
|
132
132
|
"Default: #{DEFAULT_SHEBANG}") { |x| options[:shebang] = x }
|
133
133
|
opts.on("-T", "--test-with=TEST_FRAMEWORK", String,
|
134
134
|
"Select your preferred testing framework.",
|
135
|
-
"Options:
|
135
|
+
"Options: test_unit (default), rspec.") { |x| options[:test_framework] = x }
|
136
136
|
opts.on("-v", "--version", "Show the #{File.basename($0)} version number and quit.")
|
137
137
|
opts.on("-V", "--set-version=YOUR_VERSION", String,
|
138
138
|
"Version of the gem you are creating.",
|
@@ -157,7 +157,7 @@ EOS
|
|
157
157
|
@bin_names_list = (options[:bin_name] || "").split(',')
|
158
158
|
@disable_website = options[:disable_website]
|
159
159
|
|
160
|
-
@test_framework = options[:test_framework] || "
|
160
|
+
@test_framework = options[:test_framework] || "test_unit"
|
161
161
|
@is_jruby = options[:jruby]
|
162
162
|
@project_name = options[:project] if options.include?(:project)
|
163
163
|
end
|
File without changes
|
@@ -26,7 +26,7 @@ class NewgemSimpleGenerator < RubiGen::Base
|
|
26
26
|
m.file "lib/templates.rb", "lib/#{name}.rb"
|
27
27
|
m.template "spec/templates_spec.rb.erb", "spec/#{name}_spec.rb"
|
28
28
|
|
29
|
-
%w[ LICENSE Rakefile README ].each {|file| m.template file, file}
|
29
|
+
%w[ LICENSE Rakefile README.rdoc ].each {|file| m.template file, file}
|
30
30
|
%w[ TODO spec/spec_helper.rb ].each {|file| m.file file, file }
|
31
31
|
|
32
32
|
m.dependency "install_rubigen_scripts", [destination_root, 'newgem_simple'],
|
@@ -2,6 +2,7 @@ require 'rubygems'
|
|
2
2
|
require 'rake/gempackagetask'
|
3
3
|
require 'rubygems/specification'
|
4
4
|
require 'date'
|
5
|
+
require 'spec/rake/spectask'
|
5
6
|
|
6
7
|
GEM = "<%= name %>"
|
7
8
|
GEM_VERSION = "0.0.1"
|
@@ -27,9 +28,18 @@ spec = Gem::Specification.new do |s|
|
|
27
28
|
|
28
29
|
s.require_path = 'lib'
|
29
30
|
s.autorequire = GEM
|
30
|
-
s.files = %w(LICENSE README Rakefile TODO) + Dir.glob("{lib,
|
31
|
+
s.files = %w(LICENSE README Rakefile TODO) + Dir.glob("{lib,spec}/**/*")
|
31
32
|
end
|
32
33
|
|
34
|
+
task :default => :spec
|
35
|
+
|
36
|
+
desc "Run specs"
|
37
|
+
Spec::Rake::SpecTask.new do |t|
|
38
|
+
t.spec_files = FileList['spec/**/*_spec.rb']
|
39
|
+
t.spec_opts = %w(-fs --color)
|
40
|
+
end
|
41
|
+
|
42
|
+
|
33
43
|
Rake::GemPackageTask.new(spec) do |pkg|
|
34
44
|
pkg.gem_spec = spec
|
35
45
|
end
|
data/config/hoe.rb
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
require 'hoe'
|
2
2
|
require 'newgem/version'
|
3
3
|
|
4
|
-
AUTHOR
|
5
|
-
EMAIL
|
6
|
-
DESCRIPTION
|
7
|
-
GEM_NAME
|
4
|
+
AUTHOR = "Dr Nic Williams"
|
5
|
+
EMAIL = "drnicwilliams@gmail.com"
|
6
|
+
DESCRIPTION = "Make your own gems at home"
|
7
|
+
GEM_NAME = "newgem" # what ppl will type to install your gem
|
8
8
|
RUBYFORGE_PROJECT = "newgem"
|
9
|
-
HOMEPATH
|
10
|
-
DOWNLOAD_PATH
|
9
|
+
HOMEPATH = "http://#{RUBYFORGE_PROJECT}.rubyforge.org"
|
10
|
+
DOWNLOAD_PATH = "http://rubyforge.org/projects/#{RUBYFORGE_PROJECT}"
|
11
11
|
|
12
12
|
@config_file = "~/.rubyforge/user-config.yml"
|
13
13
|
@config = nil
|
@@ -47,7 +47,7 @@ hoe = Hoe.new(GEM_NAME, VERS) do |p|
|
|
47
47
|
# == Optional
|
48
48
|
p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
|
49
49
|
p.extra_deps = [
|
50
|
-
['RedCloth','>=
|
50
|
+
['RedCloth','>=4.0.0'],
|
51
51
|
['syntax','>=1.0.0'],
|
52
52
|
['activesupport','>=2.0.2'],
|
53
53
|
['rubigen','>=1.3.0']
|
@@ -59,4 +59,4 @@ CHANGES = hoe.paragraphs_of('History.txt', 0..1).join("\n\n")
|
|
59
59
|
PATH = (RUBYFORGE_PROJECT == GEM_NAME) ? RUBYFORGE_PROJECT : "\#{RUBYFORGE_PROJECT}/\#{GEM_NAME}"
|
60
60
|
hoe.remote_rdoc_dir = File.join(PATH.gsub(/^#{RUBYFORGE_PROJECT}\/?/,''), 'rdoc')
|
61
61
|
hoe.rsync_args = '-av --delete --ignore-errors'
|
62
|
-
hoe.spec.post_install_message = File.open(File.dirname(__FILE__) + "/../PostInstall.txt").read rescue ""
|
62
|
+
hoe.spec.post_install_message = File.open(File.dirname(__FILE__) + "/../PostInstall.txt").read rescue ""
|
data/lib/newgem/version.rb
CHANGED
@@ -21,7 +21,7 @@ version = <%= module_name %>::VERSION::STRING
|
|
21
21
|
download = "http://rubyforge.org/projects/#{RUBYFORGE_PROJECT}"
|
22
22
|
|
23
23
|
def rubyforge_project_id
|
24
|
-
RubyForge.new.autoconfig["group_ids"][RUBYFORGE_PROJECT]
|
24
|
+
RubyForge.new.configure.autoconfig["group_ids"][RUBYFORGE_PROJECT]
|
25
25
|
end
|
26
26
|
|
27
27
|
class Fixnum
|
data/script/txt2html
CHANGED
@@ -21,7 +21,7 @@ version = Newgem::VERSION::STRING
|
|
21
21
|
download = "http://rubyforge.org/projects/#{RUBYFORGE_PROJECT}"
|
22
22
|
|
23
23
|
def rubyforge_project_id
|
24
|
-
RubyForge.new.autoconfig["group_ids"][RUBYFORGE_PROJECT]
|
24
|
+
RubyForge.new.configure.autoconfig["group_ids"][RUBYFORGE_PROJECT]
|
25
25
|
end
|
26
26
|
|
27
27
|
class Fixnum
|
@@ -0,0 +1,54 @@
|
|
1
|
+
---
|
2
|
+
processor_ids:
|
3
|
+
IA64: 6000
|
4
|
+
AMD-64: 1500
|
5
|
+
Any: 8000
|
6
|
+
Sparc: 4000
|
7
|
+
PPC: 2000
|
8
|
+
Other: 9999
|
9
|
+
Alpha: 7000
|
10
|
+
i386: 1000
|
11
|
+
UltraSparc: 5000
|
12
|
+
MIPS: 3000
|
13
|
+
release_ids:
|
14
|
+
some_package:
|
15
|
+
0.2.0: 12345
|
16
|
+
0.2.1: 23456
|
17
|
+
0.2.2: 34567
|
18
|
+
some_other_package:
|
19
|
+
0.0.2: 123
|
20
|
+
0.0.1: 456
|
21
|
+
group_ids:
|
22
|
+
some_group: 1234
|
23
|
+
type_ids:
|
24
|
+
.deb: 1000
|
25
|
+
.zip: 3000
|
26
|
+
.gz: 3110
|
27
|
+
.src.rpm: 5100
|
28
|
+
.jpg: 8000
|
29
|
+
.htm: 8200
|
30
|
+
.src.bz2: 5010
|
31
|
+
.html: 8200
|
32
|
+
.oth: 9999
|
33
|
+
.pem: 1500
|
34
|
+
.src.gz: 5020
|
35
|
+
.src: 5900
|
36
|
+
.pgp: 8150
|
37
|
+
.rpm: 2000
|
38
|
+
.bz2: 3100
|
39
|
+
.text: 8100
|
40
|
+
.ebuild: 1300
|
41
|
+
.gem: 1400
|
42
|
+
.txt: 8100
|
43
|
+
.src.tar.bz2: 5010
|
44
|
+
.tgz: 5000
|
45
|
+
.sig: 8150
|
46
|
+
.pdf: 8300
|
47
|
+
.exe: 1100
|
48
|
+
.src.zip: 5000
|
49
|
+
.src.tar.gz: 5020
|
50
|
+
.dmg: 1200
|
51
|
+
.tar.gz: 5000
|
52
|
+
package_ids:
|
53
|
+
some_package: 4321
|
54
|
+
some_other_package: 5432
|
@@ -0,0 +1,23 @@
|
|
1
|
+
|
2
|
+
#
|
3
|
+
# base rubyforge uri - store in /Users/username/.rubyforge/user-config.yml
|
4
|
+
#
|
5
|
+
uri : http://rubyforge.org
|
6
|
+
#
|
7
|
+
# this must be your username
|
8
|
+
#
|
9
|
+
username : user_name
|
10
|
+
#
|
11
|
+
# this must be your password
|
12
|
+
#
|
13
|
+
password : pass_word
|
14
|
+
#
|
15
|
+
# defaults for some values
|
16
|
+
#
|
17
|
+
cookie_jar : /Users/username/.rubyforge/cookie.dat
|
18
|
+
is_private : false
|
19
|
+
|
20
|
+
full_name : Fullname McDeveloper
|
21
|
+
email : firstlast@newgem.tld
|
22
|
+
github_username: githubbahubba
|
23
|
+
|
@@ -21,7 +21,7 @@ class TestNewgemGenerator < Test::Unit::TestCase
|
|
21
21
|
assert_directory_exists "tasks"
|
22
22
|
assert_directory_exists "test"
|
23
23
|
|
24
|
-
%w[Rakefile README.
|
24
|
+
%w[Rakefile README.rdoc History.txt Manifest.txt PostInstall.txt].each do |file|
|
25
25
|
assert_generated_file(file)
|
26
26
|
end
|
27
27
|
|
data/website/index.html
CHANGED
@@ -24,6 +24,10 @@
|
|
24
24
|
}
|
25
25
|
var versionBox = new curvyCorners(settings, document.getElementById("version"));
|
26
26
|
versionBox.applyCornersToAll();
|
27
|
+
|
28
|
+
var twitterBox = new curvyCorners(settings, document.getElementById("twitter_search"));
|
29
|
+
twitterBox.applyCornersToAll();
|
30
|
+
|
27
31
|
}
|
28
32
|
</script>
|
29
33
|
</head>
|
@@ -31,45 +35,40 @@
|
|
31
35
|
<div id="main">
|
32
36
|
|
33
37
|
<h1>New Gem Generator</h1>
|
34
|
-
<div
|
35
|
-
|
36
|
-
<
|
37
|
-
|
38
|
-
|
38
|
+
<div class="sidebar">
|
39
|
+
|
40
|
+
<div id="version"> <!-- class="clickable" onclick='document.location = "http://rubyforge.org/projects/newgem"; return true' -->
|
41
|
+
<p>Get Version</p>
|
42
|
+
<a href="http://rubyforge.org/projects/newgem" class="numbers">0.27.0</a>
|
43
|
+
<p>Featured in</p>
|
44
|
+
<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>
|
45
|
+
</div>
|
46
|
+
|
47
|
+
<div id="twitter_search">
|
48
|
+
<h3>Heard on twitter ('newgem')...</h3>
|
49
|
+
<!-- HELP FILE - http://twitterwidget.jazzychad.com/tw/ -->
|
50
|
+
<script language = "javascript">
|
51
|
+
var jtw_search = 'newgem';
|
52
|
+
var jtw_widget_background = 'B3ABFF';
|
53
|
+
var jtw_widget_border = '0';
|
54
|
+
var jtw_tweet_textcolor = 'fff';
|
55
|
+
var jtw_tweet_background = '000';
|
56
|
+
var jtw_tweet_border = '0px';
|
57
|
+
</script>
|
58
|
+
<script src="http://twitterwidget.jazzychad.com/tw/searchwidget.js" type="text/javascript"></script>
|
59
|
+
</div>
|
39
60
|
</div>
|
40
|
-
<h1
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
<p>Within this gem, you get one thing – <code>newgem</code> – an executable to create your own gems. Your new gems will include designated folders for Ruby code, test files, executables, and even a default website page for you to explain your project, and which instantly uploads to RubyForge website (which looks just like this one by default)</p>
|
53
|
-
|
54
|
-
|
55
|
-
<h2>Installing</h2>
|
56
|
-
|
57
|
-
|
58
|
-
<p>The <code>newgem</code> application is distributed itself as a RubyGem and is available immediately after installation.</p>
|
59
|
-
|
60
|
-
|
61
|
-
<p><pre class='syntax'><span class="ident">sudo</span> <span class="ident">gem</span> <span class="ident">install</span> <span class="ident">newgem</span></pre></p>
|
62
|
-
|
63
|
-
|
64
|
-
<p>Alternately, download the gem and install manually.</p>
|
65
|
-
|
66
|
-
|
67
|
-
<h2>The basics</h2>
|
68
|
-
|
69
|
-
|
70
|
-
<p>Go to the folder where you want to create your new gem folder structure, and run the <code>newgem</code> command to generate your gem scaffolding.</p>
|
71
|
-
|
72
|
-
|
61
|
+
<h1>newgem</h1>
|
62
|
+
<h2>What</h2>
|
63
|
+
<p>Quickly bundle any Ruby libraries into a RubyGem and share it with the world, your colleagues, or perhaps just with yourself amongst your projects.</p>
|
64
|
+
<p>RubyGems are centrally stored, versioned, and support dependencies between other gems, so they are the ultimate way to bundle libraries, executables, associated tests, examples, and more.</p>
|
65
|
+
<p>Within this gem, you get one thing – <code>newgem</code> – an executable to create your own gems. Your new gems will include designated folders for Ruby code, test files, executables, and even a default website page for you to explain your project, and which instantly uploads to RubyForge website (which looks just like this one by default)</p>
|
66
|
+
<h2>Installing</h2>
|
67
|
+
<p>The <code>newgem</code> application is distributed itself as a RubyGem and is available immediately after installation.</p>
|
68
|
+
<p><pre class='syntax'><span class="ident">sudo</span> <span class="ident">gem</span> <span class="ident">install</span> <span class="ident">newgem</span></pre></p>
|
69
|
+
<p>Alternately, download the gem and install manually.</p>
|
70
|
+
<h2>The basics</h2>
|
71
|
+
<p>Go to the folder where you want to create your new gem folder structure, and run the <code>newgem</code> command to generate your gem scaffolding.</p>
|
73
72
|
<pre>$ cd ~/ruby_projects
|
74
73
|
$ newgem wizzo
|
75
74
|
create
|
@@ -124,241 +123,109 @@ Important
|
|
124
123
|
* Open config/hoe.rb
|
125
124
|
* Update missing details (gem description, dependent gems, etc.)
|
126
125
|
</pre>
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
<p>If you create any new files, you need to manually add them to the Manifest.txt. Alphabetical order is optional, but it will make the results of <code>rake check_manifest</code> look clean if you keep them ordered. If a file is not in the Manifest.txt it will not be included in the gem when you package and release it.</p>
|
144
|
-
|
145
|
-
|
146
|
-
<h3>Executables</h3>
|
147
|
-
|
148
|
-
|
149
|
-
<p>You can include executable Ruby applications in your gem, which will be accessible on Windows and Unix/Linux/MacOS, by creating scripts in the <code>bin</code> folder. When the gem is deployed by users, these executables will be automatically placed within their path.</p>
|
150
|
-
|
151
|
-
|
152
|
-
<h3>Website</h3>
|
153
|
-
|
154
|
-
|
155
|
-
<p>The final step before releasing your gem to the world is the all-important website. Edit the file <code>website/index.txt</code> using Textile/Redcloth syntax. Syntax highlighting is also supported (see below). If you need more website pages, create more <strong>txt</strong> files in the website folder.</p>
|
156
|
-
|
157
|
-
|
158
|
-
<p>Run the rake task <code>rake website_generate</code> to convert all your website txt files into html files.</p>
|
159
|
-
|
160
|
-
|
161
|
-
<p><span class="caps">NOTE</span>: Currently, the initial <code>index.txt</code> file includes my details not yours. Currently you need to change this manually.</p>
|
162
|
-
|
163
|
-
|
164
|
-
<p>If you don’t want a website, remove the <code>website</code> related files from the Manifest.txt.</p>
|
165
|
-
|
166
|
-
|
167
|
-
<h3>Change the gems version number</h3>
|
168
|
-
|
169
|
-
|
170
|
-
<p>The version number is set in the file <code>lib/#gem name#/version.rb</code>. Update it as appropriate with major, minor and bug fix numbers. This value will be used when generating your website, for example.</p>
|
171
|
-
|
172
|
-
|
173
|
-
<h3>Check the manifest</h3>
|
174
|
-
|
175
|
-
|
126
|
+
<p>As of 0.10.0 – you can generate test::unit or rspec test stubs via the <code>-T</code> or <code>--test-with</code> options. For example, <code>-T rspec</code> generates a <code>spec</code> folder with some test stubs.</p>
|
127
|
+
<h3>Setup</h3>
|
128
|
+
<p>Now modify the constants at the top of <strong>config/hoe.rb</strong>, with your name, email and the location where you’ll host your website for the gem. The defaults are tied to RubyForge for uploading the gems and the website (see below).</p>
|
129
|
+
<h3>Create code and tests</h3>
|
130
|
+
<p>Then create your libraries (files in <code>lib</code>) and your tests (files in <code>test</code> that look like <code>test_TESTNAME.rb</code>). <a href="http://blog.grayproductions.net/">James Edward Gray II</a> did a <a href="http://macromates.com/screencasts">nice video</a> on test-driven design, that’s worth watching if <span class="caps">TDD</span> is new to you.</p>
|
131
|
+
<p>If you create any new files, you need to manually add them to the Manifest.txt. Alphabetical order is optional, but it will make the results of <code>rake check_manifest</code> look clean if you keep them ordered. If a file is not in the Manifest.txt it will not be included in the gem when you package and release it.</p>
|
132
|
+
<h3>Executables</h3>
|
133
|
+
<p>You can include executable Ruby applications in your gem, which will be accessible on Windows and Unix/Linux/MacOS, by creating scripts in the <code>bin</code> folder. When the gem is deployed by users, these executables will be automatically placed within their path.</p>
|
134
|
+
<h3>Website</h3>
|
135
|
+
<p>The final step before releasing your gem to the world is the all-important website. Edit the file <code>website/index.txt</code> using Textile/Redcloth syntax. Syntax highlighting is also supported (see below). If you need more website pages, create more <strong>txt</strong> files in the website folder.</p>
|
136
|
+
<p>Run the rake task <code>rake website_generate</code> to convert all your website txt files into html files.</p>
|
137
|
+
<p><span class="caps">NOTE</span>: Currently, the initial <code>index.txt</code> file includes my details not yours. Currently you need to change this manually.</p>
|
138
|
+
<p>If you don’t want a website, remove the <code>website</code> related files from the Manifest.txt.</p>
|
139
|
+
<h3>Change the gems version number</h3>
|
140
|
+
<p>The version number is set in the file <code>lib/#gem name#/version.rb</code>. Update it as appropriate with major, minor and bug fix numbers. This value will be used when generating your website, for example.</p>
|
141
|
+
<h3>Check the manifest</h3>
|
176
142
|
<blockquote>Manifest: a customs document listing the contents put on a ship or plane.</blockquote>
|
177
|
-
<cite><a href="http://www.google.com/search?q=define%3Amanifest">Google – define:manifest</a></cite>
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
<p>Before you package your gem, you can compared the list of files in your gem folder, with the Manifest.txt:</p>
|
183
|
-
|
184
|
-
|
143
|
+
<p><cite><a href="http://www.google.com/search?q=define%3Amanifest">Google – define:manifest</a></cite></p>
|
144
|
+
<p>Similarly here, a manifest is the log of the files to be packaged into a gem. If its not in the <code>Manifest.txt</code> file, the users won’t get it.</p>
|
145
|
+
<p>Before you package your gem, you can compared the list of files in your gem folder, with the Manifest.txt:</p>
|
185
146
|
<pre>rake check_manifest</pre>
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
<h2>Package and test locally</h2>
|
191
|
-
|
192
|
-
|
193
|
-
<p>Before releasing a new version of a gem, it is a great idea to install the gem locally and do some sanity checks. You know, to limit the chance of you looking like a noob.</p>
|
194
|
-
|
195
|
-
|
147
|
+
<p>The results show a <em>diff</em> of the two.</p>
|
148
|
+
<h2>Package and test locally</h2>
|
149
|
+
<p>Before releasing a new version of a gem, it is a great idea to install the gem locally and do some sanity checks. You know, to limit the chance of you looking like a noob.</p>
|
196
150
|
<pre>rake local_deploy</pre>
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
<h2>Releasing your gem to the world</h2>
|
208
|
-
|
209
|
-
|
210
|
-
<p>Once you’re ready for release there are some final steps.</p>
|
211
|
-
|
212
|
-
|
213
|
-
<p><a name="setup_rubyforge"></a></p>
|
214
|
-
|
215
|
-
|
216
|
-
<h3>Setup your environment to upload to RubyForge.</h3>
|
217
|
-
|
218
|
-
|
219
|
-
<p>There are several steps you need to perform initially to <a href="rubyforge.html">setup your environment for uploading gems to RubyForge</a>.</p>
|
220
|
-
|
221
|
-
|
222
|
-
<h3>Document changes in History.txt</h3>
|
223
|
-
|
224
|
-
|
225
|
-
<p>Between each version of your gem, you probably changed something. You should document this in the <code>History.txt</code> file. For each new release, you need to add two paragraphs that look like this:</p>
|
226
|
-
|
227
|
-
|
151
|
+
<p>This generates the website html files into your website folder, and locally installs the gem, ready for testing and local use.</p>
|
152
|
+
<p>Now pretend to be a user, and do some tests – especially of new functionality – so you are comfortable all the files have been packaged up, and you haven’t missed anything in the <code>Manifest.txt</code>.</p>
|
153
|
+
<p>One set of tests you should do is to repeat any tutorials you include in your website. If your gem is dependent on other gems that are rapidly changing, its possible your tutorial might be invalid even if your unit tests are successful. Best you find any errors before the users start emailing you!</p>
|
154
|
+
<h2>Releasing your gem to the world</h2>
|
155
|
+
<p>Once you’re ready for release there are some final steps.</p>
|
156
|
+
<p><a name="setup_rubyforge"></a></p>
|
157
|
+
<h3>Setup your environment to upload to RubyForge.</h3>
|
158
|
+
<p>There are several steps you need to perform initially to <a href="rubyforge.html">setup your environment for uploading gems to RubyForge</a>.</p>
|
159
|
+
<h3>Document changes in History.txt</h3>
|
160
|
+
<p>Between each version of your gem, you probably changed something. You should document this in the <code>History.txt</code> file. For each new release, you need to add two paragraphs that look like this:</p>
|
228
161
|
<pre>== 0.5.4 14/4/2007
|
229
|
-
|
162
|
+
|
230
163
|
* 1 major improvement
|
231
164
|
* 150% more Wizzos
|
232
165
|
* 2 bug fixes
|
233
166
|
* Wizzos are the proper colour
|
234
167
|
* You only get Wizzos when you ask for them
|
235
168
|
</pre>
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
<h3>Release the gem and upload the website and rdocs</h3>
|
244
|
-
|
245
|
-
|
246
|
-
<p>Run <code>rake deploy VERSION=X.Y.Z</code> after you’ve done all these steps. It does the following:</p>
|
247
|
-
|
248
|
-
|
249
|
-
<ol>
|
169
|
+
<p>The two paragraphs will be automatically picked up by the following release process and documented against the release on RubyForge site. To see an example of the end result, look at the <a href="http://newgem.rubyforge.org/rdoc/files/History_txt.html"><strong>History</strong> page for newgem</a>.</p>
|
170
|
+
<p>The History.txt notes for your first release have already been started for you.</p>
|
171
|
+
<h3>Release the gem and upload the website and rdocs</h3>
|
172
|
+
<p>Run <code>rake deploy VERSION=X.Y.Z</code> after you’ve done all these steps. It does the following:</p>
|
173
|
+
<ol>
|
250
174
|
<li>Uploads your website to rubyforge</li>
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
<p>It can take an hour or two before new gem releases are available via the gem installer. But when they are ready, everyone will be able to download and install your gem using:</p>
|
257
|
-
|
258
|
-
|
175
|
+
<li>Uploads your rdocs to rubyforge</li>
|
176
|
+
<li>Packages and uploads your gem to RubyForge</li>
|
177
|
+
</ol>
|
178
|
+
<p>It can take an hour or two before new gem releases are available via the gem installer. But when they are ready, everyone will be able to download and install your gem using:</p>
|
259
179
|
<pre>sudo gem install #gem_name#</pre>
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
<ul>
|
180
|
+
<p>If your GEM_NAME and RUBYFORGE_PROJECT name are the same, then:</p>
|
181
|
+
<ul>
|
265
182
|
<li>http://RUBYFORGE_PROJECT.rubyforge.org is your website, and</li>
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
<p>If they are different, then:</p>
|
271
|
-
|
272
|
-
|
273
|
-
<ul>
|
183
|
+
<li>http://RUBYFORGE_PROJECT.rubyforge.org/rdoc is your rdocs</li>
|
184
|
+
</ul>
|
185
|
+
<p>If they are different, then:</p>
|
186
|
+
<ul>
|
274
187
|
<li>http://RUBYFORGE_PROJECT.rubyforge.org/GEM_NAME is your website, and</li>
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
<p>Your gem uses the Hoe gem to provide a dozen or so useful rake tasks for managing your gem, such as <code>release</code>, <code>check_manifest</code> and <code>publish_docs</code>.</p>
|
283
|
-
|
284
|
-
|
285
|
-
<p>See them all with:</p>
|
286
|
-
|
287
|
-
|
188
|
+
<li>http://RUBYFORGE_PROJECT.rubyforge.org/GEM_NAME/rdoc is your rdocs</li>
|
189
|
+
</ul>
|
190
|
+
<h2>Bonus tasks thanks to Hoe</h2>
|
191
|
+
<p>Your gem uses the Hoe gem to provide a dozen or so useful rake tasks for managing your gem, such as <code>release</code>, <code>check_manifest</code> and <code>publish_docs</code>.</p>
|
192
|
+
<p>See them all with:</p>
|
288
193
|
<pre>rake -T</pre>
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
<p>For more information about each task, see the <a href="http://seattlerb.rubyforge.org/hoe/">Hoe <span class="caps">README</span></a></p>
|
294
|
-
|
295
|
-
|
296
|
-
<h2>Related articles</h2>
|
297
|
-
|
298
|
-
|
299
|
-
<ul>
|
194
|
+
<p>Remember, the Rakefile is yours to extend as you please with more rake tasks, such as the <code>website</code> tasks which are already added.</p>
|
195
|
+
<p>For more information about each task, see the <a href="http://seattlerb.rubyforge.org/hoe/">Hoe <span class="caps">README</span></a></p>
|
196
|
+
<h2>Related articles</h2>
|
197
|
+
<ul>
|
300
198
|
<li><a href="http://drnicwilliams.com/2006/10/11/generating-new-gems/">Original blog article and tutorial</a></li>
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
<h2>Dr Nic’s Blog</h2>
|
308
|
-
|
309
|
-
|
310
|
-
<p><a href="http://www.drnicwilliams.com">http://www.drnicwilliams.com</a> – for future announcements and
|
199
|
+
<li><a href="http://nubyonrails.com/articles/2007/06/15/tutorial-publishing-rubygems-with-hoe">Tutorial: Publishing RubyGems with Hoe</a> by <a href="http://geoffreygrosenbach.com/">Geoffrey Grosenbach</a></li>
|
200
|
+
<li><a href="http://codeconversations.blogspot.com/2007/07/using-new-gem-generator-in-windows_8009.html">Using New Gem Generator in Windows</a> by <a href="http://codeconversations.blogspot.com/">Jorge Cangas</a></li>
|
201
|
+
<li><a href="http://bogojoker.com/blog/2008/05/building-a-ruby-gem/">Building a Ruby Gem</a> by <a href="http://bogojoker.com/">Joseph Pecoraro</a> (includes a Problems/Troubleshooting section!!)</li>
|
202
|
+
</ul>
|
203
|
+
<h2>Dr Nic’s Blog</h2>
|
204
|
+
<p><a href="http://www.drnicwilliams.com">http://www.drnicwilliams.com</a> – for future announcements and<br />
|
311
205
|
other stories and things.</p>
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
<h2>How to submit patches</h2>
|
321
|
-
|
322
|
-
|
323
|
-
<p>Read the <a href="http://drnicwilliams.com/2007/06/01/8-steps-for-fixing-other-peoples-code/">8 steps for fixing other people’s code</a> and for section <a href="http://drnicwilliams.com/2007/06/01/8-steps-for-fixing-other-peoples-code/#8b-google-groups">8b: Submit patch to Google Groups</a>, use the Google Group above.</p>
|
324
|
-
|
325
|
-
|
326
|
-
<p>You can fetch the source from either:</p>
|
327
|
-
|
328
|
-
|
329
|
-
<ul>
|
330
|
-
<li>rubyforge: <a href="http://rubyforge.org/scm/?group_id">http://rubyforge.org/scm/?group_id=</a>=</li>
|
331
|
-
</ul>
|
332
|
-
|
333
|
-
|
206
|
+
<h2>Forum</h2>
|
207
|
+
<p><a href="http://groups.google.com/group/new-gem-generator">http://groups.google.com/group/new-gem-generator</a></p>
|
208
|
+
<h2>How to submit patches</h2>
|
209
|
+
<p>Read the <a href="http://drnicwilliams.com/2007/06/01/8-steps-for-fixing-other-peoples-code/">8 steps for fixing other people’s code</a> and for section <a href="http://drnicwilliams.com/2007/06/01/8-steps-for-fixing-other-peoples-code/#8b-google-groups">8b: Submit patch to Google Groups</a>, use the Google Group above.</p>
|
210
|
+
<p>You can fetch the source from either:</p>
|
211
|
+
<ul>
|
212
|
+
<li>rubyforge: <a href="http://rubyforge.org/scm/?group_id=2340">http://rubyforge.org/scm/?group_id=2340</a></li>
|
213
|
+
</ul>
|
334
214
|
<pre>git clone git://rubyforge.org/newgem.git</pre>
|
335
|
-
|
336
|
-
<ul>
|
215
|
+
<ul>
|
337
216
|
<li>github: <a href="http://github.com/drnic/newgem/tree/master">http://github.com/drnic/newgem/tree/master</a></li>
|
338
|
-
|
339
|
-
|
340
|
-
|
217
|
+
</ul>
|
341
218
|
<pre>git clone git://github.com/drnic/newgem.git</pre>
|
342
|
-
|
343
|
-
<h3>Build and test instructions</h3>
|
344
|
-
|
345
|
-
|
219
|
+
<h3>Build and test instructions</h3>
|
346
220
|
<pre>cd newgem
|
347
221
|
rake test
|
348
222
|
rake install_gem</pre>
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
<p>This code is free to use under the terms of the <span class="caps">MIT</span> license.</p>
|
354
|
-
|
355
|
-
|
356
|
-
<h2>Contact</h2>
|
357
|
-
|
358
|
-
|
359
|
-
<p>Comments are welcome. Send an email to <a href="mailto:drnicwilliams@gmail.com">Dr Nic Williams</a>.</p>
|
223
|
+
<h2>License</h2>
|
224
|
+
<p>This code is free to use under the terms of the <span class="caps">MIT</span> license.</p>
|
225
|
+
<h2>Contact</h2>
|
226
|
+
<p>Comments are welcome. Send an email to <a href="mailto:drnicwilliams@gmail.com">Dr Nic Williams</a>.</p>
|
360
227
|
<p class="coda">
|
361
|
-
<a href="mailto:drnicwilliams@gmail.com">Dr Nic</a>,
|
228
|
+
<a href="mailto:drnicwilliams@gmail.com">Dr Nic</a>, 24th September 2008<br>
|
362
229
|
Theme extended from <a href="http://rb2js.rubyforge.org/">Paul Battley</a>
|
363
230
|
</p>
|
364
231
|
</div>
|