Class: Jeweler
- Inherits:
-
Object
- Object
- Jeweler
- Defined in:
- lib/jeweler.rb,
lib/jeweler/errors.rb,
lib/jeweler/version.rb,
lib/jeweler/commands.rb,
lib/jeweler/generator.rb,
lib/jeweler/specification.rb,
lib/jeweler/gemspec_helper.rb,
lib/jeweler/rubygems_tasks.rb,
lib/jeweler/version_helper.rb,
lib/jeweler/gemcutter_tasks.rb,
lib/jeweler/rubyforge_tasks.rb,
lib/jeweler/rubygems_dot_org_tasks.rb,
lib/jeweler/commands/build_gem.rb,
lib/jeweler/commands/install_gem.rb,
lib/jeweler/commands/write_gemspec.rb,
lib/jeweler/commands/release_to_git.rb,
lib/jeweler/commands/release_gemspec.rb,
lib/jeweler/commands/validate_gemspec.rb,
lib/jeweler/commands/check_dependencies.rb,
lib/jeweler/commands/release_to_rubygems.rb,
lib/jeweler/generator/options.rb,
lib/jeweler/generator/rdoc_mixin.rb,
lib/jeweler/generator/riot_mixin.rb,
lib/jeweler/generator/yard_mixin.rb,
lib/jeweler/generator/application.rb,
lib/jeweler/generator/bacon_mixin.rb,
lib/jeweler/generator/rspec_mixin.rb,
lib/jeweler/generator/github_mixin.rb,
lib/jeweler/generator/shindo_mixin.rb,
lib/jeweler/generator/shoulda_mixin.rb,
lib/jeweler/generator/minitest_mixin.rb,
lib/jeweler/generator/testspec_mixin.rb,
lib/jeweler/generator/testunit_mixin.rb,
lib/jeweler/generator/micronaut_mixin.rb,
lib/jeweler/commands/version/base.rb,
lib/jeweler/commands/version/write.rb,
lib/jeweler/commands/version/bump_major.rb,
lib/jeweler/commands/version/bump_minor.rb,
lib/jeweler/commands/version/bump_patch.rb,
lib/jeweler/tasks.rb
Overview
A Jeweler helps you craft the perfect Rubygem. Give him a gemspec, and he takes care of the rest.
See Jeweler::Tasks for examples of how to get started. Additionally, resources are available on the wiki:
Defined Under Namespace
Modules: Commands, Specification, Version Classes: FileInTheWay, GemSpecHelper, GemcutterTasks, GemspecError, Generator, GitInitFailed, GitRepoCreationFailed, NoGitHubRepoNameGiven, NoGitHubUser, NoGitUserEmail, NoGitUserName, RubyforgeTasks, RubygemsDotOrgTasks, Tasks, VersionHelper, VersionYmlError
Instance Attribute Summary collapse
-
#base_dir ⇒ Object
Returns the value of attribute base_dir.
-
#commit ⇒ Object
Returns the value of attribute commit.
-
#gemspec ⇒ Object
readonly
Returns the value of attribute gemspec.
-
#gemspec_helper ⇒ Object
readonly
Returns the value of attribute gemspec_helper.
-
#output ⇒ Object
Returns the value of attribute output.
-
#repo ⇒ Object
Returns the value of attribute repo.
-
#version_helper ⇒ Object
readonly
Returns the value of attribute version_helper.
Instance Method Summary collapse
-
#build_gem ⇒ Object
Build a gem using the project’s latest Gem::Specification.
-
#bump_major_version ⇒ Object
Bumps the major version.
-
#bump_minor_version ⇒ Object
Bumps the minor version.
-
#bump_patch_version ⇒ Object
Bumps the patch version.
- #check_dependencies(type = nil) ⇒ Object
- #expects_version_file? ⇒ Boolean
- #git_base_dir(base_dir = nil) ⇒ Object
- #in_git_repo? ⇒ Boolean
-
#initialize(gemspec, base_dir = '.') ⇒ Jeweler
constructor
A new instance of Jeweler.
-
#install_gem ⇒ Object
Install a previously built gem.
-
#major_version ⇒ Object
Major version, as defined by the gemspec’s Version module.
-
#minor_version ⇒ Object
Minor version, as defined by the gemspec’s Version module.
-
#patch_version ⇒ Object
Patch version, as defined by the gemspec’s Version module.
- #release_gem_to_rubyforge ⇒ Object
- #release_gem_to_rubygems ⇒ Object
- #release_gemspec(args) ⇒ Object
- #release_to_git(args) ⇒ Object
- #setup_rubyforge ⇒ Object
-
#valid_gemspec? ⇒ Boolean
is the project’s gemspec from disk valid?.
-
#validate_gemspec ⇒ Object
Validates the project’s gemspec from disk in an environment similar to how GitHub would build from it.
-
#version ⇒ Object
Human readable version, which is used in the gemspec.
- #version_file_exist? ⇒ Boolean
-
#write_gemspec ⇒ Object
Writes out the gemspec.
-
#write_version(major, minor, patch, build, _options = {}) ⇒ Object
Bumps the version, to the specific major/minor/patch version, writing out the appropriate version.rb, and then reloads it.
Constructor Details
#initialize(gemspec, base_dir = '.') ⇒ Jeweler
Returns a new instance of Jeweler.
32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/jeweler.rb', line 32 def initialize(gemspec, base_dir = '.') raise(GemspecError, "Can't create a Jeweler with a nil gemspec") if gemspec.nil? @gemspec = gemspec @gemspec.extend(Specification) @gemspec.set_jeweler_defaults(base_dir, git_base_dir) @base_dir = base_dir @repo = Git.open(git_base_dir) if in_git_repo? @version_helper = Jeweler::VersionHelper.new(base_dir) @output = $stdout @commit = true @gemspec_helper = GemSpecHelper.new(gemspec, base_dir) end |
Instance Attribute Details
#base_dir ⇒ Object
Returns the value of attribute base_dir.
30 31 32 |
# File 'lib/jeweler.rb', line 30 def base_dir @base_dir end |
#commit ⇒ Object
Returns the value of attribute commit.
30 31 32 |
# File 'lib/jeweler.rb', line 30 def commit @commit end |
#gemspec ⇒ Object (readonly)
Returns the value of attribute gemspec.
29 30 31 |
# File 'lib/jeweler.rb', line 29 def gemspec @gemspec end |
#gemspec_helper ⇒ Object (readonly)
Returns the value of attribute gemspec_helper.
29 30 31 |
# File 'lib/jeweler.rb', line 29 def gemspec_helper @gemspec_helper end |
#output ⇒ Object
Returns the value of attribute output.
30 31 32 |
# File 'lib/jeweler.rb', line 30 def output @output end |
#repo ⇒ Object
Returns the value of attribute repo.
30 31 32 |
# File 'lib/jeweler.rb', line 30 def repo @repo end |
#version_helper ⇒ Object (readonly)
Returns the value of attribute version_helper.
29 30 31 |
# File 'lib/jeweler.rb', line 29 def version_helper @version_helper end |
Instance Method Details
#build_gem ⇒ Object
Build a gem using the project’s latest Gem::Specification
87 88 89 |
# File 'lib/jeweler.rb', line 87 def build_gem Jeweler::Commands::BuildGem.build_for(self).run end |
#bump_major_version ⇒ Object
Bumps the major version.
1.5.1 -> 2.0.0
113 114 115 |
# File 'lib/jeweler.rb', line 113 def bump_major_version Jeweler::Commands::Version::BumpMajor.build_for(self).run end |
#bump_minor_version ⇒ Object
Bumps the minor version.
1.5.1 -> 1.6.0
106 107 108 |
# File 'lib/jeweler.rb', line 106 def bump_minor_version Jeweler::Commands::Version::BumpMinor.build_for(self).run end |
#bump_patch_version ⇒ Object
Bumps the patch version.
1.5.1 -> 1.5.2
99 100 101 |
# File 'lib/jeweler.rb', line 99 def bump_patch_version Jeweler::Commands::Version::BumpPatch.build_for(self).run end |
#check_dependencies(type = nil) ⇒ Object
148 149 150 151 152 153 |
# File 'lib/jeweler.rb', line 148 def check_dependencies(type = nil) command = Jeweler::Commands::CheckDependencies.build_for(self) command.type = type command.run end |
#expects_version_file? ⇒ Boolean
174 175 176 |
# File 'lib/jeweler.rb', line 174 def expects_version_file? gemspec.version.nil? end |
#git_base_dir(base_dir = nil) ⇒ Object
155 156 157 158 159 160 161 162 163 164 |
# File 'lib/jeweler.rb', line 155 def git_base_dir(base_dir = nil) base_dir = if base_dir File.dirname(base_dir) else File.(self.base_dir || '.') end return nil if base_dir == File.dirname('/') return base_dir if File.exist?(File.join(base_dir, '.git')) git_base_dir(base_dir) end |
#in_git_repo? ⇒ Boolean
166 167 168 |
# File 'lib/jeweler.rb', line 166 def in_git_repo? git_base_dir end |
#install_gem ⇒ Object
Install a previously built gem
92 93 94 |
# File 'lib/jeweler.rb', line 92 def install_gem Jeweler::Commands::InstallGem.build_for(self).run end |
#major_version ⇒ Object
Major version, as defined by the gemspec’s Version module. For 1.5.3, this would return 1.
49 50 51 |
# File 'lib/jeweler.rb', line 49 def major_version @version_helper.major end |
#minor_version ⇒ Object
Minor version, as defined by the gemspec’s Version module. For 1.5.3, this would return 5.
55 56 57 |
# File 'lib/jeweler.rb', line 55 def minor_version @version_helper.minor end |
#patch_version ⇒ Object
Patch version, as defined by the gemspec’s Version module. For 1.5.3, this would return 5.
61 62 63 |
# File 'lib/jeweler.rb', line 61 def patch_version @version_helper.patch end |
#release_gem_to_rubyforge ⇒ Object
140 141 142 |
# File 'lib/jeweler.rb', line 140 def release_gem_to_rubyforge # no-op end |
#release_gem_to_rubygems ⇒ Object
136 137 138 |
# File 'lib/jeweler.rb', line 136 def release_gem_to_rubygems Jeweler::Commands::ReleaseToRubygems.build_for(self).run end |
#release_gemspec(args) ⇒ Object
128 129 130 |
# File 'lib/jeweler.rb', line 128 def release_gemspec(args) Jeweler::Commands::ReleaseGemspec.build_for(self).run(args) end |
#release_to_git(args) ⇒ Object
132 133 134 |
# File 'lib/jeweler.rb', line 132 def release_to_git(args) Jeweler::Commands::ReleaseToGit.build_for(self).run(args) end |
#setup_rubyforge ⇒ Object
144 145 146 |
# File 'lib/jeweler.rb', line 144 def setup_rubyforge # no-op end |
#valid_gemspec? ⇒ Boolean
is the project’s gemspec from disk valid?
82 83 84 |
# File 'lib/jeweler.rb', line 82 def valid_gemspec? gemspec_helper.valid? end |
#validate_gemspec ⇒ Object
Validates the project’s gemspec from disk in an environment similar to how GitHub would build from it. See gist.github.com/16215
77 78 79 |
# File 'lib/jeweler.rb', line 77 def validate_gemspec Jeweler::Commands::ValidateGemspec.build_for(self).run end |
#version ⇒ Object
Human readable version, which is used in the gemspec.
66 67 68 |
# File 'lib/jeweler.rb', line 66 def version @gemspec.version || @version_helper.to_s end |
#version_file_exist? ⇒ Boolean
170 171 172 |
# File 'lib/jeweler.rb', line 170 def version_file_exist? File.exist?(@version_helper.plaintext_path) || File.exist?(@version_helper.yaml_path) end |
#write_gemspec ⇒ Object
Writes out the gemspec
71 72 73 |
# File 'lib/jeweler.rb', line 71 def write_gemspec Jeweler::Commands::WriteGemspec.build_for(self).run end |
#write_version(major, minor, patch, build, _options = {}) ⇒ Object
Bumps the version, to the specific major/minor/patch version, writing out the appropriate version.rb, and then reloads it.
118 119 120 121 122 123 124 125 126 |
# File 'lib/jeweler.rb', line 118 def write_version(major, minor, patch, build, = {}) command = Jeweler::Commands::Version::Write.build_for(self) command.major = major command.minor = minor command.patch = patch command.build = build command.run end |