buildr 1.3.4-java → 1.3.5-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.
Files changed (106) hide show
  1. data/CHANGELOG +35 -0
  2. data/README.rdoc +1 -1
  3. data/Rakefile +3 -3
  4. data/buildr.buildfile +6 -1
  5. data/buildr.gemspec +10 -9
  6. data/doc/_config.yml +1 -0
  7. data/doc/_layouts/default.html +25 -19
  8. data/doc/artifacts.textile +0 -36
  9. data/doc/building.textile +0 -38
  10. data/doc/contributing.textile +51 -15
  11. data/doc/css/default.css +11 -4
  12. data/doc/css/print.css +32 -24
  13. data/doc/download.textile +33 -22
  14. data/doc/extending.textile +10 -20
  15. data/doc/images/1442160941-frontcover.jpg +0 -0
  16. data/doc/images/asf-logo.png +0 -0
  17. data/doc/images/note.png +0 -0
  18. data/doc/images/project-structure.png +0 -0
  19. data/doc/images/tip.png +0 -0
  20. data/doc/images/zbuildr.png +0 -0
  21. data/doc/index.textile +39 -17
  22. data/doc/{getting_started.textile → installing.textile} +3 -80
  23. data/doc/languages.textile +50 -52
  24. data/doc/more_stuff.textile +154 -62
  25. data/doc/packaging.textile +0 -82
  26. data/doc/preface.textile +41 -15
  27. data/doc/projects.textile +0 -18
  28. data/doc/quick_start.textile +210 -0
  29. data/doc/scripts/install-linux.sh +10 -2
  30. data/doc/settings_profiles.textile +1 -33
  31. data/doc/testing.textile +6 -32
  32. data/lib/buildr.rb +2 -1
  33. data/lib/buildr/core.rb +6 -0
  34. data/lib/buildr/core/application.rb +2 -5
  35. data/lib/buildr/core/build.rb +29 -19
  36. data/lib/buildr/core/compile.rb +22 -4
  37. data/lib/buildr/core/filter.rb +2 -4
  38. data/lib/buildr/core/project.rb +5 -4
  39. data/lib/buildr/core/shell.rb +198 -0
  40. data/lib/buildr/core/test.rb +2 -0
  41. data/lib/buildr/core/transports.rb +18 -19
  42. data/lib/buildr/core/util.rb +178 -9
  43. data/lib/buildr/groovy.rb +1 -0
  44. data/lib/buildr/groovy/bdd.rb +5 -5
  45. data/lib/buildr/groovy/shell.rb +48 -0
  46. data/lib/buildr/ide/eclipse.rb +148 -36
  47. data/lib/buildr/ide/eclipse/java.rb +53 -0
  48. data/lib/buildr/ide/eclipse/plugin.rb +68 -0
  49. data/lib/buildr/ide/eclipse/scala.rb +66 -0
  50. data/lib/buildr/java/bdd.rb +16 -8
  51. data/lib/buildr/java/cobertura.rb +44 -13
  52. data/lib/buildr/java/commands.rb +5 -3
  53. data/lib/buildr/java/org/apache/buildr/JavaTestFilter.class +0 -0
  54. data/lib/buildr/java/org/apache/buildr/JavaTestFilter.java +18 -0
  55. data/lib/buildr/java/packaging.rb +2 -2
  56. data/lib/buildr/java/rjb.rb +1 -1
  57. data/lib/buildr/java/test_result.rb +48 -1
  58. data/lib/buildr/java/tests.rb +8 -5
  59. data/lib/buildr/packaging/artifact_namespace.rb +1 -1
  60. data/lib/buildr/packaging/package.rb +6 -2
  61. data/lib/buildr/packaging/zip.rb +10 -1
  62. data/lib/buildr/packaging/ziptask.rb +5 -2
  63. data/lib/buildr/scala.rb +1 -0
  64. data/lib/buildr/scala/bdd.rb +17 -8
  65. data/lib/buildr/scala/compiler.rb +66 -21
  66. data/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner$.class +0 -0
  67. data/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner.class +0 -0
  68. data/lib/buildr/scala/org/apache/buildr/SpecsSingletonRunner.scala +35 -0
  69. data/lib/buildr/scala/shell.rb +55 -0
  70. data/lib/buildr/scala/tests.rb +6 -5
  71. data/lib/buildr/shell.rb +180 -0
  72. data/rakelib/doc.rake +2 -3
  73. data/rakelib/jekylltask.rb +42 -32
  74. data/rakelib/package.rake +4 -2
  75. data/rakelib/release.rake +8 -8
  76. data/rakelib/rspec.rake +3 -3
  77. data/rakelib/setup.rake +7 -1
  78. data/rakelib/stage.rake +9 -2
  79. data/rakelib/stage.rake~ +213 -0
  80. data/spec/core/application_spec.rb +84 -1
  81. data/spec/core/build_spec.rb +54 -2
  82. data/spec/core/common_spec.rb +1 -1
  83. data/spec/core/compile_spec.rb +2 -1
  84. data/spec/core/extension_spec.rb +93 -0
  85. data/spec/core/test_spec.rb +2 -2
  86. data/spec/core/transport_spec.rb +1 -1
  87. data/spec/groovy/bdd_spec.rb +6 -6
  88. data/spec/groovy/compiler_spec.rb +1 -0
  89. data/spec/ide/eclipse_spec.rb +262 -72
  90. data/spec/java/{ant.rb → ant_spec.rb} +0 -0
  91. data/spec/java/bdd_spec.rb +15 -0
  92. data/spec/java/cobertura_spec.rb +9 -1
  93. data/spec/java/emma_spec.rb +1 -1
  94. data/spec/java/java_spec.rb +26 -0
  95. data/spec/java/packaging_spec.rb +9 -7
  96. data/spec/java/{test_coverage_spec.rb → test_coverage_helper.rb} +6 -4
  97. data/spec/java/tests_spec.rb +22 -0
  98. data/spec/packaging/archive_spec.rb +14 -0
  99. data/spec/packaging/artifact_spec.rb +2 -2
  100. data/spec/packaging/packaging_spec.rb +97 -2
  101. data/spec/sandbox.rb +3 -1
  102. data/spec/scala/bdd_spec.rb +17 -48
  103. data/spec/scala/compiler_spec.rb +31 -2
  104. data/spec/scala/tests_spec.rb +1 -0
  105. data/spec/spec_helpers.rb +12 -0
  106. metadata +145 -148
