tug 0.0.7 → 0.0.8

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3e1f066ca1ec2ee9e8bd50c118e4c886e6f40936
4
- data.tar.gz: 3e3c7568b877698ef35f68f3d9611917af5b2d4a
3
+ metadata.gz: 92525ca816fadaf365802e1ef27f74e35e725a0c
4
+ data.tar.gz: 76d77bbbe3c1a3ff2efe8516ac24a1ab6ad3d740
5
5
  SHA512:
6
- metadata.gz: 5a64c83652aebcb0292843ec17e68c6f52682e55e6a81d5d9953ffd2fd4dddef9201b1442c61c632a061a7f637ff820e97177176e1ec38aea688976f1ce51a18
7
- data.tar.gz: 730887b46c17cdd92250cbd769862879dc64ec5e3c6d2596e38cef986156522baeb38e64da963876771fc76e82fd9efa37d903c398667bbaaf877b51ebcb8131
6
+ metadata.gz: 621ec288ab99b7cba06746a73368e6e191a82891a78efd79eda15a7a4b70a06f29ec1af2e4282ed101db629492701b727345468371bc3a11c00849abf45e146b
7
+ data.tar.gz: d4774587818baf97de2c7b185d429081b6b7e33e30374132be5203f46307d365ce4ee703a74b246f46e8985888f59bf24cc41af861d19cd63002602632974354
data/README.md CHANGED
@@ -21,17 +21,7 @@ Or install it yourself as:
21
21
 
22
22
  $ gem install tug
23
23
 
24
- ## Usage
25
-
26
- ### Build
27
-
28
- Run `tug build` from your Xcode projects root directory. Each scheme in the scheme config array will be built.
29
-
30
- ### IPA
31
-
32
- Run `tug ipa` from your Xcode projects root directory, see the example config below for details on how to set a configuration and profile name. An ipa will be generated for each scheme in the config's scheme array.
33
-
34
- ### Config
24
+ ## Config
35
25
 
36
26
  tug will look in the current directory for a `.tug.yml` config file by default, use the `--config` option to pass a path to your config file if it's in a different folder.
37
27
 
@@ -45,7 +35,85 @@ project:
45
35
  ipa_config: Release # The configuration to use to build ipas
