cuesmash 0.2.0.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0bab1becb6a34f783d7311bacbd438c71508410b
4
- data.tar.gz: 598727a31306c9fc239f0eaab7cfc90fb5e823ed
3
+ metadata.gz: 2c36e405e7913aac8f74cfead621aed03042e134
4
+ data.tar.gz: 92cf770512a727db44de69656ae2be89c0ccfa12
5
5
  SHA512:
6
- metadata.gz: 74265e8a629b1a45774e11183e8f876fcb6ba991c6251964566f3e966a1f852d9e22ffcfbff0a3f2ce10b6be5615a599dec31ace622e6c74fa0976a33669b31d
7
- data.tar.gz: 0f5628cebeffbcf3019f46de91393195fe080dfa67024aeb789a7dba2ede3bf02896fde136e302ae0d7cb9084f9d2ec48983915c5b0fe0535dbb84037903d131
6
+ metadata.gz: 95c7053653f4301113b695ab165e31497a5ba57dfdd85cd871234feab371684e9400b74ef08edebe53e18c5efd0999fc1821616f4e440238f3340604f73456fe
7
+ data.tar.gz: d65680d7d616249ae8ee301e12ea7411bd8691da122d75d30c9e3bc812e45257ab2ae0abb32615181e179c6311bff4d0aaa322e33662521c0b6b071c86127d8b
data/.cuesmash.yml CHANGED
@@ -37,3 +37,8 @@ default:
37
37
 
38
38
  platform: 'Android'
39
39
  build_configuration: 'local-Defaulttheme-Debug'
40
+
41
+ mock_server_conf:
42
+ path: 'PowaTagApplication/PowaTagApplication'
43
+ name: 'server_conf'
44
+ port: '4567'
data/Gemfile.lock CHANGED
@@ -1,25 +1,20 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cuesmash (0.2.0.0)
5
- CFPropertyList (>= 2.2.8)
4
+ cuesmash (0.3.0)
6
5
  rest-client (~> 1.7.2)
7
6
  thor (>= 0.19.1)
8
- xcpretty (>= 0.1.7)
7
+ xcpretty (>= 0.1.10)
9
8
 
10
9
  GEM
11
10
  remote: https://rubygems.org/
12
11
  specs:
13
- CFPropertyList (2.3.1)
14
- byebug (3.5.1)
15
- columnize (~> 0.8)
16
- debugger-linecache (~> 1.2)
17
- slop (~> 3.6)
12
+ byebug (5.0.0)
13
+ columnize (= 0.9.0)
18
14
  celluloid (0.16.0)
19
15
  timers (~> 4.0.0)
20
16
  coderay (1.1.0)
21
- columnize (0.8.9)
22
- debugger-linecache (1.2.0)
17
+ columnize (0.9.0)
23
18
  diff-lcs (1.2.5)
24
19
  docile (1.1.5)
25
20
  ffi (1.9.5)
@@ -34,6 +29,7 @@ GEM
34
29
  guard (~> 2.1)
35
30
  rspec (>= 2.14, < 4.0)
36
31
  hitimes (1.2.2)
32
+ json (1.8.3)
37
33
  listen (2.7.11)
38
34
  celluloid (>= 0.15.2)
39
35
  rb-fsevent (>= 0.9.3)
@@ -41,7 +37,6 @@ GEM
41
37
  lumberjack (1.0.9)
42
38
  method_source (0.8.2)
43
39
  mime-types (2.4.3)
44
- multi_json (1.10.1)
45
40
  netrc (0.10.3)
46
41
  pry (0.10.1)
47
42
  coderay (~> 1.1.0)
@@ -54,38 +49,42 @@ GEM
54
49
  rest-client (1.7.3)
55
50
  mime-types (>= 1.16, < 3.0)
56
51
  netrc (~> 0.7)
57
- rspec (3.1.0)
58
- rspec-core (~> 3.1.0)
59
- rspec-expectations (~> 3.1.0)
60
- rspec-mocks (~> 3.1.0)
61
- rspec-core (3.1.5)
62
- rspec-support (~> 3.1.0)
63
- rspec-expectations (3.1.2)
52
+ rspec (3.3.0)
53
+ rspec-core (~> 3.3.0)
54
+ rspec-expectations (~> 3.3.0)
55
+ rspec-mocks (~> 3.3.0)
56
+ rspec-core (3.3.1)
57
+ rspec-support (~> 3.3.0)
58
+ rspec-expectations (3.3.0)
64
59
  diff-lcs (>= 1.2.0, < 2.0)
