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/generator/rdoc_mixin.rb,
lib/jeweler/generator/yard_mixin.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/check_dependencies.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/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.
- #check_dependencies(type = nil) ⇒ Object
- #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_gemcutter ⇒ 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
-
#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.
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/jeweler.rb', line 27 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.
25 26 27 |
# File 'lib/jeweler.rb', line 25 def base_dir @base_dir end |
#commit ⇒ Object
Returns the value of attribute commit.
25 26 27 |
# File 'lib/jeweler.rb', line 25 def commit @commit end |
#gemspec ⇒ Object (readonly)
Returns the value of attribute gemspec.
24 25 26 |
# File 'lib/jeweler.rb', line 24 def gemspec @gemspec end |
#gemspec_helper ⇒ Object (readonly)
Returns the value of attribute gemspec_helper.
24 25 26 |
# File 'lib/jeweler.rb', line 24 def gemspec_helper @gemspec_helper end |
#output ⇒ Object
Returns the value of attribute output.
25 26 27 |
# File 'lib/jeweler.rb', line 25 def output @output end |
#repo ⇒ Object
Returns the value of attribute repo.
25 26 27 |
# File 'lib/jeweler.rb', line 25 def repo @repo end |
#rubyforge ⇒ Object
Returns the value of attribute rubyforge.
25 26 27 |
# File 'lib/jeweler.rb', line 25 def rubyforge @rubyforge end |
#version_helper ⇒ Object (readonly)
Returns the value of attribute version_helper.
24 25 26 |
# File 'lib/jeweler.rb', line 24 def version_helper @version_helper end |
Instance Method Details
#build_gem ⇒ Object
82 83 84 |
# File 'lib/jeweler.rb', line 82 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
107 108 109 |
# File 'lib/jeweler.rb', line 107 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
100 101 102 |
# File 'lib/jeweler.rb', line 100 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
93 94 95 |
# File 'lib/jeweler.rb', line 93 def bump_patch_version() Jeweler::Commands::Version::BumpPatch.build_for(self).run end |
#check_dependencies(type = nil) ⇒ Object
137 138 139 140 141 142 |
# File 'lib/jeweler.rb', line 137 def check_dependencies(type = nil) command = Jeweler::Commands::CheckDependencies.build_for(self) command.type = type command.run end |
#in_git_repo? ⇒ Boolean
144 145 146 |
# File 'lib/jeweler.rb', line 144 def in_git_repo? File.exists?(File.join(self.base_dir, '.git')) end |
#install_gem ⇒ Object
86 87 88 |
# File 'lib/jeweler.rb', line 86 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.
45 46 47 |
# File 'lib/jeweler.rb', line 45 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.
51 52 53 |
# File 'lib/jeweler.rb', line 51 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.
57 58 59 |
# File 'lib/jeweler.rb', line 57 def patch_version @version_helper.patch end |
#release ⇒ Object
121 122 123 |
# File 'lib/jeweler.rb', line 121 def release Jeweler::Commands::Release.build_for(self).run end |
#release_gem_to_gemcutter ⇒ Object
125 126 127 |
# File 'lib/jeweler.rb', line 125 def release_gem_to_gemcutter Jeweler::Commands::ReleaseToGemcutter.build_for(self).run end |
#release_gem_to_rubyforge ⇒ Object
129 130 131 |
# File 'lib/jeweler.rb', line 129 def release_gem_to_rubyforge Jeweler::Commands::ReleaseToRubyforge.build_for(self).run end |
#setup_rubyforge ⇒ Object
133 134 135 |
# File 'lib/jeweler.rb', line 133 def setup_rubyforge Jeweler::Commands::SetupRubyforge.build_for(self).run end |
#valid_gemspec? ⇒ Boolean
is the project’s gemspec from disk valid?
78 79 80 |
# File 'lib/jeweler.rb', line 78 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
73 74 75 |
# File 'lib/jeweler.rb', line 73 def validate_gemspec Jeweler::Commands::ValidateGemspec.build_for(self).run end |
#version ⇒ Object
Human readable version, which is used in the gemspec.
62 63 64 |
# File 'lib/jeweler.rb', line 62 def version @version_helper.to_s end |
#version_exists? ⇒ Boolean
148 149 150 |
# File 'lib/jeweler.rb', line 148 def version_exists? File.exists?(@version_helper.plaintext_path) || File.exists?(@version_helper.yaml_path) end |
#write_gemspec ⇒ Object
Writes out the gemspec
67 68 69 |
# File 'lib/jeweler.rb', line 67 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.
112 113 114 115 116 117 118 119 |
# File 'lib/jeweler.rb', line 112 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 |