46
36
  ```
47
37
 
48
- ### Provisioning
38
+
39
+ ## Commands
40
+
41
+ ### Build
42
+
43
+ Build from your Xcode projects root directory. Each scheme in the scheme config array will be built.
44
+
45
+ ```
46
+ $ tug build
47
+ ```
48
+
49
+ ##### Options
50
+
51
+ ```
52
+ -c, [--config=CONFIG] # the tug config file to use (optional, defaults to .tug.yml)
53
+ ```
54
+
55
+ ### IPA
56
+
57
+ Generate an ipa from your Xcode projects root directory, see the example config below for details on how to set a configuration and profile name. An ipa will be generated for each scheme in the config's scheme array.
58
+
59
+ ```
60
+ $ tug ipa
61
+ ```
62
+
63
+ ##### Options
64
+
65
+ ```
66
+ -c, [--config=CONFIG] # the tug config file to use (optional, defaults to .tug.yml)
67
+ -e, [--export=EXPORT] # the directory to export the .ipa to (optional, defaults to current directory)
68
+ ```
69
+
70
+ ### Deploy
71
+
72
+ Distrubute your builds to external services using the `deploy` command
73
+
74
+ #### Testflight
75
+
76
+ ```
77
+ $ tug ipa
78
+ $ tug deploy testflight
79
+ ```
80
+
81
+
82
+ ###### Options
83
+
84
+ ```
85
+ -f, [--file=FILE] # path to an ipa to deploy (optional, searches current directory by default)
86
+ -a, [--api-token=API_TOKEN] # testflight api token (optional, environmental variable by default)
87
+ -t, [--team-token=TEAM_TOKEN] # testflight tea, token (optional, environmental variable by default)
88
+ -l, [--lists=LISTS] # testflight distrubution lists to send the buld to (optional, defaults to none)
89
+ -n, [--notify=NOTIFY] # notify testflight users of the new build (optional, defaults to false)
90
+ ```
91
+
92
+ >
93
+ > The following environment variables are used to set your testflight API and team tokens
94
+ > * `TUG_TESTFLIGHT_API_KEY`
95
+ > * `TUG_TESTFLIGHT_TEAM_KEY`
96
+
97
+ ### Provision
98
+
99
+ 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.
100
+
101
+ ```
102
+ $ tug provision
103
+ ```
104
+
105
+ ##### Options
106
+
107
+ ```
108
+ -c, [--config=CONFIG] # the tug config file to use (optional, defaults to .tug.yml)
109
+ -k, [--keychain=KEYCHAIN] # the keychain to install the certificates to (optional, defaults to tug)
110
+ -p, [--password=PASSWORD] # the password required to access your .p12 private key (optional, environment variable by default)
111
+ ```
112
+
113
+ > The following environment variable is used to set your .p12 private key password
114
+ > * `TUG_P12_PASSWORD`
115
+
116
+ #### Config
49
117
 
50
118
  Provisioning requires you to export the following files from your keychain and place them within your project directory:
51
119
 
@@ -54,7 +122,7 @@ Provisioning requires you to export the following files from your keychain and p
54
122
  * iPhone Distribution Private Key
55
123
  * Distribution Provisioning Profile
56
124
 
57
- Run `tug provision` to provision a new machine ready for signing ipas, provisioning requires a `keychain` object in the config yaml file to specify the path to the provisioning certificates and profile:
125
+ Provisioning also requires a `keychain` object in the config yaml file to specify the path to the exported provisioning certificates and profile:
58
126
 
59
127
  ```
60
128
  keychain:
@@ -64,15 +132,6 @@ keychain:
64
132
  private_key: certs/dist.p12
