ruby-maven 3.0.4.1.3 → 3.0.4.1.4

Sign up to get free protection for your applications and to get access to all the features.
data/bin/rmvn CHANGED
@@ -1,9 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
  require 'maven/ruby/cli'
3
- require 'maven/ruby/pom_magic'
4
3
 
5
4
  mvn = Maven::Ruby::Cli.new
6
- magic = Maven::Ruby::PomMagic.new
7
5
 
8
6
  args = ARGV.dup
9
7
  ARGV.clear # clean up in case another script gets executed it gets clear ARGV
@@ -1,5 +1,5 @@
1
1
  #
2
- # Copyright (C) 2013 mkristian
2
+ # Copyright (C) 2013 Christian Meier
3
3
  #
4
4
  # Permission is hereby granted, free of charge, to any person obtaining a copy of
5
5
  # this software and associated documentation files (the "Software"), to deal in
@@ -0,0 +1,7 @@
1
+ #-*- mode: ruby -*-
2
+
3
+ # lock down versions
4
+ properties['jruby.version'] = '1.7.3'
5
+ properties['jruby.plugins.version'] = '0.29.4'
6
+
7
+ # vim: syntax=Ruby
@@ -0,0 +1,7 @@
1
+ #-*- mode: ruby -*-
2
+
3
+ # lock down versions
4
+ properties['jruby.version'] = '1.7.2'
5
+ properties['jruby.plugins.version'] = '0.29.3'
6
+
7
+ # vim: syntax=Ruby
@@ -1,5 +1,5 @@
1
1
  #
2
- # Copyright (C) 2013 mkristian
2
+ # Copyright (C) 2013 Christian Meier
3
3
  #
4
4
  # Permission is hereby granted, free of charge, to any person obtaining a copy of
5
5
  # this software and associated documentation files (the "Software"), to deal in
@@ -129,7 +129,7 @@ module Maven
129
129
  def setup(dir = '.', *args)
130
130
  log(args)
131
131
  args = command_line(args.dup.flatten)
132
- args = magic_pom(dir, *args) unless options.delete('--no-pom')
132
+ args = magic_pom(dir, *args)
133
133
  args
134
134
  end
135
135
 
@@ -140,9 +140,7 @@ module Maven
140
140
  protected
141
141
 
142
142
  def magic_pom(dir = '.', *args)
143
- file = PomMagic.new.generate_pom(File.expand_path(dir), *args)
144
- args += ['-f', file] if file && !(args.member?("-f") || args.member?("--file"))
145
- args.flatten
143
+ PomMagic.new.generate_pom(File.expand_path(dir), *args)
146
144
  end
147
145
 
148
146
  public
@@ -160,4 +158,4 @@ module Maven
160
158
  end
161
159
  end
162
160
  end
163
- end
161
+ end
@@ -1,5 +1,5 @@
1
1
  #
2
- # Copyright (C) 2013 mkristian
2
+ # Copyright (C) 2013 Christian Meier
3
3
  #
4
4
  # Permission is hereby granted, free of charge, to any person obtaining a copy of
5
5
  # this software and associated documentation files (the "Software"), to deal in
@@ -27,6 +27,7 @@ module Maven
27
27
 
28
28
  def self.new(*args)
29
29
  warn "deprecated: use Maven::Ruby::Cli or Maven::Ruby::Maven instead"
30
+ require 'maven/ruby/cli'
30
31
  ::Maven::Ruby::Cli.new(*args)
31
32
  end
32
33
  end
@@ -141,4 +142,4 @@ module Maven
141
142
  end
142
143
  end
143
144
 
144
- end
145
+ end
@@ -1,5 +1,5 @@
1
1
  #
2
- # Copyright (C) 2013 mkristian
2
+ # Copyright (C) 2013 Christian Meier
3
3
  #
4
4
  # Permission is hereby granted, free of charge, to any person obtaining a copy of
5
5
  # this software and associated documentation files (the "Software"), to deal in
@@ -25,72 +25,108 @@ require 'maven/ruby/version'
25
25
  module Maven
26
26
  module Ruby
27
27
  class PomMagic
28
-
29
- def initialize(pom = '.pom.xml')
30
- @pom = pom
31
- end
32
-
33
- def new_rails_project
34
- ::Maven::Tools::RailsProject.new
28
+
29
+ def initialize( default_pom = '.pom.xml' )
30
+ @default_pom = default_pom
35
31
  end
36
32
 
