Sha256: b37b4e6fd83e378eeca334adf77531966dc9ccbbe9b22bc8b0b820454590dcd3

Contents?: true

Size: 1.33 KB

Versions: 7

Compression:

Stored size: 1.33 KB

Contents

module Calabash
  module CLI
    # @!visibility private
    module Build
      # @!visibility private
      def parse_build_arguments!
        fail('Should only build test-server for Android') unless @platform.nil? || @platform == :android

        application = @arguments.shift
        test_server_path = nil

        arg = @arguments.shift

        if arg != nil
          if arg == '-o'
            test_server_path = @arguments.shift

            if test_server_path == nil
              raise 'Expected an output path for the test-server'
            end
          end
        end

        if application.nil?
          fail('Must supply application as first parameter to build', :build)
        elsif !File.exists?(application)
          fail("File '#{application}' does not exist", :build)
        else
          extension = File.extname(application)
          application_path = File.expand_path(application)

          case extension
            when '.apk'
              set_platform!(:android)
              Calabash::Android::Build::Builder.new(application_path).build(test_server_path)
            when '.ipa', '.app'
              set_platform!(:ios)
              fail('Should only build test-server for Android')
            else
              fail('Application must be an apk', :build)
          end
        end
      end

    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
calabash-2.0.0.pre11 lib/calabash/cli/build.rb
calabash-2.0.0.pre10 lib/calabash/cli/build.rb
calabash-2.0.0.pre9 lib/calabash/cli/build.rb
calabash-2.0.0.prelegacy4 lib/calabash/cli/build.rb
calabash-2.0.0.prelegacy3 lib/calabash/cli/build.rb
calabash-2.0.0.prelegacy2 lib/calabash/cli/build.rb
calabash-2.0.0.prelegacy lib/calabash/cli/build.rb