Module: Botstrap
- Defined in:
- lib/botstrap.rb,
lib/botstrap/version.rb
Constant Summary collapse
- VERSION =
"0.1.1"
Class Method Summary collapse
- .add_todo_build_phase ⇒ Object
- .find_project ⇒ Object
- .find_target ⇒ Object
- .generate_git_attributes ⇒ Object
- .generate_git_ignore ⇒ Object
- .install ⇒ Object
- .save_changes ⇒ Object
- .set_treat_warnings_as_errors ⇒ Object
- .turn_on_all_warnings ⇒ Object
- .xcode_project ⇒ Object
Class Method Details
.add_todo_build_phase ⇒ Object
82 83 84 |
# File 'lib/botstrap.rb', line 82 def self.add_todo_build_phase @target.shell_script_build_phases.new('name' => 'Warn for TODO and FIXME comments', 'shellScript' => TODO_WARNING_SCRIPT) end |
.find_project ⇒ Object
72 73 74 |
# File 'lib/botstrap.rb', line 72 def self.find_project @project = Xcodeproj::Project.new(self.xcode_project) end |
.find_target ⇒ Object
76 77 78 79 80 |
# File 'lib/botstrap.rb', line 76 def self.find_target available_targets = @project.targets.to_a available_targets.delete_if { |t| t.name =~ /Tests$/ } @target = available_targets.first end |
.generate_git_attributes ⇒ Object
66 67 68 69 70 |
# File 'lib/botstrap.rb', line 66 def self.generate_git_attributes File.open(".gitattributes", "a") do |file| file.write(GITATTRIBUTE_CONTENTS) end end |
.generate_git_ignore ⇒ Object
60 61 62 63 64 |
# File 'lib/botstrap.rb', line 60 def self.generate_git_ignore File.open(".gitignore", "a") do |file| file.write(GITIGNORE_CONTENTS) end end |
.install ⇒ Object
45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/botstrap.rb', line 45 def self.install unless self.xcode_project puts "I don't see an xcode project file. You need to run me from a valid project directory." exit end self.generate_git_ignore self.generate_git_attributes self.find_project self.find_target self.add_todo_build_phase self.turn_on_all_warnings self.set_treat_warnings_as_errors self.save_changes end |
.save_changes ⇒ Object
96 97 98 |
# File 'lib/botstrap.rb', line 96 def self.save_changes @project.save_as self.xcode_project end |
.set_treat_warnings_as_errors ⇒ Object
92 93 94 |
# File 'lib/botstrap.rb', line 92 def self.set_treat_warnings_as_errors @target.build_settings('Release')['GCC_TREAT_WARNINGS_AS_ERRORS'] = 'YES' end |
.turn_on_all_warnings ⇒ Object
86 87 88 89 90 |
# File 'lib/botstrap.rb', line 86 def self.turn_on_all_warnings @target.build_configurations.each do |configuration| configuration.build_settings['WARNING_CFLAGS'] = '-Wall' end end |
.xcode_project ⇒ Object
41 42 43 |
# File 'lib/botstrap.rb', line 41 def self.xcode_project Dir.glob("*.xcodeproj").first end |