65
- rspec-support (~> 3.1.0)
66
- rspec-mocks (3.1.2)
67
- rspec-support (~> 3.1.0)
68
- rspec-support (3.1.1)
69
- simplecov (0.9.1)
60
+ rspec-support (~> 3.3.0)
61
+ rspec-mocks (3.3.1)
62
+ diff-lcs (>= 1.2.0, < 2.0)
63
+ rspec-support (~> 3.3.0)
64
+ rspec-support (3.3.0)
65
+ simplecov (0.10.0)
70
66
  docile (~> 1.1.0)
71
- multi_json (~> 1.0)
72
- simplecov-html (~> 0.8.0)
73
- simplecov-html (0.8.0)
67
+ json (~> 1.8)
68
+ simplecov-html (~> 0.10.0)
69
+ simplecov-html (0.10.0)
74
70
  slop (3.6.0)
75
71
  thor (0.19.1)
76
72
  timers (4.0.1)
77
73
  hitimes
78
- xcpretty (0.1.7)
74
+ xcpretty (0.1.10)
79
75
 
80
76
  PLATFORMS
81
77
  ruby
82
78
 
83
79
  DEPENDENCIES
84
80
  bundler (~> 1.3)
85
- byebug (>= 3.5.1)
81
+ byebug (>= 5.0.0)
86
82
  cuesmash!
87
83
  guard-rspec (>= 4.3.1)
88
84
  pry (>= 0.10.1)
89
85
  rake (>= 10.3.2)
90
- rspec (>= 3.1.0)
91
- simplecov (~> 0.9.0)
86
+ rspec (>= 3.3.0)
87
+ simplecov (~> 0.10.0)
88
+
89
+ BUNDLED WITH
90
+ 1.10.4
data/cuesmash.gemspec CHANGED
@@ -4,11 +4,11 @@ $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.2.0.0"
7
+ spec.version = "0.3.0"
8
8
  spec.authors = ["Alex Fish", "Jarod McBride", "Tiago Castro"]
9
9
  spec.email = ["fish@ustwo.co.uk", "jarod@ustwo.com", "castro@ustwo.com"]
10
10
  spec.description = "Appium project manager"
11
- spec.summary = "Compile an app and run cucumber with appium"
11
+ spec.summary = "Compile an app, point the app at sinatra, run cucumber with appium"
12
12
  spec.homepage = "https://github.com/ustwo/cuesmash"
13
13
  spec.license = "MIT"
14
14
 
@@ -21,15 +21,14 @@ Gem::Specification.new do |spec|
21
21
 
22
22
  spec.add_development_dependency "bundler", "~> 1.3"
23
23
  spec.add_development_dependency 'rake', '>= 10.3.2'
24
- spec.add_development_dependency 'rspec', '>= 3.1.0'
24
+ spec.add_development_dependency 'rspec', '>= 3.3.0'
25
25
  spec.add_development_dependency 'guard-rspec', '>= 4.3.1'
26
26
  spec.add_development_dependency 'pry', '>= 0.10.1'
27
- spec.add_development_dependency 'byebug', '>= 3.5.1'
28
- spec.add_development_dependency 'simplecov', '~> 0.9.0'
27
+ spec.add_development_dependency 'byebug', '>= 5.0.0'
28
+ spec.add_development_dependency 'simplecov', '~> 0.10.0'
29
29
 
30
- spec.add_runtime_dependency 'CFPropertyList', '>= 2.2.8'
31
30
  spec.add_runtime_dependency 'thor', '>= 0.19.1'
32
- spec.add_runtime_dependency 'xcpretty', '>= 0.1.7'
31
+ spec.add_runtime_dependency 'xcpretty', '>= 0.1.10'
33
32
  spec.add_runtime_dependency 'rest-client', '~> 1.7.2'
34
33
 
35
34
  spec.executables << "cuesmash"
