yolo 1.1.17 → 1.1.18
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/yolo/config/settings.rb +43 -22
- data/lib/yolo/tasks/ios/release.rb +1 -0
- data/lib/yolo/tools/git.rb +14 -10
- data/spec/tasks/ios/coverage_spec.rb +1 -0
- data/spec/tasks/ios/ocunit_spec.rb +23 -0
- data/spec/tasks/ios/release_spec.rb +172 -0
- metadata +2 -2
data/lib/yolo/config/settings.rb
CHANGED
@@ -58,20 +58,25 @@ module Yolo
|
|
58
58
|
def update_config
|
59
59
|
if File.directory?(yolo_dir) and File.exist?(yaml_path)
|
60
60
|
@yaml = YAML::load_file yaml_path
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
61
|
+
update_yaml_setting(@yaml, "deployment", "api_token", "example")
|
62
|
+
update_yaml_setting(@yaml, "deployment", "team_token", "example")
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
#
|
67
|
+
# Check the config file for an api_token key and add it if missing
|
68
|
+
# @param yaml [Hash] The settings yaml hash
|
69
|
+
# @param key [String] The setting key to update
|
70
|
+
# @param setting [String] The setting to update
|
71
|
+
# @param default [String] [description]
|
72
|
+
#
|
73
|
+
def update_yaml_setting(yaml, key, setting, default)
|
74
|
+
unless yaml[key][setting]
|
75
|
+
yaml[key][setting] = default
|
76
|
+
File.open(yaml_path, 'w') {|f|
|
77
|
+
f.write(yaml.to_yaml)
|
78
|
+
}
|
79
|
+
@formatter.config_updated(yaml_path)
|
75
80
|
end
|
76
81
|
end
|
77
82
|
|
@@ -88,7 +93,9 @@ module Yolo
|
|
88
93
|
#
|
89
94
|
# @return [String] The deployment url defined in config.yml
|
90
95
|
def deploy_url
|
91
|
-
|
96
|
+
if @yaml["deployment"]["url"] != "http://example.com"
|
97
|
+
@yaml["deployment"]["url"]
|
98
|
+
end
|
92
99
|
end
|
93
100
|
|
94
101
|
#
|
@@ -96,7 +103,9 @@ module Yolo
|
|
96
103
|
#
|
97
104
|
# @return [String] The api token defined in config.yml
|
98
105
|
def api_token
|
99
|
-
|
106
|
+
if @yaml["deployment"]["api_token"] != "example"
|
107
|
+
@yaml["deployment"]["api_token"]
|
108
|
+
end
|
100
109
|
end
|
101
110
|
|
102
111
|
#
|
@@ -104,7 +113,9 @@ module Yolo
|
|
104
113
|
#
|
105
114
|
# @return [String] The team token defined in config.yml
|
106
115
|
def team_token
|
107
|
-
|
116
|
+
if @yaml["deployment"]["teamt_token"] != "example"
|
117
|
+
@yaml["deployment"]["team_token"]
|
118
|
+
end
|
108
119
|
end
|
109
120
|
|
110
121
|
#
|
@@ -112,7 +123,9 @@ module Yolo
|
|
112
123
|
#
|
113
124
|
# @return [String] The mail account defined in config.yml
|
114
125
|
def mail_account
|
115
|
-
|
126
|
+
if @yaml["mail"]["account"] != "example@example.com"
|
127
|
+
@yaml["mail"]["account"]
|
128
|
+
end
|
116
129
|
end
|
117
130
|
|
118
131
|
#
|
@@ -120,7 +133,9 @@ module Yolo
|
|
120
133
|
#
|
121
134
|
# @return [String] The mail password defined in config.yml
|
122
135
|
def mail_password
|
123
|
-
|
136
|
+
if @yaml["mail"]["password"] != "example"
|
137
|
+
@yaml["mail"]["password"]
|
138
|
+
end
|
124
139
|
end
|
125
140
|
|
126
141
|
#
|
@@ -128,7 +143,9 @@ module Yolo
|
|
128
143
|
#
|
129
144
|
# @return [Number] The mail port defined in config.yml
|
130
145
|
def mail_port
|
131
|
-
|
146
|
+
if @yaml["mail"]["port"] != 0
|
147
|
+
@yaml["mail"]["port"]
|
148
|
+
end
|
132
149
|
end
|
133
150
|
|
134
151
|
#
|
@@ -136,7 +153,9 @@ module Yolo
|
|
136
153
|
#
|
137
154
|
# @return [String] The mail host defined in config.yml
|
138
155
|
def mail_host
|
139
|
-
|
156
|
+
if @yaml["mail"]["host"] != "your.server.ip"
|
157
|
+
return @yaml["mail"]["host"]
|
158
|
+
end
|
140
159
|
end
|
141
160
|
|
142
161
|
#
|
@@ -144,7 +163,9 @@ module Yolo
|
|
144
163
|
#
|
145
164
|
# @return [String] The from address defined in config.yml
|
146
165
|
def mail_from
|
147
|
-
|
166
|
+
if @yaml["mail"]["from"] != "example@example.com"
|
167
|
+
return @yaml["mail"]["from"]
|
168
|
+
end
|
148
169
|
end
|
149
170
|
|
150
171
|
#
|
data/lib/yolo/tools/git.rb
CHANGED
@@ -28,14 +28,13 @@ module Yolo
|
|
28
28
|
#
|
29
29
|
# @return [BOOL] returns if there is a new commit to build
|
30
30
|
def has_new_commit(name)
|
31
|
-
|
32
|
-
|
33
|
-
if yaml_commit == commit
|
31
|
+
set_project_name(name)
|
32
|
+
if yaml_commit == latest_commit
|
34
33
|
@formatter.no_new_commit
|
35
34
|
false
|
36
35
|
else
|
37
|
-
@formatter.new_commit(
|
38
|
-
update_commit(
|
36
|
+
@formatter.new_commit(latest_commit)
|
37
|
+
update_commit(latest_commit)
|
39
38
|
true
|
40
39
|
end
|
41
40
|
end
|
@@ -46,14 +45,13 @@ module Yolo
|
|
46
45
|
#
|
47
46
|
# @return [BOOL] returns if there is a new tag to build
|
48
47
|
def has_new_tag(name)
|
49
|
-
|
50
|
-
|
51
|
-
if yaml_tag == tag
|
48
|
+
set_project_name(name)
|
49
|
+
if yaml_tag == latest_tag
|
52
50
|
@formatter.no_new_tag
|
53
51
|
false
|
54
52
|
else
|
55
|
-
@formatter.new_tag(
|
56
|
-
update_tag(
|
53
|
+
@formatter.new_tag(latest_tag)
|
54
|
+
update_tag(latest_tag)
|
57
55
|
true
|
58
56
|
end
|
59
57
|
end
|
@@ -76,6 +74,12 @@ module Yolo
|
|
76
74
|
|
77
75
|
private
|
78
76
|
|
77
|
+
#
|
78
|
+
# Sets the current project name
|
79
|
+
#
|
80
|
+
def set_project_name(name)
|
81
|
+
self.project_name = name unless name.nil?
|
82
|
+
end
|
79
83
|
|
80
84
|
#
|
81
85
|
# Updates the tag history
|
@@ -1,5 +1,28 @@
|
|
1
1
|
require 'yolo/tasks'
|
2
2
|
|
3
3
|
describe Yolo::Tasks::Ios::OCUnit do
|
4
|
+
before do
|
5
|
+
@ocunit = Yolo::Tasks::Ios::OCUnit.new
|
6
|
+
end
|
4
7
|
|
8
|
+
describe "when created" do
|
9
|
+
it "should set the iphonesimulator as the default sdk" do
|
10
|
+
@ocunit.sdk.should eq("iphonesimulator")
|
11
|
+
end
|
12
|
+
|
13
|
+
it "should set junit as the default test output" do
|
14
|
+
@ocunit.test_output.should eq(:junit)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
describe "when building an options string" do
|
19
|
+
it "should append additional options" do
|
20
|
+
@ocunit.build_opts_string("one","two","three").should match(/one two three/)
|
21
|
+
end
|
22
|
+
|
23
|
+
it "should pipe output to ocunit2junit" do
|
24
|
+
@ocunit.test_output = :junit
|
25
|
+
@ocunit.build_opts_string.should match(/2>&1 | ocunit2junit/)
|
26
|
+
end
|
27
|
+
end
|
5
28
|
end
|
@@ -1,5 +1,177 @@
|
|
1
1
|
require 'yolo/tasks'
|
2
|
+
require 'yolo/tools'
|
3
|
+
require 'yolo/notify'
|
4
|
+
require "yolo/formatters"
|
5
|
+
require "yolo/config"
|
6
|
+
require "yolo/deployment"
|
7
|
+
require 'active_support/all'
|
2
8
|
|
3
9
|
describe Yolo::Tasks::Ios::Release do
|
10
|
+
before do
|
11
|
+
@xcode = mock(Yolo::Tools::Ios::Xcode)
|
12
|
+
@xcode.stub(:build_path)
|
13
|
+
Yolo::Tools::Ios::Xcode.stub(:new){@xcode}
|
4
14
|
|
15
|
+
@email = mock(Yolo::Notify::Ios::OTAEmail)
|
16
|
+
@email.stub(:send)
|
17
|
+
Yolo::Notify::Ios::OTAEmail.stub(:new){@email}
|
18
|
+
|
19
|
+
@ota = mock(Yolo::Deployment::OTA)
|
20
|
+
Yolo::Deployment::OTA.stub(:new){@ota}
|
21
|
+
|
22
|
+
Yolo::Config::Settings.instance.stub(:bundle_directory){"test_directory"}
|
23
|
+
|
24
|
+
Yolo::Formatters::ErrorFormatter.any_instance.stub(:puts)
|
25
|
+
Yolo::Formatters::ProgressFormatter.any_instance.stub(:puts)
|
26
|
+
|
27
|
+
@release = Yolo::Tasks::Ios::Release.new
|
28
|
+
|
29
|
+
@test_path = "blah/name-test/Build/Products/Debug-iphoneos/name.app"
|
30
|
+
@false_path = "blah/name-test/Build/Products/Release-iphoneos/name.app"
|
31
|
+
end
|
32
|
+
|
33
|
+
describe "when created" do
|
34
|
+
it "should set iphoneos as the default sdk" do
|
35
|
+
@release.sdk.should eq("iphoneos")
|
36
|
+
end
|
37
|
+
|
38
|
+
it "should set OTA as the default deployment" do
|
39
|
+
@release.deployment.should eq(:OTA)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
describe "when getting the app path" do
|
44
|
+
before do
|
45
|
+
@release.stub(:name){"name"}
|
46
|
+
end
|
47
|
+
|
48
|
+
it "should find the directory" do
|
49
|
+
Find.stub(:find).and_yield(@test_path)
|
50
|
+
File.stub(:mtime){Time.now}
|
51
|
+
@release.app_path.should eq(@test_path)
|
52
|
+
end
|
53
|
+
|
54
|
+
it "should find the latest directory" do
|
55
|
+
Find.stub(:find).and_yield(@test_path).and_yield(@false_path)
|
56
|
+
File.stub(:mtime).and_return(Time.now, Time.now - 1.day)
|
57
|
+
@release.app_path.should eq(@test_path)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
describe "when getting the dsym path" do
|
62
|
+
before do
|
63
|
+
@release.stub(:app_path){"path/to/test.app"}
|
64
|
+
end
|
65
|
+
|
66
|
+
it "should get the path from the app path" do
|
67
|
+
@release.dsym_path.should eq("path/to/test.app.dSYM")
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
describe "when getting the bundle path" do
|
72
|
+
before do
|
73
|
+
@release.stub(:folder_name){"folder"}
|
74
|
+
@release.stub(:version){"1.0"}
|
75
|
+
end
|
76
|
+
|
77
|
+
it "should generate the path" do
|
78
|
+
@release.bundle_path.should eq("test_directory/folder/1.0")
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
describe "when getting the folder name" do
|
83
|
+
before do
|
84
|
+
@release.stub(:name){"name"}
|
85
|
+
end
|
86
|
+
|
87
|
+
it "should append the configuration if present" do
|
88
|
+
@release.configuration = "Debug"
|
89
|
+
@release.folder_name.should eq("name-Debug")
|
90
|
+
end
|
91
|
+
|
92
|
+
it "should use the app name if no configuration is set" do
|
93
|
+
@release.configuration = nil
|
94
|
+
@release.folder_name.should eq("name")
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
describe "when getting the info plist path" do
|
99
|
+
before do
|
100
|
+
@release.stub(:name){"name"}
|
101
|
+
@path = "/path/to/name-Info.plist"
|
102
|
+
Find.stub(:find).and_yield(@path)
|
103
|
+
end
|
104
|
+
|
105
|
+
it "should find the plist" do
|
106
|
+
@release.info_plist_path.should eq(@path)
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
describe "when getting the version" do
|
111
|
+
before do
|
112
|
+
@xcode.stub(:info_plist_path=)
|
113
|
+
end
|
114
|
+
|
115
|
+
it "should get the version string from xcode" do
|
116
|
+
@xcode.stub(:version_number){"1.0"}
|
117
|
+
@xcode.stub(:build_number){"1.0"}
|
118
|
+
|
119
|
+
@release.version.should eq("1.0-1.0")
|
120
|
+
end
|
121
|
+
|
122
|
+
it "should use the current time if xcode cant find the version" do
|
123
|
+
@xcode.stub(:version_number){nil}
|
124
|
+
@xcode.stub(:build_number){nil}
|
125
|
+
|
126
|
+
@time = mock(Time)
|
127
|
+
Time.stub(:now){@time}
|
128
|
+
@time.stub(:day){"Monday"}
|
129
|
+
@time.stub(:month){"Jan"}
|
130
|
+
@time.stub(:year){"2013"}
|
131
|
+
@time.stub(:hour){"1"}
|
132
|
+
@time.stub(:min){"1"}
|
133
|
+
@time.stub(:sec){"1"}
|
134
|
+
|
135
|
+
@release.version.should eq("Monday-Jan-2013-1-1-1")
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
139
|
+
describe "when deploying" do
|
140
|
+
before do
|
141
|
+
@ota.stub(:deploy)
|
142
|
+
@release.stub(:version){"1.0"}
|
143
|
+
@release.stub(:name){"testname"}
|
144
|
+
end
|
145
|
+
|
146
|
+
it "should create a class from the deployment symbol" do
|
147
|
+
@ota.should_receive(:deploy)
|
148
|
+
@release.deploy("")
|
149
|
+
end
|
150
|
+
|
151
|
+
it "should not try and deploy a nil class" do
|
152
|
+
Yolo::Deployment::OTA.stub(:new){nil}
|
153
|
+
Yolo::Formatters::ErrorFormatter.any_instance.should_receive(:deployment_class_error)
|
154
|
+
@release.deploy("")
|
155
|
+
end
|
156
|
+
|
157
|
+
it "shouldnt build mail options without a url" do
|
158
|
+
@ota.stub(:deploy).and_yield(nil, nil)
|
159
|
+
@email.should_not_receive(:send)
|
160
|
+
@release.deploy("")
|
161
|
+
end
|
162
|
+
|
163
|
+
it "should build mail options once deployed" do
|
164
|
+
@release.mail_to = "test@test.com"
|
165
|
+
@ota.stub(:deploy).and_yield("url", "password")
|
166
|
+
@email.should_receive(:send).with(
|
167
|
+
{
|
168
|
+
:to => "test@test.com",
|
169
|
+
:ota_url => "url",
|
170
|
+
:subject=>"New testname build: 1.0",
|
171
|
+
:title=>"testname",
|
172
|
+
:ota_password=>"password"
|
173
|
+
})
|
174
|
+
@release.deploy("")
|
175
|
+
end
|
176
|
+
end
|
5
177
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yolo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.18
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -156,7 +156,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
156
156
|
version: '0'
|
157
157
|
requirements: []
|
158
158
|
rubyforge_project:
|
159
|
-
rubygems_version: 1.8.
|
159
|
+
rubygems_version: 1.8.24
|
160
160
|
signing_key:
|
161
161
|
specification_version: 3
|
162
162
|
summary: YOLO!
|