pompompom 2.0.0.b1-java → 2.0.0.b2-java

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -15,13 +15,18 @@ module PomPomPom
15
15
  coordinate.to_ivy_module_id,
16
16
  ivy.settings.default_resolver.name,
17
17
  INSTALL_RESOLVER_NAME,
18
- install_options
18
+ install_options(coordinate.attributes)
19
19
  )
20
20
  end
21
21
 
22
22
  private
23
23
 
24
24
  INSTALL_RESOLVER_NAME = 'install'.freeze
25
+ DEFAULT_INSTALL_ATTRIBUTES = {
26
+ :overwrite => true,
27
+ :transitive => true,
28
+ :type_filter => 'jar,bundle'.freeze
29
+ }.freeze
25
30
 
26
31
  def ivy
27
32
  @ivy ||= begin
@@ -45,13 +50,13 @@ module PomPomPom
45
50
  install_resolver
46
51
  end
47
52
 
48
- def install_options
49
- @install_options ||= begin
50
- install_options = Ivy::InstallOptions.new
51
- install_options.set_overwrite(true)
52
- install_options.set_artifact_filter(Ivy::FilterHelper.get_artifact_type_filter('jar,bundle'))
53
- install_options
54
- end
53
+ def install_options(attributes)
54
+ attributes = DEFAULT_INSTALL_ATTRIBUTES.merge(attributes)
55
+ install_options = Ivy::InstallOptions.new
56
+ install_options.set_overwrite(attributes[:overwrite])
57
+ install_options.set_transitive(attributes[:transitive])
58
+ install_options.set_artifact_filter(Ivy::FilterHelper.get_artifact_type_filter(attributes[:type_filter]))
59
+ install_options
55
60
  end
56
61
 
57
62
  def install_pattern
@@ -2,19 +2,44 @@
2
2
 
3
3
  module PomPomPom
4
4
  class MavenCoordinate
5
+ attr_reader :group_id, :artifact_id, :version, :attributes
6
+
5
7
  def self.parse(str)
6
- new(*str.split(':'))
8
+ coordinate, attrs = str.split('|')
9
+ attributes = parse_attributes(attrs)
10
+ gid, aid, v = coordinate.split(':')
11
+ new(gid, aid, v, attributes)
7
12
  end
8
13
 
9
- attr_reader :group_id, :artifact_id, :version
10
-
11
14
  def initialize(*args)
12
- @group_id, @artifact_id, @version = args
15
+ @group_id, @artifact_id, @version, @attributes = args
16
+ @attributes ||= {}
13
17
  end
14
18
 
15
19
  begin :conversions
20
+ def self.parse_attributes(attrs)
21
+ return {} unless attrs
22
+ pairs = attrs.split(',').map { |a| k, v = a.split('='); [k, v] }
23
+ pairs.map! do |k, v|
24
+ vv = begin
25
+ case v
26
+ when 'true' then true
27
+ when 'false' then false
28
+ else v
29
+ end
30
+ end
31
+ [k.to_sym, vv]
32
+ end
33
+ Hash[pairs]
34
+ end
35
+
16
36
  def to_s
17
- "#{group_id}:#{artifact_id}:#{version}"
37
+ str = "#{group_id}:#{artifact_id}:#{version}"
38
+ unless attributes.empty?
39
+ attrs = attributes.map { |k, v| "#{k}=#{v}" }.join(',')
40
+ str << "|#{attrs}"
41
+ end
42
+ str
18
43
  end
19
44
 
20
45
  def to_ivy_module_id
@@ -1,3 +1,3 @@
1
1
  module PomPomPom
2
- VERSION = '2.0.0.b1'
2
+ VERSION = '2.0.0.b2'
3
3
  end
data/lib/pompompom.rb CHANGED
@@ -34,9 +34,11 @@ module PomPomPom
34
34
  destination = c['destination'] if c['destination']
35
35
  end
36
36
  destination = extra_config[:destination] if extra_config[:destination]
37
+ repositories.merge!(extra_config[:repositories]) if extra_config[:repositories]
38
+ dependencies.concat(extra_config[:dependencies]).uniq! if extra_config[:dependencies]
37
39
  {
38
- :repositories => create_repositories(repositories.merge(extra_config[:repositories])),
39
- :dependencies => (dependencies + extra_config[:dependencies]).uniq,
40
+ :repositories => create_repositories(repositories),
41
+ :dependencies => dependencies,
40
42
  :install_pattern => File.expand_path("#{destination}/[artifact]-[revision]-[type].[ext]")
41
43
  }
42
44
  end
@@ -52,7 +54,7 @@ module PomPomPom
52
54
  coordinate
53
55
  when Array
54
56
  MavenCoordinate.new(*coordinate)
55
- when /^[^:]+:[^:]+:[^:]+$/ # TODO: also /^[^#]+#[^;];.+$/
57
+ when /^[^:]+:[^:]+:[^:]+(:[^:]+)*$/ # TODO: also /^[^#]+#[^;];.+$/
56
58
  MavenCoordinate.parse(coordinate)
57
59
  else
58
60
  raise ArgumentError, %("#{coordinate}" could not be converted to a Maven coordinate)
metadata CHANGED
@@ -2,14 +2,14 @@
2
2
  name: pompompom
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease: 6
5
- version: 2.0.0.b1
5
+ version: 2.0.0.b2
6
6
  platform: java
7
7
  authors:
8
8
  - Theo Hultberg
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-06-13 00:00:00.000000000Z
12
+ date: 2012-06-20 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: ivy-jars