blast_off 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: e7b002afbfb51f56c01ff7f590d4cd4cd626b3fe
4
+ data.tar.gz: cee6323c3969bc87fc61737ed14b2514bd3a5867
5
+ SHA512:
6
+ metadata.gz: 95fc1ab54143e4587eae88e6b8a8b4dfecf77daf711c381c6f283347abf70511bc4384ac4e2ec05306f088204c941e882d9e2ea686f592ed68462cccdf6b882a
7
+ data.tar.gz: 6e8bc0a7a1d12dbecc2ab83c08f7221cdca5d6c55cae66710f9444eac466513b06722567e1589939b37c0eb8fbed56b4f15bec6dcfc93900e57bb91c7294d2ed
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --color
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in blast_off.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Jun Lin
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,72 @@
1
+ # BlastOff
2
+
3
+ An iOS beta distribution tool.
4
+
5
+ Supported services:
6
+
7
+ * Qiniu(http://qiniu.com)
8
+
9
+ ## Installation
10
+
11
+ Add this line to your application's Gemfile:
12
+
13
+ gem 'blast_off'
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install blast_off
22
+
23
+ ## Usage
24
+
25
+ ```
26
+ NAME
27
+ blast_off - An iOS beta distribution tool.
28
+
29
+ SYNOPSIS
30
+ blast_off [global options] command [command options] [arguments...]
31
+
32
+ VERSION
33
+ 0.0.1
34
+
35
+ GLOBAL OPTIONS
36
+ --help - Show this message
37
+ --version - Display the program version
38
+
39
+ COMMANDS
40
+ help - Shows a list of commands or help for one command
41
+ qiniu - Qiniu
42
+ ```
43
+
44
+ ## Services
45
+
46
+ ### Qiniu
47
+
48
+ ```
49
+ NAME
50
+ qiniu - Qiniu
51
+
52
+ SYNOPSIS
53
+ blast_off [global options] qiniu [command options]
54
+
55
+ COMMAND OPTIONS
56
+ --access_key=arg - Access Key (default: none)
57
+ --bucket=arg - bucket (default: none)
58
+ --ipa_file_path=arg - IPA file path (default: none)
59
+ --secret_key=arg - Secret Key (default: none)
60
+ ```
61
+
62
+ Example:
63
+
64
+ `$ blast_off qiniu --ipa_file_path=Foobar.ipa --bucket=foobar --access_key=$QINIU_ACCESS_KEY --secret_key=$QINIU_SECRET_KEY`
65
+
66
+ ## Contributing
67
+
68
+ 1. Fork it
69
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
70
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
71
+ 4. Push to the branch (`git push origin my-new-feature`)
72
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,7 @@
1
+ require "bundler/gem_tasks"
2
+ require 'rspec/core/rake_task'
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task default: :spec
7
+
data/bin/blast_off ADDED
@@ -0,0 +1,56 @@
1
+ #!/usr/bin/env ruby
2
+ require 'gli'
3
+ require 'blast_off'
4
+
5
+ include GLI::App
6
+
7
+ program_desc 'An iOS beta distribution tool.'
8
+
9
+ version BlastOff::VERSION
10
+
11
+ desc 'Qiniu'
12
+ command :qiniu do |c|
13
+ c.desc 'IPA file path'
14
+ c.flag :ipa_file_path
15
+
16
+ c.desc 'Access Key'
17
+ c.flag :access_key
18
+
19
+ c.desc 'Secret Key'
20
+ c.flag :secret_key
21
+
22
+ c.desc 'bucket'
23
+ c.flag :bucket
24
+
25
+ c.action do |global_options, options, args|
26
+ help_now!('IPA file is required') unless options[:ipa_file_path]
27
+ help_now!('Access Key is required') unless options[:access_key]
28
+ help_now!('Secret Key is required') unless options[:secret_key]
29
+ help_now!('Bucket is required') unless options[:bucket]
30
+
31
+ BlastOff::Services::Qiniu.new(
32
+ ipa_file_path: options[:ipa_file_path],
33
+ access_key: options[:access_key],
34
+ secret_key: options[:secret_key],
35
+ bucket: options[:bucket]
36
+ ).distribute
37
+ end
38
+ end
39
+
40
+ pre do |global,command,options,args|
41
+ true
42
+ end
43
+
44
+ post do |global,command,options,args|
45
+ # Post logic here
46
+ # Use skips_post before a command to skip this
47
+ # block on that command only
48
+ end
49
+
50
+ on_error do |exception|
51
+ # Error logic here
52
+ # return false to skip default error handling
53
+ true
54
+ end
55
+
56
+ exit run(ARGV)
data/blast_off.gemspec ADDED
@@ -0,0 +1,29 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'blast_off/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "blast_off"
8
+ spec.version = BlastOff::VERSION
9
+ spec.authors = ["Jun Lin"]
10
+ spec.email = ["linjunpop@gmail.com"]
11
+ spec.description = "An iOS beta distribution tool."
12
+ spec.summary = "An iOS beta distribution tool."
13
+ spec.homepage = "https://github.com/linjunpop/blast_off"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.3"
22
+ spec.add_development_dependency "rake"
23
+ spec.add_development_dependency "rspec", '~> 2.14'
24
+
25
+ spec.add_runtime_dependency 'gli','~> 2.8.1'
26
+ spec.add_runtime_dependency 'qiniu-rs', '~> 3.4.6'
27
+ spec.add_runtime_dependency 'rainbow', '~> 1.1.4'
28
+ spec.add_runtime_dependency 'ipa_reader', '~> 0.7.1'
29
+ end
@@ -0,0 +1,90 @@
1
+ require 'tempfile'
2
+ require 'qiniu-rs'
3
+
4
+ module BlastOff
5
+ module Services
6
+ class Qiniu
7
+ def initialize(ipa_file_path:nil, access_key:'', secret_key:'', bucket:'')
8
+ @ipa_file_path = ipa_file_path
9
+ @ipa_file = ::IpaReader::IpaFile.new(ipa_file_path)
10
+ @qiniu_bucket = bucket
11
+
12
+ ::Qiniu::RS.establish_connection!(
13
+ access_key: access_key,
14
+ secret_key: secret_key
15
+ )
16
+ end
17
+
18
+ def distribute
19
+ manifest_file = Tempfile.new('manifest')
20
+ begin
21
+ manifest_file.write(manifest_template)
22
+ manifest_file.rewind
23
+ upload(manifest_file.path, 'manifest.plist')
24
+ ensure
25
+ manifest_file.close
26
+ manifest_file.unlink
27
+ end
28
+
29
+ html_file = Tempfile.new('html')
30
+ begin
31
+ html_file.write(html_template)
32
+ html_file.rewind
33
+ upload(html_file.path, 'index.html')
34
+ ensure
35
+ html_file.close
36
+ html_file.unlink
37
+ end
38
+
39
+ upload(@ipa_file_path, "#{@ipa_file.name}.ipa")
40
+
41
+ puts "#{base_url}/index.html".foreground(:white).background(:blue)
42
+ end
43
+
44
+ private
45
+
46
+ def base_path
47
+ "#{@ipa_file.name}/#{@ipa_file.version}"
48
+ end
49
+
50
+ def base_url
51
+ "http://#{@qiniu_bucket}.qiniudn.com/#{base_path}"
52
+ end
53
+
54
+ def upload(file, key)
55
+ upload_token = ::Qiniu::RS.generate_upload_token scope: @qiniu_bucket
56
+
57
+ ::Qiniu::RS.upload_file uptoken: upload_token,
58
+ file: file,
59
+ bucket: @qiniu_bucket,
60
+ key: "#{base_path}/#{key}"
61
+ end
62
+
63
+ def manifest_template
64
+ {
65
+ items: [
66
+ assets: [
67
+ {
68
+ kind: 'software-package',
69
+ url: "#{base_url}/#{@ipa_file.name}.ipa"
70
+ }
71
+ ],
72
+ metadata: {
73
+ 'bundle-identifier' => @ipa_file.bundle_identifier,
74
+ 'bundle-version' => @ipa_file.version,
75
+ kind: 'software',
76
+ title: @ipa_file.name
77
+ }
78
+ ]
79
+ }.to_plist
80
+ end
81
+
82
+ def html_template
83
+ html_content = <<-EOS
84
+ <a href="itms-services://?action=download-manifest&url=#{base_url}/manifest.plist">Download</a>
85
+ EOS
86
+ end
87
+
88
+ end
89
+ end
90
+ end
@@ -0,0 +1,6 @@
1
+ require_relative 'services/qiniu'
2
+
3
+ module BlastOff
4
+ module Services
5
+ end
6
+ end
@@ -0,0 +1,3 @@
1
+ module BlastOff
2
+ VERSION = "0.0.1"
3
+ end
data/lib/blast_off.rb ADDED
@@ -0,0 +1,9 @@
1
+ require 'rainbow'
2
+ require 'ipa_reader'
3
+
4
+ require "blast_off/version"
5
+ require "blast_off/services"
6
+
7
+ module BlastOff
8
+ end
9
+
@@ -0,0 +1,4 @@
1
+ require 'spec_helper'
2
+
3
+ describe BlastOff::Services::Qiniu do
4
+ end
@@ -0,0 +1,3 @@
1
+ require 'rspec/autorun'
2
+ require 'blast_off'
3
+
metadata ADDED
@@ -0,0 +1,160 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: blast_off
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Jun Lin
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-11-12 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.3'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.3'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ~>
46
+ - !ruby/object:Gem::Version
47
+ version: '2.14'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: '2.14'
55
+ - !ruby/object:Gem::Dependency
56
+ name: gli
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: 2.8.1
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ~>
67
+ - !ruby/object:Gem::Version
68
+ version: 2.8.1
69
+ - !ruby/object:Gem::Dependency
70
+ name: qiniu-rs
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ~>
74
+ - !ruby/object:Gem::Version
75
+ version: 3.4.6
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ~>
81
+ - !ruby/object:Gem::Version
82
+ version: 3.4.6
83
+ - !ruby/object:Gem::Dependency
84
+ name: rainbow
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ~>
88
+ - !ruby/object:Gem::Version
89
+ version: 1.1.4
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ~>
95
+ - !ruby/object:Gem::Version
96
+ version: 1.1.4
97
+ - !ruby/object:Gem::Dependency
98
+ name: ipa_reader
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ~>
102
+ - !ruby/object:Gem::Version
103
+ version: 0.7.1
104
+ type: :runtime
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ~>
109
+ - !ruby/object:Gem::Version
110
+ version: 0.7.1
111
+ description: An iOS beta distribution tool.
112
+ email:
113
+ - linjunpop@gmail.com
114
+ executables:
115
+ - blast_off
116
+ extensions: []
117
+ extra_rdoc_files: []
118
+ files:
119
+ - .gitignore
120
+ - .rspec
121
+ - Gemfile
122
+ - LICENSE.txt
123
+ - README.md
124
+ - Rakefile
125
+ - bin/blast_off
126
+ - blast_off.gemspec
127
+ - lib/blast_off.rb
128
+ - lib/blast_off/services.rb
129
+ - lib/blast_off/services/qiniu.rb
130
+ - lib/blast_off/version.rb
131
+ - spec/blast_off/services/qiniu_spec.rb
132
+ - spec/spec_helper.rb
133
+ homepage: https://github.com/linjunpop/blast_off
134
+ licenses:
135
+ - MIT
136
+ metadata: {}
137
+ post_install_message:
138
+ rdoc_options: []
139
+ require_paths:
140
+ - lib
141
+ required_ruby_version: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - '>='
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ required_rubygems_version: !ruby/object:Gem::Requirement
147
+ requirements:
148
+ - - '>='
149
+ - !ruby/object:Gem::Version
150
+ version: '0'
151
+ requirements: []
152
+ rubyforge_project:
153
+ rubygems_version: 2.1.10
154
+ signing_key:
155
+ specification_version: 4
156
+ summary: An iOS beta distribution tool.
157
+ test_files:
158
+ - spec/blast_off/services/qiniu_spec.rb
159
+ - spec/spec_helper.rb
160
+ has_rdoc: