Sha256: 51206bbc07e704d495f1ca4df2fc548719742a99f6451c668eed30eb16ffce82

Contents?: true

Size: 1.43 KB

Versions: 27

Compression:

Stored size: 1.43 KB

Contents

require 'erb'

module Frank
  module Plugins
    class Plugin

      attr_accessor :plugin_dir, :name, :exclude_dependencies

      def initialize(plugin_dir, name)
        self.plugin_dir= plugin_dir
        self.name = name
      end

      def dependency(lib,linker_flag="-l#{lib}")
        return linker_flag unless exclude_dependencies.include?(lib)
        ''
      end

      def write_xcconfig(exclude_dependencies)
          self.exclude_dependencies= exclude_dependencies

          _xcconfig_erb = File.join(plugin_dir,"#{xcconfig}.erb")

          unless File.exist?(_xcconfig_erb)
            raise "Invalid plugin #{name} at #{File.join(plugin_dir)}.\nDoesn't have an erb file: #{_xcconfig_erb}"
          end


          _template = ERB.new(File.read(_xcconfig_erb))
          result = _template.result(binding)
          output_path = File.join(plugin_dir, xcconfig)
          File.open(output_path,'w') {|f| f.write(result)}
          output_path
      end

      def xcconfig
        "#{name}.xcconfig"
      end

      def self.from_plugin_directory(path)
        plugin_name = File.basename(path)
        Plugin.new(path, plugin_name)
      end

      def self.generate_core_xcconfig(plugins)
        _template = ERB.new(File.read(core_xcconfig_path))

        _template.result(binding)
      end

      def self.core_xcconfig_path
        File.expand_path(File.join(File.dirname(__FILE__), '..', 'frank.xcconfig.erb'))
      end

    end
  end
end

Version data entries

27 entries across 27 versions & 4 rubygems

Version Path
sc-frank-ios-1.2.3 lib/frank-cucumber/plugins/plugin.rb
frank-cucumber-1.2.5 lib/frank-cucumber/plugins/plugin.rb
frank-cucumber-1.2.4.pre1 lib/frank-cucumber/plugins/plugin.rb
frank-pivotal-1.3.0.pre.2 lib/frank-pivotal/plugins/plugin.rb
sc-frank-cucumber-1.2.1.bba52d7.debug lib/frank-cucumber/plugins/plugin.rb
sc-frank-cucumber-1.2.1.e1e3ccb.debug lib/frank-cucumber/plugins/plugin.rb
sc-frank-cucumber-1.2.1.1a856ca.debug lib/frank-cucumber/plugins/plugin.rb
frank-pivotal-1.3.0.pre.1 lib/frank-pivotal/plugins/plugin.rb
frank-pivotal-1.2.4 lib/frank-pivotal/plugins/plugin.rb
frank-pivotal-1.2.3.pre.2 lib/frank-pivotal/plugins/plugin.rb
frank-pivotal-1.2.3.pre.1 lib/frank-pivotal/plugins/plugin.rb
frank-pivotal-1.2.3 lib/frank-pivotal/plugins/plugin.rb
sc-frank-cucumber-1.2.1.b7791c5.debug lib/frank-cucumber/plugins/plugin.rb
frank-cucumber-1.2.3 lib/frank-cucumber/plugins/plugin.rb
sc-frank-cucumber-1.2.1.3256dc1.debug lib/frank-cucumber/plugins/plugin.rb
sc-frank-cucumber-1.2.1.9c95c03.debug lib/frank-cucumber/plugins/plugin.rb
sc-frank-cucumber-1.2.1.1dcc760.debug lib/frank-cucumber/plugins/plugin.rb
frank-cucumber-1.2.2 lib/frank-cucumber/plugins/plugin.rb
sc-frank-cucumber-1.2.1.1dcc760 lib/frank-cucumber/plugins/plugin.rb
frank-cucumber-1.2.1 lib/frank-cucumber/plugins/plugin.rb