Module: DeployGate::Xcode::Ios
- Defined in:
- lib/deploygate/xcode/ios.rb
Defined Under Namespace
Classes: NotSupportExportMethodError
Constant Summary collapse
- WORK_DIR_EXTNAME =
'.xcworkspace'- PROJECT_DIR_EXTNAME =
'.xcodeproj'- IGNORE_DIRS =
[ '.git', 'Carthage' ]
Class Method Summary collapse
- .build(ios_analyze, target_scheme, codesigning_identity, export_method = DeployGate::Xcode::Export::AD_HOC) ⇒ String
- .find_workspaces(base_path) ⇒ Array
- .ios_root?(base_path) ⇒ Boolean
- .project?(path) ⇒ Boolean
- .project_root_path(path) ⇒ String
- .workspace?(path) ⇒ Boolean
Class Method Details
.build(ios_analyze, target_scheme, codesigning_identity, export_method = DeployGate::Xcode::Export::AD_HOC) ⇒ String
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/deploygate/xcode/ios.rb', line 17 def build(ios_analyze, target_scheme, codesigning_identity, export_method = DeployGate::Xcode::Export::AD_HOC) raise NotSupportExportMethodError, 'Not support export' unless DeployGate::Xcode::Export::SUPPORT_EXPORT_METHOD.include?(export_method) values = { export_method: export_method, workspace: ios_analyze.build_workspace, configuration: DeployGate::Xcode::Analyze::BUILD_CONFIGRATION, scheme: target_scheme } values[:codesigning_identity] = codesigning_identity if codesigning_identity v = FastlaneCore::Configuration.create(Gym::Options., values) begin absolute_ipa_path = File.(Gym::Manager.new.work(v)) rescue => e # TODO: build error handling use_xcode_path = `xcode-select -p` puts HighLine.color(I18n.t('xcode.ios.build.error.use_xcode', use_xcode_path: use_xcode_path), HighLine::RED) raise e end absolute_dsym_path = absolute_ipa_path.gsub(".ipa", ".app.dSYM.zip") # TODO: upload to deploygate absolute_ipa_path end |
.find_workspaces(base_path) ⇒ Array
66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/deploygate/xcode/ios.rb', line 66 def find_workspaces(base_path) projects = [] Find.find(base_path) do |path| next if path == base_path if File.extname(path) == WORK_DIR_EXTNAME projects.push(path) end Find.prune if FileTest.directory?(path) && IGNORE_DIRS.include?(File.basename(path)) end projects end |
.ios_root?(base_path) ⇒ Boolean
54 55 56 57 58 59 60 61 |
# File 'lib/deploygate/xcode/ios.rb', line 54 def ios_root?(base_path) Find.find(base_path) do |path| next if path == base_path return true if workspace?(path) || project?(path) Find.prune if FileTest.directory?(path) end false end |
.project?(path) ⇒ Boolean
50 51 52 |
# File 'lib/deploygate/xcode/ios.rb', line 50 def project?(path) PROJECT_DIR_EXTNAME == File.extname(path) end |
.project_root_path(path) ⇒ String
82 83 84 85 86 87 88 |
# File 'lib/deploygate/xcode/ios.rb', line 82 def project_root_path(path) result = path if workspace?(path) || project?(path) result = project_root_path(File.dirname(path)) end result end |
.workspace?(path) ⇒ Boolean
44 45 46 |
# File 'lib/deploygate/xcode/ios.rb', line 44 def workspace?(path) WORK_DIR_EXTNAME == File.extname(path) end |