Module: RakeJavaUtil

Includes:
Rake::DSL
Included in:
JarFiles, RakeJava::JarTask, RakeJava::JavacTask
Defined in:
lib/rakejava.rb

Instance Method Summary collapse

Instance Method Details

#path_esc(str) ⇒ Object



57
58
59
60
61
62
63
# File 'lib/rakejava.rb', line 57

def path_esc str
   if !winderz?
      str.gsub('$', '\$').gsub(' ', '\ ')
   else
      str
   end
end

#path_sep(str_ary) ⇒ Object



65
66
67
# File 'lib/rakejava.rb', line 65

def path_sep str_ary
   separate(str_ary, File::PATH_SEPARATOR)
end

#popdObject



34
35
36
# File 'lib/rakejava.rb', line 34

def popd
   cd pushd_stack.shift
end

#pushd(dir) ⇒ Object



29
30
31
32
# File 'lib/rakejava.rb', line 29

def pushd dir
   pushd_stack.unshift(Dir.pwd)
   cd dir
end

#pushd_stackObject



38
39
40
41
42
43
# File 'lib/rakejava.rb', line 38

def pushd_stack
   unless defined?(@pushd_stack)
      @pushd_stack = []
   end
   @pushd_stack
end

#separate(str_ary, sep) ⇒ Object



73
74
75
76
77
# File 'lib/rakejava.rb', line 73

def separate str_ary, sep
   result = ""
   str_ary.each { |str| result << "#{str}#{sep}" }
   result.chop!
end

#space_sep(str_ary) ⇒ Object



69
70
71
# File 'lib/rakejava.rb', line 69

def space_sep str_ary
   separate(str_ary, ' ')
end

#winderz?Boolean

Returns:

  • (Boolean)


45
46
47
48
49
50
51
52
53
54
55
# File 'lib/rakejava.rb', line 45

def winderz?
  if @winderz == nil
    win_regex = /(win|w)32/
    if RUBY_PLATFORM =~ /java/
      @winderz = Config::CONFIG['host_os'] =~ win_regex ? true : false
    else
      @winderz = RUBY_PLATFORM =~ win_regex ? true : false
    end
  end
  @winderz
end