Class: Pod::TrySettings
- Inherits:
-
Object
- Object
- Pod::TrySettings
- Defined in:
- lib/pod/try_settings.rb
Instance Attribute Summary collapse
-
#pre_install_commands ⇒ Object
Returns the value of attribute pre_install_commands.
-
#project_path ⇒ Object
Returns the value of attribute project_path.
Class Method Summary collapse
-
.settings_from_folder(path) ⇒ Object
Creates a TrySettings instance based on a folder path.
Instance Method Summary collapse
-
#prompt_for_permission ⇒ Object
If we need to run commands from pod-try we should let the users know what is going to be running on their device.
-
#run_pre_install_commands(prompt) ⇒ Object
Runs the pre_install_commands from.
Instance Attribute Details
#pre_install_commands ⇒ Object
Returns the value of attribute pre_install_commands.
3 4 5 |
# File 'lib/pod/try_settings.rb', line 3 def pre_install_commands @pre_install_commands end |
#project_path ⇒ Object
Returns the value of attribute project_path.
3 4 5 |
# File 'lib/pod/try_settings.rb', line 3 def project_path @project_path end |
Class Method Details
.settings_from_folder(path) ⇒ Object
Creates a TrySettings instance based on a folder path
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/pod/try_settings.rb', line 7 def self.settings_from_folder(path) settings_path = Pathname.new(path) + '.cocoapods.yml' return TrySettings.new unless File.exist? settings_path settings = YAMLHelper.load_file(settings_path) try_settings = TrySettings.new return try_settings unless settings['try'] if settings['try']['install'] try_settings.pre_install_commands = Array(settings['try']['install']['pre']) end if settings['try']['project'] try_settings.project_path = Pathname.new(path) + settings['try']['project'] end try_settings end |
Instance Method Details
#prompt_for_permission ⇒ Object
If we need to run commands from pod-try we should let the users know what is going to be running on their device.
29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/pod/try_settings.rb', line 29 def UI.titled_section 'Running Pre-Install Commands' do commands = pre_install_commands.length > 1 ? 'commands' : 'command' UI.puts "In order to try this pod, CocoaPods-Try needs to run the following #{commands}:" pre_install_commands.each { |command| UI.puts " - #{command}" } UI.puts "\nPress return to run these #{commands}, or press `ctrl + c` to stop trying this pod." end # Give an elegant exit point. UI.gets.chomp end |
#run_pre_install_commands(prompt) ⇒ Object
Runs the pre_install_commands from
46 47 48 49 50 51 |
# File 'lib/pod/try_settings.rb', line 46 def run_pre_install_commands(prompt) if pre_install_commands if prompt pre_install_commands.each { |command| Executable.execute_command('bash', ['-ec', command], true) } end end |