Class: Jeweler::Tasks

Inherits:
Rake::TaskLib
  • Object
show all
Defined in:
lib/jeweler/tasks.rb

Overview

Rake tasks for managing your gem.

Here’s a basic example of using it:

Jeweler::Tasks.new do |gem|
  gem.name = "jeweler"
  gem.summary = "Simple and opinionated helper for creating Rubygem projects on GitHub"
  gem.email = "[email protected]"
  gem.homepage = "http://github.com/technicalpickles/jeweler"
  gem.description = "Simple and opinionated helper for creating Rubygem projects on GitHub"
  gem.authors = ["Josh Nichols"]
end

The block variable gem is actually a Gem::Specification, so you can do anything you would normally do with a Gem::Specification. For more details, see the official gemspec reference: docs.rubygems.org/read/chapter/20

Jeweler fills in a few reasonable defaults for you:

gem.files

a Rake::FileList of anything that is in git and not gitignored. You can include/exclude this default set, or override it entirely

gem.test_files

Similar to gem.files, except it’s only things under the spec, test, or examples directory.

gem.extra_rdoc_files

a Rake::FileList including files like README*, ChangeLog*, and LICENSE*

gem.executables

uses anything found in the bin/ directory. You can override this.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(gemspec = nil) {|@gemspec| ... } ⇒ Tasks

Returns a new instance of Tasks.

Yields:



34
35
36
37
38
39
40
41
# File 'lib/jeweler/tasks.rb', line 34

def initialize(gemspec = nil, &block)
  @gemspec = gemspec || Gem::Specification.new
  @jeweler = Jeweler.new(@gemspec)
  yield @gemspec if block_given?

  Rake.application.jeweler = @jeweler
  define
end

Instance Attribute Details

#gemspecObject

Returns the value of attribute gemspec.



32
33
34
# File 'lib/jeweler/tasks.rb', line 32

def gemspec
  @gemspec
end

#jewelerObject

Returns the value of attribute jeweler.



32
33
34
# File 'lib/jeweler/tasks.rb', line 32

def jeweler
  @jeweler
end