Class: Maven::Tools::MinimalProject
- Inherits:
-
Model::Project
- Object
- Model::Tag
- Model::Coordinate
- Model::Project
- Maven::Tools::MinimalProject
- Defined in:
- lib/maven/tools/minimal_project.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(spec, &block) ⇒ MinimalProject
constructor
A new instance of MinimalProject.
Methods inherited from Model::Project
#_name, #build, #dependency_management, #description, #description=, #developers, #dump_pom, #execute_in_phase, #executions_in_phase, #licenses, #name, #name=, #parent, #plugin, #plugin?, #plugin_repositories, #plugin_repository, #profile, #profiles, #properties, #properties=, #repositories, #repository, #source_control, #version
Methods included from Model::Dependencies
#dependencies, #detect_gem, #gem, #gem?, included, #jar, #jar?, #pom, #pom?, #test_jar, #test_jar?
Methods inherited from Model::Coordinate
Methods included from Coordinate
#gav, #group_artifact, #to_coordinate, #to_split_coordinate, #to_version
Methods inherited from Model::Tag
#_name, _tags, #comment, prepend_tags, tags, #to_xml
Constructor Details
#initialize(spec, &block) ⇒ MinimalProject
Returns a new instance of MinimalProject.
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/maven/tools/minimal_project.rb', line 37 def initialize( spec, &block ) super( "rubygems", spec.name, spec.version, &block ) packaging "gem" name spec.summary || "#{self.artifact_id} - gem" description spec.description if spec.description url spec.homepage if spec.homepage ( [spec.email].flatten || [] ).zip( [spec.].flatten || [] ).map do |email, | self.developers.new( , email ) end # flatten the array since copyright-header-1.0.3.gemspec has a double # nested array ( spec.licenses + spec.files.select {|file| file.to_s =~ /license|gpl/i } ).flatten.each do |license| # TODO make this better, i.e. detect the right license name from the file itself self.licenses.new( license ) end plugin('gem', VERSIONS[:jruby_plugins]) do |g| g.extensions = true end spec.dependencies.each do |dep| versions = dep.requirement.requirements.collect do |req| # use this construct to get the same result in 1.8.x and 1.9.x req.collect{ |i| i.to_s }.join end g = gem( dep.name, versions ) g.scope = 'test' if dep.type == :development end spec.requirements.each do |req| req.split( /\n/ ).each do |r| coord = to_coordinate( r ) if coord name = coord.sub(/:[^:]+:[^:]+$/, '') versions = coord.sub(/.*:/, '') if r =~ /^\s*(jar|pom)\s/ jar( name, versions ) end end end end end |
Class Method Details
.create(gemfile, &block) ⇒ Object
31 32 33 34 35 |
# File 'lib/maven/tools/minimal_project.rb', line 31 def self.create( gemfile, &block ) require 'rubygems' require 'rubygems/format' self.new( Gem::Format.from_file_by_path( gemfile ).spec ) end |