@@ -31,7 +31,7 @@ module Buildr::Scala
31
31
  end
32
32
 
33
33
  def dependencies
34
- ["org.scalacheck:scalacheck:jar:#{version}"]
34
+ ["org.scala-tools.testing:scalacheck:jar:#{version}"]
35
35
  end
36
36
 
37
37
  private
@@ -109,8 +109,9 @@ module Buildr::Scala
109
109
  ant.suite :classname=>suite
110
110
  ant.reporter :type=>'stdout', :config=>reporter_options
111
111
  ant.reporter :type=>'file', :filename=> reportFile, :config=>reporter_options
112
- ant.includes group_includes.join(" ") if group_includes
113
- ant.excludes group_excludes.join(" ") if group_excludes
112
+ # TODO: This should be name=>value pairs!
113
+ #ant.includes group_includes.join(" ") if group_includes
114
+ #ant.excludes group_excludes.join(" ") if group_excludes
114
115
  (options[:properties] || []).each { |name, value| ant.property :name=>name, :value=>value }
115
116
  end
116
117
  end
@@ -125,9 +126,9 @@ module Buildr::Scala
125
126
  while (!completed) do
126
127
  File.open(reportFile, "r") do |input|
127
128
  while (line = input.gets) do
128
- failed = (line =~ /(TEST FAILED -)|(RUN STOPPED)|(RUN ABORTED)/) unless failed
129
+ failed = (line =~ /(TESTS? FAILED -)|(RUN STOPPED)|(RUN ABORTED)/) unless failed
129
130
  completed |= (line =~ /Run completed\./)
130
- break if (failed || completed)
131
+ break if (failed)
131
132
  end
132
133
  end
133
134
  wait += 1
