lazyatom-gem-this 0.1.1 → 0.1.2

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.
Files changed (4) hide show
  1. data/Rakefile +2 -2
  2. data/Rakefile.erb +130 -0
  3. data/bin/gem-this +2 -134
  4. metadata +2 -1
data/Rakefile CHANGED
@@ -15,7 +15,7 @@ spec = Gem::Specification.new do |s|
15
15
 
16
16
  # Change these as appropriate
17
17
  s.name = "gem-this"
18
- s.version = "0.1.1"
18
+ s.version = "0.1.2"
19
19
  s.summary = "Make existing code into a gem, without any fuss."
20
20
  s.author = "James Adam"
21
21
  s.email = "james@lazyatom.com"
@@ -26,7 +26,7 @@ spec = Gem::Specification.new do |s|
26
26
  # s.rdoc_options = %w(--main Readme.markdown)
27
27
 
28
28
  # Add any extra files to include in the gem
29
- s.files = %w(Rakefile Readme.markdown) + Dir.glob("{bin,lib}/**/*")
29
+ s.files = %w(Rakefile Readme.markdown Rakefile.erb) + Dir.glob("{bin}/**/*")
30
30
  s.executables = FileList["bin/**"].map { |f| File.basename(f) }
31
31
  s.require_paths = ["bin"]
32
32
 
data/Rakefile.erb ADDED
@@ -0,0 +1,130 @@
1
+ require "rubygems"
2
+ require "rake/gempackagetask"
3
+ require "rake/rdoctask"
4
+
5
+ <% if using_rspec? %>
6
+ task :default => :spec
7
+
8
+ require "spec"
9
+ require "spec/rake/spectask"
10
+ Spec::Rake::SpecTask.new do |t|
11
+ t.spec_opts = %w(--format specdoc --colour)
12
+ t.libs = ["spec"]
13
+ end
14
+ <% elsif using_test_unit? %>
15
+ task :default => :test
16
+
17
+ require "rake/testtask"
18
+ Rake::TestTask.new do |t|
19
+ t.libs << "test"
20
+ t.test_files = FileList["test/**/*_test.rb"]
21
+ t.verbose = true
22
+ end
23
+ <% else %>
24
+ task :default => :package do
25
+ puts "Don't forget to write some tests!"
26
+ end
27
+ <% end %>
28
+
29
+ # This builds the actual gem. For details of what all these options
30
+ # mean, and other ones you can add, check the documentation here:
31
+ #
32
+ # http://rubygems.org/read/chapter/20
33
+ #
34
+ spec = Gem::Specification.new do |s|
35
+
36
+ # Change these as appropriate
37
+ s.name = "<%= gem_name %>"
38
+ s.version = "0.1.0"
39
+ s.summary = "What this thing does"
40
+ s.author = "Your name"
41
+ s.email = "you@example.com"
42
+ s.homepage = "http://example.com"
43
+
44
+ s.has_rdoc = true
45
+ <% if readme %>
46
+ s.extra_rdoc_files = %w(<%= readme %>)
47
+ s.rdoc_options = %w(--main <%= readme %>)
48
+
49
+ # Add any extra files to include in the gem
50
+ <% else %>
51
+ # You should probably have a README of some kind. Change the filename
52
+ # as appropriate
53
+ # s.extra_rdoc_files = %w(README)
54
+ # s.rdoc_options = %w(--main README)
55
+
56
+ # Add any extra files to include in the gem (like your README)
57
+ <% end %>
58
+ s.files = %w(<%= files_in_root %>) + Dir.glob("{<%= dirs_to_include %>}/**/*")
59
+ <% if has_executables? %>
60
+ s.executables = FileList["bin/**"].map { |f| File.basename(f) }
61
+ <% end %>
62
+ s.require_paths = ["lib"]
63
+
64
+ # If you want to depend on other gems, add them here, along with any
65
+ # relevant versions
66
+ # s.add_dependency("some_other_gem", "~> 0.1.0")
67
+
68
+ <% if using_rspec? %>
69
+ s.add_development_dependency("rspec") # add any other gems for testing/development
70
+ <% else %>
71
+ # If your tests use any gems, include them here
72
+ # s.add_development_dependency("mocha")
73
+ <% end %>
74
+
75
+ # If you want to publish automatically to rubyforge, you'll may need
76
+ # to tweak this, and the publishing task below too.
77
+ s.rubyforge_project = "<%= gem_name %>"
78
+ end
79
+
80
+ # This task actually builds the gem. We also regenerate a static
81
+ # .gemspec file, which is useful if something (i.e. GitHub) will
82
+ # be automatically building a gem for this project. If you're not
83
+ # using GitHub, edit as appropriate.
84
+ Rake::GemPackageTask.new(spec) do |pkg|
85
+ pkg.gem_spec = spec
86
+
87
+ # Generate the gemspec file for github.
88
+ file = File.dirname(__FILE__) + "/#{spec.name}.gemspec"
89
+ File.open(file, "w") {|f| f << spec.to_ruby }
90
+ end
91
+
92
+ # Generate documentation
93
+ Rake::RDocTask.new do |rd|
94
+ <% if readme %>rd.main = "<%= readme %>"<% end %>
95
+ rd.rdoc_files.include(<%= %{"#{readme}", } if readme %>"lib/**/*.rb")
96
+ rd.rdoc_dir = "rdoc"
97
+ end
98
+
99
+ desc 'Clear out RDoc and generated packages'
100
+ task :clean => [:clobber_rdoc, :clobber_package] do
101
+ rm "#{spec.name}.gemspec"
102
+ end
103
+
104
+ # If you want to publish to RubyForge automatically, here's a simple
105
+ # task to help do that. If you don't, just get rid of this.
106
+ begin
107
+ require "rake/contrib/sshpublisher"
108
+ namespace :rubyforge do
109
+
110
+ desc "Release gem and RDoc documentation to RubyForge"
111
+ task :release => ["rubyforge:release:gem", "rubyforge:release:docs"]
112
+
113
+ namespace :release do
114
+ desc "Publish RDoc to RubyForge."
115
+ task :docs => [:rdoc] do
116
+ config = YAML.load(
117
+ File.read(File.expand_path('~/.rubyforge/user-config.yml'))
118
+ )
119
+
120
+ host = "#{config['username']}@rubyforge.org"
121
+ remote_dir = "/var/www/gforge-projects/<%= gem_name %>/" # Should be the same as the rubyforge project name
122
+ local_dir = 'rdoc'
123
+
124
+ Rake::SshDirPublisher.new(host, remote_dir, local_dir).upload
125
+ end
126
+ end
127
+ end
128
+ rescue LoadError
129
+ puts "Rake SshDirPublisher is unavailable or your rubyforge environment is not configured."
130
+ end
data/bin/gem-this CHANGED
@@ -51,7 +51,7 @@ end
51
51
 
