botstrap 0.0.5 → 0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/bin/botstrap +1 -1
- data/botstrap.gemspec +1 -0
- data/lib/botstrap.rb +71 -15
- data/lib/botstrap/version.rb +1 -1
- metadata +18 -2
data/bin/botstrap
CHANGED
data/botstrap.gemspec
CHANGED
data/lib/botstrap.rb
CHANGED
@@ -1,18 +1,8 @@
|
|
1
1
|
require "botstrap/version"
|
2
|
+
require 'xcodeproj'
|
2
3
|
|
3
|
-
|
4
|
-
|
5
|
-
not Dir.glob("#{directory}/*.xcodeproj").empty?
|
6
|
-
end
|
7
|
-
|
8
|
-
def self.generate_files
|
9
|
-
if directory_contains_xcode_project(".")
|
10
|
-
File.open(".gitattributes", "a") do |file|
|
11
|
-
file.write("*.pbxproj binary merge=union")
|
12
|
-
end
|
13
|
-
|
14
|
-
File.open(".gitignore", "a") do |file|
|
15
|
-
file.write("# OS X Finder
|
4
|
+
GITIGNORE_CONTENTS = <<GITIGNORE
|
5
|
+
# OS X Finder
|
16
6
|
.DS_Store
|
17
7
|
|
18
8
|
# Xcode per-user config
|
@@ -36,8 +26,74 @@ build/
|
|
36
26
|
*.swp
|
37
27
|
*~
|
38
28
|
*.dat
|
39
|
-
*.dep
|
40
|
-
|
29
|
+
*.dep
|
30
|
+
GITIGNORE
|
31
|
+
|
32
|
+
GITATTRIBUTE_CONTENTS = "*.pbxproj binary merge=union"
|
33
|
+
|
34
|
+
TODO_WARNING_SCRIPT = <<WARNING
|
35
|
+
KEYWORDS="TODO:|FIXME:|\?\?\?:|\!\!\!:"
|
36
|
+
find "${SRCROOT}" \( -name "*.h" -or -name "*.m" \) -print0 | xargs -0 egrep --with-filename --line-number --only-matching "($KEYWORDS).*\$" | perl -p -e "s/($KEYWORDS)/ warning: \$1/"
|
37
|
+
WARNING
|
38
|
+
|
39
|
+
module Botstrap
|
40
|
+
|
41
|
+
def self.xcode_project
|
42
|
+
Dir.glob("*.xcodeproj").first
|
43
|
+
end
|
44
|
+
|
45
|
+
def self.install
|
46
|
+
unless self.xcode_project
|
47
|
+
puts "I don't see an xcode project file. You need to run me from a valid project directory."
|
48
|
+
exit
|
49
|
+
end
|
50
|
+
self.generate_git_ignore
|
51
|
+
self.generate_git_attributes
|
52
|
+
self.find_project
|
53
|
+
self.find_target
|
54
|
+
self.add_todo_build_phase
|
55
|
+
self.turn_on_all_warnings
|
56
|
+
self.set_treat_warnings_as_errors
|
57
|
+
self.save_changes
|
58
|
+
end
|
59
|
+
|
60
|
+
def self.generate_git_ignore
|
61
|
+
File.open(".gitignore", "a") do |file|
|
62
|
+
file.write(GITIGNORE_CONTENTS)
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
def self.generate_git_attributes
|
67
|
+
File.open(".gitattributes", "a") do |file|
|
68
|
+
file.write(GITATTRIBUTE_CONTENTS)
|
41
69
|
end
|
42
70
|
end
|
71
|
+
|
72
|
+
def self.find_project
|
73
|
+
@project = Xcodeproj::Project.new(self.xcode_project)
|
74
|
+
end
|
75
|
+
|
76
|
+
def self.find_target
|
77
|
+
available_targets = @project.targets.to_a
|
78
|
+
available_targets.delete_if { |t| t.name =~ /Tests$/ }
|
79
|
+
@target = available_targets.first
|
80
|
+
end
|
81
|
+
|
82
|
+
def self.add_todo_build_phase
|
83
|
+
@target.shell_script_build_phases.new('name' => 'Warn for TODO and FIXME comments', 'shellScript' => TODO_WARNING_SCRIPT)
|
84
|
+
end
|
85
|
+
|
86
|
+
def self.turn_on_all_warnings
|
87
|
+
@target.build_configurations.each do |configuration|
|
88
|
+
configuration.build_settings['WARNING_CFLAGS'] = '-Wall'
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
def self.set_treat_warnings_as_errors
|
93
|
+
@target.build_settings('Release')['GCC_TREAT_WARNINGS_AS_ERRORS'] = 'YES'
|
94
|
+
end
|
95
|
+
|
96
|
+
def self.save_changes
|
97
|
+
@project.save_as self.xcode_project
|
98
|
+
end
|
43
99
|
end
|
data/lib/botstrap/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: botstrap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: '0.1'
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,23 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
date: 2012-10-17 00:00:00.000000000 Z
|
13
|
-
dependencies:
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: xcodeproj
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 0.3.4
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 0.3.4
|
14
30
|
description: Xcode/git bootstrapping
|
15
31
|
email:
|
16
32
|
- mark@thoughtbot.com
|