dima-jeweler 0.9.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.
- data/ChangeLog.markdown +58 -0
- data/LICENSE +20 -0
- data/README.markdown +103 -0
- data/Rakefile +61 -0
- data/TODO +11 -0
- data/VERSION.yml +4 -0
- data/bin/jeweler +8 -0
- data/lib/jeweler.rb +161 -0
- data/lib/jeweler/commands.rb +11 -0
- data/lib/jeweler/commands/build_gem.rb +22 -0
- data/lib/jeweler/commands/install_gem.rb +19 -0
- data/lib/jeweler/commands/release.rb +46 -0
- data/lib/jeweler/commands/release_to_rubyforge.rb +28 -0
- data/lib/jeweler/commands/validate_gemspec.rb +21 -0
- data/lib/jeweler/commands/version/base.rb +30 -0
- data/lib/jeweler/commands/version/bump_major.rb +13 -0
- data/lib/jeweler/commands/version/bump_minor.rb +12 -0
- data/lib/jeweler/commands/version/bump_patch.rb +14 -0
- data/lib/jeweler/commands/version/write.rb +12 -0
- data/lib/jeweler/commands/write_gemspec.rb +26 -0
- data/lib/jeweler/errors.rb +8 -0
- data/lib/jeweler/gemspec_helper.rb +51 -0
- data/lib/jeweler/generator.rb +345 -0
- data/lib/jeweler/generator/application.rb +45 -0
- data/lib/jeweler/generator/options.rb +64 -0
- data/lib/jeweler/tasks.rb +102 -0
- data/lib/jeweler/templates/.gitignore +5 -0
- data/lib/jeweler/templates/LICENSE +20 -0
- data/lib/jeweler/templates/README.rdoc +7 -0
- data/lib/jeweler/templates/Rakefile +116 -0
- data/lib/jeweler/templates/bacon/flunking.rb +7 -0
- data/lib/jeweler/templates/bacon/helper.rb +8 -0
- data/lib/jeweler/templates/features/default.feature +9 -0
- data/lib/jeweler/templates/features/support/env.rb +11 -0
- data/lib/jeweler/templates/micronaut/flunking.rb +7 -0
- data/lib/jeweler/templates/micronaut/helper.rb +17 -0
- data/lib/jeweler/templates/minitest/flunking.rb +7 -0
- data/lib/jeweler/templates/minitest/helper.rb +11 -0
- data/lib/jeweler/templates/rspec/flunking.rb +7 -0
- data/lib/jeweler/templates/rspec/helper.rb +9 -0
- data/lib/jeweler/templates/shoulda/flunking.rb +7 -0
- data/lib/jeweler/templates/shoulda/helper.rb +10 -0
- data/lib/jeweler/templates/testunit/flunking.rb +7 -0
- data/lib/jeweler/templates/testunit/helper.rb +9 -0
- data/lib/jeweler/version_helper.rb +83 -0
- data/test/fixtures/bar/VERSION.yml +4 -0
- data/test/geminstaller.yml +12 -0
- data/test/generators/initialization_test.rb +146 -0
- data/test/jeweler/commands/test_build_gem.rb +53 -0
- data/test/jeweler/commands/test_install_gem.rb +0 -0
- data/test/jeweler/commands/test_release.rb +150 -0
- data/test/jeweler/commands/test_release_to_rubyforge.rb +141 -0
- data/test/jeweler/commands/test_write_gemspec.rb +58 -0
- data/test/jeweler/commands/version/test_bump_major.rb +21 -0
- data/test/jeweler/commands/version/test_bump_minor.rb +19 -0
- data/test/jeweler/commands/version/test_bump_patch.rb +20 -0
- data/test/jeweler/commands/version/test_write.rb +23 -0
- data/test/shoulda_macros/jeweler_macros.rb +35 -0
- data/test/test_application.rb +109 -0
- data/test/test_gemspec_helper.rb +36 -0
- data/test/test_generator.rb +179 -0
- data/test/test_helper.rb +51 -0
- data/test/test_jeweler.rb +136 -0
- data/test/test_options.rb +90 -0
- data/test/test_tasks.rb +40 -0
- data/test/test_version_helper.rb +115 -0
- metadata +152 -0
@@ -0,0 +1,45 @@
|
|
1
|
+
class Jeweler
|
2
|
+
class Generator
|
3
|
+
class Application
|
4
|
+
class << self
|
5
|
+
def run!(*arguments)
|
6
|
+
options = Jeweler::Generator::Options.new(arguments)
|
7
|
+
|
8
|
+
if options[:show_help]
|
9
|
+
$stderr.puts options.opts
|
10
|
+
return 1
|
11
|
+
end
|
12
|
+
|
13
|
+
unless arguments.size == 1
|
14
|
+
$stderr.puts options.opts
|
15
|
+
return 1
|
16
|
+
end
|
17
|
+
|
18
|
+
github_repo_name = arguments.first
|
19
|
+
|
20
|
+
begin
|
21
|
+
generator = Jeweler::Generator.new(github_repo_name, options)
|
22
|
+
generator.run
|
23
|
+
return 0
|
24
|
+
rescue Jeweler::NoGitUserName
|
25
|
+
$stderr.puts %Q{No user.name found in ~/.gitconfig. Please tell git about yourself (see http://github.com/guides/tell-git-your-user-name-and-email-address for details). For example: git config --global user.name "mad voo"}
|
26
|
+
return 1
|
27
|
+
rescue Jeweler::NoGitUserEmail
|
28
|
+
$stderr.puts %Q{No user.email found in ~/.gitconfig. Please tell git about yourself (see http://github.com/guides/tell-git-your-user-name-and-email-address for details). For example: git config --global user.email mad.vooo@gmail.com}
|
29
|
+
return 1
|
30
|
+
rescue Jeweler::NoGitHubUser
|
31
|
+
$stderr.puts %Q{No github.user found in ~/.gitconfig. Please tell git about your GitHub account (see http://github.com/blog/180-local-github-config for details). For example: git config --global github.user defunkt}
|
32
|
+
return 1
|
33
|
+
rescue Jeweler::NoGitHubToken
|
34
|
+
$stderr.puts %Q{No github.token found in ~/.gitconfig. Please tell git about your GitHub account (see http://github.com/blog/180-local-github-config for details). For example: git config --global github.token 6ef8395fecf207165f1a82178ae1b984}
|
35
|
+
return 1
|
36
|
+
rescue Jeweler::FileInTheWay
|
37
|
+
$stderr.puts "The directory #{github_repo_name} already exists. Maybe move it out of the way before continuing?"
|
38
|
+
return 1
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,64 @@
|
|
1
|
+
class Jeweler
|
2
|
+
class Generator
|
3
|
+
class Options < Hash
|
4
|
+
attr_reader :opts
|
5
|
+
|
6
|
+
def initialize(args)
|
7
|
+
super()
|
8
|
+
|
9
|
+
self[:testing_framework] = :shoulda
|
10
|
+
|
11
|
+
@opts = OptionParser.new do |o|
|
12
|
+
o.banner = "Usage: #{File.basename($0)} [options] reponame\ne.g. #{File.basename($0)} the-perfect-gem"
|
13
|
+
|
14
|
+
o.on('--bacon', 'generate bacon specifications') do
|
15
|
+
self[:testing_framework] = :bacon
|
16
|
+
end
|
17
|
+
|
18
|
+
o.on('--shoulda', 'generate shoulda tests') do
|
19
|
+
self[:testing_framework] = :shoulda
|
20
|
+
end
|
21
|
+
|
22
|
+
o.on('--testunit', 'generate test/unit tests') do
|
23
|
+
self[:testing_framework] = :testunit
|
24
|
+
end
|
25
|
+
|
26
|
+
o.on('--minitest', 'generate minitest tests') do
|
27
|
+
self[:testing_framework] = :minitest
|
28
|
+
end
|
29
|
+
|
30
|
+
o.on('--rspec', 'generate rspec code examples') do
|
31
|
+
self[:testing_framework] = :rspec
|
32
|
+
end
|
33
|
+
|
34
|
+
o.on('--micronaut', 'generate micronaut examples') do
|
35
|
+
self[:testing_framework] = :micronaut
|
36
|
+
end
|
37
|
+
|
38
|
+
o.on('--cucumber', 'generate cucumber stories in addition to the other tests') do
|
39
|
+
self[:use_cucumber] = true
|
40
|
+
end
|
41
|
+
|
42
|
+
o.on('--create-repo', 'create the repository on GitHub') do
|
43
|
+
self[:create_repo] = true
|
44
|
+
end
|
45
|
+
|
46
|
+
o.on('--summary [SUMMARY]', 'specify the summary of the project') do |summary|
|
47
|
+
self[:summary] = summary
|
48
|
+
end
|
49
|
+
|
50
|
+
o.on('--directory [DIRECTORY]', 'specify the directory to generate into') do |directory|
|
51
|
+
self[:directory] = directory
|
52
|
+
end
|
53
|
+
|
54
|
+
o.on_tail('-h', '--help', 'display this help and exit') do
|
55
|
+
self[:show_help] = true
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
@opts.parse!(args)
|
60
|
+
end
|
61
|
+
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
@@ -0,0 +1,102 @@
|
|
1
|
+
require 'rake'
|
2
|
+
require 'rake/tasklib'
|
3
|
+
|
4
|
+
class Jeweler
|
5
|
+
class Tasks < ::Rake::TaskLib
|
6
|
+
attr_accessor :gemspec, :jeweler
|
7
|
+
|
8
|
+
def initialize(gemspec = nil, &block)
|
9
|
+
@gemspec = gemspec || Gem::Specification.new()
|
10
|
+
yield @gemspec if block_given?
|
11
|
+
|
12
|
+
@jeweler = Jeweler.new(@gemspec)
|
13
|
+
|
14
|
+
define
|
15
|
+
end
|
16
|
+
|
17
|
+
private
|
18
|
+
def define
|
19
|
+
desc "Setup initial version of 0.0.0"
|
20
|
+
file "VERSION.yml" do
|
21
|
+
@jeweler.write_version 0, 0, 0, :commit => false
|
22
|
+
$stdout.puts "Created VERSION.yml: 0.0.0"
|
23
|
+
end
|
24
|
+
|
25
|
+
desc "Build gem"
|
26
|
+
task :build do
|
27
|
+
@jeweler.build_gem
|
28
|
+
end
|
29
|
+
|
30
|
+
desc "Install gem using sudo"
|
31
|
+
task :install do
|
32
|
+
@jeweler.install_gem
|
33
|
+
end
|
34
|
+
|
35
|
+
desc "Generate and validates gemspec"
|
36
|
+
task :gemspec => ['gemspec:generate', 'gemspec:validate']
|
37
|
+
|
38
|
+
namespace :gemspec do
|
39
|
+
desc "Validates the gemspec"
|
40
|
+
task :validate => 'VERSION.yml' do
|
41
|
+
@jeweler.validate_gemspec
|
42
|
+
end
|
43
|
+
|
44
|
+
desc "Generates the gemspec, using version from VERSION.yml"
|
45
|
+
task :generate => 'VERSION.yml' do
|
46
|
+
@jeweler.write_gemspec
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
desc "Displays the current version"
|
51
|
+
task :version => 'version:setup' do
|
52
|
+
$stdout.puts "Current version: #{@jeweler.version}"
|
53
|
+
end
|
54
|
+
|
55
|
+
namespace :version do
|
56
|
+
desc "Setup initial version of 0.0.0"
|
57
|
+
task :setup => "VERSION.yml"
|
58
|
+
|
59
|
+
desc "Writes out an explicit version. Respects the following environment variables, or defaults to 0: MAJOR, MINOR, PATCH"
|
60
|
+
task :write do
|
61
|
+
major, minor, patch = ENV['MAJOR'].to_i, ENV['MINOR'].to_i, ENV['PATCH'].to_i
|
62
|
+
@jeweler.write_version(major, minor, patch, :announce => false, :commit => false)
|
63
|
+
$stdout.puts "Updated version: #{@jeweler.version}"
|
64
|
+
end
|
65
|
+
|
66
|
+
namespace :bump do
|
67
|
+
desc "Bump the gemspec by a major version."
|
68
|
+
task :major => ['VERSION.yml', :version] do
|
69
|
+
@jeweler.bump_major_version
|
70
|
+
$stdout.puts "Updated version: #{@jeweler.version}"
|
71
|
+
end
|
72
|
+
|
73
|
+
desc "Bump the gemspec by a minor version."
|
74
|
+
task :minor => ['VERSION.yml', :version] do
|
75
|
+
@jeweler.bump_minor_version
|
76
|
+
$stdout.puts "Updated version: #{@jeweler.version}"
|
77
|
+
end
|
78
|
+
|
79
|
+
desc "Bump the gemspec by a patch version."
|
80
|
+
task :patch => ['VERSION.yml', :version] do
|
81
|
+
@jeweler.bump_patch_version
|
82
|
+
$stdout.puts "Updated version: #{@jeweler.version}"
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
desc "Release the current version. Includes updating the gemspec, pushing, and tagging the release"
|
88
|
+
task :release do
|
89
|
+
@jeweler.release
|
90
|
+
end
|
91
|
+
|
92
|
+
namespace :rubyforge do
|
93
|
+
namespace :release do
|
94
|
+
desc "Publish the current gem version to RubyForge."
|
95
|
+
task :gem do
|
96
|
+
@jeweler.release_gem_to_rubyforge
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2009 <%= user_name %>
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
@@ -0,0 +1,116 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
|
4
|
+
begin
|
5
|
+
require 'jeweler'
|
6
|
+
Jeweler::Tasks.new do |gem|
|
7
|
+
gem.name = "<%= github_repo_name %>"
|
8
|
+
gem.summary = %Q{<%= summary %>}
|
9
|
+
gem.email = "<%= user_email %>"
|
10
|
+
gem.homepage = "<%= github_url %>"
|
11
|
+
gem.authors = ["<%= user_name %>"]
|
12
|
+
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
13
|
+
end
|
14
|
+
rescue LoadError
|
15
|
+
puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
|
16
|
+
end
|
17
|
+
|
18
|
+
<% case testing_framework.to_sym %>
|
19
|
+
<% when :rspec %>
|
20
|
+
require 'spec/rake/spectask'
|
21
|
+
Spec::Rake::SpecTask.new(:spec) do |spec|
|
22
|
+
spec.libs << 'lib' << 'spec'
|
23
|
+
spec.spec_files = FileList['spec/**/*_spec.rb']
|
24
|
+
end
|
25
|
+
<% when :micronaut %>
|
26
|
+
require 'micronaut/rake_task'
|
27
|
+
Micronaut::RakeTask.new(:examples) do |examples|
|
28
|
+
examples.pattern = 'examples/**/*_example.rb'
|
29
|
+
examples.ruby_opts << '-Ilib -Iexamples'
|
30
|
+
end
|
31
|
+
<% else %>
|
32
|
+
require 'rake/testtask'
|
33
|
+
Rake::TestTask.new(:<%= test_or_spec %>) do |<%= test_or_spec %>|
|
34
|
+
<%= test_or_spec %>.libs << 'lib' << '<%= test_or_spec %>'
|
35
|
+
<%= test_or_spec %>.pattern = '<%= test_or_spec %>/**/*_<%= test_or_spec %>.rb'
|
36
|
+
<%= test_or_spec %>.verbose = false
|
37
|
+
end
|
38
|
+
<% end %>
|
39
|
+
|
40
|
+
<% case testing_framework.to_sym %>
|
41
|
+
<% when :rspec %>
|
42
|
+
Spec::Rake::SpecTask.new(:rcov) do |spec|
|
43
|
+
spec.libs << 'lib' << 'spec'
|
44
|
+
spec.pattern = 'spec/**/*_spec.rb'
|
45
|
+
spec.rcov = true
|
46
|
+
end
|
47
|
+
<% when :micronaut %>
|
48
|
+
Micronaut::RakeTask.new(:rcov) do |examples|
|
49
|
+
examples.pattern = 'examples/**/*_example.rb'
|
50
|
+
examples.rcov_opts = '-Ilib -Iexamples'
|
51
|
+
examples.rcov = true
|
52
|
+
end
|
53
|
+
<% else %>
|
54
|
+
begin
|
55
|
+
require 'rcov/rcovtask'
|
56
|
+
Rcov::RcovTask.new do |<%= test_or_spec %>|
|
57
|
+
<%= test_or_spec %>.libs << '<%= test_or_spec %>'
|
58
|
+
<%= test_or_spec %>.pattern = '<%= test_or_spec %>/**/*_<%= test_or_spec %>.rb'
|
59
|
+
<%= test_or_spec %>.verbose = true
|
60
|
+
end
|
61
|
+
rescue LoadError
|
62
|
+
task :rcov do
|
63
|
+
abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
|
64
|
+
end
|
65
|
+
end
|
66
|
+
<% end %>
|
67
|
+
|
68
|
+
<% if should_use_cucumber %>
|
69
|
+
begin
|
70
|
+
require 'cucumber/rake/task'
|
71
|
+
Cucumber::Rake::Task.new(:features)
|
72
|
+
rescue LoadError
|
73
|
+
task :features do
|
74
|
+
abort "Cucumber is not available. In order to run features, you must: sudo gem install cucumber"
|
75
|
+
end
|
76
|
+
end
|
77
|
+
<% end %>
|
78
|
+
|
79
|
+
task :default => :<%= default_task %>
|
80
|
+
|
81
|
+
require 'rake/rdoctask'
|
82
|
+
Rake::RDocTask.new do |rdoc|
|
83
|
+
config = YAML.load(File.read('VERSION.yml'))
|
84
|
+
rdoc.rdoc_dir = 'rdoc'
|
85
|
+
rdoc.title = "<%= github_repo_name %> #{config[:major]}.#{config[:minor]}.#{config[:patch]}"
|
86
|
+
rdoc.options << '--line-numbers' << '--inline-source'
|
87
|
+
rdoc.rdoc_files.include('README*')
|
88
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
89
|
+
end
|
90
|
+
|
91
|
+
# Rubyforge documentation task
|
92
|
+
begin
|
93
|
+
require 'rake/contrib/sshpublisher'
|
94
|
+
namespace :rubyforge do
|
95
|
+
|
96
|
+
desc "Release gem and RDoc documentation to RubyForge"
|
97
|
+
task :release => ["rubyforge:release:gem", "rubyforge:release:docs"]
|
98
|
+
|
99
|
+
namespace :release do
|
100
|
+
desc "Publish RDoc to RubyForge."
|
101
|
+
task :docs => [:rdoc] do
|
102
|
+
config = YAML.load(
|
103
|
+
File.read(File.expand_path('~/.rubyforge/user-config.yml'))
|
104
|
+
)
|
105
|
+
|
106
|
+
host = "#{config['username']}@rubyforge.org"
|
107
|
+
remote_dir = "/var/www/gforge-projects/<%= github_repo_name %>/"
|
108
|
+
local_dir = 'rdoc'
|
109
|
+
|
110
|
+
Rake::SshDirPublisher.new(host, remote_dir, local_dir).upload
|
111
|
+
end
|
112
|
+
end
|
113
|
+
end
|
114
|
+
rescue LoadError
|
115
|
+
puts "Rake SshDirPublisher is unavailable or your rubyforge environment is not configured."
|
116
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__) + '/../../lib')
|
2
|
+
require '<%= file_name_prefix %>'
|
3
|
+
|
4
|
+
require '<%= feature_support_require %>'
|
5
|
+
|
6
|
+
World do |world|
|
7
|
+
<% if feature_support_extend %>
|
8
|
+
world.extend(<%= feature_support_extend %>)
|
9
|
+
<% end %>
|
10
|
+
world
|
11
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'micronaut'
|
3
|
+
|
4
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
5
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
6
|
+
|
7
|
+
require '<%= file_name_prefix %>'
|
8
|
+
|
9
|
+
def not_in_editor?
|
10
|
+
!(ENV.has_key?('TM_MODE') || ENV.has_key?('EMACS') || ENV.has_key?('VIM'))
|
11
|
+
end
|
12
|
+
|
13
|
+
Micronaut.configure do |c|
|
14
|
+
c.color_enabled = not_in_editor?
|
15
|
+
c.filter_run :focused => true
|
16
|
+
end
|
17
|
+
|