@@ -61,18 +61,6 @@ module Cuesmash
61
61
  # app_server.stop_server
62
62
  end # execute
63
63
 
64
- #
65
- # Update the applications plist so that the application
66
- # connects to sinatra
67
- #
68
- # @param scheme [String] The scheme related to the application
69
- # @param app_path [String] The path to the app
70
- #
71
- def self.update_plist(scheme, app_path)
72
- plist = Cuesmash::Plist.new(scheme, app_path)
73
- plist.execute
74
- end
75
-
76
64
  #
77
65
  # Run the cucumber tests, that's why we're here afterall
78
66
  #
@@ -0,0 +1,87 @@
1
+ #!/usr/bin/env ruby
2
+ # coding: utf-8
3
+
4
+ require 'json'
5
+
6
+ module Cuesmash
7
+ #
8
+ # Cuesmash needs to create a json file in the iOS or Android project to trick the simulator into connecting
9
+ # to a sinatra server instead
10
+ #
11
+ # @author [jarod]
12
+ #
13
+ class JsonConf
14
+ # Public: the Scheme the json is related to
15
+ attr_accessor :file_name
16
+ attr_accessor :app_path
17
+ attr_accessor :port
18
+
19
+ #
20
+ # Create a new json instance
21
+ # @param scheme [String] The scheme related to the json
22
+ # @param app_path [String] The dir where the app is going to be placed.
23
+ # @param file_name [String] Default: server_config. The name of the file with the server configurations.
24
+ #
25
+ # @return [JsonConf] A JsonConf instance
26
+ def initialize(app_path:, file_name: 'server_config', port:)
27
+ @file_name = file_name
28
+ @app_path = app_path
29
+ @port = port
30
+ end
31
+
32
+ #
33
+ # Executes the json tasks update and clear the old jsons
34
+ #
35
+ def execute
36
+ started
37
+ update
38
+
39
+ completed
40
+ end
41
+
42
+ private
43
+
44
+ #
45
+ # Output a nice message for starting
46
+ #
47
+ def started
48
+ Logger.info 'Updating json'
49
+ end
50
+
51
+ #
52
+ # Output a nice message for completing
53
+ #
54
+ def completed
55
+ Logger.info 'json updated 👌'
56
+ end
57
+
58
+ #
59
+ # Update the Xcode applications server.json file
60
+ # with sinatras port and URL
61
+ #
62
+ def update
63
+ data = {
64
+ url_preference: "#{server_ip}",
65
+ port_preference: "#{@port}"
66
+ }
67
+
68
+ File.write(server_json_path, data.to_json)
69
+ end
70
+
71
+ #
72
+ # The local IP address of the mock backend server
73
+ #
74
+ # @return [String] The mock backends IP
75
+ def server_ip
76
+ Socket.ip_address_list.find { |a| a.ipv4? && !a.ipv4_loopback? }.ip_address
77
+ end
78
+
79
+ #
80
+ # The path to the server config json
81
+ #
82
+ # @return [String] The full path to the server config json
83
+ def server_json_path
84
+ @app_path + "/#{@file_name}.json"
85
+ end
86
+ end # class json
87
+ end
@@ -9,6 +9,7 @@ require 'cuesmash/android_compiler'
9
9
  require 'cuesmash/android_command'
10
10
  require 'cuesmash/setup'
11
11
  require 'byebug'
12
+ require 'json'
12
13
 
13
14
  module Cuesmash
14
15
  CONFIG_FILE = '.cuesmash.yml'
@@ -22,7 +23,8 @@ module Cuesmash
22
23
 
23
24
  desc 'test OPTIONS', 'run the tests'
24
25
  long_desc <<-LONGDESC
25
- --tags -t the tags to pass to cucumber, for multiple tags pass one per tag. See cucumber tags for more info. https://github.com/cucumber/cucumber/wiki/Tags\n
26
+ --tags -t the tags to pass to cucumber, for multiple tags pass one per tag.
27
+ See cucumber tags for more info. https://github.com/cucumber/cucumber/wiki/Tags\n
26
28
  --output -o The output directory for the test report --not yet implemented--\n
27
29
  --format -f The format of the test report --not yet implemented--\n
28
30
  --scheme -s iOS only: the Xcode scheme to build\n