@@ -0,0 +1,180 @@
1
+ # Licensed to the Apache Software Foundation (ASF) under one or more
2
+ # contributor license agreements. See the NOTICE file distributed with this
3
+ # work for additional information regarding copyright ownership. The ASF
4
+ # licenses this file to you under the Apache License, Version 2.0 (the
5
+ # "License"); you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12
+ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13
+ # License for the specific language governing permissions and limitations under
14
+ # the License.
15
+
16
+
17
+ module Buildr
18
+ module ShellProviders
19
+ class << self
20
+ def add(p)
21
+ @providers ||= {}
22
+
23
+ if p.lang == :none
24
+ @providers[:none] ||= []
25
+ @providers[:none] << p
26
+ else
27
+ @providers[p.lang] = p
28
+ end
29
+ end
30
+ alias :<< :add
31
+
32
+ def providers
33
+ @providers ||= {}
34
+ end
35
+
36
+ def each
37
+ providers.each do |lang, p|
38
+ if lang == :none
39
+ p.each do |x|
40
+ yield x
41
+ end
42
+ else
43
+ yield p
44
+ end
45
+ end
46
+ end
47
+ end
48
+ end
49
+
50
+ module Shell
51
+ class Base
52
+ attr_reader :project
53
+
54
+ class << self
55
+ def lang
56
+ :none
57
+ end
58
+
59
+ def to_sym
60
+ @symbol ||= name.split('::').last.downcase.to_sym
61
+ end
62
+ end
63
+
64
+ def initialize(project)
65
+ @project = project
66
+ end
67
+
68
+ def build?
69
+ true
70
+ end
71
+
72
+ def launch
73
+ fail 'Not implemented'
74
+ end
75
+ end
76
+
77
+ module JavaRebel
78
+ def rebel_home
79
+ unless @rebel_home
80
+ @rebel_home = ENV['REBEL_HOME'] or ENV['JAVA_REBEL'] or ENV['JAVAREBEL'] or ENV['JAVAREBEL_HOME']
81
+
82
+ if @rebel_home and File.directory? @rebel_home
83
+ @rebel_home += File::SEPARATOR + 'javarebel.jar'
84
+ end
85
+ end
86
+
87
+ if @rebel_home and File.exists? @rebel_home
88
+ @rebel_home
89
+ else
90
+ nil
91
+ end
92
+ end
93
+
94
+ def rebel_args
95
+ if rebel_home
96
+ [
97
+ '-noverify',
98
+ "-javaagent:#{rebel_home}"
99
+ ]
100
+ else
101
+ []
102
+ end
103
+ end
104
+
105
+ def rebel_props(project)
106
+ {}
107
+ end
108
+ end
109
+ end
110
+
111
+ module ShellExtension
112
+ include Extension
113
+
114
+ first_time do
115
+ Project.local_task 'shell'
116
+
117
+ ShellProviders.each { |p| Project.local_task "shell:#{p.to_sym}" } # TODO not working
118
+ end
119
+
120
+ before_define do |project|
121
+ ShellProviders.each do |p|
122
+ name = p.to_sym
123
+
124
+ trace "Defining task #{project.name}:shell:#{name}"
125
+
126
+ p_inst = p.new project
127
+ deps = if p_inst.build? then [:compile] else [] end
128
+
129
+ project.task "shell:#{name}" => deps do
130
+ trace "Launching #{name} shell"
131
+ p_inst.launch
132
+ end
133
+ end
134
+ end
135
+
136
+ after_define do |project|
137
+ default_shell = project.shell.using
138
+
139
+ if default_shell
140
+ dep = "shell:#{default_shell.to_sym}"
141
+
142
+ trace "Defining task shell based on #{dep}"
143
+ project.task :shell => dep
144
+ else
145
+ project.task :shell do
146
+ fail "No shell provider defined for language '#{project.compile.language}'"
147
+ end
148
+ end
149
+ end
150
+
151
+ class ShellConfig
152
+ def initialize(project)
153
+ @project = project
154
+ end
155
+
156
+ def using(*args)
157
+ if args.size > 0
158
+ @using ||= args.first
159
+ else
160
+ @using ||= find_shell_task
161
+ end
162
+ end
163
+
164
+ private
165
+ def find_shell_task
166
+ lang = @project.compile.language
167
+ ShellProviders.providers[lang]
168
+ end
169
+ end
170
+
171
+ # TODO temporary hack
172
+ def shell
173
+ @shell ||= ShellConfig.new self
174
+ end
175
+ end
176
+
177
+ class Project
178
+ include ShellExtension
179
+ end
180
+ end
@@ -42,13 +42,12 @@ begin
42
42
  JekyllTask.new :jekyll do |task|
