Skip to content

Commit

Permalink
Add configuration for setting up Run Script phases
Browse files Browse the repository at this point in the history
This adds the ability for users to define custom Run Script build phases
to be added to the main application target. By default, we're only
adding the original TODO/FIXME comment script

- Adds `run_script_phases` key to configuration. The value for this key
  is an array of dictionaries. The key for the dictionary will be used
  as the filename of the template script and the value will be used as the
  name for the script inside Xcode.
- Removes the `install_todo_script` key from the configuration. This key
  is superseded by the `run_script_phases` key.

Fixes #118
  • Loading branch information
mikaelbartlett authored and gfontenot committed Mar 20, 2014
1 parent 8f79a69 commit a8cef3e
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 11 deletions.
4 changes: 3 additions & 1 deletion defaults/liftoffrc
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@

configure_git: true
warnings_as_errors: true
install_todo_script: true
enable_static_analyzer: true
indentation_level: 4
use_tabs: false
use_cocoapods: true

run_script_phases:
- todo.sh: Warn for TODO and FIXME comments

warnings:
- GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED
- GCC_WARN_MISSING_PARENTHESES
Expand Down
8 changes: 4 additions & 4 deletions lib/liftoff/launchpad.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def perform_project_actions
set_indentation_level
enable_warnings
treat_warnings_as_errors
add_todo_script_phase
add_script_phases
enable_static_analyzer
generate_git
end
Expand All @@ -54,9 +54,9 @@ def set_indentation_level
def treat_warnings_as_errors
xcode_helper.treat_warnings_as_errors(@config.warnings_as_errors)
end

def add_todo_script_phase
xcode_helper.add_todo_script_phase(@config.install_todo_script)
def add_script_phases
xcode_helper.add_script_phases(@config.run_script_phases)
end

def enable_warnings
Expand Down
2 changes: 1 addition & 1 deletion lib/liftoff/project_configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module Liftoff
class ProjectConfiguration
LATEST_IOS = 7.0

attr_accessor :project_name, :company, :prefix, :configure_git, :warnings_as_errors, :install_todo_script, :enable_static_analyzer, :indentation_level, :warnings, :application_target_groups, :unit_test_target_groups, :use_cocoapods
attr_accessor :project_name, :company, :prefix, :configure_git, :warnings_as_errors, :enable_static_analyzer, :indentation_level, :warnings, :application_target_groups, :unit_test_target_groups, :use_cocoapods, :run_script_phases
attr_writer :author, :company_identifier, :use_tabs

def initialize(liftoffrc)
Expand Down
13 changes: 8 additions & 5 deletions lib/liftoff/xcodeproj_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,14 @@ def set_indentation_level(level, use_tabs)
main_group.uses_tabs = use_tabs
end
end

def add_todo_script_phase(enable_todos)
if enable_todos
puts 'Adding shell script build phase to warn on TODO and FIXME comments'
add_shell_script_build_phase(file_manager.template_contents('todo.sh'), 'Warn for TODO and FIXME comments')

def add_script_phases(scripts)
if scripts
scripts.each do |script|
key, value = script.first
puts "Adding shell script build phase '#{value}'"
add_shell_script_build_phase(file_manager.template_contents(key), value)
end
end
end

Expand Down

0 comments on commit a8cef3e

Please sign in to comment.