tug 0.1.2 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Gemfile.lock +1 -1
- data/README.md +2 -0
- data/lib/tug/config/.tug.yml +1 -1
- data/lib/tug/config/config_file.rb +2 -2
- data/lib/tug/interface/interface.rb +13 -1
- data/lib/tug/notify/slack.rb +31 -0
- data/lib/tug/version.rb +1 -1
- data/lib/tug.rb +4 -1
- data/spec/keychain_spec.rb +2 -2
- data/spec/slack_spec.rb +32 -0
- data/spec/spec_helper.rb +28 -8
- metadata +5 -2
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -129,6 +129,8 @@ $ tug deploy hockeyapp
|
|
129
129
|
|
130
130
|
### Provision
|
131
131
|
|
132
|
+
> :warning: Beware of running this command on a local dev machine, this should only be run on CI servers as your keychain is altered.
|
133
|
+
|
132
134
|
Tug can provision a new machine ready for signing ipas by installing the certificates and provisioning profile required for generating a signed ipa of your application, this is very useful for CI environments like Travis.
|
133
135
|
|
134
136
|
```
|
data/lib/tug/config/.tug.yml
CHANGED
@@ -108,7 +108,19 @@ module Tug
|
|
108
108
|
execute(__method__.to_s, config_file)
|
109
109
|
end
|
110
110
|
|
111
|
-
desc "
|
111
|
+
desc "notify", "notify your team via slack"
|
112
|
+
option :message,
|
113
|
+
:aliases => "-m",
|
114
|
+
:required => true
|
115
|
+
option :webhook_url,
|
116
|
+
:aliases => "-w",
|
117
|
+
:default => ENV['TUG_SLACK_WEBHOOK_URL']
|
118
|
+
def notify
|
119
|
+
slack = Tug::Slack.new(options)
|
120
|
+
slack.notify(options[:message])
|
121
|
+
end
|
122
|
+
|
123
|
+
desc "provision", "provision system distrubution certificates and provisioning profile, don't run this on a local dev machine"
|
112
124
|
option :config,
|
113
125
|
:default => "#{Dir.pwd}/.tug.yml",
|
114
126
|
:aliases => "-c"
|
@@ -0,0 +1,31 @@
|
|
1
|
+
module Tug
|
2
|
+
class Slack
|
3
|
+
|
4
|
+
attr_accessor :url
|
5
|
+
|
6
|
+
def initialize(options)
|
7
|
+
@url = options[:webhook_url]
|
8
|
+
end
|
9
|
+
|
10
|
+
def notify(text)
|
11
|
+
unless @url.nil?
|
12
|
+
IO.popen("curl #{@url} -X POST -# #{params(text)}") do |pipe|
|
13
|
+
puts pipe.read
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
def params(text)
|
21
|
+
"-F payload='#{payload(text).to_json}'"
|
22
|
+
end
|
23
|
+
|
24
|
+
def payload(text)
|
25
|
+
{
|
26
|
+
"text" => text,
|
27
|
+
"color"=> "good",
|
28
|
+
}
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
data/lib/tug/version.rb
CHANGED
data/lib/tug.rb
CHANGED
@@ -2,6 +2,7 @@ require "optparse"
|
|
2
2
|
require 'yaml'
|
3
3
|
require 'thor'
|
4
4
|
require 'fileutils'
|
5
|
+
require 'json'
|
5
6
|
|
6
7
|
require "tug/version"
|
7
8
|
|
@@ -30,4 +31,6 @@ require "tug/deployment/deployer"
|
|
30
31
|
require "tug/deployment/testflight"
|
31
32
|
require "tug/deployment/hockeyapp"
|
32
33
|
require "tug/deployment/notes_parser"
|
33
|
-
require "tug/deployment/notes_file_parser"
|
34
|
+
require "tug/deployment/notes_file_parser"
|
35
|
+
|
36
|
+
require "tug/notify/slack"
|
data/spec/keychain_spec.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
|
-
describe Tug::Keychain do
|
3
|
+
describe Tug::Keychain do
|
4
4
|
|
5
5
|
before(:each) do
|
6
6
|
@yaml = keychain_yaml
|
@@ -104,7 +104,7 @@ describe Tug::Keychain do
|
|
104
104
|
end
|
105
105
|
|
106
106
|
describe "when importing profiles" do
|
107
|
-
|
107
|
+
|
108
108
|
before(:each) do
|
109
109
|
allow(FileUtils).to receive(:mkdir_p)
|
110
110
|
end
|
data/spec/slack_spec.rb
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Tug::Slack do
|
4
|
+
|
5
|
+
before(:each) do
|
6
|
+
@options = {:webhook_url => "slack_url"}
|
7
|
+
@slack = Tug::Slack.new(@options)
|
8
|
+
end
|
9
|
+
|
10
|
+
describe "when notifying" do
|
11
|
+
it "should send a payload to slack with text" do
|
12
|
+
expect(IO).to receive(:popen).with(/"text\":\"text\"/)
|
13
|
+
@slack.notify("text")
|
14
|
+
end
|
15
|
+
|
16
|
+
it "should send a payload to slack with a color" do
|
17
|
+
expect(IO).to receive(:popen).with(/\"color\":\"good\"/)
|
18
|
+
@slack.notify("text")
|
19
|
+
end
|
20
|
+
|
21
|
+
it "should send a payload with the webhook url" do
|
22
|
+
expect(IO).to receive(:popen).with(/slack_url/)
|
23
|
+
@slack.notify("text")
|
24
|
+
end
|
25
|
+
|
26
|
+
it "shouldn't send a payload if missing a url" do
|
27
|
+
slack = Tug::Slack.new({"foo" => "bar"})
|
28
|
+
expect(IO).to_not receive(:popen)
|
29
|
+
slack.notify("text")
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -5,17 +5,37 @@ CodeClimate::TestReporter.start
|
|
5
5
|
|
6
6
|
module Helpers
|
7
7
|
def project_yaml
|
8
|
-
{
|
9
|
-
"
|
10
|
-
|
11
|
-
|
8
|
+
{
|
9
|
+
"project" =>
|
10
|
+
{
|
11
|
+
"workspace" => "workspace",
|
12
|
+
"schemes" => ["scheme"],
|
13
|
+
"ipa_config" => "config",
|
14
|
+
"ipa_profile" => "profile"
|
15
|
+
}
|
16
|
+
}
|
12
17
|
end
|
13
18
|
|
14
19
|
def keychain_yaml
|
15
|
-
{
|
16
|
-
|
17
|
-
|
18
|
-
|
20
|
+
{
|
21
|
+
"keychain" =>
|
22
|
+
{
|
23
|
+
"apple_certificate" => "apple",
|
24
|
+
"distribution_certificate" => "dist",
|
25
|
+
"distribution_profile" => "path/to/profile",
|
26
|
+
"private_key" => "private"
|
27
|
+
}
|
28
|
+
}
|
29
|
+
end
|
30
|
+
|
31
|
+
def slack_yaml
|
32
|
+
{
|
33
|
+
"slack" =>
|
34
|
+
{
|
35
|
+
"team" => "slack_team",
|
36
|
+
"channel" => "#slack_channel"
|
37
|
+
}
|
38
|
+
}
|
19
39
|
end
|
20
40
|
|
21
41
|
def release_notes_path
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tug
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-01-
|
12
|
+
date: 2015-01-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: thor
|
@@ -143,6 +143,7 @@ files:
|
|
143
143
|
- lib/tug/deployment/testflight.rb
|
144
144
|
- lib/tug/interface/interface.rb
|
145
145
|
- lib/tug/keychain/keychain.rb
|
146
|
+
- lib/tug/notify/slack.rb
|
146
147
|
- lib/tug/project/project.rb
|
147
148
|
- lib/tug/tool/xcode_build.rb
|
148
149
|
- lib/tug/tool/xctool.rb
|
@@ -162,6 +163,7 @@ files:
|
|
162
163
|
- spec/output.txt
|
163
164
|
- spec/project_spec.rb
|
164
165
|
- spec/release_notes_spec.rb
|
166
|
+
- spec/slack_spec.rb
|
165
167
|
- spec/spec_helper.rb
|
166
168
|
- spec/test_notes.txt
|
167
169
|
- spec/test_special_notes.txt
|
@@ -207,6 +209,7 @@ test_files:
|
|
207
209
|
- spec/output.txt
|
208
210
|
- spec/project_spec.rb
|
209
211
|
- spec/release_notes_spec.rb
|
212
|
+
- spec/slack_spec.rb
|
210
213
|
- spec/spec_helper.rb
|
211
214
|
- spec/test_notes.txt
|
212
215
|
- spec/test_special_notes.txt
|