wox 0.0.1
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/.gitignore +4 -0
- data/Gemfile +4 -0
- data/Rakefile +2 -0
- data/lib/wox.rb +7 -0
- data/lib/wox/build_environment.rb +69 -0
- data/lib/wox/builder.rb +15 -0
- data/lib/wox/packager.rb +24 -0
- data/lib/wox/task.rb +17 -0
- data/lib/wox/tasks.rb +77 -0
- data/lib/wox/test_flight.rb +33 -0
- data/lib/wox/version.rb +3 -0
- data/wox.gemspec +22 -0
- metadata +92 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/Rakefile
ADDED
data/lib/wox.rb
ADDED
@@ -0,0 +1,69 @@
|
|
1
|
+
module Wox
|
2
|
+
module Environment
|
3
|
+
attr_reader :environment
|
4
|
+
def initialize environment
|
5
|
+
@environment = environment
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
class BuildEnvironment
|
10
|
+
attr_reader :info_plist, :build_dir, :default_sdk
|
11
|
+
|
12
|
+
def initialize options
|
13
|
+
options[:info_plist] ||= 'Resources/Info.plist'
|
14
|
+
options[:version] ||= Plist::parse_xml(options[:info_plist])['CFBundleVersion']
|
15
|
+
options[:build_dir] ||= 'build'
|
16
|
+
options[:sdk] ||= 'iphoneos'
|
17
|
+
options[:configuration] ||= 'Release'
|
18
|
+
@options = options
|
19
|
+
end
|
20
|
+
|
21
|
+
def apply options, &block
|
22
|
+
yield BuildEnvironment.new @options.merge(options)
|
23
|
+
end
|
24
|
+
|
25
|
+
def project_name
|
26
|
+
@project_name ||= xcodebuild_list.first.scan(/project\s\"([^\"]+)/i).flatten.first
|
27
|
+
end
|
28
|
+
|
29
|
+
def version
|
30
|
+
self[:version]
|
31
|
+
end
|
32
|
+
|
33
|
+
def full_name
|
34
|
+
"#{project_name} #{version}"
|
35
|
+
end
|
36
|
+
|
37
|
+
def sdks
|
38
|
+
@sdks ||= `xcodebuild -showsdks`.scan(/-sdk (.*?$)/m).flatten
|
39
|
+
end
|
40
|
+
|
41
|
+
def configurations
|
42
|
+
@configurations ||= begin
|
43
|
+
start_line = xcodebuild_list.find_index{ |l| l =~ /configurations/i } + 1
|
44
|
+
end_line = xcodebuild_list.find_index{ |l| l =~ /if no/i } - 1
|
45
|
+
xcodebuild_list.slice start_line...end_line
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def [](name)
|
50
|
+
fail "You need to specify :#{name} in Rakefile" unless @options[name]
|
51
|
+
@options[name]
|
52
|
+
end
|
53
|
+
|
54
|
+
def configuration_sym
|
55
|
+
self[:configuration].gsub(' ', '_').downcase
|
56
|
+
end
|
57
|
+
|
58
|
+
def ipa_file
|
59
|
+
File.join self[:build_dir], "#{project_name}-#{version}-#{configuration_sym}-#{self[:ipa_name]}.ipa"
|
60
|
+
end
|
61
|
+
|
62
|
+
private
|
63
|
+
|
64
|
+
def xcodebuild_list
|
65
|
+
@xcodebuild_list ||= `xcodebuild -list`.lines.map{|l| l.strip }.to_a
|
66
|
+
end
|
67
|
+
|
68
|
+
end
|
69
|
+
end
|
data/lib/wox/builder.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
module Wox
|
2
|
+
class Builder < Task
|
3
|
+
include Environment
|
4
|
+
# def initialize(environment); super end
|
5
|
+
|
6
|
+
def build
|
7
|
+
configuration = environment[:configuration]
|
8
|
+
puts "Building #{environment.full_name} configuration:#{configuration}"
|
9
|
+
|
10
|
+
log_file = File.join environment[:build_dir], "build-#{configuration}.log"
|
11
|
+
|
12
|
+
run_command "xcodebuild -target '#{environment.project_name}' -configuration #{configuration}", :results => log_file
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
data/lib/wox/packager.rb
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
module Wox
|
2
|
+
class Packager < Task
|
3
|
+
include Environment
|
4
|
+
|
5
|
+
def package
|
6
|
+
configuration, sdk, ipa_file, build_dir = environment[:configuration], environment[:sdk], environment.ipa_file, environment[:build_dir]
|
7
|
+
|
8
|
+
app_file = File.join build_dir, "#{configuration}-#{sdk}", "#{environment.project_name}.app"
|
9
|
+
fail "Couldn't find #{app_file}" unless File.exists? app_file
|
10
|
+
|
11
|
+
provisioning_profile_file = find_matching_mobile_provision environment[:provisioning_profile]
|
12
|
+
fail "Unable to find matching provisioning profile for '#{options[:provisioning_profile]}'" if provisioning_profile_file.empty?
|
13
|
+
|
14
|
+
puts "Creating #{ipa_file}"
|
15
|
+
log_file = File.join build_dir, "ipa.log"
|
16
|
+
run_command "xcrun -sdk #{sdk} PackageApplication -v '#{app_file}' -o '#{File.expand_path ipa_file}' --sign '#{environment[:developer_certificate]}' --embed '#{provisioning_profile_file}'", :results => log_file
|
17
|
+
end
|
18
|
+
|
19
|
+
def find_matching_mobile_provision match_text
|
20
|
+
`grep -rl '#{match_text}' '#{ENV['HOME']}/Library/MobileDevice/Provisioning\ Profiles/'`.strip
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
end
|
data/lib/wox/task.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
module Wox
|
2
|
+
class Task
|
3
|
+
def run_command text, options
|
4
|
+
result = `#{text}`
|
5
|
+
|
6
|
+
File.open(options[:results], "w") {|f| f.write result }
|
7
|
+
|
8
|
+
if $?.to_i == 0
|
9
|
+
puts "Success. Results in #{options[:results]}"
|
10
|
+
puts
|
11
|
+
else
|
12
|
+
system "cat #{options[:results]}"
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
data/lib/wox/tasks.rb
ADDED
@@ -0,0 +1,77 @@
|
|
1
|
+
require 'thor'
|
2
|
+
|
3
|
+
module Wox
|
4
|
+
module TasksScope
|
5
|
+
attr_reader :environment, :parent_task
|
6
|
+
def initialize environment, parent_task = nil
|
7
|
+
@environment = environment
|
8
|
+
@parent_task = parent_task
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
class Tasks
|
13
|
+
def self.create options = {}, &block
|
14
|
+
tasks = self.new(BuildEnvironment.new(options))
|
15
|
+
tasks.default_tasks
|
16
|
+
tasks.instance_eval &block if block_given?
|
17
|
+
end
|
18
|
+
|
19
|
+
include TasksScope
|
20
|
+
|
21
|
+
def default_tasks
|
22
|
+
namespace :info do
|
23
|
+
desc "List available sdks"
|
24
|
+
task :sdks do
|
25
|
+
puts environment.sdks.join("\n")
|
26
|
+
end
|
27
|
+
|
28
|
+
desc "List available configurations"
|
29
|
+
task :configurations do
|
30
|
+
puts environment.configurations.join("\n")
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def build name, options, &block
|
36
|
+
environment.apply options do |e|
|
37
|
+
t = nil
|
38
|
+
namespace :build do
|
39
|
+
desc "Build #{e.full_name} with #{e[:configuration]} configuration"
|
40
|
+
t = task(name) { Builder.new(e).build }
|
41
|
+
end
|
42
|
+
tasks = BuildTasks.new(e, t)
|
43
|
+
tasks.instance_eval &block if block_given?
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
class BuildTasks
|
49
|
+
include TasksScope
|
50
|
+
|
51
|
+
def ipa name, options, &block
|
52
|
+
environment.apply options.merge({:ipa_name => name}) do |e|
|
53
|
+
t = nil
|
54
|
+
namespace :ipa do
|
55
|
+
desc "Creates #{e.ipa_file}"
|
56
|
+
t = task(name => parent_task) { Packager.new(e).package }
|
57
|
+
end
|
58
|
+
|
59
|
+
tasks = IpaTasks.new(e, t)
|
60
|
+
tasks.instance_eval &block if block_given?
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
class IpaTasks
|
66
|
+
include TasksScope
|
67
|
+
|
68
|
+
def testflight name, options
|
69
|
+
environment.apply options do |e|
|
70
|
+
namespace :testflight do
|
71
|
+
desc "Publishes #{e.ipa_file} to testflight"
|
72
|
+
task(name => parent_task) { TestFlight.new(e).publish }
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
module Wox
|
2
|
+
class TestFlight < Task
|
3
|
+
include Environment
|
4
|
+
|
5
|
+
def notes
|
6
|
+
environment[:notes].respond_to?(:call) ? environment[:notes].call : environment[:notes]
|
7
|
+
end
|
8
|
+
|
9
|
+
def lists
|
10
|
+
environment[:notify].respond_to?(:join) ? environment[:notify].join(",") : environment[:notify]
|
11
|
+
end
|
12
|
+
|
13
|
+
def publish
|
14
|
+
args = {
|
15
|
+
:file => "@#{environment.ipa_file}",
|
16
|
+
:api_token => environment[:api_token],
|
17
|
+
:team_token => environment[:team_token],
|
18
|
+
:notes => notes
|
19
|
+
}
|
20
|
+
if environment[:notify]
|
21
|
+
args[:notify] = "True"
|
22
|
+
args[:distribution_lists] = lists
|
23
|
+
end
|
24
|
+
|
25
|
+
arg_string = args.map {|k,v| "-F #{k}='#{v}'"}.join(" ")
|
26
|
+
|
27
|
+
puts "Uploading ipa to TestFlight"
|
28
|
+
log_file = File.join environment[:build_dir], "testflight.log"
|
29
|
+
run_command "curl --progress-bar #{arg_string} http://testflightapp.com/api/builds.json", :results => log_file
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
end
|
data/lib/wox/version.rb
ADDED
data/wox.gemspec
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "wox/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "wox"
|
7
|
+
s.version = Wox::VERSION
|
8
|
+
s.platform = Gem::Platform::RUBY
|
9
|
+
s.authors = ["Dave Newman"]
|
10
|
+
s.email = ["dave@snappyco.de"]
|
11
|
+
s.homepage = ""
|
12
|
+
s.summary = %q{The Wizard of Xcode}
|
13
|
+
s.description = %q{Wox is a collection of build tasks that helps you build and publish iOS appicatinos}
|
14
|
+
|
15
|
+
s.rubyforge_project = "wox"
|
16
|
+
|
17
|
+
s.add_dependency "thor"
|
18
|
+
|
19
|
+
s.files = `git ls-files`.split("\n")
|
20
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
21
|
+
s.require_paths = ["lib"]
|
22
|
+
end
|
metadata
ADDED
@@ -0,0 +1,92 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: wox
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 29
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 1
|
10
|
+
version: 0.0.1
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Dave Newman
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2011-04-13 00:00:00 +10:00
|
19
|
+
default_executable:
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
name: thor
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
hash: 3
|
30
|
+
segments:
|
31
|
+
- 0
|
32
|
+
version: "0"
|
33
|
+
type: :runtime
|
34
|
+
version_requirements: *id001
|
35
|
+
description: Wox is a collection of build tasks that helps you build and publish iOS appicatinos
|
36
|
+
email:
|
37
|
+
- dave@snappyco.de
|
38
|
+
executables: []
|
39
|
+
|
40
|
+
extensions: []
|
41
|
+
|
42
|
+
extra_rdoc_files: []
|
43
|
+
|
44
|
+
files:
|
45
|
+
- .gitignore
|
46
|
+
- Gemfile
|
47
|
+
- Rakefile
|
48
|
+
- lib/wox.rb
|
49
|
+
- lib/wox/build_environment.rb
|
50
|
+
- lib/wox/builder.rb
|
51
|
+
- lib/wox/packager.rb
|
52
|
+
- lib/wox/task.rb
|
53
|
+
- lib/wox/tasks.rb
|
54
|
+
- lib/wox/test_flight.rb
|
55
|
+
- lib/wox/version.rb
|
56
|
+
- wox.gemspec
|
57
|
+
has_rdoc: true
|
58
|
+
homepage: ""
|
59
|
+
licenses: []
|
60
|
+
|
61
|
+
post_install_message:
|
62
|
+
rdoc_options: []
|
63
|
+
|
64
|
+
require_paths:
|
65
|
+
- lib
|
66
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
67
|
+
none: false
|
68
|
+
requirements:
|
69
|
+
- - ">="
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
hash: 3
|
72
|
+
segments:
|
73
|
+
- 0
|
74
|
+
version: "0"
|
75
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
76
|
+
none: false
|
77
|
+
requirements:
|
78
|
+
- - ">="
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
hash: 3
|
81
|
+
segments:
|
82
|
+
- 0
|
83
|
+
version: "0"
|
84
|
+
requirements: []
|
85
|
+
|
86
|
+
rubyforge_project: wox
|
87
|
+
rubygems_version: 1.5.3
|
88
|
+
signing_key:
|
89
|
+
specification_version: 3
|
90
|
+
summary: The Wizard of Xcode
|
91
|
+
test_files: []
|
92
|
+
|