43
43
  task.source = 'doc'
44
44
  task.target = '_site'
45
- task.pygments = true
46
45
  end
47
46
 
48
47
  rescue LoadError
49
48
  puts "Buildr uses the mojombo-jekyll to generate the Web site. You can install it by running rake doc:setup"
50
49
  task 'doc:setup' do
51
- install_gem 'mojombo-jekyll', :source=>'http://gems.github.com', :version=>'0.4.1'
50
+ install_gem 'mojombo-jekyll', :source=>'http://gems.github.com', :version=>'0.5.4'
52
51
  if `pygmentize -V`.empty?
53
52
  args = %w{easy_install Pygments}
54
53
  args.unshift 'sudo' unless Config::CONFIG['host_os'] =~ /windows/
@@ -60,7 +59,7 @@ end
60
59
 
61
60
  desc "Generate Buildr documentation as buildr.pdf"
62
61
  file 'buildr.pdf'=>'_site' do |task|
63
- pages = File.read('doc/preface.textile').scan(/^#.*":(\S*)$/).flatten.map { |f| "_site/#{f}" }
62
+ pages = File.read('_site/preface.html').scan(/<li><a href=['"]([^'"]+)/).flatten.map { |f| "_site/#{f}" }
64
63
  sh 'prince', '--input=html', '--no-network', '--log=prince_errors.log', "--output=#{task.name}", '_site/preface.html', *pages
65
64
  end
66
65
 
@@ -14,6 +14,7 @@
14
14
  # the License.
15
15
 
16
16
 
17
+ gem 'mojombo-jekyll', '~> 0.5.2' # skip past some buggy versions
17
18
  require 'rake/tasklib'
18
19
  require 'jekyll'
19
20
 
@@ -39,14 +40,11 @@ class JekyllTask < Rake::TaskLib
39
40
 
40
41
  attr_accessor :source
41
42
  attr_accessor :target
42
- attr_accessor :pygments
43
43
 
44
44
  def generate(auto = false)
45
- process = lambda do
46
- Jekyll.pygments = @pygments
47
- Jekyll.process source, target
48
- touch target
49
- end
45
+ options = { 'source'=>source, 'destination'=>target }
46
+ options = Jekyll.configuration(options)
47
+ site = Jekyll::Site.new(options)
50
48
 
51
49
  if auto
52
50
  require 'directory_watcher'
@@ -63,44 +61,22 @@ class JekyllTask < Rake::TaskLib
63
61
  dw.add_observer do |*args|
64
62
  t = Time.now.strftime("%Y-%m-%d %H:%M:%S")
65
63
  puts "[#{t}] regeneration: #{args.size} files changed"
66
- process.call
64
+ site.process
67
65
  puts "Done"
68
66
  end
69
67
  loop { sleep 1 }
70
68
  else
71
69
  puts "Generating documentation in #{target}"
72
- process.call
73
- end
74
- end
75
- end
76
-
77
-
78
- # TODO: Worked around bug in Jekyll 0.4.1. Removed when 0.4.2 is out.
79
- # http://github.com/mojombo/jekyll/commit/c180bc47bf2f63db1bff9f6600cccbe5ad69077e#diff-0
80
- class Albino
81
- def execute(command)
82
- output = ''
83
- Open4.popen4(command) do |pid, stdin, stdout, stderr|
84
- stdin.puts @target
85
- stdin.close
86
- output = stdout.read.strip
87
- [stdout, stderr].each { |io| io.close }
70
+ site.process
71
+ touch target
88
72
  end
89
- output
90
73
  end
91
74
  end
92
75
 
93
- class Jekyll::Page
94
- def render(layouts, site_payload)
95
- puts "... #{@name}"
96
- payload = {"page" => self.data}.deep_merge(site_payload)
97
- do_layout(payload, layouts)
98
- end
99
- end
100
76
 
101
77
  module TocFilter
102
78
  def toc(input)
103
- input.scan(/<(h2)(?:>|\s+(.*?)>)(.*?)<\/\1\s*>/mi).inject(%{<ol class="toc">}) { |toc, entry|
79
+ input.scan(/<(h2)(?:>|\s+(.*?)>)([^<]*)<\/\1\s*>/mi).inject(%{<ol class="toc">}) { |toc, entry|
104
80
  id = entry[1][/^id=(['"])(.*)\1$/, 2]
105
81
  title = entry[2].gsub(/<(\w*).*?>(.*?)<\/\1\s*>/m, '\2').strip
106
82
  toc << %{<li><a href="##{id}">#{title}</a></li>}
@@ -108,3 +84,37 @@ module TocFilter
108
84
  end
109
85
  end
110
86
  Liquid::Template.register_filter(TocFilter)
87
+
88
+
89
+
90
+ # Under Ruby 1.9 [a,b,c].to_s doesn't join the array first. (Jekyll 0.5.2 requires this)
91
+ module Jekyll
92
+ class HighlightBlock < Liquid::Block
93
+ def render(context)
94
+ if context.registers[:site].pygments
95
+ render_pygments(context, super.join)
96
+ else
97
+ render_codehighlighter(context, super.join)
98
+ end
99
+ end
100
+ end
101
+ end
102
+
103
+ # Ruby 1.9 has sane closure scoping which manages to mess Liquid filters. (Liquid 2.0.0 requires this)
104
+ module Liquid
105
+ class Variable
106
+ def render(context)
107
+ return '' if @name.nil?
108
+ @filters.inject(context[@name]) do |output, filter|
109
+ filterargs = filter[1].to_a.collect do |a|
110
+ context[a]
111
+ end
112
+ begin
113
+ context.invoke(filter[0], output, *filterargs)
114
+ rescue FilterNotFound
115
+ raise FilterNotFound, "Error - filter '#{filter[0]}' in '#{@markup.strip}' could not be found."
116
+ end
117
+ end
118
+ end
119
+ end
120
+ end
@@ -51,9 +51,11 @@ end
51
51
  file Rake::GemPackageTask.new(spec).package_dir=>:compile
52
52
  file Rake::GemPackageTask.new(spec).package_dir_path=>:compile
53
53
 
54
- # We also need the other package (JRuby if building on Ruby, and vice versa)
54
+ # We also need the other packages (JRuby if building on Ruby, and vice versa)
55
55
  # Must call new with block, even if block does nothing, otherwise bad things happen.
56
- Rake::GemPackageTask.new(spec(RUBY_PLATFORM[/java/] ? 'ruby' : 'java')) { |task| }
56
+ @specs.values.each do |s|
57
+ Rake::GemPackageTask.new(s) { |task| }
58
+ end
57
59
 
58
60
 
59
61
  desc "Upload snapshot packages over to people.apache.org"
@@ -32,12 +32,12 @@ task :release do
32
32
  host, remote_dir = target.split(':')
33
33
  sh 'ssh', host, 'rm', '-rf', remote_dir rescue nil
34
34
  sh 'ssh', host, 'mkdir', remote_dir
35
- sh 'rsync', '--progress', '--recursive', '_release/dist/', target
35
+ sh 'rsync', '--progress', '--recursive', "_release/#{spec.version}/dist/", target
36
36
  puts "[X] Uploaded packages to www.apache.org/dist"
37
37
 
38
38
  target = "people.apache.org:/www/#{spec.name}.apache.org/"
39
39
  puts "Uploading new site to #{spec.name}.apache.org ..."
40
- sh 'rsync', '--progress', '--recursive', '--delete', '_release/site/', target
40
+ sh 'rsync', '--progress', '--recursive', '--delete', "_release/#{spec.version}/site/", target
41
41
  sh 'ssh', 'people.apache.org', 'chmod', '-R', 'g+w', "/www/#{spec.name}.apache.org/*"
42
42
  puts "[X] Uploaded new site to #{spec.name}.apache.org"
43
43
  end.call
@@ -45,16 +45,16 @@ task :release do
45
45
 
46
46
  # Upload binary and source packages to RubyForge.
47
47
  lambda do
48
- files = FileList['_release/dist/*.{gem,tgz,zip}']
48
+ files = FileList["_release/#{spec.version}/dist/*.{gem,tgz,zip}"]
49
49
  puts "Uploading #{spec.version} to RubyForge ... "
50
50
  rubyforge = RubyForge.new.configure
51
- rubyforge.login
52
- rubyforge.userconfig.merge!('release_changes'=>'_release/CHANGES', 'preformatted' => true)
51
+ rubyforge.login
52
+ rubyforge.userconfig.merge!('release_changes'=>"_release/#{spec.version}/CHANGES", 'preformatted' => true)
53
53
  rubyforge.add_release spec.rubyforge_project.downcase, spec.name.downcase, spec.version.to_s, *files
54
54
 
55
55
  puts "Posting news to RubyForge ... "
56
- changes = File.read('_release/CHANGES')[/.*?\n(.*)/m, 1]
57
- rubyforge.post_news spec.rubyforge_project.downcase, "Buildr #{spec.versions} released",
56
+ changes = File.read("_release/#{spec.version}/CHANGES")[/.*?\n(.*)/m, 1]
57
+ rubyforge.post_news spec.rubyforge_project.downcase, "Buildr #{spec.version} released",
58
58
  "#{spec.description}\n\nNew in Buildr #{spec.version}:\n#{changes.gsub(/^/, ' ')}\n"
59
59
  puts "[X] Uploaded gems and source files to #{spec.name}.rubyforge.org"
60
60
  end.call
@@ -118,7 +118,7 @@ task :release do
118
118
 
119
119
  # Prepare release announcement email.
120
120
  lambda do
121
- changes = File.read('_release/CHANGES')[/.*?\n(.*)/m, 1]
121
+ changes = File.read("_release/#{spec.version}/CHANGES")[/.*?\n(.*)/m, 1]
122
122
  email = <<-EMAIL
123
123
  To: users@buildr.apache.org, announce@apache.org
124
124
  Subject: [ANNOUNCE] Apache Buildr #{spec.version} released
@@ -19,10 +19,10 @@ begin
19
19
  directory '_reports'
20
20
 
21
21
  desc "Run all specs"
22
- Spec::Rake::SpecTask.new :spec=>'_reports' do |task|
22
+ Spec::Rake::SpecTask.new :spec=>['_reports', :compile] do |task|
23
23
  task.spec_files = FileList['spec/**/*_spec.rb']
24
24
  task.spec_files.exclude('spec/groovy/*') if RUBY_PLATFORM[/java/]
25
- task.spec_opts = %w{--format specdoc --format failing_examples:failed --format html:_reports/specs.html --loadby mtime --backtrace}
25
+ task.spec_opts = %w{--format specdoc --format failing_examples:failed --format html:_reports/specs.html --backtrace}
26
26
  task.spec_opts << '--colour' if $stdout.isatty
27
27
  end
28
28
  file('_reports/specs.html') { task(:spec).invoke }
@@ -35,7 +35,7 @@ begin
35
35
  end
36
36
 
37
37
  desc 'Run RSpec and generate Spec and coverage reports (slow)'
38
- Spec::Rake::SpecTask.new :coverage=>'_reports' do |task|
38
+ Spec::Rake::SpecTask.new :coverage=>['_reports', :compile] do |task|
39
39
  task.spec_files = FileList['spec/**/*_spec.rb']
40
40
  task.spec_opts = %W{--format progress --format failing_examples:failed --format html:_reports/specs.html --backtrace}
41
41
  task.spec_opts << '--colour' if $stdout.isatty
@@ -17,6 +17,12 @@
17
17
  require 'jruby' if RUBY_PLATFORM[/java/]
18
18
  require 'rubygems/source_info_cache'
19
19
 
20
+ RAKE_SUDO = case (ENV['RAKE_SUDO'] or 'yes').strip.downcase
21
+ when 'yes', 'true'
22
+ true
23
+ else
24
+ false
25
+ end
20
26
 
21
27
  # Install the specified gem. Options include:
22
28
  # - :version -- Version requirement, e.g. '1.2' or '~> 1.2'
@@ -27,7 +33,7 @@ def install_gem(name, options = {})
27
33
  puts "Installing #{name} ..."
28
34
  rb_bin = File.join(Config::CONFIG['bindir'], Config::CONFIG['ruby_install_name'])
29
35
  args = []
30
- args << 'sudo' << 'env' << "JAVA_HOME=#{ENV['JAVA_HOME']}" if sudo_needed?
36
+ args << 'sudo' << 'env' << "JAVA_HOME=#{ENV['JAVA_HOME']}" if sudo_needed? and RAKE_SUDO
31
37
  args << rb_bin << '-S' << 'gem' << 'install' << name
32
38
  args << '--version' << dep.version_requirements.to_s
33
39
  args << '--source' << options[:source] if options[:source]