-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #389 from calabash/release/2.0.7
Release/2.0.7
- Loading branch information
Showing
472 changed files
with
1,200 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
require "thor" | ||
require "run_loop" | ||
require "run_loop/cli/errors" | ||
|
||
module RunLoop | ||
module CLI | ||
class Codesign < Thor | ||
|
||
desc "info ARTIFACT", "Print codesign information about ARTIFACT (ipa, app, or library)" | ||
|
||
def info(app_or_ipa) | ||
extension = File.extname(app_or_ipa) | ||
|
||
if extension == ".app" | ||
puts RunLoop::App.new(app_or_ipa).codesign_info | ||
elsif extension == ".ipa" | ||
puts RunLoop::Ipa.new(app_or_ipa).codesign_info | ||
else | ||
puts RunLoop::Codesign.info(app_or_ipa) | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
module RunLoop | ||
# @!visibility private | ||
# A wrapper around codesign command line tool | ||
class Codesign | ||
|
||
# @!visibility private | ||
DEV_REGEX = /Authority=iPhone Developer:/ | ||
|
||
# @!visibility private | ||
APP_STORE_REGEX = /Authority=Apple iPhone OS Application Signing/ | ||
|
||
# @!visibility private | ||
DISTR_REGEX = /Authority=iPhone Distribution:/ | ||
|
||
# @!visibility private | ||
NOT_SIGNED_REGEX = /code object is not signed at all/ | ||
|
||
# @!visibility private | ||
def self.info(path) | ||
self.expect_path_exists(path) | ||
self.exec(["--display", "--verbose=4", path]) | ||
end | ||
|
||
# @!visibility private | ||
# | ||
# True if the asset is signed. | ||
def self.signed?(path) | ||
info = self.info(path) | ||
info[NOT_SIGNED_REGEX, 0] == nil | ||
end | ||
|
||
# @!visibility private | ||
# | ||
# True if the asset is signed with anything other than a dev cert. | ||
def self.distribution?(path) | ||
info = self.info(path) | ||
|
||
info[NOT_SIGNED_REGEX, 0] == nil && | ||
info[DEV_REGEX, 0] == nil | ||
end | ||
|
||
# @!visibility private | ||
# | ||
# True if the asset is signed with a dev cert | ||
def self.developer?(path) | ||
info = self.info(path) | ||
info[DEV_REGEX, 0] != nil | ||
end | ||
|
||
private | ||
|
||
def self.expect_path_exists(path) | ||
if !File.exist?(path) | ||
raise ArgumentError, | ||
%Q{There is no file or directory at path: | ||
#{path} | ||
} | ||
end | ||
end | ||
|
||
def self.exec(args) | ||
if !args.is_a?(Array) | ||
raise ArgumentError, "Expected args: '#{args}' to be an Array" | ||
end | ||
|
||
xcrun = RunLoop::Xcrun.new | ||
cmd = ["codesign"] + args | ||
options = {:log_cmd => true} | ||
hash = xcrun.exec(cmd, options) | ||
|
||
hash[:out] | ||
end | ||
end | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
module RunLoop | ||
module HTTP | ||
|
||
# Raised when there is a problem communicating with the Calabash test | ||
# server. | ||
class Error < StandardError | ||
|
||
end | ||
|
||
# Raised when there is a problem creating an HTTP request. | ||
class RequestError < StandardError | ||
|
||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
module RunLoop | ||
module HTTP | ||
|
||
# A representation of an HTTP request that can be passed passed to the HTTP | ||
# client as an argument for `get` or `post`. | ||
# @!visibility private | ||
class Request | ||
attr_reader :route, :params | ||
|
||
def initialize(route, params={}) | ||
@route = route | ||
@params = params | ||
end | ||
|
||
# Create a new Request from `route` and `parameters`. | ||
# | ||
# @param [String] route The http route for the new request. | ||
# @param [Array, Hash] parameters An Array or Hash of parameters. | ||
# @return [Request] A new Request for `route` with `parameters`. | ||
# @raise [RequestError] Raises an error if the parameters cannot be | ||
# converted to JSON | ||
def self.request(route, parameters) | ||
Request.new(route, Request.data(parameters)) | ||
end | ||
|
||
private | ||
|
||
# Converts `parameters` to JSON. | ||
# | ||
# @param [Array, Hash] parameters An Array or Hash of parameters. | ||
# @return [String] A JSON formatted string that represents the parameters. | ||
# @raise [RequestError] Raises an error if the parameters cannot be | ||
# converted to JSON | ||
def self.data(parameters) | ||
begin | ||
JSON.generate(parameters) | ||
rescue *[TypeError, JSON::GeneratorError] => e | ||
raise RequestError, "#{e}: could not generate JSON from '#{parameters}'" | ||
end | ||
end | ||
end | ||
end | ||
end | ||
|
Oops, something went wrong.