52
52
  require 'erb'
53
53
 
54
- template = ERB.new DATA.read, nil, '<>'
54
+ template = ERB.new File.read(File.join(File.dirname(__FILE__), '..', 'Rakefile.erb')), nil, '<>'
55
55
  rakefile = template.result(binding)
56
56
 
57
57
  if debug
@@ -68,136 +68,4 @@ else
68
68
  add_to_gitignore if using_git?
69
69
  end
70
70
 
71
- exit(0)
72
-
73
- __END__
74
- require "rubygems"
75
- require "rake/gempackagetask"
76
- require "rake/rdoctask"
77
-
78
- <% if using_rspec? %>
79
- task :default => :spec
80
-
81
- require "spec"
82
- require "spec/rake/spectask"
83
- Spec::Rake::SpecTask.new do |t|
84
- t.spec_opts = %w(--format specdoc --colour)
85
- t.libs = ["spec"]
86
- end
87
- <% elsif using_test_unit? %>
88
- task :default => :test
89
-
90
- require "rake/testtask"
91
- Rake::TestTask.new do |t|
92
- t.libs << "test"
93
- t.test_files = FileList["test/**/*_test.rb"]
94
- t.verbose = true
95
- end
96
- <% else %>
97
- task :default => :package do
98
- puts "Don't forget to write some tests!"
99
- end
100
- <% end %>
101
-
102
- # This builds the actual gem. For details of what all these options
103
- # mean, and other ones you can add, check the documentation here:
104
- #
105
- # http://rubygems.org/read/chapter/20
106
- #
107
- spec = Gem::Specification.new do |s|
108
-
109
- # Change these as appropriate
110
- s.name = "<%= gem_name %>"
111
- s.version = "0.1.0"
112
- s.summary = "What this thing does"
113
- s.author = "Your name"
114
- s.email = "you@example.com"
115
- s.homepage = "http://example.com"
116
-
117
- s.has_rdoc = true
118
- <% if readme %>
119
- s.extra_rdoc_files = %w(<%= readme %>)
120
- s.rdoc_options = %w(--main <%= readme %>)
121
-
122
- # Add any extra files to include in the gem
123
- <% else %>
124
- # You should probably have a README of some kind. Change the filename
125
- # as appropriate
126
- # s.extra_rdoc_files = %w(README)
127
- # s.rdoc_options = %w(--main README)
128
-
129
- # Add any extra files to include in the gem (like your README)
130
- <% end %>
131
- s.files = %w(<%= files_in_root %>) + Dir.glob("{<%= dirs_to_include %>}/**/*")
132
- <% if has_executables? %>
133
- s.executables = FileList["bin/**"].map { |f| File.basename(f) }
134
- <% end %>
135
- s.require_paths = ["lib"]
136
-
137
- # If you want to depend on other gems, add them here, along with any
138
- # relevant versions
139
- # s.add_dependency("some_other_gem", "~> 0.1.0")
140
-
141
- <% if using_rspec? %>
142
- s.add_development_dependency("rspec") # add any other gems for testing/development
143
- <% else %>
144
- # If your tests use any gems, include them here
145
- # s.add_development_dependency("mocha")
146
- <% end %>
147
-
148
- # If you want to publish automatically to rubyforge, you'll may need
149
- # to tweak this, and the publishing task below too.
150
- s.rubyforge_project = "<%= gem_name %>"
151
- end
152
-
153
- # This task actually builds the gem. We also regenerate a static
154
- # .gemspec file, which is useful if something (i.e. GitHub) will
155
- # be automatically building a gem for this project. If you're not
156
- # using GitHub, edit as appropriate.
157
- Rake::GemPackageTask.new(spec) do |pkg|
158
- pkg.gem_spec = spec
159
-
160
- # Generate the gemspec file for github.
161
- file = File.dirname(__FILE__) + "/#{spec.name}.gemspec"
162
- File.open(file, "w") {|f| f << spec.to_ruby }
163
- end
164
-
165
- # Generate documentation
166
- Rake::RDocTask.new do |rd|
167
- <% if readme %>rd.main = "<%= readme %>"<% end %>
168
- rd.rdoc_files.include(<%= %{"#{readme}", } if readme %>"lib/**/*.rb")
169
- rd.rdoc_dir = "rdoc"
170
- end
171
-
172
- desc 'Clear out RDoc and generated packages'
173
- task :clean => [:clobber_rdoc, :clobber_package] do
174
- rm "#{spec.name}.gemspec"
175
- end
176
-
177
- # If you want to publish to RubyForge automatically, here's a simple
178
- # task to help do that. If you don't, just get rid of this.
179
- begin
180
- require "rake/contrib/sshpublisher"
181
- namespace :rubyforge do
182
-
183
- desc "Release gem and RDoc documentation to RubyForge"
184
- task :release => ["rubyforge:release:gem", "rubyforge:release:docs"]
185
-
186
- namespace :release do
187
- desc "Publish RDoc to RubyForge."
188
- task :docs => [:rdoc] do
189
- config = YAML.load(
190
- File.read(File.expand_path('~/.rubyforge/user-config.yml'))
191
- )
192
-
193
- host = "#{config['username']}@rubyforge.org"
194
- remote_dir = "/var/www/gforge-projects/<%= gem_name %>/" # Should be the same as the rubyforge project name
195
- local_dir = 'rdoc'
196
-
197
- Rake::SshDirPublisher.new(host, remote_dir, local_dir).upload
198
- end
199
- end
200
- end
201
- rescue LoadError
202
- puts "Rake SshDirPublisher is unavailable or your rubyforge environment is not configured."
203
- end
71
+ exit(0)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lazyatom-gem-this
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Adam
@@ -24,6 +24,7 @@ extra_rdoc_files: []
24
24
  files:
25
25
  - Rakefile
26
26
  - Readme.markdown
27
+ - Rakefile.erb
27
28
  - bin/gem-this
28
29
  has_rdoc: true
29
30
  homepage: http://github.com/lazyatom/gem-this