65
133
  ```
66
134
 
67
- #### Private Key Password
68
-
69
- If your `.p12` private key requires a password, you can either set the environment variable:
70
-
71
- `$ export TUG_P12_PASSWORD=yourpassword`
72
-
73
- or use the `--password` option when running the provision command:
74
-
75
- `$ tug provision --password yourpassword`
76
135
 
77
136
  ## Contributing
78
137
 
@@ -10,6 +10,8 @@ module Tug
10
10
  Tug::IpaCommand.new
11
11
  when "provision"
12
12
  Tug::ProvisionCommand.new
13
+ when "deploy"
14
+ Tug::DeployCommand.new
13
15
  else
14
16
  Tug::Command.new
15
17
  end
@@ -0,0 +1,49 @@
1
+ module Tug
2
+ class Deployer
3
+
4
+ attr_reader :ipa
5
+ attr_reader :api_token
6
+ attr_reader :team_token
7
+ attr_reader :lists
8
+ attr_reader :notify
9
+
10
+ class << self
11
+ def deployer(options)
12
+ Tug::Deployer.new(options)
13
+ end
14
+ end
15
+
16
+ def initialize(options)
17
+ @ipa = options[:file]
18
+ @lists = options[:lists]
19
+ @notify = options[:notify]
20
+ @api_token = options[:api_token]
21
+ @team_token = options[:team_token]
22
+ end
23
+
24
+ def deploy
25
+ IO.popen("curl #{url} -X POST -# #{params}") do |pipe|
26
+ puts pipe.read
27
+ end
28
+ end
29
+
30
+ private
31
+
32
+ def url
33
+ "http://testflightapp.com/api/builds.json"
34
+ end
35
+
36
+ def notes
37
+ "This build was uploaded via Tug"
38
+ end
39
+
40
+ def params
41
+ params = "-F file=@#{ipa} "
42
+ params += "-F api_token='#{api_token}' "
43
+ params += "-F team_token='#{team_token}' "
44
+ params += "-F notes='#{notes}' "
45
+ params += "-F distribution_lists='#{lists}' "
46
+ params += "-F notify=#{notify}"
47
+ end
48
+ end
49
+ end
@@ -1,4 +1,26 @@
1
1
  module Tug
2
+
3
+ class Deploy < Thor
4
+
5
+ desc "testflight", "deploy an ipa to testflight"
6
+ option :file, :aliases => "-f", :default => Dir.glob("*.ipa").first
7
+ option :api_token, :aliases => "-a", :default => ENV['TUG_TESTFLIGHT_API_TOKEN']
8
+ option :team_token, :aliases => "-t", :default => ENV['TUG_TESTFLIGHT_TEAM_TOKEN']
9
+ option :lists, :aliases => "-l"
10
+ option :notify, :aliases => "-n", :default => false
11
+ def testflight
12
+ deployer = Tug::Deployer.deployer(options)
13
+ deployer.deploy
14
+ end
15
+
16
+ no_commands do
17
+ def execute(config_file)
18
+ command = Tug::Command.command_for_string("deploy")
19
+ command.execute(config_file)
20
+ end
21
+ end
22
+ end
23
+
2
24
  class Interface < Thor
3
25
 
4
26
  desc "build", "build a project"
@@ -20,7 +42,7 @@ module Tug
20
42
  desc "provision", "provision system distrubution certificates and provisioning profile"
21
43
  option :config, :default => "#{Dir.pwd}/.tug.yml", :aliases => "-c"
22
44
  option :keychain, :default => "tug", :aliases => "-k"
23
- option :password, :aliases => "-p"
45
+ option :password, :aliases => "-p", :default => ENV['TUG_P12_PASSWORD']
24
46
  def provision
25
47
  config_file = Tug::ConfigFile.config_file(options[:config])
26
48
  config_file.keychain.name = options[:keychain]
@@ -28,6 +50,9 @@ module Tug
28
50
  execute(__method__.to_s, config_file)
29
51
  end
30
52
 
53
+ desc "deploy", "deploy an ipa to an external service"
54
+ subcommand "deploy", Deploy
55
+
31
56
  no_commands do
32
57
  def execute(command, config_file)
33
58
  command = Tug::Command.command_for_string(command)
@@ -21,6 +21,8 @@ module Tug
21
21
  @distribution_certificate = keychain_yaml["distribution_certificate"]
22
22
  @distribution_profile = keychain_yaml["distribution_profile"]
23
23
  @private_key = keychain_yaml["private_key"]
24
+
25
+ # these defaults are also set in Interface
24
26
  @private_key_password = ENV['TUG_P12_PASSWORD']
25
27
  @name = "tug"
26
28
  end
@@ -6,7 +6,7 @@ module Tug
6
6
  class << self
7
7
  def tool_for_config(config)
8
8
  case config.downcase
9
- when "inhouse", "release"
9
+ when "inhouse", "release", /release/, /inhouse/
10
10
  Tug::XCToolArchive.new(config)
11
11
  else
12
12
  Tug::XCToolBuild.new(config)
data/lib/tug/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Tug
2
- VERSION = "0.0.7"
2
+ VERSION = "0.0.8"
3
3
  end
data/lib/tug.rb CHANGED
@@ -21,4 +21,6 @@ require "tug/tool/xctool"
21
21
  require "tug/tool/xctool_build"
22
22
  require "tug/tool/xctool_archive"
23
23
 
24
- require "tug/keychain/keychain"
24
+ require "tug/keychain/keychain"
25
+
26
+ require "tug/deployment/deployer"
@@ -0,0 +1,59 @@
1
+ require 'spec_helper'
2
+
3
+ describe Tug::Deployer do
4
+
5
+ before(:each) do
6
+ @options = {
7
+ :api_token => "api_token",
8
+ :team_token => "team_token",
9
+ :file => "test.ipa",
10
+ :notify => true
11
+ }
12
+
13
+ @deployer = Tug::Deployer.deployer(@options)
14
+ end
15
+
16
+ describe "when returning a deployer" do
17
+ it "should return a default deployer" do
18
+ expect(Tug::Deployer.deployer(@options)).to be_kind_of(Tug::Deployer)
19
+ end
20
+ end
21
+
22
+ describe "when deploying" do
23
+
24
+ it "should send to testflight by default" do
25
+ expect(IO).to receive(:popen).with(/http:\/\/testflightapp.com\/api\/builds.json/)
26
+ @deployer.deploy
27
+ end
28
+
29
+ it "should send the ipa as a param" do
30
+ expect(IO).to receive(:popen).with(/-F file=@test.ipa/)
31
+ @deployer.deploy
32
+ end
33
+
34
+ it "should send the team token as a param" do
35
+ expect(IO).to receive(:popen).with(/-F team_token='team_token'/)
36
+ @deployer.deploy
37
+ end
38
+
39
+ it "should send the api token as a param" do
40
+ expect(IO).to receive(:popen).with(/-F api_token='api_token'/)
41
+ @deployer.deploy
42
+ end
43
+
44
+ it "should have some release notes" do
45
+ expect(IO).to receive(:popen).with(/-F notes='This build was uploaded via Tug'/)
46
+ @deployer.deploy
47
+ end
48
+
49
+ it "should have lists" do
50
+ expect(IO).to receive(:popen).with(/-F distribution_lists=''/)
51
+ @deployer.deploy
52
+ end
53
+
54
+ it "should notify" do
55
+ expect(IO).to receive(:popen).with(/-F notify=true/)
56
+ @deployer.deploy
57
+ end
58
+ end
59
+ end
data/spec/xctool_spec.rb CHANGED
@@ -11,5 +11,15 @@ describe Tug::XCTool do
11
11
  xctool = Tug::XCTool.tool_for_config("InHouse")
12
12
  expect(xctool).to be_kind_of(Tug::XCToolArchive)
13
13
  end
14
+
15
+ it "should return an archive tool when release is in the config" do
16
+ xctool = Tug::XCTool.tool_for_config("TestRelease")
17
+ expect(xctool).to be_kind_of(Tug::XCToolArchive)
18
+ end
19
+
20
+ it "should return an archive tool when inhouse is in the config" do
21
+ xctool = Tug::XCTool.tool_for_config("TestInHouse")
22
+ expect(xctool).to be_kind_of(Tug::XCToolArchive)
23
+ end
14
24
  end
15
25
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tug
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Fish
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-29 00:00:00.000000000 Z
11
+ date: 2014-09-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -106,6 +106,7 @@ files:
106
106
  - lib/tug/config/.tug.yml
107
107
  - lib/tug/config/config_file.rb
108
108
  - lib/tug/config/missing_config_file.rb
109
+ - lib/tug/deployment/deployer.rb
109
110
  - lib/tug/interface/interface.rb
110
111
  - lib/tug/keychain/keychain.rb
111
112
  - lib/tug/project/project.rb
@@ -117,6 +118,7 @@ files:
117
118
  - spec/build_command_spec.rb
118
119
  - spec/command_spec.rb
119
120
  - spec/config_file_spec.rb
121
+ - spec/deployer_spec.rb
120
122
  - spec/ipa_command_spec.rb
121
123
  - spec/keychain_spec.rb
122
124
  - spec/output.txt
@@ -152,6 +154,7 @@ test_files:
152
154
  - spec/build_command_spec.rb
153
155
  - spec/command_spec.rb
154
156
  - spec/config_file_spec.rb
157
+ - spec/deployer_spec.rb
155
158
  - spec/ipa_command_spec.rb
156
159
  - spec/keychain_spec.rb
157
160
  - spec/output.txt