fwtoolkit 2.0.2 → 2.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/fwtoolkit/cli.rb +0 -11
- data/lib/fwtoolkit/cli/project.rb +3 -2
- data/lib/fwtoolkit/version.rb +1 -1
- data/templates/{swift_project/xcode/.DS_Store → .DS_Store} +0 -0
- data/templates/objc_project/xcode/%project_name%/%project_name%.xcodeproj/project.pbxproj.tt +5 -1
- data/templates/objc_project/xcode/%project_name%/%project_name%.xcodeproj/xcshareddata/xcschemes/%project_name%.xcscheme.tt +1 -1
- data/templates/objc_project/xcode/%project_name%/%target_name%/%class_prefix%AppDelegate.h.tt +1 -2
- data/templates/objc_project/xcode/%project_name%/%target_name%/%class_prefix%AppDelegate.m.tt +1 -2
- data/templates/objc_project/xcode/%project_name%/%target_name%/%class_prefix%ViewController.h.tt +1 -2
- data/templates/objc_project/xcode/%project_name%/%target_name%/%class_prefix%ViewController.m.tt +1 -2
- data/templates/objc_project/xcode/%project_name%/%target_name%/Resources/Assets.xcassets/AppIcon.appiconset/Contents.json +91 -7
- data/templates/objc_project/xcode/%project_name%/%target_name%/Resources/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png +0 -0
- data/templates/objc_project/xcode/%project_name%/%target_name%/Resources/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png +0 -0
- data/templates/objc_project/xcode/%project_name%/%target_name%/Resources/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png +0 -0
- data/templates/objc_project/xcode/%project_name%/%target_name%/Resources/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png +0 -0
- data/templates/objc_project/xcode/%project_name%/%target_name%/Resources/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png +0 -0
- data/templates/objc_project/xcode/%project_name%/%target_name%/Resources/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png +0 -0
- data/templates/objc_project/xcode/%project_name%/%target_name%/Resources/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png +0 -0
- data/templates/objc_project/xcode/%project_name%/%target_name%/Resources/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png +0 -0
- data/templates/objc_project/xcode/%project_name%/%target_name%/Resources/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png +0 -0
- data/templates/objc_project/xcode/%project_name%/%target_name%/Resources/Assets.xcassets/AppIcon.appiconset/Icon-App-57x57@1x.png +0 -0
- data/templates/objc_project/xcode/%project_name%/%target_name%/Resources/Assets.xcassets/AppIcon.appiconset/Icon-App-57x57@2x.png +0 -0
- data/templates/objc_project/xcode/%project_name%/%target_name%/Resources/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png +0 -0
- data/templates/objc_project/xcode/%project_name%/%target_name%/Resources/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png +0 -0
- data/templates/objc_project/xcode/%project_name%/%target_name%/Resources/Assets.xcassets/AppIcon.appiconset/Icon-App-72x72@1x.png +0 -0
- data/templates/objc_project/xcode/%project_name%/%target_name%/Resources/Assets.xcassets/AppIcon.appiconset/Icon-App-72x72@2x.png +0 -0
- data/templates/objc_project/xcode/%project_name%/%target_name%/Resources/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png +0 -0
- data/templates/objc_project/xcode/%project_name%/%target_name%/Resources/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png +0 -0
- data/templates/objc_project/xcode/%project_name%/%target_name%/Resources/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png +0 -0
- data/templates/objc_project/xcode/%project_name%/%target_name%/Resources/Assets.xcassets/AppIcon.appiconset/Icon-Small-50x50@1x.png +0 -0
- data/templates/objc_project/xcode/%project_name%/%target_name%/Resources/Assets.xcassets/AppIcon.appiconset/Icon-Small-50x50@2x.png +0 -0
- data/templates/objc_project/xcode/%project_name%/%target_name%/Supporting Files/main.m.tt +1 -2
- data/templates/objc_project/xcode/%project_name%/%target_name%Tests/%class_prefix%%project_name%Tests.m.tt +1 -3
- data/templates/swift_project/xcode/%project_name%/%project_name%.xcodeproj/project.pbxproj.tt +12 -1
- data/templates/swift_project/xcode/%project_name%/%project_name%.xcodeproj/xcshareddata/xcschemes/%project_name%.xcscheme.tt +1 -1
- data/templates/swift_project/xcode/%project_name%/%target_name%/AppDelegate.swift.tt +7 -8
- data/templates/swift_project/xcode/%project_name%/%target_name%/Resources/Assets.xcassets/AppIcon.appiconset/Contents.json +87 -8
- data/templates/swift_project/xcode/%project_name%/%target_name%/Resources/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png +0 -0
- data/templates/swift_project/xcode/%project_name%/%target_name%/Resources/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png +0 -0
- data/templates/swift_project/xcode/%project_name%/%target_name%/Resources/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png +0 -0
- data/templates/swift_project/xcode/%project_name%/%target_name%/Resources/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png +0 -0
- data/templates/swift_project/xcode/%project_name%/%target_name%/Resources/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png +0 -0
- data/templates/swift_project/xcode/%project_name%/%target_name%/Resources/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png +0 -0
- data/templates/swift_project/xcode/%project_name%/%target_name%/Resources/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png +0 -0
- data/templates/swift_project/xcode/%project_name%/%target_name%/Resources/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png +0 -0
- data/templates/swift_project/xcode/%project_name%/%target_name%/Resources/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png +0 -0
- data/templates/swift_project/xcode/%project_name%/%target_name%/Resources/Assets.xcassets/AppIcon.appiconset/Icon-App-57x57@1x.png +0 -0
- data/templates/swift_project/xcode/%project_name%/%target_name%/Resources/Assets.xcassets/AppIcon.appiconset/Icon-App-57x57@2x.png +0 -0
- data/templates/swift_project/xcode/%project_name%/%target_name%/Resources/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png +0 -0
- data/templates/swift_project/xcode/%project_name%/%target_name%/Resources/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png +0 -0
- data/templates/swift_project/xcode/%project_name%/%target_name%/Resources/Assets.xcassets/AppIcon.appiconset/Icon-App-72x72@1x.png +0 -0
- data/templates/swift_project/xcode/%project_name%/%target_name%/Resources/Assets.xcassets/AppIcon.appiconset/Icon-App-72x72@2x.png +0 -0
- data/templates/swift_project/xcode/%project_name%/%target_name%/Resources/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png +0 -0
- data/templates/swift_project/xcode/%project_name%/%target_name%/Resources/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png +0 -0
- data/templates/swift_project/xcode/%project_name%/%target_name%/Resources/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png +0 -0
- data/templates/swift_project/xcode/%project_name%/%target_name%/Resources/Assets.xcassets/AppIcon.appiconset/Icon-Small-50x50@1x.png +0 -0
- data/templates/swift_project/xcode/%project_name%/%target_name%/Resources/Assets.xcassets/AppIcon.appiconset/Icon-Small-50x50@2x.png +0 -0
- data/templates/swift_project/xcode/%project_name%/%target_name%/ViewController.swift.tt +1 -2
- data/templates/swift_project/xcode/%project_name%/%tests_target_name%/%project_name%Tests.swift.tt +2 -3
- metadata +44 -55
- data/lib/fwtoolkit/cli/bootstrap.rb +0 -75
- data/lib/fwtoolkit/cli/ci.rb +0 -52
- data/lib/fwtoolkit/cli/frank.rb +0 -113
- data/lib/fwtoolkit/cli/ota.rb +0 -109
- data/lib/fwtoolkit/cli/ota_client/hockeyapp_client.rb +0 -70
- data/templates/objc_project/git/.gitignore +0 -31
- data/templates/objc_project/rvm/Gemfile +0 -3
- data/templates/objc_project/xcode/%project_name%/%target_name%/AppDelegate.swift.tt +0 -46
- data/templates/objc_project/xcode/%project_name%/%target_name%/Resources/Base.lproj/Main.storyboard +0 -26
- data/templates/objc_project/xcode/%project_name%/%target_name%/ViewController.swift.tt +0 -25
- data/templates/objc_project/xcode/%project_name%/%target_name%Tests/%project_name%Tests.m.tt +0 -39
- data/templates/objc_project/xcode/%project_name%/%tests_target_name%/%project_name%Tests.swift.tt +0 -36
- data/templates/objc_project/xcode/%project_name%/%tests_target_name%/Supporting Files/Info.plist +0 -24
- data/templates/swift_project/git/.gitignore +0 -31
- data/templates/swift_project/rvm/Gemfile +0 -3
- data/templates/swift_project/xcode/%project_name%/%target_name%/%class_prefix%AppDelegate.h.tt +0 -18
- data/templates/swift_project/xcode/%project_name%/%target_name%/%class_prefix%AppDelegate.m.tt +0 -45
- data/templates/swift_project/xcode/%project_name%/%target_name%/%class_prefix%ViewController.h.tt +0 -15
- data/templates/swift_project/xcode/%project_name%/%target_name%/%class_prefix%ViewController.m.tt +0 -27
- data/templates/swift_project/xcode/%project_name%/%target_name%/Supporting Files/main.m.tt +0 -16
- data/templates/swift_project/xcode/%project_name%/%target_name%Tests/%project_name%Tests.m.tt +0 -39
- data/templates/swift_project/xcode/%project_name%/%target_name%Tests/Resources/Info.plist +0 -24
- data/templates/swift_project/xcode/%project_name%/.DS_Store +0 -0
@@ -1,75 +0,0 @@
|
|
1
|
-
require 'thor'
|
2
|
-
require 'fwtoolkit/config'
|
3
|
-
require 'fwtoolkit/cli/cocoapods'
|
4
|
-
|
5
|
-
module FWToolkit
|
6
|
-
class Bootstrap < Thor::Group
|
7
|
-
include Thor::Actions
|
8
|
-
|
9
|
-
def xcode_check
|
10
|
-
if File::exists?('/Applications/Xcode.app')
|
11
|
-
say_status :skip, 'Xcode is already installed', :blue
|
12
|
-
elsif
|
13
|
-
say_status :error, 'Xcode is not installed. Please download it from developer.apple.com', :red
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
def git_check
|
18
|
-
if File.available_in_path?('git')
|
19
|
-
say_status :skip, 'Git is already installed', :blue
|
20
|
-
elsif
|
21
|
-
say_status :error, 'Git is not installed. Please review your system configuration', :red
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
def rvm_check
|
26
|
-
if File.available_in_path?('rvm')
|
27
|
-
say_status :skip, 'Rvm is already installed', :blue
|
28
|
-
elsif
|
29
|
-
say_status :install, 'Installing rvm from https://get.rvm.io', :green
|
30
|
-
Dir.mktmpdir do |dir|
|
31
|
-
installer_path = File.join(dir, 'rvm_install.sh');
|
32
|
-
get 'https://get.rvm.io', installer_path
|
33
|
-
run! "bash -s stable #{installer_path}", {:capture => true}
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
def ruby_ver_check
|
39
|
-
default_rvm_ruby = run! 'rvm list default string', {:capture => true}
|
40
|
-
if default_rvm_ruby.include? Config.ruby_version
|
41
|
-
say_status :skip, "Ruby is already at the last version (#{Config.ruby_version})", :blue
|
42
|
-
end
|
43
|
-
say_status :install, "Installing ruby version #{Config.ruby_version} (through rvm)", :green
|
44
|
-
run! "rvm use --install #{Config.ruby_version}", {:with => 'bash -lc', :capture => true}
|
45
|
-
end
|
46
|
-
|
47
|
-
def cocoapods_check
|
48
|
-
if File.available_in_path?('pods')
|
49
|
-
say_status :skip, 'Cocoapods is already installed', :blue
|
50
|
-
elsif
|
51
|
-
invoke FWToolkit::Cocoapods, 'install', []
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
class File
|
58
|
-
|
59
|
-
def available_in_path?(prog_name)
|
60
|
-
which(prog_name)!=nil
|
61
|
-
end
|
62
|
-
|
63
|
-
private
|
64
|
-
|
65
|
-
def which cmd
|
66
|
-
exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']
|
67
|
-
ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|
|
68
|
-
exts.each do |ext|
|
69
|
-
exe = "#{path}/#{cmd}#{ext}"
|
70
|
-
return exe if File.executable? exe
|
71
|
-
end
|
72
|
-
end
|
73
|
-
return nil
|
74
|
-
end
|
75
|
-
end
|
data/lib/fwtoolkit/cli/ci.rb
DELETED
@@ -1,52 +0,0 @@
|
|
1
|
-
require 'thor'
|
2
|
-
require 'net/http'
|
3
|
-
require 'uri'
|
4
|
-
require 'fwtoolkit/git_client'
|
5
|
-
require 'fwtoolkit/config'
|
6
|
-
|
7
|
-
module FWToolkit
|
8
|
-
class Ci < Thor
|
9
|
-
include Thor::Actions
|
10
|
-
|
11
|
-
desc 'add [PROJECT_NAME] [PROJECT_DIR]', 'Add a project to the CI environment'
|
12
|
-
def add(project_name, project_root)
|
13
|
-
raise Thor::Error, "\"#{project_root}\" doesn't contain a valid git repository" unless repository.initialized?
|
14
|
-
|
15
|
-
if project_exists_on_ci? project_name
|
16
|
-
say_status :skip, "There's already a project named \"#{project_name}\" on the ci at #{Config.ci_server_url}"
|
17
|
-
return
|
18
|
-
end
|
19
|
-
|
20
|
-
remotes = repository.remotes
|
21
|
-
raise Thor::Error, "\"#{project_root}\" is a local-only repository" if remotes.to_a.size == 0
|
22
|
-
|
23
|
-
remotes = repository.remotes
|
24
|
-
if remotes.keys.count == 1
|
25
|
-
remote_name = remotes.values.first
|
26
|
-
else
|
27
|
-
remote_name = ask 'There\'s more than one remote configured for this repository. Select one:', {:limited_to => remotes.keys }
|
28
|
-
end
|
29
|
-
|
30
|
-
remote_url = remotes[remote_name]
|
31
|
-
|
32
|
-
response = Net::HTTP.post_form(URI.parse("#{Config.ci_server_url}/projects"),
|
33
|
-
{'project[name]' => project_name,
|
34
|
-
'project[source_control][repository]' => remote_url,
|
35
|
-
'project[source_control][source_contro]' => 'Git',
|
36
|
-
'project[source_control][branch]' => 'dev'})
|
37
|
-
if response.kind_of? Net::HTTPSuccess
|
38
|
-
say_status :add, "Project \"#{project_name}\" successfully added to the CI environment", :green
|
39
|
-
elsif
|
40
|
-
raise Thor::Error, "Failed to add project \"#{project_name}\" to the CI"
|
41
|
-
end
|
42
|
-
|
43
|
-
end
|
44
|
-
|
45
|
-
private
|
46
|
-
def project_exists_on_ci?(project_name)
|
47
|
-
response = Net::HTTP.request_get URI.parse("#{Config.ci_server_url}/builds/#{project_name}")
|
48
|
-
response.kind_if? Net::HTTPSuccess
|
49
|
-
end
|
50
|
-
|
51
|
-
end
|
52
|
-
end
|
data/lib/fwtoolkit/cli/frank.rb
DELETED
@@ -1,113 +0,0 @@
|
|
1
|
-
require 'thor'
|
2
|
-
require 'xcodeproj'
|
3
|
-
require 'core_data'
|
4
|
-
require 'fwtoolkit/ext/gem'
|
5
|
-
require 'fwtoolkit/projectfile'
|
6
|
-
require 'fwtoolkit/cli/fw_actions'
|
7
|
-
require 'fwtoolkit/cli/thorutils'
|
8
|
-
|
9
|
-
module Xcodeproj
|
10
|
-
class Project
|
11
|
-
def core_data_files(target_name=nil)
|
12
|
-
mom_files = Array.new
|
13
|
-
targets_list = target_name ? self.targets.select { |t| t.name == target_name } : self.targets
|
14
|
-
targets_list.each do |t|
|
15
|
-
mom_files << t.source_build_phase.files.select{ |f| f.display_name =~ /.*?\.xcdatamodeld/ }.map{ |f| f.file_ref.current_version.path }
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
class String
|
22
|
-
def ruby_format
|
23
|
-
self.gsub(/(.)([A-Z])/,'\1_\2').downcase
|
24
|
-
end
|
25
|
-
|
26
|
-
def ruby_format!
|
27
|
-
replace ruby_format
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
module FWToolkit
|
32
|
-
class Frank < Thor
|
33
|
-
include Thor::Actions
|
34
|
-
include FWToolkit::ThorUtils
|
35
|
-
source_root_templates!
|
36
|
-
|
37
|
-
add_runtime_options!
|
38
|
-
|
39
|
-
desc 'setup [PROJECT_DIR]', 'Sets up Frank for the project at project_dir and on the given target'
|
40
|
-
option :target,
|
41
|
-
:banner => 'Xcode target',
|
42
|
-
:desc => 'Specify the build target that Frank should use. Default: the one specified by :target in the FWProjectFile'
|
43
|
-
def setup(project_dir)
|
44
|
-
destination_root = project_dir
|
45
|
-
Projectfile.load!(project_dir)
|
46
|
-
|
47
|
-
if !options[:force] && frank_alredy_set_up?(project_dir)
|
48
|
-
say_status :skip, 'Frank is already set up for the project'
|
49
|
-
return
|
50
|
-
end
|
51
|
-
say 'Setting up Frank'
|
52
|
-
|
53
|
-
template_conf = Projectfile.config
|
54
|
-
Projectfile.config[:target_name] ||= options[:target] if options[:target]
|
55
|
-
|
56
|
-
inside(File.join(destination_root, template_conf[:project_name])) { run! "frank setup --target #{Projectfile.target_name}" }
|
57
|
-
|
58
|
-
#remove files we're going to overwrite
|
59
|
-
FileUtils.rm File.join(destination_root, template_conf[:project_name], 'Frank', 'features', 'step_definitions', 'launch_steps.rb')
|
60
|
-
FileUtils.rm File.join(destination_root, template_conf[:project_name], 'Frank', 'features', 'support', 'env.rb')
|
61
|
-
|
62
|
-
template_directory 'templates/default_project/frank', destination_root, template_conf
|
63
|
-
end
|
64
|
-
|
65
|
-
desc 'model [PROJECT_DIR]', 'Creates Frank model files from CoreData for the project at project_dir'
|
66
|
-
option :modelfile,
|
67
|
-
:banner => 'core data xcdatamodel file',
|
68
|
-
:desc => 'Specify the position of the xcdatamodel file you want to extract the Core Data entity from. By default, fwtoolkit searches recursively inside project_dir for all *.xcdatamodel files'
|
69
|
-
def model(project_dir)
|
70
|
-
say 'Creating model files out of core data entities'
|
71
|
-
destination_root = project_dir
|
72
|
-
Projectfile.load!(project_dir)
|
73
|
-
|
74
|
-
if options[:modelfile].nil?
|
75
|
-
mom_files = Dir.glob(File.join(project_dir, '**/*.xcdatamodel'))
|
76
|
-
|
77
|
-
if mom_files.size > 1
|
78
|
-
mom_file = ask('I\'ve found more than one core data model, which one would you like to use?', mom_files)
|
79
|
-
elsif mom_files.size == 1
|
80
|
-
mom_file = mom_files[0]
|
81
|
-
else
|
82
|
-
raise Thor::Error, "Can't locate a valid core data model for #{mom_file}"
|
83
|
-
end
|
84
|
-
end
|
85
|
-
|
86
|
-
template_conf = Projectfile.config
|
87
|
-
|
88
|
-
model = CoreData::DataModel.new File.join(mom_file, 'contents')
|
89
|
-
|
90
|
-
model.entities.each do |entity|
|
91
|
-
seed_conf = template_conf.clone
|
92
|
-
seed_conf[:class_name] = remove_prefix(template_conf[:class_prefix], entity.name).ruby_format
|
93
|
-
seed_conf[:model] = entity
|
94
|
-
directory 'templates/default_project/frank_seed_core_data', destination_root, seed_conf
|
95
|
-
end
|
96
|
-
|
97
|
-
template_conf[:models] = model.entities
|
98
|
-
directory 'templates/default_project/frank_seed_support', destination_root, template_conf
|
99
|
-
end
|
100
|
-
|
101
|
-
private
|
102
|
-
|
103
|
-
def remove_prefix(prefix, entity)
|
104
|
-
entity[/^#{prefix}/] = '' if entity[/^#{prefix}/]
|
105
|
-
entity
|
106
|
-
end
|
107
|
-
|
108
|
-
def frank_alredy_set_up?(project_dir)
|
109
|
-
File.exists? File.join(project_dir, File.basename(project_dir), 'Frank')
|
110
|
-
end
|
111
|
-
|
112
|
-
end
|
113
|
-
end
|
data/lib/fwtoolkit/cli/ota.rb
DELETED
@@ -1,109 +0,0 @@
|
|
1
|
-
require 'thor'
|
2
|
-
require 'rake'
|
3
|
-
require 'fwtoolkit/projectfile'
|
4
|
-
require 'fwtoolkit/xcode'
|
5
|
-
require 'fwtoolkit/config'
|
6
|
-
require 'fwtoolkit/hockeyapp_client'
|
7
|
-
require 'fwtoolkit/hash_yaml'
|
8
|
-
|
9
|
-
module XcodedBuild
|
10
|
-
def self.create_ipa(xcarchive_path, ipa_output, dev_id=nil, provisionin_profile=nil)
|
11
|
-
provisioning_profile = File.expand_path provisioning_profile
|
12
|
-
raise Thor::Error, "Unable to locate the provisioning profile: #{provisioning_profile}" unless File.exists?(provisioning_profile)
|
13
|
-
|
14
|
-
app_path = find_unique! xcarchive_path, '*.app'
|
15
|
-
raise Thor::Error, "Unable to find any .app file at path: #{xcarchive_path}" unless app_path
|
16
|
-
|
17
|
-
ipa_output = File.expand_path ipa_output
|
18
|
-
|
19
|
-
cmd_line = "xcrun -sdk iphoneos PackageApplication -v #{app_path} -o #{ipa_output}"
|
20
|
-
cmd_line += "--sign #{dev_id}" if dev_id
|
21
|
-
cmd_line += "--embed #{provisioning_profile}" if provisioning_profile
|
22
|
-
run! "xcrun -sdk iphoneos PackageApplication -v #{app_path} -o #{ipa_output}"
|
23
|
-
end
|
24
|
-
|
25
|
-
def self.find_unique!(root, file)
|
26
|
-
files_in_root = Dir["#{root}/**/#{file}"]
|
27
|
-
raise Thor::Error, "Found more than one \"#{file}\" at path: #{root}" if apps_in_root.size > 1
|
28
|
-
files_in_root.size > 0 ? File.expand_path(files_in_root.first) : nil
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
module FWToolkit
|
33
|
-
class Ota < Thor
|
34
|
-
include Thor::Actions
|
35
|
-
|
36
|
-
desc 'ipa [PROJECT_ROOT]', 'Creates an ipa file signed with the credentials defined in the FWProjectfile for the project at project_root'
|
37
|
-
option :sign,
|
38
|
-
:type => :boolean,
|
39
|
-
:default => :true,
|
40
|
-
:desc => 'If true, the dev_id defined in the project file is ignored and the app is signed with the dev_id defined on FWProjectfile. Default: true'
|
41
|
-
def sign(project_root)
|
42
|
-
invoke FWToolkit::Xcode, 'build', [project_root], :clean => true, :archive => true, :type => 'testing', :sdk => 'iphoneos'
|
43
|
-
Projectfile.load! project_root
|
44
|
-
|
45
|
-
if options[:sign]
|
46
|
-
XcodeBuild.create_ipa xcarchive_path, ipa_path, Projectfile.dev_id, Projectfile.provisioning_profile
|
47
|
-
else
|
48
|
-
XcodeBuild.create_ipa xcarchive_path, ipa_path
|
49
|
-
end
|
50
|
-
|
51
|
-
say_status :created, "IPA at: #{ipa_path} signed with developer id: #{dev_id}", :green
|
52
|
-
end
|
53
|
-
|
54
|
-
desc 'upload [PROJECT_ROOT]', 'Upload a new build to FW\'s Hockeyapp account'
|
55
|
-
option :sign,
|
56
|
-
:type => :boolean,
|
57
|
-
:default => true,
|
58
|
-
:desc => 'If true, the dev_id defined in the project file is ignored and the app is signed with the dev_id defined on FWProjectfile. Default: true'
|
59
|
-
def upload(project_root)
|
60
|
-
if options[:sign]
|
61
|
-
invoke('sign')
|
62
|
-
else
|
63
|
-
invoke FWToolkit::Xcode, 'build', [project_root], :clean => true, :archive => true, :type => 'testing', :sdk => 'iphoneos'
|
64
|
-
end
|
65
|
-
|
66
|
-
Projectfile.load! project_root
|
67
|
-
|
68
|
-
raise Thor::Error, "Unable to find the xcarchive file at path: #{ipa}" unless File.exists?(ipa_path)
|
69
|
-
raise Thor::Error, "Unable to find the dSYM file at path: #{dsym}" unless File.exists?(dsym_path)
|
70
|
-
|
71
|
-
uploader = FWToolkit::OTA::HockeyappClient.new(Config.hockeyapp_api_token, Projectfile.app_token)
|
72
|
-
|
73
|
-
begin
|
74
|
-
uploader.upload_build ipa_path, dsym_path
|
75
|
-
rescue StandardError => e
|
76
|
-
say_status :error, "Error uploading to hockeyapp: #{e.message}", :red
|
77
|
-
end
|
78
|
-
|
79
|
-
say_status :upload, "Uploaded a new version to Hockeyapp", :green
|
80
|
-
end
|
81
|
-
|
82
|
-
|
83
|
-
private
|
84
|
-
|
85
|
-
def ipa_path
|
86
|
-
File.join xcarchive_path, "#{Projectfile.project_name}.ipa"
|
87
|
-
end
|
88
|
-
|
89
|
-
def dsym_path
|
90
|
-
File.join xcarchive_path, 'dSYMs' "#{Projectfile.project_name}.app.dSYM"
|
91
|
-
end
|
92
|
-
|
93
|
-
def artifacts_dir
|
94
|
-
File.join Config.artifacts_tmp_dir, Projectfile.project_name
|
95
|
-
end
|
96
|
-
|
97
|
-
def xcarchive_path
|
98
|
-
if @xcarchive_path.nil
|
99
|
-
build_conf = Hash.hash_from_yaml File.join(Config.artifacts_tmp_dir, Projectfile.project_name, 'env.log')
|
100
|
-
|
101
|
-
@xcarchive_path = build_conf[:ARCHIVE_PATH]
|
102
|
-
raise Thor::Error, "Cannot locate the xcarchive for the project" unless File.exists?(xcarchive)
|
103
|
-
end
|
104
|
-
@xcarchive_path
|
105
|
-
end
|
106
|
-
|
107
|
-
|
108
|
-
end
|
109
|
-
end
|
@@ -1,70 +0,0 @@
|
|
1
|
-
require 'hockeyapp'
|
2
|
-
require 'fwtoolkit/config'
|
3
|
-
require 'rubyzip'
|
4
|
-
|
5
|
-
module FWToolkit
|
6
|
-
module OTA
|
7
|
-
class HockeyappClient
|
8
|
-
|
9
|
-
class CmdUploader
|
10
|
-
def initialize(api_token, app_id)
|
11
|
-
HockeyApp::Config.configure { |config| config.token = api_token }
|
12
|
-
@client = HockeyApp.build_client
|
13
|
-
@app = HockeyApp::App.from_hash({"public_identifier" => app_id}, @client)
|
14
|
-
end
|
15
|
-
|
16
|
-
def upload_build(bin_file, dsym_file = nil, notes = nil)
|
17
|
-
raise ArgumentError, "No valid ipa file exists at path #{bin_file}" unless bin_file.exists?
|
18
|
-
raise ArgumentError, "No valid dsym_file file exists at path #{dsym_file}" unless (dsym_file.nil? || dsym_file.exists?)
|
19
|
-
zip_dsym = zipped_dsym(dsym_file) if dsym_file
|
20
|
-
new_version = HockeyApp::Version.new(@app, @client)
|
21
|
-
new_version.ipa = bin_file
|
22
|
-
new_version.dsym = zipped_dsym(zip_dsym)
|
23
|
-
new_version.notes = notes
|
24
|
-
@client.post_new_version new_version
|
25
|
-
end
|
26
|
-
|
27
|
-
def dsym_path_from_xcarchive(xcarchive_path)
|
28
|
-
|
29
|
-
end
|
30
|
-
|
31
|
-
def
|
32
|
-
end
|
33
|
-
|
34
|
-
# class GuiUploader
|
35
|
-
# def initialize(api_token, app_id)
|
36
|
-
# @api_token = api_token
|
37
|
-
# @app_id = app_id
|
38
|
-
# end
|
39
|
-
|
40
|
-
# def upload_build(bin_file, dsym_file = nil, notes = nil)
|
41
|
-
# raise ArgumentError, 'Not implemented'
|
42
|
-
# end
|
43
|
-
# end
|
44
|
-
|
45
|
-
# There are two kind of uploader: internal and gui. The second one utilizes hockeyapp's mac app to provide
|
46
|
-
def initialize(api_token, app_id, uploader=:cmd_uploader)
|
47
|
-
@uploader = uploader==:cmd_uploader ? CmdUploader.new(api_token, app_id) : GuiUploader.new(api_token, app_id)
|
48
|
-
end
|
49
|
-
|
50
|
-
def upload_build(bin_file, dsym_file = nil, notes = nil)
|
51
|
-
@uploader.upload_build bin_file, dsym_file, notes
|
52
|
-
raise ArgumentError, "No valid ipa file exists at path #{bin_file}" unless bin_file.exists?
|
53
|
-
raise ArgumentError, "No valid dsym_file file exists at path #{dsym_file}" unless (dsym_file.nil? || dsym_file.exists?)
|
54
|
-
zip_dsym = zipped_dsym(dsym_file) if dsym_file
|
55
|
-
new_version = HockeyApp::Version.new(@app, @client)
|
56
|
-
new_version.ipa = bin_file
|
57
|
-
new_version.dsym = zipped_dsym(zip_dsym)
|
58
|
-
new_version.notes = notes
|
59
|
-
@client.post_new_version new_version
|
60
|
-
end
|
61
|
-
|
62
|
-
def zipped_dsym(dsym_file)
|
63
|
-
zip_file = "#{dsym_file}.zip"
|
64
|
-
Zip::ZipFile.open(zip_file, Zip::ZipFile::CREATE) do |zipfile|
|
65
|
-
zipfile.add(dsym_file)
|
66
|
-
end
|
67
|
-
end
|
68
|
-
end
|
69
|
-
end
|
70
|
-
end
|
@@ -1,31 +0,0 @@
|
|
1
|
-
# Ruby
|
2
|
-
tmp/
|
3
|
-
log/
|
4
|
-
db/production.sqlite3
|
5
|
-
db/development.sqlite3
|
6
|
-
|
7
|
-
# Xcode
|
8
|
-
build/*
|
9
|
-
*.pbxuser
|
10
|
-
!default.pbxuser
|
11
|
-
*.mode1v3
|
12
|
-
!default.mode1v3
|
13
|
-
*.mode2v3
|
14
|
-
!default.mode2v3
|
15
|
-
*.perspectivev3
|
16
|
-
!default.perspectivev3
|
17
|
-
!default.xcworkspace
|
18
|
-
xcuserdata
|
19
|
-
profile
|
20
|
-
*.moved-aside
|
21
|
-
# Finder
|
22
|
-
.DS_Store
|
23
|
-
.svn
|
24
|
-
*.swp
|
25
|
-
*.~nib
|
26
|
-
|
27
|
-
# Frank
|
28
|
-
Frank/frankified_build/
|
29
|
-
|
30
|
-
# Cocoapods
|
31
|
-
/Pods/
|