Sha256: b8c83dd34764c1b8c09ffc07a2cb44d7894e0bb1ca01ac69e9a456e29ea581b1

Contents?: true

Size: 1.58 KB

Versions: 11

Compression:

Stored size: 1.58 KB

Contents

# vim: set shiftwidth=2 tabstop=2 expandtab:
# encoding: utf-8

require 'erb'
require 'rake/helpers/raketask'
require 'rake/helpers/gemversion'
require 'rake/common/chdirtask'

module Rake
  module Delphi
    class AndroidManifestInfo
      attr_accessor :version

      def initialize(owner)
        @owner = owner
      end

      def get_binding
        binding
      end

      def version
        Gem::VersionImproved.new(@version)
      end

      def libname
        @owner.dccTask.dpr.pathmap('%n')
      end
    end

    class AndroidManifestTask < Rake::Task
      attr_reader :output, :dccTask
    public
      def initialize(name, application)
        super
        self.needed = false
        @template = 'AndroidManifest.erb'
        @output = 'AndroidManifest.xml'
        @template_obj = AndroidManifestInfo.new(self)
      end

      def execute(args = nil)
        super
        paclientTaskName = name.gsub(/:manifest$/, '')
        @dccTask = application[paclientTaskName].dccTask
        projectTaskName = @dccTask.name.gsub(/:dcc32$/, '')
        projectTask = application[projectTaskName]
        @template_obj.version = projectTask.properties[:version]
        ChDir.new(self, File.dirname(@dccTask.dpr)) do |dir|
          RakeFileUtils.verbose(Logger.debug?) do
            erb = ERB.new(IO.read(@template))
            text = erb.result(@template_obj.get_binding)
            File.open(@output, 'w') do |f|
              f.write(text)
            end
          end
        end
      end
    end # class AndroidManifestTask
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
rake-delphi-0.0.31 lib/rake/delphi/androidmanifest.rb
rake-delphi-0.0.29 lib/rake/delphi/androidmanifest.rb
rake-delphi-0.0.30 lib/rake/delphi/androidmanifest.rb
rake-delphi-0.0.28 lib/rake/delphi/androidmanifest.rb
rake-delphi-0.0.27 lib/rake/delphi/androidmanifest.rb
rake-delphi-0.0.26 lib/rake/delphi/androidmanifest.rb
rake-delphi-0.0.25 lib/rake/delphi/androidmanifest.rb
rake-delphi-0.0.24 lib/rake/delphi/androidmanifest.rb
rake-delphi-0.0.23 lib/rake/delphi/androidmanifest.rb
rake-delphi-0.0.22 lib/rake/delphi/androidmanifest.rb
rake-delphi-0.0.21 lib/rake/delphi/androidmanifest.rb