juwelier 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.coveralls.yml +2 -0
- data/.document +8 -0
- data/.semver +5 -0
- data/.travis.yml +7 -0
- data/.yardopts +2 -0
- data/ChangeLog.markdown +230 -0
- data/Gemfile +40 -0
- data/LICENSE.txt +20 -0
- data/README.markdown +252 -0
- data/Rakefile +78 -0
- data/bin/juwelier +9 -0
- data/features/generator/cucumber.feature +103 -0
- data/features/generator/directory_layout.feature +86 -0
- data/features/generator/dotdocument.feature +13 -0
- data/features/generator/env_options.feature +9 -0
- data/features/generator/gemfile.feature +81 -0
- data/features/generator/git.feature +102 -0
- data/features/generator/license.feature +20 -0
- data/features/generator/rakefile.feature +158 -0
- data/features/generator/readme.feature +12 -0
- data/features/generator/test.feature +54 -0
- data/features/generator/test_helper.feature +149 -0
- data/features/placeholder.feature +5 -0
- data/features/step_definitions/debug_steps.rb +6 -0
- data/features/step_definitions/filesystem_steps.rb +70 -0
- data/features/step_definitions/generator_steps.rb +387 -0
- data/features/step_definitions/task_steps.rb +6 -0
- data/features/support/env.rb +41 -0
- data/features/tasks/build_gem.feature +9 -0
- data/features/tasks/version.feature +31 -0
- data/features/tasks/version_bumping.feature +49 -0
- data/juwelier.gemspec +241 -0
- data/lib/juwelier.rb +178 -0
- data/lib/juwelier/commands.rb +20 -0
- data/lib/juwelier/commands/build_gem.rb +40 -0
- data/lib/juwelier/commands/check_dependencies.rb +66 -0
- data/lib/juwelier/commands/install_gem.rb +31 -0
- data/lib/juwelier/commands/release_gemspec.rb +87 -0
- data/lib/juwelier/commands/release_to_git.rb +64 -0
- data/lib/juwelier/commands/release_to_rubygems.rb +28 -0
- data/lib/juwelier/commands/validate_gemspec.rb +30 -0
- data/lib/juwelier/commands/version/base.rb +55 -0
- data/lib/juwelier/commands/version/bump_major.rb +13 -0
- data/lib/juwelier/commands/version/bump_minor.rb +12 -0
- data/lib/juwelier/commands/version/bump_patch.rb +14 -0
- data/lib/juwelier/commands/version/write.rb +12 -0
- data/lib/juwelier/commands/write_gemspec.rb +39 -0
- data/lib/juwelier/errors.rb +8 -0
- data/lib/juwelier/gemcutter_tasks.rb +8 -0
- data/lib/juwelier/gemspec_helper.rb +87 -0
- data/lib/juwelier/generator.rb +304 -0
- data/lib/juwelier/generator/application.rb +63 -0
- data/lib/juwelier/generator/bacon_mixin.rb +43 -0
- data/lib/juwelier/generator/github_mixin.rb +22 -0
- data/lib/juwelier/generator/micronaut_mixin.rb +41 -0
- data/lib/juwelier/generator/minitest_mixin.rb +42 -0
- data/lib/juwelier/generator/options.rb +172 -0
- data/lib/juwelier/generator/rdoc_mixin.rb +13 -0
- data/lib/juwelier/generator/riot_mixin.rb +42 -0
- data/lib/juwelier/generator/rspec_mixin.rb +42 -0
- data/lib/juwelier/generator/shindo_mixin.rb +44 -0
- data/lib/juwelier/generator/shoulda_mixin.rb +42 -0
- data/lib/juwelier/generator/testspec_mixin.rb +42 -0
- data/lib/juwelier/generator/testunit_mixin.rb +39 -0
- data/lib/juwelier/generator/yard_mixin.rb +15 -0
- data/lib/juwelier/rubyforge_tasks.rb +95 -0
- data/lib/juwelier/rubygems_dot_org_tasks.rb +38 -0
- data/lib/juwelier/rubygems_tasks.rb +38 -0
- data/lib/juwelier/specification.rb +110 -0
- data/lib/juwelier/tasks.rb +239 -0
- data/lib/juwelier/templates/.document +5 -0
- data/lib/juwelier/templates/.gitignore +49 -0
- data/lib/juwelier/templates/Gemfile +12 -0
- data/lib/juwelier/templates/LICENSE.txt +20 -0
- data/lib/juwelier/templates/README.rdoc +19 -0
- data/lib/juwelier/templates/Rakefile +9 -0
- data/lib/juwelier/templates/bacon/flunking.rb +7 -0
- data/lib/juwelier/templates/bacon/helper.rb +10 -0
- data/lib/juwelier/templates/bundler_setup.erb +10 -0
- data/lib/juwelier/templates/features/default.feature +9 -0
- data/lib/juwelier/templates/features/support/env.rb +11 -0
- data/lib/juwelier/templates/juwelier_tasks.erb +31 -0
- data/lib/juwelier/templates/micronaut/flunking.rb +7 -0
- data/lib/juwelier/templates/micronaut/helper.rb +19 -0
- data/lib/juwelier/templates/minitest/flunking.rb +7 -0
- data/lib/juwelier/templates/minitest/helper.rb +13 -0
- data/lib/juwelier/templates/other_tasks.erb +70 -0
- data/lib/juwelier/templates/riot/flunking.rb +11 -0
- data/lib/juwelier/templates/riot/helper.rb +5 -0
- data/lib/juwelier/templates/rspec/.rspec +1 -0
- data/lib/juwelier/templates/rspec/flunking.rb +7 -0
- data/lib/juwelier/templates/rspec/helper.rb +14 -0
- data/lib/juwelier/templates/shindo/flunking.rb +8 -0
- data/lib/juwelier/templates/shindo/helper.rb +7 -0
- data/lib/juwelier/templates/shoulda/flunking.rb +7 -0
- data/lib/juwelier/templates/shoulda/helper.rb +12 -0
- data/lib/juwelier/templates/simplecov.erb +16 -0
- data/lib/juwelier/templates/testspec/flunking.rb +7 -0
- data/lib/juwelier/templates/testspec/helper.rb +7 -0
- data/lib/juwelier/templates/testunit/flunking.rb +7 -0
- data/lib/juwelier/templates/testunit/helper.rb +11 -0
- data/lib/juwelier/version.rb +10 -0
- data/lib/juwelier/version_helper.rb +141 -0
- data/test/fixtures/bar/VERSION.yml +4 -0
- data/test/fixtures/bar/bin/foo_the_ultimate_bin +1 -0
- data/test/fixtures/bar/hey_include_me_in_gemspec +0 -0
- data/test/fixtures/bar/lib/foo_the_ultimate_lib.rb +1 -0
- data/test/fixtures/existing-project-with-version-constant/.document +5 -0
- data/test/fixtures/existing-project-with-version-constant/.gitignore +5 -0
- data/test/fixtures/existing-project-with-version-constant/LICENSE.txt +20 -0
- data/test/fixtures/existing-project-with-version-constant/README.rdoc +7 -0
- data/test/fixtures/existing-project-with-version-constant/Rakefile +85 -0
- data/test/fixtures/existing-project-with-version-constant/existing-project-with-version.gemspec +29 -0
- data/test/fixtures/existing-project-with-version-constant/lib/existing_project_with_version.rb +0 -0
- data/test/fixtures/existing-project-with-version-constant/test/existing_project_with_version_test.rb +7 -0
- data/test/fixtures/existing-project-with-version-constant/test/test_helper.rb +10 -0
- data/test/fixtures/existing-project-with-version-plaintext/.document +5 -0
- data/test/fixtures/existing-project-with-version-plaintext/.gitignore +5 -0
- data/test/fixtures/existing-project-with-version-plaintext/LICENSE.txt +20 -0
- data/test/fixtures/existing-project-with-version-plaintext/README.rdoc +7 -0
- data/test/fixtures/existing-project-with-version-plaintext/Rakefile +84 -0
- data/test/fixtures/existing-project-with-version-plaintext/VERSION +1 -0
- data/test/fixtures/existing-project-with-version-plaintext/existing-project-with-version.gemspec +29 -0
- data/test/fixtures/existing-project-with-version-plaintext/lib/existing_project_with_version.rb +0 -0
- data/test/fixtures/existing-project-with-version-plaintext/test/existing_project_with_version_test.rb +7 -0
- data/test/fixtures/existing-project-with-version-plaintext/test/test_helper.rb +10 -0
- data/test/fixtures/existing-project-with-version-yaml/.document +5 -0
- data/test/fixtures/existing-project-with-version-yaml/.gitignore +5 -0
- data/test/fixtures/existing-project-with-version-yaml/LICENSE.txt +20 -0
- data/test/fixtures/existing-project-with-version-yaml/README.rdoc +7 -0
- data/test/fixtures/existing-project-with-version-yaml/Rakefile +84 -0
- data/test/fixtures/existing-project-with-version-yaml/VERSION.yml +4 -0
- data/test/fixtures/existing-project-with-version-yaml/bin/foo_the_ultimate_bin +0 -0
- data/test/fixtures/existing-project-with-version-yaml/existing-project-with-version.gemspec +29 -0
- data/test/fixtures/existing-project-with-version-yaml/lib/existing_project_with_version.rb +0 -0
- data/test/fixtures/existing-project-with-version-yaml/test/existing_project_with_version_test.rb +7 -0
- data/test/fixtures/existing-project-with-version-yaml/test/test_helper.rb +10 -0
- data/test/geminstaller.yml +12 -0
- data/test/juwelier/commands/test_build_gem.rb +112 -0
- data/test/juwelier/commands/test_install_gem.rb +35 -0
- data/test/juwelier/commands/test_release_to_gemcutter.rb +39 -0
- data/test/juwelier/commands/test_release_to_git.rb +271 -0
- data/test/juwelier/commands/test_release_to_github.rb +477 -0
- data/test/juwelier/commands/test_validate_gemspec.rb +27 -0
- data/test/juwelier/commands/test_write_gemspec.rb +103 -0
- data/test/juwelier/commands/version/test_base.rb +53 -0
- data/test/juwelier/commands/version/test_bump_major.rb +22 -0
- data/test/juwelier/commands/version/test_bump_minor.rb +19 -0
- data/test/juwelier/commands/version/test_bump_patch.rb +20 -0
- data/test/juwelier/commands/version/test_write.rb +22 -0
- data/test/juwelier/generator/test_application.rb +142 -0
- data/test/juwelier/generator/test_options.rb +227 -0
- data/test/juwelier/test_gemspec_helper.rb +44 -0
- data/test/juwelier/test_generator.rb +140 -0
- data/test/juwelier/test_generator_initialization.rb +150 -0
- data/test/juwelier/test_generator_mixins.rb +23 -0
- data/test/juwelier/test_specification.rb +245 -0
- data/test/juwelier/test_tasks.rb +50 -0
- data/test/juwelier/test_version_helper.rb +214 -0
- data/test/shoulda_macros/juwelier_macros.rb +35 -0
- data/test/test_helper.rb +174 -0
- data/test/test_juwelier.rb +177 -0
- metadata +396 -0
@@ -0,0 +1,42 @@
|
|
1
|
+
class Juwelier
|
2
|
+
class Generator
|
3
|
+
module RspecMixin
|
4
|
+
def self.extended(generator)
|
5
|
+
generator.development_dependencies << ["rspec", "~> 2.8.0"]
|
6
|
+
end
|
7
|
+
|
8
|
+
def default_task
|
9
|
+
'spec'
|
10
|
+
end
|
11
|
+
|
12
|
+
def feature_support_require
|
13
|
+
'rspec/expectations'
|
14
|
+
end
|
15
|
+
|
16
|
+
def feature_support_extend
|
17
|
+
nil # Cucumber is smart enough extend Spec::Expectations on its own
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_dir
|
21
|
+
'spec'
|
22
|
+
end
|
23
|
+
|
24
|
+
def test_task
|
25
|
+
'spec'
|
26
|
+
end
|
27
|
+
|
28
|
+
def test_pattern
|
29
|
+
'spec/**/*_spec.rb'
|
30
|
+
end
|
31
|
+
|
32
|
+
def test_filename
|
33
|
+
"#{require_name}_spec.rb"
|
34
|
+
end
|
35
|
+
|
36
|
+
def test_helper_filename
|
37
|
+
"spec_helper.rb"
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
class Juwelier
|
2
|
+
class Generator
|
3
|
+
module ShindoMixin
|
4
|
+
def self.extended(generator)
|
5
|
+
generator.development_dependencies << ["shindo", ">= 0"]
|
6
|
+
end
|
7
|
+
|
8
|
+
def default_task
|
9
|
+
'tests'
|
10
|
+
end
|
11
|
+
|
12
|
+
def feature_support_require
|
13
|
+
# 'test/unit/assertions'
|
14
|
+
nil
|
15
|
+
end
|
16
|
+
|
17
|
+
def feature_support_extend
|
18
|
+
# 'Test::Unit::Assertions'
|
19
|
+
nil
|
20
|
+
end
|
21
|
+
|
22
|
+
def test_dir
|
23
|
+
'tests'
|
24
|
+
end
|
25
|
+
|
26
|
+
def test_task
|
27
|
+
'tests'
|
28
|
+
end
|
29
|
+
|
30
|
+
def test_pattern
|
31
|
+
'tests/**/*_tests.rb'
|
32
|
+
end
|
33
|
+
|
34
|
+
def test_filename
|
35
|
+
"#{require_name}_tests.rb"
|
36
|
+
end
|
37
|
+
|
38
|
+
def test_helper_filename
|
39
|
+
"tests_helper.rb"
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
class Juwelier
|
2
|
+
class Generator
|
3
|
+
module ShouldaMixin
|
4
|
+
def self.extended(generator)
|
5
|
+
generator.development_dependencies << ["shoulda", ">= 0"]
|
6
|
+
end
|
7
|
+
|
8
|
+
def default_task
|
9
|
+
'test'
|
10
|
+
end
|
11
|
+
|
12
|
+
def feature_support_require
|
13
|
+
'test/unit/assertions'
|
14
|
+
end
|
15
|
+
|
16
|
+
def feature_support_extend
|
17
|
+
'Test::Unit::Assertions'
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_dir
|
21
|
+
'test'
|
22
|
+
end
|
23
|
+
|
24
|
+
def test_task
|
25
|
+
'test'
|
26
|
+
end
|
27
|
+
|
28
|
+
def test_pattern
|
29
|
+
'test/**/test_*.rb'
|
30
|
+
end
|
31
|
+
|
32
|
+
def test_filename
|
33
|
+
"test_#{require_name}.rb"
|
34
|
+
end
|
35
|
+
|
36
|
+
def test_helper_filename
|
37
|
+
"helper.rb"
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
class Juwelier
|
2
|
+
class Generator
|
3
|
+
module TestspecMixin
|
4
|
+
def self.extended(generator)
|
5
|
+
generator.development_dependencies << ["test-spec", ">= 0"]
|
6
|
+
end
|
7
|
+
|
8
|
+
def default_task
|
9
|
+
'test'
|
10
|
+
end
|
11
|
+
|
12
|
+
def feature_support_require
|
13
|
+
'test/unit/assertions'
|
14
|
+
end
|
15
|
+
|
16
|
+
def feature_support_extend
|
17
|
+
'Test::Unit::Assertions'
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_dir
|
21
|
+
'test'
|
22
|
+
end
|
23
|
+
|
24
|
+
def test_task
|
25
|
+
'test'
|
26
|
+
end
|
27
|
+
|
28
|
+
def test_pattern
|
29
|
+
'test/**/*_test.rb'
|
30
|
+
end
|
31
|
+
|
32
|
+
def test_filename
|
33
|
+
"#{require_name}_test.rb"
|
34
|
+
end
|
35
|
+
|
36
|
+
def test_helper_filename
|
37
|
+
"test_helper.rb"
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
class Juwelier
|
2
|
+
class Generator
|
3
|
+
module TestunitMixin
|
4
|
+
|
5
|
+
def default_task
|
6
|
+
'test'
|
7
|
+
end
|
8
|
+
|
9
|
+
def feature_support_require
|
10
|
+
'test/unit/assertions'
|
11
|
+
end
|
12
|
+
|
13
|
+
def feature_support_extend
|
14
|
+
'Test::Unit::Assertions'
|
15
|
+
end
|
16
|
+
|
17
|
+
def test_dir
|
18
|
+
'test'
|
19
|
+
end
|
20
|
+
|
21
|
+
def test_task
|
22
|
+
'test'
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_pattern
|
26
|
+
'test/**/test_*.rb'
|
27
|
+
end
|
28
|
+
|
29
|
+
def test_filename
|
30
|
+
"test_#{require_name}.rb"
|
31
|
+
end
|
32
|
+
|
33
|
+
def test_helper_filename
|
34
|
+
"helper.rb"
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
class Juwelier
|
2
|
+
class Generator
|
3
|
+
module YardMixin
|
4
|
+
def self.extended(generator)
|
5
|
+
generator.development_dependencies << ["yard", "~> 0.7"]
|
6
|
+
generator.development_dependencies << ["rdoc", "~> 3.12"]
|
7
|
+
end
|
8
|
+
|
9
|
+
def doc_task
|
10
|
+
'yardoc'
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
@@ -0,0 +1,95 @@
|
|
1
|
+
require 'rake'
|
2
|
+
require 'rake/tasklib'
|
3
|
+
|
4
|
+
class Juwelier
|
5
|
+
# Rake tasks for putting a Juwelier gem on Rubyforge.
|
6
|
+
#
|
7
|
+
# Juwelier::Tasks.new needs to be used before this.
|
8
|
+
#
|
9
|
+
# Basic usage:
|
10
|
+
#
|
11
|
+
# Juwelier::RubyforgeTasks.new
|
12
|
+
#
|
13
|
+
# Easy enough, right?
|
14
|
+
#
|
15
|
+
# There are a few options you can tweak:
|
16
|
+
#
|
17
|
+
# * project: the rubyforge project to operate on. This defaults to whatever you specified in your gemspec. Defaults to your gem name.
|
18
|
+
# * remote_doc_path: the place to upload docs to on Rubyforge under /var/www/gforge-projects/#{project}/
|
19
|
+
#
|
20
|
+
# See also http://wiki.github.com/flajann2/juwelier/rubyforge
|
21
|
+
class RubyforgeTasks < ::Rake::TaskLib
|
22
|
+
# The RubyForge project to interact with. Defaults to whatever is in your juwelier gemspec.
|
23
|
+
attr_accessor :project
|
24
|
+
# The path to upload docs to. It is relative to /var/www/gforge-projects/#{project}/, and defaults to your gemspec's name
|
25
|
+
attr_accessor :remote_doc_path
|
26
|
+
# Task to be used for generating documentation, before they are uploaded. Defaults to rdoc.
|
27
|
+
attr_accessor :doc_task
|
28
|
+
|
29
|
+
attr_accessor :juwelier
|
30
|
+
|
31
|
+
def initialize
|
32
|
+
yield self if block_given?
|
33
|
+
|
34
|
+
$stderr.puts "Releasing gems to Rubyforge is deprecated. See details at http://wiki.github.com/flajann2/juwelier/migrating-from-releasing-gems-to-rubyforge"
|
35
|
+
|
36
|
+
define
|
37
|
+
end
|
38
|
+
|
39
|
+
def juwelier
|
40
|
+
@juwelier ||= Rake.application.juwelier
|
41
|
+
end
|
42
|
+
|
43
|
+
def remote_doc_path
|
44
|
+
@remote_doc_path ||= juwelier.gemspec.name
|
45
|
+
end
|
46
|
+
|
47
|
+
def project
|
48
|
+
@project ||= juwelier.gemspec.rubyforge_project
|
49
|
+
end
|
50
|
+
|
51
|
+
def define
|
52
|
+
namespace :rubyforge do
|
53
|
+
namespace :release do
|
54
|
+
desc "Release the current gem version to RubyForge."
|
55
|
+
task :gem do
|
56
|
+
$stderr.puts "DEPRECATION: Releasing gems to RubyForge is deprecated. You should see about releasing to Gemcutter instead: http://wiki.github.com/flajann2/juwelier/gemcutter"
|
57
|
+
end
|
58
|
+
|
59
|
+
if publish_documentation?
|
60
|
+
desc "Publish docs to RubyForge."
|
61
|
+
task :docs => doc_task do
|
62
|
+
config = YAML.load(
|
63
|
+
File.read(File.expand_path('~/.rubyforge/user-config.yml'))
|
64
|
+
)
|
65
|
+
|
66
|
+
host = "#{config['username']}@rubyforge.org"
|
67
|
+
remote_dir = "/var/www/gforge-projects/#{project}/#{remote_doc_path}"
|
68
|
+
|
69
|
+
local_dir = case self.doc_task.to_sym
|
70
|
+
when :rdoc then 'rdoc'
|
71
|
+
when :yardoc then 'doc'
|
72
|
+
when 'doc:app'.to_sym then 'doc/app'
|
73
|
+
else
|
74
|
+
raise "Unsure what to run to generate documentation. Please set doc_task and re-run."
|
75
|
+
end
|
76
|
+
|
77
|
+
sh %{rsync --archive --verbose --delete #{local_dir}/ #{host}:#{remote_dir}}
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
if publish_documentation?
|
83
|
+
desc "Release RDoc documentation to RubyForge"
|
84
|
+
task :release => "rubyforge:release:docs"
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
task :release => 'rubyforge:release'
|
89
|
+
end
|
90
|
+
|
91
|
+
def publish_documentation?
|
92
|
+
! (doc_task == false || doc_task == :none)
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require 'rake'
|
2
|
+
require 'rake/tasklib'
|
3
|
+
|
4
|
+
class Juwelier
|
5
|
+
# Rake tasks for putting a Juwelier gem on Gemcutter.
|
6
|
+
#
|
7
|
+
# Juwelier::Tasks.new needs to be used before this.
|
8
|
+
#
|
9
|
+
# Basic usage:
|
10
|
+
#
|
11
|
+
# Juwelier::RubygemsDotOrgTasks.new
|
12
|
+
#
|
13
|
+
# Easy enough, right?
|
14
|
+
class RubygemsDotOrgTasks < ::Rake::TaskLib
|
15
|
+
attr_accessor :juwelier
|
16
|
+
|
17
|
+
def initialize
|
18
|
+
yield self if block_given?
|
19
|
+
|
20
|
+
define
|
21
|
+
end
|
22
|
+
|
23
|
+
def juwelier
|
24
|
+
@juwelier ||= Rake.application.juwelier
|
25
|
+
end
|
26
|
+
|
27
|
+
def define
|
28
|
+
namespace :gemcutter do
|
29
|
+
desc "Release gem to Gemcutter"
|
30
|
+
task :release => [:gemspec, :build] do
|
31
|
+
juwelier.release_gem_to_rubygems
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
task :release => 'gemcutter:release'
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require 'rake'
|
2
|
+
require 'rake/tasklib'
|
3
|
+
|
4
|
+
class Juwelier
|
5
|
+
# Rake tasks for putting a Juwelier gem on Gemcutter.
|
6
|
+
#
|
7
|
+
# Juwelier::Tasks.new needs to be used before this.
|
8
|
+
#
|
9
|
+
# Basic usage:
|
10
|
+
#
|
11
|
+
# Juwelier::RubygemsDotOrgTasks.new
|
12
|
+
#
|
13
|
+
# Easy enough, right?
|
14
|
+
class RubygemsDotOrgTasks < ::Rake::TaskLib
|
15
|
+
attr_accessor :juwelier
|
16
|
+
|
17
|
+
def initialize
|
18
|
+
yield self if block_given?
|
19
|
+
|
20
|
+
define
|
21
|
+
end
|
22
|
+
|
23
|
+
def juwelier
|
24
|
+
@juwelier ||= Rake.application.juwelier
|
25
|
+
end
|
26
|
+
|
27
|
+
def define
|
28
|
+
namespace :rubygems do
|
29
|
+
desc "Release gem to Gemcutter"
|
30
|
+
task :release => [:gemspec, :build] do
|
31
|
+
juwelier.release_gem_to_rubygems
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
task :release => 'rubygems:release'
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,110 @@
|
|
1
|
+
|
2
|
+
require 'rubygems/specification'
|
3
|
+
|
4
|
+
class Juwelier
|
5
|
+
# Extend a Gem::Specification instance with this module to give it Juwelier
|
6
|
+
# super-cow powers.
|
7
|
+
#
|
8
|
+
# [files] a Rake::FileList of anything that is in git and not gitignored. You can include/exclude this default set, or override it entirely
|
9
|
+
# [extra_rdoc_files] a Rake::FileList including files like README*, ChangeLog*, and LICENSE*
|
10
|
+
# [executables] uses anything found in the bin/ directory.
|
11
|
+
module Specification
|
12
|
+
def self.filelist_attribute(name)
|
13
|
+
code = %{
|
14
|
+
def #{name}
|
15
|
+
if @#{name} && @#{name}.class != FileList
|
16
|
+
@#{name} = FileList[@#{name}]
|
17
|
+
end
|
18
|
+
@#{name} ||= FileList[]
|
19
|
+
end
|
20
|
+
def #{name}=(value)
|
21
|
+
@#{name} = FileList[value]
|
22
|
+
end
|
23
|
+
}
|
24
|
+
|
25
|
+
module_eval code, __FILE__, __LINE__ - 9
|
26
|
+
end
|
27
|
+
|
28
|
+
filelist_attribute :files
|
29
|
+
filelist_attribute :extra_rdoc_files
|
30
|
+
|
31
|
+
# Assigns the Juwelier defaults to the Gem::Specification
|
32
|
+
def set_juwelier_defaults(base_dir, git_base_dir = nil)
|
33
|
+
base_dir = File.expand_path(base_dir)
|
34
|
+
git_base_dir = if git_base_dir
|
35
|
+
File.expand_path(git_base_dir)
|
36
|
+
else
|
37
|
+
base_dir
|
38
|
+
end
|
39
|
+
can_git = git_base_dir && base_dir.include?(git_base_dir) && File.directory?(File.join(git_base_dir, '.git'))
|
40
|
+
|
41
|
+
Dir.chdir(git_base_dir) do
|
42
|
+
repo = if can_git
|
43
|
+
require 'git'
|
44
|
+
Git.open(git_base_dir)
|
45
|
+
end
|
46
|
+
|
47
|
+
if blank?(files) && repo
|
48
|
+
base_dir_with_trailing_separator = File.join(base_dir, "")
|
49
|
+
|
50
|
+
ignored_files = repo.lib.ignored_files + [".gitignore"]
|
51
|
+
self.files = (repo.ls_files(base_dir).keys - ignored_files).compact.map do |file|
|
52
|
+
File.expand_path(file).sub(base_dir_with_trailing_separator, "")
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
if blank?(executables) && repo
|
57
|
+
self.executables = (repo.ls_files(File.join(base_dir, 'bin')).keys - repo.lib.ignored_files).map do |file|
|
58
|
+
File.basename(file)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
if blank?(extensions)
|
63
|
+
self.extensions = FileList['ext/**/{extconf,mkrf_conf}.rb']
|
64
|
+
end
|
65
|
+
|
66
|
+
if blank?(extra_rdoc_files)
|
67
|
+
self.extra_rdoc_files = FileList['README*', 'ChangeLog*', 'LICENSE*', 'TODO']
|
68
|
+
end
|
69
|
+
|
70
|
+
if File.exist?('Gemfile')
|
71
|
+
require 'bundler'
|
72
|
+
bundler = Bundler.load
|
73
|
+
bundler.dependencies_for(:default, :runtime).each do |dependency|
|
74
|
+
self.add_dependency dependency.name, *dependency.requirement.as_list
|
75
|
+
end
|
76
|
+
bundler.dependencies_for(:development).each do |dependency|
|
77
|
+
self.add_development_dependency dependency.name, *dependency.requirement.as_list
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
# Used by Specification#to_ruby to generate a ruby-respresentation of a Gem::Specification
|
85
|
+
def ruby_code(obj)
|
86
|
+
case obj
|
87
|
+
when Rake::FileList then obj.uniq.to_a.inspect
|
88
|
+
else super
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
private
|
93
|
+
|
94
|
+
def blank?(value)
|
95
|
+
value.nil? || value.empty?
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
|
101
|
+
# Workaround for cloning/duping a Gem::Specification
|
102
|
+
# documented in http://github.com/flajann2/juwelier/issues#issue/73
|
103
|
+
Gem::Specification.class_eval do
|
104
|
+
def initialize_copy(original)
|
105
|
+
super
|
106
|
+
|
107
|
+
self.files = original.files.to_a
|
108
|
+
self.extra_rdoc_files = original.extra_rdoc_files.to_a
|
109
|
+
end
|
110
|
+
end
|