cuesmash 0.1.7.1 → 0.1.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.cuesmash.yml +4 -1
- data/Gemfile.lock +9 -1
- data/cuesmash.gemspec +2 -1
- data/lib/cuesmash/android_app.rb +36 -0
- data/lib/cuesmash/android_appium_text.rb +71 -0
- data/lib/cuesmash/android_command.rb +86 -0
- data/lib/cuesmash/android_compiler.rb +27 -0
- data/lib/cuesmash/androidapp.rb +36 -0
- data/lib/cuesmash/app.rb +22 -0
- data/lib/cuesmash/appium_text.rb +8 -5
- data/lib/cuesmash/command.rb +12 -10
- data/lib/cuesmash/compiler.rb +4 -39
- data/lib/cuesmash/cucumber.rb +1 -2
- data/lib/cuesmash/ios_app.rb +42 -0
- data/lib/cuesmash/ios_compiler.rb +49 -0
- data/lib/cuesmash/iosapp.rb +9 -15
- data/lib/cuesmash/ioscompiler.rb +49 -0
- data/lib/cuesmash/setup.rb +1 -0
- data/lib/cuesmash/start.rb +123 -36
- data/spec/android_compiler_spec.rb +37 -0
- data/spec/appium_text_spec.rb +22 -1
- data/spec/command_spec.rb +5 -10
- data/spec/cucumber_spec.rb +14 -14
- data/spec/ios_app_spec.rb +36 -0
- data/spec/ios_compiler_spec.rb +76 -0
- data/spec/{compiler_spec.rb → ioscompiler_spec.rb} +10 -9
- data/spec/spec_helper.rb +2 -0
- metadata +33 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 48e58bea94fd7f9c3530ae9d5e58b01c97be9fa8
|
4
|
+
data.tar.gz: e9b0af7c1164eb3421559e980670669cd5621c21
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8b363d22b641435db75895ce121375df0c37741cbc3738c04cd1fa15b7ae400e69faf931d35a536ad02d41b49a7d02c826fb483bbd702ac84b392a01ce159e09
|
7
|
+
data.tar.gz: e476b772402fe0daee97cdcd25b8ba61d6f1c4c180d7afe360e25a7e0371b79cf600fc8183930bb037aa27ad1f3213c009b6ff29a02520a269626aacc63e211b
|
data/.cuesmash.yml
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
cuesmash (0.1.
|
4
|
+
cuesmash (0.1.9)
|
5
5
|
CFPropertyList (>= 2.2.8)
|
6
6
|
rest-client (~> 1.7.2)
|
7
7
|
thor (>= 0.19.1)
|
@@ -21,6 +21,7 @@ GEM
|
|
21
21
|
columnize (0.8.9)
|
22
22
|
debugger-linecache (1.2.0)
|
23
23
|
diff-lcs (1.2.5)
|
24
|
+
docile (1.1.5)
|
24
25
|
ffi (1.9.5)
|
25
26
|
formatador (0.2.5)
|
26
27
|
guard (2.6.1)
|
@@ -40,6 +41,7 @@ GEM
|
|
40
41
|
lumberjack (1.0.9)
|
41
42
|
method_source (0.8.2)
|
42
43
|
mime-types (2.3)
|
44
|
+
multi_json (1.10.1)
|
43
45
|
netrc (0.7.7)
|
44
46
|
pry (0.10.1)
|
45
47
|
coderay (~> 1.1.0)
|
@@ -64,6 +66,11 @@ GEM
|
|
64
66
|
rspec-mocks (3.1.2)
|
65
67
|
rspec-support (~> 3.1.0)
|
66
68
|
rspec-support (3.1.1)
|
69
|
+
simplecov (0.9.1)
|
70
|
+
docile (~> 1.1.0)
|
71
|
+
multi_json (~> 1.0)
|
72
|
+
simplecov-html (~> 0.8.0)
|
73
|
+
simplecov-html (0.8.0)
|
67
74
|
slop (3.6.0)
|
68
75
|
thor (0.19.1)
|
69
76
|
timers (4.0.1)
|
@@ -81,3 +88,4 @@ DEPENDENCIES
|
|
81
88
|
pry (>= 0.10.1)
|
82
89
|
rake (>= 10.3.2)
|
83
90
|
rspec (>= 3.1.0)
|
91
|
+
simplecov (~> 0.9.0)
|
data/cuesmash.gemspec
CHANGED
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = "cuesmash"
|
7
|
-
spec.version = "0.1.
|
7
|
+
spec.version = "0.1.9"
|
8
8
|
spec.authors = ["Alex Fish", "Jarod McBride"]
|
9
9
|
spec.email = ["fish@ustwo.co.uk", "jarod@ustwo.com"]
|
10
10
|
spec.description = "A gift for Juan"
|
@@ -25,6 +25,7 @@ Gem::Specification.new do |spec|
|
|
25
25
|
spec.add_development_dependency 'guard-rspec', '>= 4.3.1'
|
26
26
|
spec.add_development_dependency 'pry', '>= 0.10.1'
|
27
27
|
spec.add_development_dependency 'byebug', '>= 3.5.1'
|
28
|
+
spec.add_development_dependency 'simplecov', '~> 0.9.0'
|
28
29
|
|
29
30
|
spec.add_runtime_dependency 'CFPropertyList', '>= 2.2.8'
|
30
31
|
spec.add_runtime_dependency 'thor', '>= 0.19.1'
|
@@ -0,0 +1,36 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# coding: utf-8
|
3
|
+
|
4
|
+
module Cuesmash
|
5
|
+
|
6
|
+
#
|
7
|
+
# Provides an object to get information about the ios app that is being built.
|
8
|
+
#
|
9
|
+
class AndroidApp < App
|
10
|
+
|
11
|
+
# app/build/outputs/apk/
|
12
|
+
attr_reader :app_dir
|
13
|
+
|
14
|
+
# Public: the full path including the built app i.e. ./app/build/outputs/apk/app-debug.apk"
|
15
|
+
attr_reader :app_path
|
16
|
+
|
17
|
+
# Public: the app name i.e. app-debug.apk
|
18
|
+
attr_reader :app_name
|
19
|
+
|
20
|
+
#
|
21
|
+
# Create a new App instance
|
22
|
+
#
|
23
|
+
# @param project_name [String] the project name to be built.
|
24
|
+
# @param build_configuration [String] which build configuration to run i.e. Release, Debug
|
25
|
+
#
|
26
|
+
# @return [App] A app instance
|
27
|
+
def initialize(project_name:, build_configuration:)
|
28
|
+
@app_name = "#{project_name}-#{build_configuration}" << ".apk"
|
29
|
+
|
30
|
+
@app_dir = File.expand_path("./app/build/outputs/apk/")
|
31
|
+
|
32
|
+
@app_path = "#{@app_dir}/" << "#{@app_name}"
|
33
|
+
end
|
34
|
+
|
35
|
+
end # class AndroidApp
|
36
|
+
end # module Cuesmash
|
@@ -0,0 +1,71 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# coding: utf-8
|
3
|
+
|
4
|
+
module Cuesmash
|
5
|
+
|
6
|
+
#
|
7
|
+
# Creates the appium.txt file that is needed by appium
|
8
|
+
#
|
9
|
+
# @author [jarod]
|
10
|
+
#
|
11
|
+
class AndroidAppiumText
|
12
|
+
|
13
|
+
attr_accessor :appium_avd
|
14
|
+
attr_accessor :appium_app
|
15
|
+
attr_accessor :appium_platform_name
|
16
|
+
attr_accessor :appium_new_command_timeout
|
17
|
+
attr_accessor :appium_text_for_file
|
18
|
+
|
19
|
+
#
|
20
|
+
# [initialize description]
|
21
|
+
# @param platform_name: [type] [description]
|
22
|
+
# @param avd: [type] [description]
|
23
|
+
# @param app: [type] [description]
|
24
|
+
# @param new_command_timeout: 60 [type] [description]
|
25
|
+
#
|
26
|
+
# @return [type] [description]
|
27
|
+
def initialize(platform_name:, avd:, app:, new_command_timeout: 60)
|
28
|
+
@appium_platform_name = platform_name
|
29
|
+
@appium_avd = avd
|
30
|
+
@appium_app = app
|
31
|
+
@appium_new_command_timeout = new_command_timeout
|
32
|
+
end
|
33
|
+
|
34
|
+
def execute
|
35
|
+
started
|
36
|
+
update
|
37
|
+
completed
|
38
|
+
end
|
39
|
+
|
40
|
+
private
|
41
|
+
|
42
|
+
def started
|
43
|
+
Logger.info "Updating appium.txt"
|
44
|
+
end
|
45
|
+
|
46
|
+
def update
|
47
|
+
@appium_text_for_file = file_text
|
48
|
+
IO.write("features/support/appium.txt", @appium_text_for_file)
|
49
|
+
end
|
50
|
+
|
51
|
+
def completed
|
52
|
+
Logger.info "appium.txt updated 👌"
|
53
|
+
end
|
54
|
+
|
55
|
+
# [caps]
|
56
|
+
# platformName = "Android"
|
57
|
+
# app = "/Users/admin/repos/android-bbd-sample/app/build/outputs/apk/app-debug.apk"
|
58
|
+
# newCommandTimeout = "130"
|
59
|
+
# avd = "Nexus_6_API_21"
|
60
|
+
def file_text
|
61
|
+
text = "[caps]\n"
|
62
|
+
text << "platformName = \"#{appium_platform_name}\"\n"
|
63
|
+
text << "deviceName = \"Android Emulator\"\n"
|
64
|
+
text << "avd = \"#{appium_avd}\"\n"
|
65
|
+
text << "app = \"#{appium_app}\"\n"
|
66
|
+
text << "newCommandTimeout = \"#{appium_new_command_timeout}\"\n"
|
67
|
+
Logger.debug "appium.text == #{text}"
|
68
|
+
text
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
@@ -0,0 +1,86 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# coding: utf-8
|
3
|
+
require 'cuesmash/android_appium_text'
|
4
|
+
|
5
|
+
module Cuesmash
|
6
|
+
|
7
|
+
#
|
8
|
+
# The main point of entry for all commands, Command parses command line arguments
|
9
|
+
# and decides what to do about them.
|
10
|
+
#
|
11
|
+
# @author [alexfish]
|
12
|
+
#
|
13
|
+
class AndroidCommand
|
14
|
+
|
15
|
+
#
|
16
|
+
# Execute a command with some arguments
|
17
|
+
# then figure out what we're supposed to be doing with
|
18
|
+
# the arguments
|
19
|
+
#
|
20
|
+
# @param avd: [type] [description]
|
21
|
+
# @param server: [type] [description]
|
22
|
+
# @param tags: [type] [description]
|
23
|
+
# @param debug: false [type] [description]
|
24
|
+
# @param format: nil [type] [description]
|
25
|
+
# @param output: nil [type] [description]
|
26
|
+
# @param app: [type] [description]
|
27
|
+
# @param profile: [type] [description]
|
28
|
+
# @param quiet: false [type] [description]
|
29
|
+
# @param timeout: [type] [description]
|
30
|
+
#
|
31
|
+
# @return [type] [description]
|
32
|
+
def self.execute(avd:, server:, tags:, debug: false, format: nil, output: nil, app:, profile:, quiet: false, timeout:)
|
33
|
+
|
34
|
+
if debug
|
35
|
+
Logger.level = ::Logger::DEBUG
|
36
|
+
Logger.formatter = proc do |serverity, time, progname, msg|
|
37
|
+
"\n#{time}\t#{serverity}\t#{msg.rstrip}"
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
# Update the appium.txt file
|
42
|
+
create_appium_txt(app: app.app_path, timeout: timeout, avd: avd)
|
43
|
+
|
44
|
+
# start the appium server
|
45
|
+
app_server = AppiumServer.new
|
46
|
+
app_server.start_server
|
47
|
+
|
48
|
+
# Run the tests
|
49
|
+
run_tests(tags: tags, profile: profile, format: format, output: output, quiet: quiet)
|
50
|
+
|
51
|
+
# Stop the Appium server
|
52
|
+
# app_server.stop_server
|
53
|
+
|
54
|
+
end # execute
|
55
|
+
|
56
|
+
#
|
57
|
+
# Run the cucumber tests, that's why we're here afterall
|
58
|
+
#
|
59
|
+
# @param tags [Array] The cucumber tags to test with
|
60
|
+
# @param profile [String] cucumber profile to use
|
61
|
+
# @param format [String] The output format for the cucumber tests, Optional
|
62
|
+
# @param output [String] The path to the output directory to output test reports to, Optional
|
63
|
+
# @param quiet [Boolean] quiet flag for cucumber
|
64
|
+
#
|
65
|
+
def self.run_tests(tags:, profile:, format: nil, output: nil, quiet: false)
|
66
|
+
cucumber = Cuesmash::Cucumber.new(tags, profile, quiet)
|
67
|
+
cucumber.format = format if format
|
68
|
+
cucumber.output = output if output
|
69
|
+
cucumber.test
|
70
|
+
end
|
71
|
+
|
72
|
+
#
|
73
|
+
# Update appium.txt file with the directory of the build product
|
74
|
+
#
|
75
|
+
# @param platform_name [String] default 'iOS' name of platform to test on (Android or iOS)
|
76
|
+
# @param device_name [String] deviceName = "iPhone Simulator"
|
77
|
+
# @param platform_version [String] platformVersion = "7.1"
|
78
|
+
# @param app [String] path to built .app file
|
79
|
+
# @param timeout [String] time in seconds to set the newCommandTimeout to.
|
80
|
+
#
|
81
|
+
def self.create_appium_txt(platform_name: "Android", app:, timeout:, avd:)
|
82
|
+
appium = Cuesmash::AndroidAppiumText.new(platform_name: platform_name, avd: avd, app: app, new_command_timeout: timeout)
|
83
|
+
appium.execute
|
84
|
+
end
|
85
|
+
end # class Command
|
86
|
+
end # module Cuesmash
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
module Cuesmash
|
4
|
+
|
5
|
+
#
|
6
|
+
# iOS Specific compiler
|
7
|
+
#
|
8
|
+
class AndroidCompiler < Compiler
|
9
|
+
|
10
|
+
OUTPUT_PATH = "app/build/outputs/apk"
|
11
|
+
|
12
|
+
def initialize
|
13
|
+
end
|
14
|
+
|
15
|
+
#
|
16
|
+
# Generate the string to be used as the gradle build command
|
17
|
+
# using the scheme ivar
|
18
|
+
#
|
19
|
+
# @return [String] The full gradle build command with args
|
20
|
+
def command
|
21
|
+
gradle_command = './gradlew assemble'
|
22
|
+
|
23
|
+
Logger.info "gradle_command == #{gradle_command}"
|
24
|
+
gradle_command
|
25
|
+
end # command
|
26
|
+
end # class AndroidCompiler
|
27
|
+
end # module Cuesmash
|
@@ -0,0 +1,36 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# coding: utf-8
|
3
|
+
|
4
|
+
module Cuesmash
|
5
|
+
|
6
|
+
#
|
7
|
+
# Provides an object to get information about the ios app that is being built.
|
8
|
+
#
|
9
|
+
class AndroidApp < App
|
10
|
+
|
11
|
+
# app/build/outputs/apk/
|
12
|
+
attr_reader :app_dir
|
13
|
+
|
14
|
+
# Public: the full path including the built app i.e. ./app/build/outputs/apk/app-debug.apk"
|
15
|
+
attr_reader :app_path
|
16
|
+
|
17
|
+
# Public: the app name i.e. app-debug.apk
|
18
|
+
attr_reader :app_name
|
19
|
+
|
20
|
+
#
|
21
|
+
# Create a new App instance
|
22
|
+
#
|
23
|
+
# @param project_name [String] the project name to be built.
|
24
|
+
# @param build_configuration [String] which build configuration to run i.e. Release, Debug
|
25
|
+
#
|
26
|
+
# @return [App] A app instance
|
27
|
+
def initialize(project_name:, build_configuration:)
|
28
|
+
@app_name = "#{project_name}-#{build_configuration}" << ".apk"
|
29
|
+
|
30
|
+
@app_dir = File.expand_path("./app/build/outputs/apk/")
|
31
|
+
|
32
|
+
@app_path = "#{@app_dir}/" << "#{@app_name}"
|
33
|
+
end
|
34
|
+
|
35
|
+
end # class AndroidApp
|
36
|
+
end # module Cuesmash
|
data/lib/cuesmash/app.rb
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# coding: utf-8
|
3
|
+
|
4
|
+
module Cuesmash
|
5
|
+
|
6
|
+
#
|
7
|
+
# Provides an object to get information about the ios app that is being built
|
8
|
+
#
|
9
|
+
class App
|
10
|
+
|
11
|
+
# Public: the xcode Derived Data temp directory
|
12
|
+
attr_reader :tmp_dir
|
13
|
+
|
14
|
+
#
|
15
|
+
# Create a new App instance
|
16
|
+
#
|
17
|
+
# @return [App] A app instance
|
18
|
+
def initialize()
|
19
|
+
@tmp_dir = Dir.mktmpdir(file_name)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
data/lib/cuesmash/appium_text.rb
CHANGED
@@ -14,6 +14,8 @@ module Cuesmash
|
|
14
14
|
attr_accessor :app
|
15
15
|
attr_accessor :platform_name
|
16
16
|
attr_accessor :device_name
|
17
|
+
attr_accessor :new_command_timeout
|
18
|
+
attr_accessor :appium_text_for_file
|
17
19
|
|
18
20
|
#
|
19
21
|
# Create a new appium_text instance. These params are based off the appium.txt
|
@@ -25,11 +27,12 @@ module Cuesmash
|
|
25
27
|
# @param app [String] path to built .app file
|
26
28
|
#
|
27
29
|
# @return [AppiumText] A appiumtext instance
|
28
|
-
def initialize(platform_name:, device_name:, platform_version:,
|
30
|
+
def initialize(platform_name:, device_name:, platform_version: nil, app:, new_command_timeout: 60)
|
29
31
|
@platform_name = platform_name
|
30
32
|
@device_name = device_name
|
31
33
|
@platform_version = platform_version
|
32
34
|
@app = app
|
35
|
+
@new_command_timeout = new_command_timeout
|
33
36
|
end
|
34
37
|
|
35
38
|
def execute
|
@@ -38,7 +41,6 @@ module Cuesmash
|
|
38
41
|
completed
|
39
42
|
end
|
40
43
|
|
41
|
-
|
42
44
|
private
|
43
45
|
|
44
46
|
def started
|
@@ -46,8 +48,8 @@ module Cuesmash
|
|
46
48
|
end
|
47
49
|
|
48
50
|
def update
|
49
|
-
|
50
|
-
IO.write("features/support/appium.txt",
|
51
|
+
@appium_text_for_file = file_text
|
52
|
+
IO.write("features/support/appium.txt", @appium_text_for_file)
|
51
53
|
end
|
52
54
|
|
53
55
|
def completed
|
@@ -63,8 +65,9 @@ module Cuesmash
|
|
63
65
|
text = "[caps]\n"
|
64
66
|
text << "platformName = \"#{platform_name}\"\n"
|
65
67
|
text << "deviceName = \"#{device_name}\"\n"
|
66
|
-
text << "platformVersion = \"#{platform_version}\"\n"
|
68
|
+
text << "platformVersion = \"#{platform_version}\"\n" unless platform_version == nil
|
67
69
|
text << "app = \"#{app}\"\n"
|
70
|
+
text << "newCommandTimeout = \"#{new_command_timeout}\"\n"
|
68
71
|
Logger.debug "appium.text == #{text}"
|
69
72
|
text
|
70
73
|
end
|
data/lib/cuesmash/command.rb
CHANGED
@@ -30,9 +30,10 @@ module Cuesmash
|
|
30
30
|
# @param app [IosApp Object]
|
31
31
|
# @param profile [String]
|
32
32
|
# @param quiet [String]
|
33
|
+
# @param timeout [String] newCommandTimeout for appium in seconds
|
33
34
|
#
|
34
35
|
# @return [type] [description]
|
35
|
-
def execute(device:, os:, server:, tags:, scheme:, debug: false, format: nil, output: nil, travis: nil, app:, profile:, quiet: false)
|
36
|
+
def execute(device:, os:, server:, tags:, scheme:, debug: false, format: nil, output: nil, travis: nil, app:, profile:, quiet: false, timeout:)
|
36
37
|
|
37
38
|
if debug
|
38
39
|
Logger.level = ::Logger::DEBUG
|
@@ -45,14 +46,14 @@ module Cuesmash
|
|
45
46
|
# update_plist(scheme, app.app_path)
|
46
47
|
|
47
48
|
# Update the appium.txt file
|
48
|
-
create_appium_txt(app: app.app_path, device_name: device, platform_version: os)
|
49
|
+
create_appium_txt(app: app.app_path, device_name: device, platform_version: os, timeout: timeout)
|
49
50
|
|
50
51
|
# start the appium server
|
51
52
|
app_server = AppiumServer.new
|
52
53
|
app_server.start_server
|
53
54
|
|
54
55
|
# Run the tests
|
55
|
-
run_tests(
|
56
|
+
run_tests(tags: tags, profile: profile, format: format, output: output, quiet: quiet)
|
56
57
|
|
57
58
|
# Stop the Appium server
|
58
59
|
# app_server.stop_server
|
@@ -81,8 +82,8 @@ module Cuesmash
|
|
81
82
|
# @param output [String] The path to the output directory to output test reports to, Optional
|
82
83
|
# @param quiet [Boolean] quiet flag for cucumber
|
83
84
|
#
|
84
|
-
def run_tests(
|
85
|
-
cucumber = Cuesmash::Cucumber.new(
|
85
|
+
def run_tests(tags:, profile:, format: nil, output: nil, quiet: false)
|
86
|
+
cucumber = Cuesmash::Cucumber.new(tags, profile, quiet)
|
86
87
|
cucumber.format = format if format
|
87
88
|
cucumber.output = output if output
|
88
89
|
cucumber.test
|
@@ -95,11 +96,12 @@ module Cuesmash
|
|
95
96
|
# @param device_name [String] deviceName = "iPhone Simulator"
|
96
97
|
# @param platform_version [String] platformVersion = "7.1"
|
97
98
|
# @param app [String] path to built .app file
|
99
|
+
# @param timeout [String] time in seconds to set the newCommandTimeout to.
|
98
100
|
#
|
99
|
-
def create_appium_txt(platform_name: "iOS", device_name:, platform_version:, app:)
|
100
|
-
appium = AppiumText.new(platform_name: platform_name, device_name: device_name, platform_version: platform_version, app: app)
|
101
|
+
def create_appium_txt(platform_name: "iOS", device_name:, platform_version:, app:, timeout:)
|
102
|
+
appium = AppiumText.new(platform_name: platform_name, device_name: device_name, platform_version: platform_version, app: app, new_command_timeout: timeout)
|
101
103
|
appium.execute
|
102
104
|
end
|
103
|
-
end
|
104
|
-
end
|
105
|
-
end
|
105
|
+
end # self
|
106
|
+
end # class Command
|
107
|
+
end # module Cuesmash
|
data/lib/cuesmash/compiler.rb
CHANGED
@@ -6,20 +6,15 @@ module Cuesmash
|
|
6
6
|
# The calamsash compiler will compiles the Xcode project with the
|
7
7
|
# scheme it's told to compile with.
|
8
8
|
#
|
9
|
-
# @author [alexfish]
|
10
|
-
#
|
11
9
|
class Compiler
|
12
|
-
# include Logging
|
13
10
|
|
14
11
|
# Public: the Scheme the compiler is compiling
|
15
12
|
attr_accessor :scheme
|
16
13
|
attr_accessor :tmp_dir
|
17
|
-
attr_accessor :build_configuration
|
18
14
|
|
19
|
-
def initialize(scheme, tmp_dir
|
15
|
+
def initialize(scheme, tmp_dir)
|
20
16
|
@scheme = scheme
|
21
17
|
@tmp_dir = tmp_dir
|
22
|
-
@build_configuration = build_configuration
|
23
18
|
end
|
24
19
|
|
25
20
|
#
|
@@ -44,7 +39,7 @@ module Cuesmash
|
|
44
39
|
end
|
45
40
|
|
46
41
|
if status != 0
|
47
|
-
Logger.fatal "Compilation failed: #{output}"
|
42
|
+
# Logger.fatal "Compilation failed: #{output}"
|
48
43
|
exit status
|
49
44
|
status
|
50
45
|
else
|
@@ -67,35 +62,5 @@ module Cuesmash
|
|
67
62
|
def completed
|
68
63
|
Logger.info "Compiled 👌"
|
69
64
|
end
|
70
|
-
|
71
|
-
|
72
|
-
# Generate the string to be used as the xcode build command
|
73
|
-
# using the scheme ivar
|
74
|
-
#
|
75
|
-
# @return [String] The full xcode build command with args
|
76
|
-
def command
|
77
|
-
# xcode_command = "xcodebuild #{workspace} -scheme #{@scheme} -sdk iphonesimulator CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO -derivedDataPath #{@tmp_dir}"
|
78
|
-
xcode_command = "set -o pipefail && xcodebuild #{workspace} -scheme #{@scheme} -derivedDataPath #{@tmp_dir} -configuration #{@build_configuration} OBJROOT=#{@tmp_dir} SYMROOT=#{@tmp_dir} -sdk iphonesimulator build | bundle exec xcpretty -c"
|
79
|
-
|
80
|
-
Logger.info "xcode_command == #{xcode_command}"
|
81
|
-
xcode_command
|
82
|
-
end
|
83
|
-
|
84
|
-
#
|
85
|
-
# Looks in the current directory for the workspace file and
|
86
|
-
# gets it's name if there is one
|
87
|
-
#
|
88
|
-
# @return [String] The name of the workspace file that was found along with the -workspace flag
|
89
|
-
def workspace
|
90
|
-
wp = Dir["*.xcworkspace"].first
|
91
|
-
if wp
|
92
|
-
flag = "-workspace #{wp}"
|
93
|
-
Logger.debug "workspace == #{wp}"
|
94
|
-
return flag
|
95
|
-
else
|
96
|
-
Logger.debug "no workspace found"
|
97
|
-
return wp
|
98
|
-
end
|
99
|
-
end
|
100
|
-
end
|
101
|
-
end
|
65
|
+
end # class compiler
|
66
|
+
end # module cuesmash
|
data/lib/cuesmash/cucumber.rb
CHANGED
@@ -30,8 +30,7 @@ module Cuesmash
|
|
30
30
|
# @param profile [String] the cucumber profile to use for the tests
|
31
31
|
# @param quiet [Boolean]
|
32
32
|
#
|
33
|
-
def initialize(
|
34
|
-
@ios = ios
|
33
|
+
def initialize(tags, profile, quiet)
|
35
34
|
@tags = tags
|
36
35
|
@profile = profile
|
37
36
|
@quiet = quiet
|
@@ -0,0 +1,42 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# coding: utf-8
|
3
|
+
|
4
|
+
require 'cuesmash/app'
|
5
|
+
|
6
|
+
module Cuesmash
|
7
|
+
|
8
|
+
#
|
9
|
+
# Provides an object to get information about the ios app that is being built.
|
10
|
+
#
|
11
|
+
class IosApp < App
|
12
|
+
|
13
|
+
# Public: the path to the dir containing the built app i.e. /tmp/MyAppQWERQW/Build/Products/Debug-iphonesimulator/
|
14
|
+
attr_reader :app_dir
|
15
|
+
|
16
|
+
# Public: the full path including the built app i.e. /tmp/MyAppQWERQW/Build/Products/Debug-iphonesimulator/MyApp.app"
|
17
|
+
attr_reader :app_path
|
18
|
+
|
19
|
+
# Public: the app name i.e. MyApp.app
|
20
|
+
attr_reader :app_name
|
21
|
+
|
22
|
+
# Public: the xcode Derived Data temp directory
|
23
|
+
attr_reader :tmp_dir
|
24
|
+
|
25
|
+
#
|
26
|
+
# Create a new App instance
|
27
|
+
#
|
28
|
+
# @param file_name [String] The usually is the scheme of the xcode project
|
29
|
+
# @param build_configuration [String] which iOS build configuration to run i.e. Release, Debug
|
30
|
+
#
|
31
|
+
# @return [App] A app instance
|
32
|
+
def initialize(file_name:, build_configuration:)
|
33
|
+
@app_name = "#{file_name}" << ".app"
|
34
|
+
@tmp_dir = Dir.mktmpdir(file_name)
|
35
|
+
@build_configuration = build_configuration
|
36
|
+
|
37
|
+
@app_dir = "#{@tmp_dir}" << "/#{@build_configuration}-iphonesimulator/"
|
38
|
+
|
39
|
+
@app_path = "#{@app_dir}" << "#{@app_name}"
|
40
|
+
end
|
41
|
+
end # class IosApp
|
42
|
+
end # module Cuesmash
|
@@ -0,0 +1,49 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
module Cuesmash
|
4
|
+
|
5
|
+
#
|
6
|
+
# iOS Specific compiler
|
7
|
+
#
|
8
|
+
class IosCompiler < Compiler
|
9
|
+
|
10
|
+
attr_accessor :scheme
|
11
|
+
attr_accessor :tmp_dir
|
12
|
+
attr_accessor :build_configuration
|
13
|
+
|
14
|
+
def initialize(scheme, tmp_dir, build_configuration)
|
15
|
+
@scheme = scheme
|
16
|
+
@tmp_dir = tmp_dir
|
17
|
+
@build_configuration = build_configuration
|
18
|
+
end
|
19
|
+
|
20
|
+
#
|
21
|
+
# Generate the string to be used as the xcode build command
|
22
|
+
# using the scheme ivar
|
23
|
+
#
|
24
|
+
# @return [String] The full xcode build command with args
|
25
|
+
def command
|
26
|
+
xcode_command = "set -o pipefail && xcodebuild #{workspace} -scheme #{@scheme} -derivedDataPath #{@tmp_dir} -configuration #{@build_configuration} OBJROOT=#{@tmp_dir} SYMROOT=#{@tmp_dir} -sdk iphonesimulator build | bundle exec xcpretty -c"
|
27
|
+
|
28
|
+
Logger.info "xcode_command == #{xcode_command}"
|
29
|
+
xcode_command
|
30
|
+
end # command
|
31
|
+
|
32
|
+
#
|
33
|
+
# Looks in the current directory for the workspace file and
|
34
|
+
# gets it's name if there is one
|
35
|
+
#
|
36
|
+
# @return [String] The name of the workspace file that was found along with the -workspace flag
|
37
|
+
def workspace
|
38
|
+
wp = Dir["*.xcworkspace"].first
|
39
|
+
if wp
|
40
|
+
flag = "-workspace #{wp}"
|
41
|
+
Logger.debug "workspace == #{wp}"
|
42
|
+
return flag
|
43
|
+
else
|
44
|
+
Logger.debug "no workspace found"
|
45
|
+
return wp
|
46
|
+
end
|
47
|
+
end # workspace
|
48
|
+
end # class IosCompiler
|
49
|
+
end # module Cuesmash
|