Class: Parka::Specification

Inherits:
Gem::Specification
  • Object
show all
Defined in:
lib/parka/specification.rb

Class Method Summary collapse

Class Method Details

.new(&block) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/parka/specification.rb', line 7

def self.new(&block)
  gemspec_filename = caller.first.split(':').first

  # add the lib/ dir of the gem to the load path
  $:.unshift File.expand_path(File.join(File.dirname(gemspec_filename), 'lib'))

  # autorequire the same name as the gem spec
  require File.basename(gemspec_filename, File.extname(gemspec_filename))

  spec = Gem::Specification.new(&block)

  # set up some sensible defaults
  spec.author      ||= default_author
  spec.email       ||= default_email
  spec.description ||= spec.summary

  # hack to avoid rubyforge_project warning
  spec.rubyforge_project = "nowarning"

  # default file list if none specified
  spec.files = (spec.files + default_files).uniq

  # get dependencies from bundler
  add_bundler_dependencies(spec)

  spec
end