rake-delphi 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -229,11 +229,7 @@ module Rake
229
229
  @rc_template_task[:releaseCandidate] = properties[:releaseCandidate]
230
230
  @rc_task.input = src
231
231
  @rc_task.is_rc = properties[:releaseCandidate]
232
- mainicon_path = File.expand_path2(Rake.unquotepath(@mainicon))
233
- @rc_task.is_main_icon = File.exists?(mainicon_path)
234
- unless @rc_task.is_main_icon
235
- warn "WARNING! Icon file '#{mainicon_path}' does not exists. Application icon is disabled."
236
- end
232
+ @rc_task.mainicon_path = @mainicon
237
233
  return unless properties[:resources_additional]
238
234
  res_add = properties[:resources_additional]
239
235
  if res_add.kind_of?(String)
@@ -6,6 +6,7 @@ require 'rake/common/logger'
6
6
  require 'rake/delphi/rc'
7
7
  require 'rake/helpers/gemversion'
8
8
  require 'rake/helpers/rake'
9
+ require 'rake/helpers/file'
9
10
 
10
11
  module Rake
11
12
  module Delphi
@@ -94,13 +95,12 @@ module Rake
94
95
  end
95
96
 
96
97
  class RCTask < Rake::Task
97
- attr_accessor :output, :input
98
- attr_reader :is_main_icon
98
+ attr_accessor :output, :input, :mainicon_path
99
99
  def initialize(name, app)
100
100
  super
101
101
  @output = nil
102
102
  @is_rc = false
103
- @is_main_icon = false
103
+ @main_icon_path = nil
104
104
  end
105
105
 
106
106
  def input=(value)
@@ -112,15 +112,20 @@ module Rake
112
112
  @is_rc = ! value.to_s.empty?
113
113
  end
114
114
 
115
- def is_main_icon=(value)
116
- @is_main_icon = value
115
+ def is_main_icon
116
+ mainicon_path_unquoted = File.expand_path2(Rake.unquotepath(@mainicon_path), '-ml')
117
+ is_main_icon = File.exists?(mainicon_path_unquoted)
118
+ unless is_main_icon
119
+ warn "WARNING! Icon file '#{mainicon_path_unquoted}' does not exists. Application icon is disabled."
120
+ end
121
+ return is_main_icon
117
122
  end
118
123
 
119
124
  def execute(args=nil)
120
125
  v, path, tool = RCResourceCompiler.find(true)
121
126
  a = []
122
127
  a << '/dRC' if @is_rc
123
- a << '/dMAIN_ICON' if @is_main_icon
128
+ a << '/dMAIN_ICON' if is_main_icon
124
129
  a |= ['/fo', Rake.quotepath('', output), '/r', Rake.quotepath('', input) ]
125
130
  opts = { :args => a }
126
131
  opts.merge!(args)
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Rake
4
4
  module Delphi
5
- VERSION = '0.0.6'
5
+ VERSION = '0.0.7'
6
6
  end
7
7
  end
@@ -19,10 +19,10 @@ class File
19
19
  path = `cygpath #{flag} "#{path}"`.chomp
20
20
  end
21
21
 
22
- def self.expand_path2(path)
22
+ def self.expand_path2(path, flag = nil)
23
23
  path = expand_path(path)
24
24
  return path unless cygwin?
25
- return cygpath(path)
25
+ return cygpath(path, flag)
26
26
  end
27
27
 
28
28
  def self.dirname2(path, flag = nil)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rake-delphi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-06-11 00:00:00.000000000 Z
12
+ date: 2014-06-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler