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:
Build a gem using the project’s latest Gem::Specification
# File lib/jeweler.rb, line 86 def build_gem Jeweler::Commands::BuildGem.build_for(self).run end
Bumps the major version.
1.5.1 -> 2.0.0
# File lib/jeweler.rb, line 112 def bump_major_version() Jeweler::Commands::Version::BumpMajor.build_for(self).run end
Bumps the minor version.
1.5.1 -> 1.6.0
# File lib/jeweler.rb, line 105 def bump_minor_version() Jeweler::Commands::Version::BumpMinor.build_for(self).run end
Bumps the patch version.
1.5.1 -> 1.5.2
# File lib/jeweler.rb, line 98 def bump_patch_version() Jeweler::Commands::Version::BumpPatch.build_for(self).run end
# File lib/jeweler.rb, line 147 def check_dependencies(type = nil) command = Jeweler::Commands::CheckDependencies.build_for(self) command.type = type command.run end
# File lib/jeweler.rb, line 173 def expects_version_file? gemspec.version.nil? end
# File lib/jeweler.rb, line 154 def git_base_dir(base_dir = nil) if base_dir base_dir = File.dirname(base_dir) else base_dir = File.expand_path(self.base_dir || ".") end return nil if base_dir==File.dirname("/") return base_dir if File.exists?(File.join(base_dir, '.git')) return git_base_dir(base_dir) end
# File lib/jeweler.rb, line 165 def in_git_repo? git_base_dir end
Install a previously built gem
# File lib/jeweler.rb, line 91 def install_gem Jeweler::Commands::InstallGem.build_for(self).run end
Major version, as defined by the gemspec’s Version module. For 1.5.3, this would return 1.
# File lib/jeweler.rb, line 48 def major_version @version_helper.major end
Minor version, as defined by the gemspec’s Version module. For 1.5.3, this would return 5.
# File lib/jeweler.rb, line 54 def minor_version @version_helper.minor end
Patch version, as defined by the gemspec’s Version module. For 1.5.3, this would return 5.
# File lib/jeweler.rb, line 60 def patch_version @version_helper.patch end
# File lib/jeweler.rb, line 139 def release_gem_to_rubyforge # no-op end
# File lib/jeweler.rb, line 135 def release_gem_to_rubygems Jeweler::Commands::ReleaseToRubygems.build_for(self).run end
# File lib/jeweler.rb, line 127 def release_gemspec Jeweler::Commands::ReleaseGemspec.build_for(self).run end
# File lib/jeweler.rb, line 131 def release_to_git Jeweler::Commands::ReleaseToGit.build_for(self).run end
# File lib/jeweler.rb, line 143 def setup_rubyforge # no-op end
is the project’s gemspec from disk valid?
# File lib/jeweler.rb, line 81 def valid_gemspec? gemspec_helper.valid? end
Validates the project’s gemspec from disk in an environment similar to how GitHub would build from it. See gist.github.com/16215
# File lib/jeweler.rb, line 76 def validate_gemspec Jeweler::Commands::ValidateGemspec.build_for(self).run end
Human readable version, which is used in the gemspec.
# File lib/jeweler.rb, line 65 def version @gemspec.version || @version_helper.to_s end
# File lib/jeweler.rb, line 169 def version_file_exists? File.exists?(@version_helper.plaintext_path) || File.exists?(@version_helper.yaml_path) end
Writes out the gemspec
# File lib/jeweler.rb, line 70 def write_gemspec Jeweler::Commands::WriteGemspec.build_for(self).run end
Bumps the version, to the specific major/minor/patch version, writing out the appropriate version.rb, and then reloads it.
# File lib/jeweler.rb, line 117 def write_version(major, minor, patch, build, options = {}) command = Jeweler::Commands::Version::Write.build_for(self) command.major = major command.minor = minor command.patch = patch command.build = build command.run end
# File lib/jeweler.rb, line 31 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