@@ -46,11 +48,18 @@ module Cuesmash
46
48
  aliases: '-c', desc: 'turn on settings for building on Travis CI'
47
49
  method_option :profile, type: :string, aliases: '-p', desc: 'which cucumber.yml profile to use'
48
50
  method_option :quiet, type: :boolean, aliases: '-q', desc: 'cucumber quiet mode'
49
- # method_option :server, type: :string, aliases: "-r", desc: ""
50
51
  def test
51
52
  # get the cuesmash.yml config
52
53
  @config = load_config
53
54
 
55
+ unless @config['mock_server_conf'].nil?
56
+ mock_server = JsonConf.new(app_path: @config['mock_server_conf']['path'],
57
+ file_name: @config['mock_server_conf']['name'],
58
+ port: @config['mock_server_conf']['port'])
59
+
60
+ mock_server.execute
61
+ end
62
+
54
63
  # Compile the project
55
64
  if @config['platform'] == 'iOS'
56
65
 
@@ -110,7 +119,6 @@ module Cuesmash
110
119
  timeout: @config['default']['test_timeout'].to_s)
111
120
  end # device each
112
121
  end
113
-
114
122
  else
115
123
  say "please set platform: 'iOS' or 'Android' in your .cuesmash.yml file", :red
116
124
  return
@@ -124,7 +132,6 @@ module Cuesmash
124
132
  LONGDESC
125
133
  method_option :scheme, type: :array, aliases: '-s', desc: 'the Xcode scheme to build'
126
134
  method_option :app_name, type: :string, aliases: '-n', desc: 'Android only: the name of the app'
127
-
128
135
  def build
129
136
  # get the cuesmash.yml config
130
137
  @config = load_config
@@ -135,6 +142,14 @@ module Cuesmash
135
142
  return
136
143
  end
137
144
 
145
+ unless @config['mock_server_conf'].nil?
146
+ mock_server = JsonConf.new(app_path: @config['mock_server_conf']['path'],
147
+ file_name: @config['mock_server_conf']['name'],
148
+ port: @config['mock_server_conf']['port'])
149
+
150
+ mock_server.execute
151
+ end
152
+
138
153
  if @config['platform'] == 'iOS'
139
154
  setup_ios
140
155
  elsif @config['platform'] == 'Android'
@@ -167,7 +182,9 @@ module Cuesmash
167
182
  # helper methods
168
183
  #
169
184
  def setup_ios
170
- @app = IosApp.new(file_name: options[:scheme].join(' '), build_configuration: @config['build_configuration'], app_name: @config['app_name'])
185
+ @app = IosApp.new(file_name: options[:scheme].join(' '),
186
+ build_configuration: @config['build_configuration'],
187
+ app_name: @config['app_name'])
171
188
 
172
189
  # Compile the project
