Module: Rake

Defined in:
lib/rake/helpers/rake.rb,
lib/rake/delphi/rc.rb,
lib/rake/common/git.rb,
lib/rake/delphi/tool.rb,
lib/rake/delphi/dcc32.rb,
lib/rake/common/logger.rb,
lib/rake/common/classes.rb,
lib/rake/common/initask.rb,
lib/rake/common/ziptask.rb,
lib/rake/delphi/liblist.rb,
lib/rake/delphi/project.rb,
lib/rake/delphi/version.rb,
lib/rake/common/echotask.rb,
lib/rake/common/exectask.rb,
lib/rake/common/hashtask.rb,
lib/rake/common/libstask.rb,
lib/rake/delphi/paclient.rb,
lib/rake/common/chdirtask.rb,
lib/rake/delphi/dcc32tool.rb,
lib/rake/delphi/resources.rb,
lib/rake/helpers/filelist.rb,
lib/rake/helpers/raketask.rb,
lib/rake/delphi/dccaarmtool.rb,
lib/rake/delphi/projectinfo.rb,
lib/rake/common/sendmailtask.rb,
lib/rake/delphi/envvariables.rb,
lib/rake/delphi/paclienttool.rb,
lib/rake/delphi/androidmanifest.rb

Overview

extend Rake task with a logger

Defined Under Namespace

Modules: Delphi Classes: FileList, Task

Class Method Summary collapse

Class Method Details

.cygwin?Boolean

Returns:

  • (Boolean)


52
53
54
# File 'lib/rake/helpers/rake.rb', line 52

def self.cygwin?
    RUBY_PLATFORM.downcase.include?('cygwin')
end

.quotepath(switch, path) ⇒ Object



40
41
42
# File 'lib/rake/helpers/rake.rb', line 40

def self.quotepath(switch, path)
    return ! path.to_s.empty? ? "#{switch}\"#{path.to_s}\"" : ''
end

.ruby18?Boolean

Returns:

  • (Boolean)


48
49
50
# File 'lib/rake/helpers/rake.rb', line 48

def self.ruby18?
    /^1\.8/.match(RUBY_VERSION)
end

.set_env_to_vars(vars_list, vars, envVarsEncoding, localEncoding) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/rake/helpers/rake.rb', line 19

def self.set_env_to_vars(vars_list, vars, envVarsEncoding, localEncoding)
    vars_list.flatten.each do |v|
        value = ENV[v]
        if value
            value = value.dup
            # Env vars are in system encoding

            # On Windows/Cygwin only

            if value.respond_to?(:force_encoding)
                if Rake.application.windows? || Rake.cygwin?
                    value.force_encoding(envVarsEncoding)
                    value.encode!(localEncoding, envVarsEncoding)
                end
            elsif Rake.application.windows?
                require 'iconv'
                value = Iconv.iconv(localEncoding, envVarsEncoding, value)[0]
            end
        end
        vars[v.to_sym] = value
    end
end

.set_non_standard_varsObject



6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/rake/helpers/rake.rb', line 6

def self.set_non_standard_vars
    # convert tasks to vars

    # and remove them from the list of tasks

    Rake.application.top_level_tasks.delete_if do |task|
        # if task name is like <var.with.dot>=<value>

        if /^[^.=][^=]+=.*/.match(task)
            name, value = task.split('=', 2)
            ENV[name] = value
            true
        end
    end
end

.unquotepath(path) ⇒ Object



44
45
46
# File 'lib/rake/helpers/rake.rb', line 44

def self.unquotepath(path)
    return path.to_s.gsub(/^"|"$/, '')
end