Class: Jeweler
- Inherits:
-
Object
- Object
- Jeweler
- Defined in:
- lib/jeweler.rb,
lib/jeweler/errors.rb,
lib/jeweler/generator.rb,
lib/jeweler/specification.rb,
lib/jeweler/gemspec_helper.rb,
lib/jeweler/version_helper.rb,
lib/jeweler/rubyforge_tasks.rb,
lib/jeweler/commands/release.rb,
lib/jeweler/generator/options.rb,
lib/jeweler/commands/build_gem.rb,
lib/jeweler/commands/install_gem.rb,
lib/jeweler/commands/version/base.rb,
lib/jeweler/generator/application.rb,
lib/jeweler/generator/bacon_mixin.rb,
lib/jeweler/generator/rspec_mixin.rb,
lib/jeweler/commands/version/write.rb,
lib/jeweler/commands/write_gemspec.rb,
lib/jeweler/generator/shoulda_mixin.rb,
lib/jeweler/commands/setup_rubyforge.rb,
lib/jeweler/generator/minitest_mixin.rb,
lib/jeweler/generator/testunit_mixin.rb,
lib/jeweler/commands/validate_gemspec.rb,
lib/jeweler/generator/micronaut_mixin.rb,
lib/jeweler/commands/version/bump_major.rb,
lib/jeweler/commands/version/bump_minor.rb,
lib/jeweler/commands/version/bump_patch.rb,
lib/jeweler/commands/release_to_rubyforge.rb,
lib/jeweler/commands/version/bump_timestamp.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.
Defined Under Namespace
Modules: Commands, Specification Classes: FileInTheWay, GemSpecHelper, GemspecError, Generator, GitInitFailed, MissingRubyForgePackageError, NoGitHubRepoNameGiven, NoGitHubToken, NoGitHubUser, NoGitUserEmail, NoGitUserName, NoRubyForgeProjectInGemspecError, RubyForgeProjectNotConfiguredError, RubyforgeTasks, 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.
-
#rubyforge ⇒ Object
Returns the value of attribute rubyforge.
-
#version_helper ⇒ Object
readonly
Returns the value of attribute version_helper.
Instance Method Summary collapse
- #build_gem ⇒ Object
-
#bump_major_version ⇒ Object
Bumps the major version.
-
#bump_minor_version ⇒ Object
Bumps the minor version.
-
#bump_patch_version ⇒ Object
Bumps the patch version.
-
#bump_timestamp_version ⇒ Object
Bumps the timestamp version.
- #in_git_repo? ⇒ Boolean
-
#initialize(gemspec, base_dir = '.') ⇒ Jeweler
constructor
A new instance of Jeweler.
- #install_gem ⇒ Object
-
#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 ⇒ Object
- #release_gem_to_rubyforge ⇒ 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_exists? ⇒ Boolean
- #version_timestamp ⇒ Object
-
#write_gemspec ⇒ Object
Writes out the gemspec.
-
#write_version(major, minor, patch, 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.
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/jeweler.rb', line 26 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) @base_dir = base_dir @repo = Git.open(base_dir) if in_git_repo? @version_helper = Jeweler::VersionHelper.new(base_dir) @output = $stdout @commit = true @gemspec_helper = GemSpecHelper.new(gemspec, base_dir) @rubyforge = RubyForge.new end |
Instance Attribute Details
#base_dir ⇒ Object
Returns the value of attribute base_dir.
24 25 26 |
# File 'lib/jeweler.rb', line 24 def base_dir @base_dir end |
#commit ⇒ Object
Returns the value of attribute commit.
24 25 26 |
# File 'lib/jeweler.rb', line 24 def commit @commit end |
#gemspec ⇒ Object (readonly)
Returns the value of attribute gemspec.
23 24 25 |
# File 'lib/jeweler.rb', line 23 def gemspec @gemspec end |
#gemspec_helper ⇒ Object (readonly)
Returns the value of attribute gemspec_helper.
23 24 25 |
# File 'lib/jeweler.rb', line 23 def gemspec_helper @gemspec_helper end |
#output ⇒ Object
Returns the value of attribute output.
24 25 26 |
# File 'lib/jeweler.rb', line 24 def output @output end |
#repo ⇒ Object
Returns the value of attribute repo.
24 25 26 |
# File 'lib/jeweler.rb', line 24 def repo @repo end |
#rubyforge ⇒ Object
Returns the value of attribute rubyforge.
24 25 26 |
# File 'lib/jeweler.rb', line 24 def rubyforge @rubyforge end |
#version_helper ⇒ Object (readonly)
Returns the value of attribute version_helper.
23 24 25 |
# File 'lib/jeweler.rb', line 23 def version_helper @version_helper end |
Instance Method Details
#build_gem ⇒ Object
86 87 88 |
# File 'lib/jeweler.rb', line 86 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
118 119 120 |
# File 'lib/jeweler.rb', line 118 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
111 112 113 |
# File 'lib/jeweler.rb', line 111 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
104 105 106 |
# File 'lib/jeweler.rb', line 104 def bump_patch_version() Jeweler::Commands::Version::BumpPatch.build_for(self).run end |
#bump_timestamp_version ⇒ Object
Bumps the timestamp version.
1.5.1 -> 1.5.1.YYYYMMDDHHMMSS
97 98 99 |
# File 'lib/jeweler.rb', line 97 def () Jeweler::Commands::Version::BumpTimestamp.build_for(self).run end |
#in_git_repo? ⇒ Boolean
146 147 148 |
# File 'lib/jeweler.rb', line 146 def in_git_repo? File.exists?(File.join(self.base_dir, '.git')) end |
#install_gem ⇒ Object
90 91 92 |
# File 'lib/jeweler.rb', line 90 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.
44 45 46 |
# File 'lib/jeweler.rb', line 44 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.
50 51 52 |
# File 'lib/jeweler.rb', line 50 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 3.
56 57 58 |
# File 'lib/jeweler.rb', line 56 def patch_version @version_helper.patch end |
#release ⇒ Object
133 134 135 |
# File 'lib/jeweler.rb', line 133 def release Jeweler::Commands::Release.build_for(self).run end |
#release_gem_to_rubyforge ⇒ Object
137 138 139 |
# File 'lib/jeweler.rb', line 137 def release_gem_to_rubyforge Jeweler::Commands::ReleaseToRubyforge.build_for(self).run end |
#setup_rubyforge ⇒ Object
141 142 143 |
# File 'lib/jeweler.rb', line 141 def setup_rubyforge Jeweler::Commands::SetupRubyforge.build_for(self).run 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 @version_helper.to_s end |
#version_exists? ⇒ Boolean
150 151 152 |
# File 'lib/jeweler.rb', line 150 def version_exists? File.exists?(@version_helper.plaintext_path) || File.exists?(@version_helper.yaml_path) end |
#version_timestamp ⇒ Object
60 61 62 |
# File 'lib/jeweler.rb', line 60 def @version_helper. 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, options = {}) ⇒ Object
Bumps the version, to the specific major/minor/patch version, writing out the appropriate version.rb, and then reloads it.
124 125 126 127 128 129 130 131 |
# File 'lib/jeweler.rb', line 124 def write_version(major, minor, patch, = {}) command = Jeweler::Commands::Version::Write.build_for(self) command.major = major command.minor = minor command.patch = patch command.run end |