Class: Maven::Tools::DSL::Gemspec

Inherits:
Object
  • Object
show all
Includes:
Coordinate
Defined in:
lib/maven/tools/dsl/gemspec.rb

Direct Known Subclasses

ProfileGemspec, ProjectGemspec

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Coordinate

#gav, #group_artifact, #to_coordinate, #to_split_coordinate, #to_split_coordinate_with_scope, #to_version

Constructor Details

#initialize(parent, name = nil, options = {}) ⇒ Gemspec

Returns a new instance of Gemspec.



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/maven/tools/dsl/gemspec.rb', line 30

def initialize( parent, name = nil, options = {} )
  @parent = parent
  case name
  when Hash
    options = name
    name = options[ 'name' ] || options[ :name ]
  when Gem::Specification
    process_gem_spec( name, options )
    return
  end
  name = find_gemspec_file( name )
  spec = gem_specification( name )
  name ||= "#{spec.name}-#{spec.version}.gemspec"
  process( spec, name, options )
  JarsLock.new( parent ) if parent.respond_to? :profile
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(m, *args) ⇒ Object



65
66
67
68
69
70
71
# File 'lib/maven/tools/dsl/gemspec.rb', line 65

def method_missing( m, *args )
  if args.size == 1
    warn "unknown declaration: #{m} " + args[0]
  else
    super
  end
end

Instance Attribute Details

#parentObject (readonly)

Returns the value of attribute parent.



47
48
49
# File 'lib/maven/tools/dsl/gemspec.rb', line 47

def parent
  @parent
end

Instance Method Details

#gem(scope, coord) ⇒ Object



53
54
55
# File 'lib/maven/tools/dsl/gemspec.rb', line 53

def gem( scope, coord )
  DependencyDSL.create( @parent.current, :gem, scope, coord )
end

#helpObject



49
50
51
# File 'lib/maven/tools/dsl/gemspec.rb', line 49

def help
  warn "\n# gemspec(filename) - default find gemspec in current directory #\n"
end

#jar(line) ⇒ Object



57
58
59
# File 'lib/maven/tools/dsl/gemspec.rb', line 57

def jar( line )
  maven_dependency( "jar #{line}" )
end

#pom(line) ⇒ Object



61
62
63
# File 'lib/maven/tools/dsl/gemspec.rb', line 61

def pom( line )
  maven_dependency( "pom #{line}" )
end