class Redbreast::Command::ConfigurationInstaller

Class for installing configuration

Public Class Methods

init() click to toggle source
# File lib/redbreast/commands/configuration_installer.rb, line 9
def self.init
  new.call
end

Public Instance Methods

call() click to toggle source
# File lib/redbreast/commands/configuration_installer.rb, line 13
def call
  prompt.say('Adding generation script to xcode buid phases...')
  project = fetch_project
  configure_target project.targets.first
  project.save
  success('Build phase setup!')
end

Private Instance Methods

configure_target(target) click to toggle source
# File lib/redbreast/commands/configuration_installer.rb, line 30
def configure_target(target)
  puts target.build_phases.class
  phase = target.new_shell_script_build_phase('Redbreast generate')
  phase.shell_script = "PATH=$PATH:~/.rbenv/shims\nredbreast generate"
end
fetch_project() click to toggle source
# File lib/redbreast/commands/configuration_installer.rb, line 23
def fetch_project
  path = Dir.glob('*.xcodeproj').first
  raise '.xcodeproj file not found' if path.nil?

  Xcodeproj::Project.open(path)
end