Class: RXCode::XCode::CommandLine
- Inherits:
-
Object
- Object
- RXCode::XCode::CommandLine
- Defined in:
- lib/rxcode/tasks/ios_framework.rb
Instance Attribute Summary collapse
-
#action ⇒ Object
ACTION =================================================================================================.
-
#sdk ⇒ Object
SDK ====================================================================================================.
-
#target ⇒ Object
TARGET =================================================================================================.
Instance Method Summary collapse
- #action_arguments ⇒ Object
- #command ⇒ Object
- #command_environment ⇒ Object
- #command_line_arguments ⇒ Object
- #command_variables ⇒ Object
-
#configuration ⇒ Object
CONFIGURATION ==========================================================================================.
- #configuration_arguments ⇒ Object
-
#default_environment ⇒ Object
ENVIRONMENT VARIABLES ==================================================================================.
- #dry_run? ⇒ Boolean
- #environment ⇒ Object
-
#initialize(options = nil) {|_self| ... } ⇒ CommandLine
constructor
A new instance of CommandLine.
- #project_arguments ⇒ Object
- #project_file_path ⇒ Object
-
#project_name ⇒ Object
PROJECT ================================================================================================.
- #run(print_command = false) ⇒ Object
- #sdk_arguments ⇒ Object
-
#symroot ⇒ Object
BUILD LOCATION =========================================================================================.
- #target_arguments ⇒ Object
- #target_name ⇒ Object
-
#xcodebuild_binary ⇒ Object
COMMAND ================================================================================================.
Constructor Details
#initialize(options = nil) {|_self| ... } ⇒ CommandLine
Returns a new instance of CommandLine.
8 9 10 11 12 13 14 |
# File 'lib/rxcode/tasks/ios_framework.rb', line 8 def initialize( = nil) if .each { |attr_name, attr_value| self.send("#{attr_name}=", attr_value) } end yield self if block_given? end |
Instance Attribute Details
#action ⇒ Object
ACTION =================================================================================================
18 19 20 |
# File 'lib/rxcode/tasks/ios_framework.rb', line 18 def action @action end |
#sdk ⇒ Object
SDK ====================================================================================================
73 74 75 |
# File 'lib/rxcode/tasks/ios_framework.rb', line 73 def sdk @sdk end |
#target ⇒ Object
TARGET =================================================================================================
44 45 46 |
# File 'lib/rxcode/tasks/ios_framework.rb', line 44 def target @target || target_name end |
Instance Method Details
#action_arguments ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/rxcode/tasks/ios_framework.rb', line 20 def action_arguments if action [ action ] else [] end end |
#command ⇒ Object
119 120 121 122 123 124 |
# File 'lib/rxcode/tasks/ios_framework.rb', line 119 def command command_args = command_line_arguments.join(' ') command_variables = command_environment.collect { |var_name, value| "#{var_name}='#{value}'" }.join(' ') "#{xcodebuild_binary} #{command_args} #{command_variables}" end |
#command_environment ⇒ Object
101 102 103 |
# File 'lib/rxcode/tasks/ios_framework.rb', line 101 def command_environment default_environment.merge(environment) end |
#command_line_arguments ⇒ Object
115 116 117 |
# File 'lib/rxcode/tasks/ios_framework.rb', line 115 def command_line_arguments project_arguments + target_arguments + configuration_arguments + sdk_arguments + action_arguments end |
#command_variables ⇒ Object
105 106 107 |
# File 'lib/rxcode/tasks/ios_framework.rb', line 105 def command_variables environment.collect { |var_name, value| "#{var_name}='#{value}'" }.join(' ') end |
#configuration ⇒ Object
CONFIGURATION ==========================================================================================
63 64 65 |
# File 'lib/rxcode/tasks/ios_framework.rb', line 63 def configuration ENV['CONFIGURATION'] end |
#configuration_arguments ⇒ Object
67 68 69 |
# File 'lib/rxcode/tasks/ios_framework.rb', line 67 def configuration_arguments [ '-configuration', configuration] end |
#default_environment ⇒ Object
ENVIRONMENT VARIABLES ==================================================================================
91 92 93 94 95 |
# File 'lib/rxcode/tasks/ios_framework.rb', line 91 def default_environment default_env = {} default_env['SYMROOT'] = symroot if symroot default_env end |
#dry_run? ⇒ Boolean
126 127 128 |
# File 'lib/rxcode/tasks/ios_framework.rb', line 126 def dry_run? ENV['DRY_RUN'] =~ /^(1|yes|true)$/i end |
#environment ⇒ Object
97 98 99 |
# File 'lib/rxcode/tasks/ios_framework.rb', line 97 def environment @environment ||= {} end |
#project_arguments ⇒ Object
38 39 40 |
# File 'lib/rxcode/tasks/ios_framework.rb', line 38 def project_arguments [ '-project', project_file_path ] end |
#project_file_path ⇒ Object
34 35 36 |
# File 'lib/rxcode/tasks/ios_framework.rb', line 34 def project_file_path ENV['PROJECT_FILE_PATH'] || "#{project_name}.xcodeproj" end |
#project_name ⇒ Object
PROJECT ================================================================================================
30 31 32 |
# File 'lib/rxcode/tasks/ios_framework.rb', line 30 def project_name ENV['PROJECT_NAME'] end |
#run(print_command = false) ⇒ Object
130 131 132 133 |
# File 'lib/rxcode/tasks/ios_framework.rb', line 130 def run(print_command = false) puts(command) if print_command system(command) unless dry_run? end |
#sdk_arguments ⇒ Object
75 76 77 78 79 80 81 |
# File 'lib/rxcode/tasks/ios_framework.rb', line 75 def sdk_arguments if sdk.nil? [] else [ '-sdk', sdk ] end end |
#symroot ⇒ Object
BUILD LOCATION =========================================================================================
85 86 87 |
# File 'lib/rxcode/tasks/ios_framework.rb', line 85 def symroot ENV['SYMROOT'] end |
#target_arguments ⇒ Object
53 54 55 56 57 58 59 |
# File 'lib/rxcode/tasks/ios_framework.rb', line 53 def target_arguments if target [ "-target", "'#{target}'" ] else [] end end |
#target_name ⇒ Object
49 50 51 |
# File 'lib/rxcode/tasks/ios_framework.rb', line 49 def target_name ENV['TARGET_NAME'] end |
#xcodebuild_binary ⇒ Object
COMMAND ================================================================================================
111 112 113 |
# File 'lib/rxcode/tasks/ios_framework.rb', line 111 def xcodebuild_binary "xcodebuild" end |