37
- def pom_xml(dir = '.')
38
- File.join(dir, @pom)
33
+ def dump_pom( dir = '.', force = false, file = 'pom.xml' )
34
+ if force || !File.exists?( file )
35
+ generate_pom( dir, '--pom', file )
36
+ end
39
37
  end
40
38
 
41
- def generate_pom(dir = '.', *args)
42
- pom = nil
39
+ def generate_pom( dir = '.', *args )
43
40
  dir = File.expand_path( dir )
44
41
  Dir.chdir(dir) do
42
+ skip_some_files = false
45
43
  if index = (args.index("-f") || args.index("--file"))
46
44
  filename = args[index + 1]
47
45
  if filename =~ /.gemspec$/
46
+ skip_some_files = true
48
47
  proj = ::Maven::Tools::GemProject.new
49
48
  proj.load_gemspec(filename)
50
49
  elsif filename =~ /Gemfile/
50
+ skip_some_files = true
51
51
  proj = ::Maven::Tools::GemProject.new
52
52
  proj.load_gemfile(filename)
53
53
  end
54
54
  else
55
- gemfiles = Dir[File.join('.', "*Gemfile")]
56
- gemfiles.delete_if {|g| g =~ /.pom/}
57
- if gemfiles.size > 0
58
- proj =
59
- if File.exists? File.join( 'config', 'application.rb' )
60
- new_rails_project
61
- else
62
- ::Maven::Tools::GemProject.new
63
- end
64
- filename = gemfiles[0]
65
- proj.load_gemfile(filename)
66
- else
67
- gemspecs = Dir[File.join('.', "*.gemspec")]
68
- gemspecs.delete_if {|g| g =~ /.pom/}
69
- if gemspecs.size > 0
70
- proj = ::Maven::Tools::GemProject.new
71
- filename = File.basename(gemspecs[0])
72
- proj.load_gemspec(filename)
55
+ proj =
56
+ if File.exists? File.join( 'config', 'application.rb' )
57
+ ::Maven::Tools::RailsProject.new
58
+ else
59
+ ::Maven::Tools::GemProject.new
73
60
  end
74
- end
75
61
  end
76
62
  if proj
