Sha256: 9b752cec05f0033fd7705235141f94b0647312810493c6d6d34cf4642939f1a9

Contents?: true

Size: 1.94 KB

Versions: 2

Compression:

Stored size: 1.94 KB

Contents

unless defined?(Motion::Project::Config)
  raise 'This file must be required within a RubyMotion project Rakefile.'
end

unless defined?(BubbleWrap::LOADER_PRESENT)
  require 'bubble-wrap/version' unless defined?(VERSION)
  if Gem::Version.new(Motion::Version) < Gem::Version.new(BubbleWrap::MIN_MOTION_VERSION)
    raise "BubbleWrap #{BubbleWrap::VERSION} requires at least RubyMotion #{BubbleWrap::MIN_MOTION_VERSION}"
  end

  require 'bubble-wrap/ext'
  require 'bubble-wrap/requirement'

  module BubbleWrap

    LOADER_PRESENT = true
    module_function

    def root
      File.expand_path('../../../', __FILE__)
    end

    def require(file_spec, &block)
      Requirement.scan(caller.first, file_spec, &block)
    end

    def require_ios(requirement = nil, &callback)
      if !Motion::Project::App.osx?
        callback.call
      else
        puts "bubble-wrap/#{requirement} requires iOS to use." if requirement
      end
    end

    def require_osx(requirement = nil, &callback)
      if Motion::Project::App.osx?
        callback.call
      else
        puts "bubble-wrap/#{requirement} requires OS X to use." if requirement
      end
    end

    def before_config(app)
      app.files = ::BubbleWrap::Requirement.files(app.files)
      app.files_dependencies ::BubbleWrap::Requirement.files_dependencies
      app.frameworks = ::BubbleWrap::Requirement.frameworks(app.frameworks)
    end

    def after_config(config)
      BubbleWrap.require_ios do
        ios7_files = 'motion/ios/7/uiactivity_view_controller_constants.rb'
        if config.send(:deployment_target).to_f >= 7.0
          ::BubbleWrap.require(ios7_files)
          before_config(config)
        else
          config.files = config.files.reject {|s|
            s.include?(ios7_files)
          }
        end
      end
    end
  end

  BW = BubbleWrap unless defined?(BW)

  BW.require 'motion/shortcut.rb'
  BW.require 'lib/bubble-wrap/version.rb'
  BW.require 'motion/util/deprecated.rb'

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
bubble-wrap-1.8.0 lib/bubble-wrap/loader.rb
bubble-wrap-1.7.1 lib/bubble-wrap/loader.rb