173
190
  compiler = Cuesmash::IosCompiler.new(scheme: options[:scheme].join(' '),
data/lib/cuesmash.rb CHANGED
@@ -2,8 +2,7 @@
2
2
  # coding: utf-8
3
3
 
4
4
  require 'optparse'
5
- require "open3"
6
- require 'cfpropertylist'
5
+ require 'open3'
7
6
  require 'find'
8
7
  require 'socket'
9
8
  require 'fileutils'
@@ -13,11 +12,11 @@ require 'yaml'
13
12
 
14
13
  require 'cuesmash/command'
15
14
  require 'cuesmash/compiler'
16
- require 'cuesmash/plist'
17
15
  require 'cuesmash/cucumber'
18
16
  require 'cuesmash/appium_text'
19
17
  require 'cuesmash/ios_app'
20
18
  require 'cuesmash/appium_server'
19
+ require 'cuesmash/jsonconf'
21
20
 
22
21
  module Cuesmash
23
22
  PORT = 4567
data/spec/command_spec.rb CHANGED
@@ -1,86 +1,46 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Cuesmash::Command do
4
-
5
- describe "when executing" do
6
-
4
+ describe 'when executing' do
7
5
  before(:each) do
8
6
  Cuesmash::Command.stub(:compile)
9
- Cuesmash::Command.stub(:parse){nil}
7
+ Cuesmash::Command.stub(:parse) { nil }
10
8
  end
11
9
  end
12
10
 
13
- # describe "when starting a compile" do
14
- #
15
- # before(:each) do
16
- # @mock = double(Cuesmash::Compiler)
17
- # @mock.stub(:compile)
18
- # Cuesmash::Compiler.stub(:new){@mock}
19
- # end
20
- #
21
- # it "should set the compilers scheme and tmp dir" do
22
- # Cuesmash::Compiler.should_receive(:new).with("scheme", "/tmp")
23
- # Cuesmash::Command.compile("scheme", "/tmp")
24
- # end
25
- #
26
- # it "should start compiling" do
27
- # @mock.should_receive(:compile)
28
- # Cuesmash::Command.compile("scheme", "/tmp")
29
- # end
30
- # end
31
-
32
- describe "when updating the plist" do
33
-
34
- before(:each ) do
35
- @mock = double(Cuesmash::Plist)
36
- @mock.stub(:execute)
37
- Cuesmash::Plist.stub(:new){@mock}
38
- end
39
-
40
- it "should set the plists scheme" do
41
- Cuesmash::Plist.should_receive(:new).with("scheme", "/tmp")
42
- Cuesmash::Command.update_plist("scheme", "/tmp")
43
- end
44
-
45
- it "should execute the plist update" do
46
- @mock.should_receive(:execute)
47
- Cuesmash::Command.update_plist("scheme", "/tmp")
48
- end
49
-
50
- describe "when running the cucumber tests" do
51
-
52
- before(:each ) do
11
+ describe 'when updating the plist' do
12
+ describe 'when running the cucumber tests' do
13
+ before(:each) do
53
14
  @mock = double(Cuesmash::Cucumber)
54
15
  @mock.stub(:test)
55
- Cuesmash::Cucumber.stub(:new){@mock}
16
+ Cuesmash::Cucumber.stub(:new) { @mock }
56
17
  end
57
18
 
58
- it "should set the cucumber tags" do
59
- Cuesmash::Cucumber.should_receive(:new).with("tags", anything, anything)
60
- Cuesmash::Command.run_tests(tags: "tags", profile: "profile", quiet: true)
19
+ it 'should set the cucumber tags' do
20
+ Cuesmash::Cucumber.should_receive(:new).with('tags', anything, anything)
21
+ Cuesmash::Command.run_tests(tags: 'tags', profile: 'profile', quiet: true)
61
22
  end
62
23
 
63
- it "should set the format" do
24
+ it 'should set the format' do
64
25
  @cucumber = Cuesmash::Cucumber.new
65
- Cuesmash::Cucumber.stub(:new){@cucumber}
26
+ Cuesmash::Cucumber.stub(:new) { @cucumber }
66
27
 
67
28
  @cucumber.should_receive(:format=)
68
- Cuesmash::Command.run_tests(tags: nil, profile: nil, format: "format", quiet: anything)
29
+ Cuesmash::Command.run_tests(tags: nil, profile: nil, format: 'format', quiet: anything)
69
30
  end
70
31
 
71
- it "should set the output" do
32
+ it 'should set the output' do
72
33
  @cucumber = Cuesmash::Cucumber.new
73
- Cuesmash::Cucumber.stub(:new){@cucumber}
34
+ Cuesmash::Cucumber.stub(:new) { @cucumber }
74
35
 
75
36
  @cucumber.should_receive(:output=)
76
- Cuesmash::Command.run_tests(tags: nil, profile: nil, format: nil, output: "output", quiet: anything)
37
+ Cuesmash::Command.run_tests(tags: nil, profile: nil, format: nil, output: 'output', quiet: anything)
77
38
  end
78
39
 
79
- it "should start the tests" do
40
+ it 'should start the tests' do
80
41
  @mock.should_receive(:test)
81
- Cuesmash::Command.run_tests(tags: "tags", profile: "profile", quiet: true)
42
+ Cuesmash::Command.run_tests(tags: 'tags', profile: 'profile', quiet: true)
82
43
  end
83
-
84
44
  end # describe "when running the cucumber tests"
85
45
  end # describe "when updating the plist"
86
46
  end # describe Cuesmash::Command
@@ -0,0 +1,42 @@
1
+ require 'spec_helper'
2
+
3
+ describe Cuesmash::JsonConf do
4
+ describe 'when executed' do
5
+ before(:each) do
6
+ @json = Cuesmash::JsonConf.new(app_path: 'spec', file_name: 'test', port: '4567')
7
+ @json.stub(:update)
8
+ @json.stub(:clear)
9
+ @json.stub(:completed)
10
+ @json.stub(:started)
11
+ end
12
+
13
+ it 'should update' do
14
+ @json.should_receive(:update)
15
+ @json.execute
16
+ end
17
+ end
18
+
19
+ describe 'when updating' do
20
+ before(:each) do
21
+ @file_write = double(File)
22
+ @file_write.stub(:write)
23
+
24
+ @json = Cuesmash::JsonConf.new(app_path: 'spec', file_name: 'test', port: '4567')
25
+ @json.stub(:clear)
26
+ @json.stub(:completed)
27
+ @json.stub(:started)
28
+ @json.stub(:app_path) { 'app_path' }
29
+ @json.stub(:file_name)
30
+ end
31
+
32
+ it 'should set the server ip and port' do
33
+ @json.stub(:server_ip) { 'server_ip' }
34
+
35
+ @json.execute
36
+ end
37
+
38
+ it 'should write the app server plist' do
39
+ @json.execute
40
+ end
41
+ end
42
+ end
data/spec/spec_helper.rb CHANGED
@@ -1,6 +1,10 @@
1
- require "cuesmash"
1
+ require 'cuesmash'
2
2
  require 'simplecov'
3
- SimpleCov.start
3
+
4
+ SimpleCov.start do
5
+ add_filter '/spec/'
6
+ add_filter '/pkg/'
7
+ end
4
8
 
5
9
  RSpec.configure do |config|
6
10
  # ...
data/spec/test.json ADDED
@@ -0,0 +1 @@
1
+ {"url_preference":"10.1.20.99","port_preference":"4567"}
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cuesmash
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Fish
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2015-06-16 00:00:00.000000000 Z
13
+ date: 2015-06-30 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler
@@ -46,14 +46,14 @@ dependencies:
46
46
  requirements:
47
47
  - - ">="
48
48
  - !ruby/object:Gem::Version
49
- version: 3.1.0
49
+ version: 3.3.0
50
50
  type: :development
51
51
  prerelease: false
52
52
  version_requirements: !ruby/object:Gem::Requirement
53
53
  requirements:
54
54
  - - ">="
55
55
  - !ruby/object:Gem::Version
56
- version: 3.1.0
56
+ version: 3.3.0
57
57
  - !ruby/object:Gem::Dependency
58
58
  name: guard-rspec
59
59
  requirement: !ruby/object:Gem::Requirement
@@ -88,42 +88,28 @@ dependencies:
88
88
  requirements:
89
89
  - - ">="
90
90
  - !ruby/object:Gem::Version
91
- version: 3.5.1
91
+ version: 5.0.0
92
92
  type: :development
93
93
  prerelease: false
94
94
  version_requirements: !ruby/object:Gem::Requirement
95
95
  requirements:
96
96
  - - ">="
97
97
  - !ruby/object:Gem::Version
98
- version: 3.5.1
98
+ version: 5.0.0
99
99
  - !ruby/object:Gem::Dependency
100
100
  name: simplecov
101
101
  requirement: !ruby/object:Gem::Requirement
102
102
  requirements:
103
103
  - - "~>"
104
104
  - !ruby/object:Gem::Version
105
- version: 0.9.0
105
+ version: 0.10.0
106
106
  type: :development
107
107
  prerelease: false
108
108
  version_requirements: !ruby/object:Gem::Requirement
109
109
  requirements:
110
110
  - - "~>"
111
111
  - !ruby/object:Gem::Version
112
- version: 0.9.0
113
- - !ruby/object:Gem::Dependency
114
- name: CFPropertyList
115
- requirement: !ruby/object:Gem::Requirement
116
- requirements:
117
- - - ">="
118
- - !ruby/object:Gem::Version
119
- version: 2.2.8
120
- type: :runtime
121
- prerelease: false
122
- version_requirements: !ruby/object:Gem::Requirement
123
- requirements:
124
- - - ">="
125
- - !ruby/object:Gem::Version
126
- version: 2.2.8
112
+ version: 0.10.0
127
113
  - !ruby/object:Gem::Dependency
128
114
  name: thor
129
115
  requirement: !ruby/object:Gem::Requirement
@@ -144,14 +130,14 @@ dependencies:
144
130
  requirements:
145
131
  - - ">="
146
132
  - !ruby/object:Gem::Version
147
- version: 0.1.7
133
+ version: 0.1.10
148
134
  type: :runtime
149
135
  prerelease: false
150
136
  version_requirements: !ruby/object:Gem::Requirement
151
137
  requirements:
152
138
  - - ">="
153
139
  - !ruby/object:Gem::Version
154
- version: 0.1.7
140
+ version: 0.1.10
155
141
  - !ruby/object:Gem::Dependency
156
142
  name: rest-client
157
143
  requirement: !ruby/object:Gem::Requirement
@@ -201,7 +187,7 @@ files:
201
187
  - lib/cuesmash/cucumber.rb
202
188
  - lib/cuesmash/ios_app.rb
203
189
  - lib/cuesmash/ios_compiler.rb
204
- - lib/cuesmash/plist.rb
190
+ - lib/cuesmash/jsonconf.rb
205
191
  - lib/cuesmash/setup.rb
206
192
  - lib/cuesmash/start.rb
207
193
  - spec/android_compiler_spec.rb
@@ -210,8 +196,9 @@ files:
210
196
  - spec/cucumber_spec.rb
211
197
  - spec/ios_app_spec.rb
212
198
  - spec/ios_compiler_spec.rb
213
- - spec/plist_spec.rb
199
+ - spec/jsonconf_spec.rb
214
200
  - spec/spec_helper.rb
201
+ - spec/test.json
215
202
  homepage: https://github.com/ustwo/cuesmash
216
203
  licenses:
217
204
  - MIT
@@ -232,10 +219,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
232
219
  version: '0'
233
220
  requirements: []
234
221
  rubyforge_project:
235
- rubygems_version: 2.4.3
222
+ rubygems_version: 2.4.6
236
223
  signing_key:
237
224
  specification_version: 4
238
- summary: Compile an app and run cucumber with appium
225
+ summary: Compile an app, point the app at sinatra, run cucumber with appium
239
226
  test_files:
240
227
  - spec/android_compiler_spec.rb
241
228
  - spec/appium_text_spec.rb
@@ -243,6 +230,6 @@ test_files:
243
230
  - spec/cucumber_spec.rb
244
231
  - spec/ios_app_spec.rb
245
232
  - spec/ios_compiler_spec.rb
246
- - spec/plist_spec.rb
233
+ - spec/jsonconf_spec.rb
247
234
  - spec/spec_helper.rb
248
- has_rdoc:
235
+ - spec/test.json
@@ -1,107 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # coding: utf-8
3
-
4
- module Cuesmash
5
- #
6
- # Does some fun stuff with Xcode plists, cuesmash needs to update
7
- # the Xcode projects plist to trick the simulator into connecting
8
- # to a sinatra server instead
9
- #
10
- # @author [alexfish]
11
- #
12
- class Plist
13
- # include Logging
14
-
15
- # Public: the Scheme the plist is related to
16
- attr_accessor :scheme
17
- attr_accessor :tmp_dir
18
- attr_accessor :plist_name
19
-
20
- #
21
- # Create a new plist instance
22
- # @param scheme [String] The scheme related to the plist
23
- # @param app_path [String] The dir where the app is going to be placed.
24
- # @param plist_name [String] Default: server_config. The name of the file with the server configurations.
25
- #
26
- # @return [Plist] A plist instance
27
- def initialize(scheme, app_path, plist_name = 'server_config')
28
- @scheme = scheme
29
- @tmp_dir = tmp_dir
30
- @plist_name = plist_name
31
- @app_path = app_path
32
- end
33
-
34
- #
35
- # Executes the plist tasks update and clear the old plists
36
- #
37
- def execute
38
- started
39
- update
40
- clear
41
-
42
- completed
43
- end
44
-
45
- private
46
-
47
- #
48
- # Output a nice message for starting
49
- #
50
- def started
51
- Logger.info 'Updating plist'
52
- end
53
-
54
- #
55
- # Output a nice message for completing
56
- #
57
- def completed
58
- Logger.info 'Plist updated 👌'
59
- end
60
-
61
- #
62
- # Update the Xcode applications server.plist file
63
- # with sinatras port and URL
64
- #
65
- def update
66
- plist_file = CFPropertyList::List.new(file: server_plist_path)
67
- plist = CFPropertyList.native_types(plist_file.value)
68
-
69
- plist['url_preference'] = server_ip
70
- plist['port_preference'] = Cuesmash::PORT
71
-
72
- plist_file.value = CFPropertyList.guess(plist)
73
- plist_file.save(server_plist_path, CFPropertyList::List::FORMAT_XML)
74
- end
75
-
76
- #
77
- # Clear the existing plist from the iOS simulator
78
- #
79
- def clear
80
- FileUtils.rm(simulator_plist_path, force: true)
81
- end
82
-
83
- #
84
- # The local IP address of the mock backend server
85
- #
86
- # @return [String] The mock backends IP
87
- def server_ip
88
- Socket.ip_address_list.find { |a| a.ipv4? && !a.ipv4_loopback? }.ip_address
89
- end
90
-
91
- #
92
- # The path to the iOS simulators plist
93
- #
94
- # @return [String] The path to the plist
95
- def simulator_plist_path
96
- "#{File.expand_path('~')}/Library/Preferences/com.apple.iphonesimulator.plist"
97
- end
98
-
99
- #
100
- # The path to the server config plist
101
- #
102
- # @return [String] The full path to the server config plist
103
- def server_plist_path
104
- @app_path + "/#{@plist_name}.plist"
105
- end
106
- end
107
- end
data/spec/plist_spec.rb DELETED
@@ -1,78 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Cuesmash::Plist do
4
-
5
- describe "when executed" do
6
-
7
- before(:each) do
8
- @plist = Cuesmash::Plist.new("scheme", "/tmp")
9
- @plist.stub(:update)
10
- @plist.stub(:clear)
11
- @plist.stub(:completed)
12
- @plist.stub(:started)
13
- end
14
-
15
- it "should update" do
16
- @plist.should_receive(:update)
17
- @plist.execute
18
- end
19
-
20
- it "should clear" do
21
- @plist.should_receive(:clear)
22
- @plist.execute
23
- end
24
- end
25
-
26
- describe "when clearing" do
27
-
28
- before(:each) do
29
- @plist = Cuesmash::Plist.new("scheme", "/tmp")
30
- @plist.stub(:update)
31
- @plist.stub(:completed)
32
- @plist.stub(:started)
33
- end
34
-
35
- it "should delete the simulator plist" do
36
- @plist.stub(:simulator_plist_path){"plist_path"}
37
- FileUtils.should_receive(:rm).with("plist_path", anything)
38
- @plist.execute
39
- end
40
- end
41
-
42
- describe "when updating" do
43
-
44
- before(:each) do
45
- @cfplist = double(CFPropertyList::List)
46
- @cfplist.stub(:value)
47
- @cfplist.stub(:value=)
48
- @cfplist.stub(:save)
49
- CFPropertyList::List.stub(:new){@cfplist}
50
- CFPropertyList.stub(:native_types){@cfplist}
51
- CFPropertyList.stub(:guess)
52
-
53
- @plist = Cuesmash::Plist.new("scheme", "app_path")
54
- @plist.stub(:clear)
55
- @plist.stub(:completed)
56
- @plist.stub(:started)
57
- @plist.stub(:app_path){"app_path"}
58
- end
59
-
60
- it "should set the server ip and port" do
61
- @plist.stub(:server_ip){"server_ip"}
62
- stub_const("Cuesmash::PORT", 123)
63
-
64
- @cfplist.should_receive(:[]=).with("url_preference", "server_ip")
65
- @cfplist.should_receive(:[]=).with("port_preference", 123)
66
-
67
- @plist.execute
68
- end
69
-
70
- it "should write the app server plist" do
71
- @cfplist.should_receive(:save).with("app_path/server_config.plist", anything)
72
- @cfplist.stub(:[]=)
73
-
74
- @plist.execute
75
- end
76
-
77
- end
78
- end