77
- proj.load_jarfile(File.join(File.dirname(filename), 'Jarfile'))
78
- proj.load_gemfile(File.join(File.dirname(filename), 'Mavenfile'))
79
- proj.add_defaults( :jruby_plugins => JRUBY_MAVEN_PLUGINS_VERSION )
80
- pom = pom_xml(dir)
81
- File.open(pom, 'w') do |f|
82
- f.puts proj.to_xml
63
+
64
+ ensure_mavenfile( dir )
65
+
66
+ load_standard_files( dir, proj, skip_some_files )
67
+
68
+ pom_xml( dir, proj, args )
69
+
70
+ end
71
+ end
72
+ end
73
+
74
+ protected
75
+
76
+ def load_standard_files( dir, proj, skip_some_files = false )
77
+ gemspec = first_gemspec( dir ) unless skip_some_files
78
+ proj.load_gemspec( gemspec ) if gemspec
79
+ proj.load_gemfile( file( 'Gemfile', dir ) ) unless skip_some_files
80
+ proj.load_jarfile( file( 'Jarfile', dir ) )
81
+ proj.load_mavenfile( file( 'Mavenfile', dir ) )
82
+ proj.add_defaults
83
+ end
84
+
85
+ def ensure_mavenfile( dir, source = File.dirname( __FILE__ ), filter_map = {} )
86
+ mavenfile = File.join( dir, 'Mavenfile' )
87
+ unless File.exists?( mavenfile )
88
+ content = File.read( File.join( source, 'Mavenfile' ) )
89
+ File.open( mavenfile, 'w' ) do |f|
90
+ filter_map.each do |k,v|
91
+ content.gsub!( /#{k}/, v )
83
92
  end
93
+ f.puts content
84
94
  end
95
+ warn "created Mavenfile with some locked down versions."
96
+ end
97
+ end
98
+
99
+ def file( name, dir = '.' )
100
+ File.expand_path( File.join( dir, name ) )
101
+ end
102
+
103
+ def pom_xml( dir, proj, args )
104
+ dir ||= '.'
105
+ #index = args.index( '-f' ) || args.index( '--file' )
106
+ index = args.index( '--pom' )
107
+ name = args[ index + 1 ] if index
108
+ pom = File.join( dir, name || @default_pom )
109
+ File.open(pom, 'w') do |f|
110
+ f.puts proj.to_xml
111
+ end
112
+ f_index = args.index( '-f' ) || args.index( '--file' )
113
+ if f_index
114
+ args[ f_index + 1 ] = pom
115
+ elsif index
116
+ args[ index ] = '-f'
117
+ else
118
+ args += ['-f', pom]
85
119
  end
86
- pom
120
+ args
87
121
  end
88
122
 
89
- def dump_pom(dir = '.', force = false, file = 'pom.xml')
90
- if force || !File.exists?(file)
91
- FileUtils.cp(generate_pom(dir), file)
123
+ def first_gemspec( dir = '.' )
124
+ gemspecs = Dir[ File.join( dir, "*.gemspec" ) ]
125
+ if gemspecs.size > 0
126
+ File.expand_path( gemspecs[ 0 ] )
92
127
  end
93
128
  end
129
+
94
130
  end
95
131
  end
96
- end
132
+ end
@@ -1,5 +1,5 @@
1
1
  #
2
- # Copyright (C) 2013 mkristian
2
+ # Copyright (C) 2013 Christian Meier
3
3
  #
4
4
  # Permission is hereby granted, free of charge, to any person obtaining a copy of
5
5
  # this software and associated documentation files (the "Software"), to deal in
@@ -20,10 +20,13 @@
20
20
  #
21
21
  module Maven
22
22
  module Ruby
23
- VERSION = '3.0.4.1.3'
23
+
24
+ VERSION = '3.0.4.1.4'
25
+
24
26
  # allow to overwrite the default from maven-tools
25
27
  # since jruby-maven-plugins depend on maven-tools and
26
28
  # default version in maven-tools is often behind
27
- JRUBY_MAVEN_PLUGINS_VERSION = '0.29.3'
29
+ JRUBY_MAVEN_PLUGINS_VERSION = '0.29.4'
30
+
28
31
  end
29
32
  end
@@ -1,5 +1,5 @@
1
1
  #
2
- # Copyright (C) 2013 mkristian
2
+ # Copyright (C) 2013 Christian Meier
3
3
  #
4
4
  # Permission is hereby granted, free of charge, to any person obtaining a copy of
5
5
  # this software and associated documentation files (the "Software"), to deal in
@@ -1,5 +1,5 @@
1
1
  #
2
- # Copyright (C) 2013 mkristian
2
+ # Copyright (C) 2013 Christian Meier
3
3
  #
4
4
  # Permission is hereby granted, free of charge, to any person obtaining a copy of
5
5
  # this software and associated documentation files (the "Software"), to deal in
metadata CHANGED
@@ -2,14 +2,14 @@
2
2
  name: ruby-maven
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 3.0.4.1.3
5
+ version: 3.0.4.1.4
6
6
  platform: ruby
7
7
  authors:
8
- - mkristian
8
+ - Christian Meier
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-01-27 00:00:00.000000000 Z
12
+ date: 2013-03-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: thor
@@ -41,13 +41,13 @@ dependencies:
41
41
  requirements:
42
42
  - - "~>"
43
43
  - !ruby/object:Gem::Version
44
- version: 0.32.1
44
+ version: 0.32.3
45
45
  none: false
46
46
  requirement: !ruby/object:Gem::Requirement
47
47
  requirements:
48
48
  - - "~>"
49
49
  - !ruby/object:Gem::Version
50
- version: 0.32.1
50
+ version: 0.32.3
51
51
  none: false
52
52
  prerelease: false
53
53
  type: :runtime
@@ -146,12 +146,14 @@ files:
146
146
  - lib/ruby/maven/ruby.rb
147
147
  - lib/ruby/maven/pom_magic.rb~
148
148
  - lib/ruby/maven/ruby/pom_magic.rb
149
+ - lib/ruby/maven/ruby/Mavenfile~
149
150
  - lib/ruby/maven/ruby/cli.rb~
150
151
  - lib/ruby/maven/ruby/version.rb
151
152
  - lib/ruby/maven/ruby/cli.rb
152
153
  - lib/ruby/maven/ruby/pom_magic.rb~
153
154
  - lib/ruby/maven/ruby/version.rb~
154
155
  - lib/ruby/maven/ruby/maven.rb
156
+ - lib/ruby/maven/ruby/Mavenfile
155
157
  - lib/ruby/maven/ruby/maven.rb~
156
158
  - MIT-LICENSE
157
159
  homepage: http://github.com/mkristian/ruby-maven