Class: Gym::BuildCommandGenerator
- Inherits:
-
Object
- Object
- Gym::BuildCommandGenerator
- Defined in:
- lib/gym/generators/build_command_generator.rb
Overview
Responsible for building the fully working xcodebuild command
Class Method Summary collapse
- .actions ⇒ Object
- .archive_path ⇒ Object
-
.build_path ⇒ Object
The path to set the Derived Data to.
- .generate ⇒ Object
- .options ⇒ Object
- .pipe ⇒ Object
- .prefix ⇒ Object
-
.project_path_array ⇒ Array
Path to the project or workspace as parameter This will also include the scheme (if given).
- .suffix ⇒ Object
Class Method Details
.actions ⇒ Object
49 50 51 52 53 54 55 56 57 |
# File 'lib/gym/generators/build_command_generator.rb', line 49 def actions config = Gym.config actions = [] actions << :clean if config[:clean] actions << :archive actions end |
.archive_path ⇒ Object
80 81 82 83 84 85 86 87 |
# File 'lib/gym/generators/build_command_generator.rb', line 80 def archive_path @archive_path ||= Gym.config[:archive_path] unless @archive_path file_name = [Gym.config[:output_name], Time.now.strftime("%F %H.%M.%S")] # e.g. 2015-08-07 14.49.12 @archive_path = File.join(build_path, file_name.join(" ") + ".xcarchive") end return @archive_path end |
.build_path ⇒ Object
The path to set the Derived Data to
70 71 72 73 74 75 76 77 78 |
# File 'lib/gym/generators/build_command_generator.rb', line 70 def build_path unless @build_path day = Time.now.strftime("%F") # e.g. 2015-08-07 @build_path = File.("~/Library/Developer/Xcode/Archives/#{day}/") FileUtils.mkdir_p @build_path end @build_path end |
.generate ⇒ Object
5 6 7 8 9 10 11 12 13 14 |
# File 'lib/gym/generators/build_command_generator.rb', line 5 def generate parts = prefix parts << "xcodebuild" parts += parts += actions parts += suffix parts += pipe parts end |
.options ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/gym/generators/build_command_generator.rb', line 34 def config = Gym.config = [] += project_path_array << "-configuration '#{config[:configuration]}'" if config[:configuration] << "-sdk '#{config[:sdk]}'" if config[:sdk] << "-destination '#{config[:destination]}'" if config[:destination] << "-xcconfig '#{config[:xcconfig]}'" if config[:xcconfig] << "-archivePath '#{archive_path}'" << config[:xcargs] if config[:xcargs] end |
.pipe ⇒ Object
65 66 67 |
# File 'lib/gym/generators/build_command_generator.rb', line 65 def pipe ["| xcpretty"] end |
.prefix ⇒ Object
16 17 18 |
# File 'lib/gym/generators/build_command_generator.rb', line 16 def prefix ["set -o pipefail &&"] end |
.project_path_array ⇒ Array
Path to the project or workspace as parameter This will also include the scheme (if given)
23 24 25 26 27 28 29 30 31 32 |
# File 'lib/gym/generators/build_command_generator.rb', line 23 def project_path_array config = Gym.config proj = [] proj << "-workspace '#{config[:workspace]}'" if config[:workspace] proj << "-scheme '#{config[:scheme]}'" if config[:scheme] proj << "-project '#{config[:project]}'" if config[:project] return proj if proj.count > 0 raise "No project/workspace found" end |