guard-xcode 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,6 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
5
+ test/GuardXcodeTest/build/GuardXcodeTest.build/Release/GuardXcodeTest.build
6
+ doc
data/Gemfile ADDED
@@ -0,0 +1,9 @@
1
+ source "http://rubygems.org"
2
+
3
+ gem "rake"
4
+ gem "guard"
5
+
6
+ # Specify your gem's dependencies in guard-xcode.gemspec
7
+ gemspec
8
+
9
+
data/LICENSE.md ADDED
@@ -0,0 +1,22 @@
1
+ The ISC license:
2
+ Copyright (c) 2012 Kyle Isom <coder@kyleisom.net>
3
+
4
+ Permission to use, copy, modify, and distribute this software for any
5
+ purpose with or without fee is hereby granted, provided that the above
6
+ copyright notice and this permission notice appear in all copies.
7
+
8
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9
+ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10
+ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11
+ ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13
+ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14
+ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15
+
16
+ --------------------------------------------------------------------------------
17
+
18
+ You may choose to follow this license or public domain. The intent with
19
+ dual-licensing this code is to afford you, the end user, maximum freedom
20
+ with the software. If public domain affords you more freedom, use it.
21
+
22
+
data/README.md ADDED
@@ -0,0 +1,65 @@
1
+ # guard-xcode
2
+
3
+ Continuous integration for your Xcode project. Run guard in your Xcode
4
+ directory, one of two things will happen: all your dreams will come true
5
+ OR any time a source file is changed, guard will kick off a build.
6
+ Guaranteed or your money back.
7
+
8
+ ## Prerequisites
9
+ You need `bundler`. If you've never used `Bundler` before, you'll need to
10
+ install the `bundler` gem:
11
+
12
+ ```bash
13
+ gem install Bundler
14
+ ```
15
+
16
+ (You may need to run this as `sudo`.)
17
+
18
+
19
+ ## Getting started
20
+ Create a Gemfile in your project root:
21
+
22
+ ```ruby
23
+ source :rubygems
24
+
25
+ gem "guard-xcode"
26
+ gem "growl"
27
+ ```
28
+
29
+ Run `bundle install` and run `guard xcode` in your project root. You may wish
30
+ to review the generate Guardfile.
31
+
32
+ If you want growl support, you'll need to install [GrowlNotify](http://growl.info/downloads#generaldownloads).
33
+ See also the [Growl notes](#growl-notes) in this document.
34
+
35
+ ## Options
36
+
37
+ The Xcode Guard supports the following options:
38
+
39
+ * `:target` - string defining the target to build (i.e. MyClassTests or MyClass)
40
+ * `:configuration` - string defining the build configuration to use
41
+ * `:scheme` - string defining the build scheme to use
42
+ * `:arch` - string defining the arch to build for
43
+ * `:all` - boolean indicated whether to build all targets. If true, overrides :target.
44
+ * `:quiet` - only notify on errors / warnings
45
+
46
+ <a name="growl-notes">
47
+ ## Growl Notes
48
+ </a>
49
+ There are two options for Growl support:
50
+
51
+ * the `growl` gem
52
+ * the 'growl_notify' gem
53
+
54
+ ### `growl`
55
+ This is a safe default, but requires you to download [GrowlNotify](http://growl.info/downloads#generaldownloads).
56
+ This is enabled by default. If you are using the stock version of Ruby shipped
57
+ with OS X, this is what you'll want to use. (Also, if you're using JRuby,
58
+ you'll need to use this.)
59
+
60
+ ### `growl_notify`
61
+ If you're using a version of Growl from the App Store, i.e. a version >= 1.3,
62
+ and you're not using JRuby or MacRuby (the default shipped with OS X), you
63
+ can use this. Instead of `gem "growl"` in your `Gemfile`, you'll want to
64
+ use `gem "growl_notify"`. Then, in your Guardfile, you'll need to change the
65
+ `notification :growl` line to `notification :growl_notify`.
data/Rakefile ADDED
@@ -0,0 +1,15 @@
1
+ require "bundler/gem_tasks"
2
+ require 'rake/testtask'
3
+ require 'rdoc/task'
4
+
5
+ Rake::TestTask.new do |t|
6
+ t.libs << 'test'
7
+ end
8
+
9
+ RDoc::Task.new do |rdoc|
10
+ rdoc.main = "README.rdoc"
11
+ rdoc.rdoc_files.include("lib/*.rb")
12
+ end
13
+
14
+ desc "Run tests"
15
+ task :default => :test
@@ -0,0 +1,28 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+
4
+ Gem::Specification.new do |s|
5
+ s.name = "guard-xcode"
6
+ s.version = "1.0.0"
7
+
8
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
9
+
10
+ s.authors = ["Kyle Isom"]
11
+ s.email = ["coder@kyleisom.net"]
12
+ s.homepage = "https://github.com/kisom/guard-xcode"
13
+ s.summary = "Run Xcode builds when source files change."
14
+ s.licenses = ["ISC", "public domain"]
15
+ s.description = "Build an Xcode project when source files change."
16
+
17
+ s.files = `git ls-files`.split("\n")
18
+ s.test_files = `git ls-files -- {test}/*`.split("\n")
19
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
20
+ s.require_paths = ["lib"]
21
+ s.extra_rdoc_files = [
22
+ "LICENSE.md",
23
+ "README.md"
24
+ ]
25
+
26
+ s.add_runtime_dependency "guard"
27
+ #s.add_development_dependency "rspec"
28
+ end
data/lib/.rspec ADDED
@@ -0,0 +1 @@
1
+ --color
@@ -0,0 +1,7 @@
1
+ # template Xcode guard
2
+
3
+ notification :growl
4
+
5
+ guard :xcode, :configuration => 'Debug', :target => 'MyApp', :clean =>true do
6
+ watch(/^.+\.[hmc]$/)
7
+ end
@@ -0,0 +1,5 @@
1
+ module Guard
2
+ module Xcode
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
@@ -0,0 +1,150 @@
1
+ require 'guard'
2
+ require 'guard/guard'
3
+
4
+ module Guard
5
+ class Xcode < ::Guard::Guard
6
+ # Build an Xcode project on file change
7
+ #
8
+ # Should be initialised with 'guard xcode' in the target project's
9
+ # directory
10
+
11
+ attr_reader :options
12
+
13
+ # Initialize a Guard.
14
+ # @param [Array<Guard::Watcher>] watchers the Guard file watchers
15
+ # @param [Hash] options the custom Guard options
16
+ def initialize(watchers = [], options = {})
17
+ super
18
+ @target = options[:target]
19
+ @config = options[:configuration]
20
+ @scheme = options[:scheme]
21
+ @arch = options[:arch]
22
+
23
+ if true == options[:all]
24
+ @all = true
25
+ @target = nil
26
+ else
27
+ @all = false
28
+ end
29
+
30
+ if true == options[:quiet]
31
+ @quiet = true
32
+ else
33
+ @quiet = false
34
+ end
35
+
36
+ if true == options[:clean]
37
+ @clean = true
38
+ else
39
+ @clean = false
40
+ end
41
+ end
42
+
43
+ def get_build_line
44
+ # generate the build line from the initialised options
45
+ build_line = 'xcodebuild '
46
+
47
+ ## configure build options
48
+ unless nil == @config
49
+ build_line += "-configuration #{@config} "
50
+ end
51
+
52
+ unless nil == @target
53
+ build_line += "-target #{@target} "
54
+ end
55
+
56
+ if @all
57
+ build_line += "-alltargets "
58
+ end
59
+
60
+ unless nil == @scheme
61
+ build_line += "-scheme #{@scheme} "
62
+ end
63
+
64
+ unless nil == @arch
65
+ build_line += "-arch #{@arch} "
66
+ end
67
+
68
+ unless false == @clean
69
+ build_line += "clean "
70
+ end
71
+
72
+ build_line += "build"
73
+ end
74
+
75
+ def run_build(build_line)
76
+ # run the build, returning a list of alerts
77
+ #
78
+ # returns:
79
+ # a list of symbols; possible values include :errors and :warnings which
80
+ # indicate the build included warnings or errors. Returning an empty list
81
+ # means no errors were detected.
82
+ alerts = []
83
+
84
+ unless @quiet
85
+ Notifier.notify("kicking off build with:\n#{build_line}")
86
+ end
87
+
88
+ output = `#{build_line}`
89
+ res = $?
90
+
91
+ unless @quiet
92
+ Notifier.notify("build finished.")
93
+ end
94
+
95
+ unless @quiet
96
+ puts output
97
+ end
98
+
99
+ if not 0 == res or output =~ /errors? generated/
100
+ Notifier.notify("xcode: errors in build!")
101
+ alerts.push :errors
102
+ end
103
+
104
+ if output =~ /warning/
105
+ Notifier.notify("xcode: warnings in build!")
106
+ alerts.push :warnings
107
+ end
108
+
109
+ alerts
110
+ end
111
+
112
+ # Call once when Guard starts. Please override initialize method to init stuff.
113
+ # @raise [:task_has_failed] when start has failed
114
+ def start
115
+ end
116
+
117
+ # Called when `stop|quit|exit|s|q|e + enter` is pressed (when Guard quits).
118
+ # @raise [:task_has_failed] when stop has failed
119
+ def stop
120
+ end
121
+
122
+ # Called when `reload|r|z + enter` is pressed.
123
+ # This method should be mainly used for "reload" (really!) actions like reloading passenger/spork/bundler/...
124
+ # @raise [:task_has_failed] when reload has failed
125
+ def reload
126
+ end
127
+
128
+ # Called when just `enter` is pressed
129
+ # This method should be principally used for long action like running all specs/tests/...
130
+ # @raise [:task_has_failed] when run_all has failed
131
+ def run_all
132
+ run_build(get_build_line)
133
+ end
134
+
135
+ # Called on file(s) modifications that the Guard watches.
136
+ # @param [Array<String>] paths the changes files or paths
137
+ # @raise [:task_has_failed] when run_on_change has failed
138
+ def run_on_change(paths)
139
+ run_build(get_build_line)
140
+ end
141
+
142
+ # Called on file(s) deletions that the Guard watches.
143
+ # @param [Array<String>] paths the deleted files or paths
144
+ # @raise [:task_has_failed] when run_on_change has failed
145
+ def run_on_deletion(paths)
146
+ run_build(get_build_line)
147
+ end
148
+
149
+ end
150
+ end
@@ -0,0 +1 @@
1
+ require "guard/xcode"
@@ -0,0 +1,7 @@
1
+ //
2
+ // Prefix header for all source files of the 'GuardXcodeTest' target in the 'GuardXcodeTest' project
3
+ //
4
+
5
+ #ifdef __OBJC__
6
+ #import <Foundation/Foundation.h>
7
+ #endif
@@ -0,0 +1,79 @@
1
+ .\"Modified from man(1) of FreeBSD, the NetBSD mdoc.template, and mdoc.samples.
2
+ .\"See Also:
3
+ .\"man mdoc.samples for a complete listing of options
4
+ .\"man mdoc for the short list of editing options
5
+ .\"/usr/share/misc/mdoc.template
6
+ .Dd 16/03/2012 \" DATE
7
+ .Dt GuardXcodeTest 1 \" Program name and manual section number
8
+ .Os Darwin
9
+ .Sh NAME \" Section Header - required - don't modify
10
+ .Nm GuardXcodeTest,
11
+ .\" The following lines are read in generating the apropos(man -k) database. Use only key
12
+ .\" words here as the database is built based on the words here and in the .ND line.
13
+ .Nm Other_name_for_same_program(),
14
+ .Nm Yet another name for the same program.
15
+ .\" Use .Nm macro to designate other names for the documented program.
16
+ .Nd This line parsed for whatis database.
17
+ .Sh SYNOPSIS \" Section Header - required - don't modify
18
+ .Nm
19
+ .Op Fl abcd \" [-abcd]
20
+ .Op Fl a Ar path \" [-a path]
21
+ .Op Ar file \" [file]
22
+ .Op Ar \" [file ...]
23
+ .Ar arg0 \" Underlined argument - use .Ar anywhere to underline
24
+ arg2 ... \" Arguments
25
+ .Sh DESCRIPTION \" Section Header - required - don't modify
26
+ Use the .Nm macro to refer to your program throughout the man page like such:
27
+ .Nm
28
+ Underlining is accomplished with the .Ar macro like this:
29
+ .Ar underlined text .
30
+ .Pp \" Inserts a space
31
+ A list of items with descriptions:
32
+ .Bl -tag -width -indent \" Begins a tagged list
33
+ .It item a \" Each item preceded by .It macro
34
+ Description of item a
35
+ .It item b
36
+ Description of item b
37
+ .El \" Ends the list
38
+ .Pp
39
+ A list of flags and their descriptions:
40
+ .Bl -tag -width -indent \" Differs from above in tag removed
41
+ .It Fl a \"-a flag as a list item
42
+ Description of -a flag
43
+ .It Fl b
44
+ Description of -b flag
45
+ .El \" Ends the list
46
+ .Pp
47
+ .\" .Sh ENVIRONMENT \" May not be needed
48
+ .\" .Bl -tag -width "ENV_VAR_1" -indent \" ENV_VAR_1 is width of the string ENV_VAR_1
49
+ .\" .It Ev ENV_VAR_1
50
+ .\" Description of ENV_VAR_1
51
+ .\" .It Ev ENV_VAR_2
52
+ .\" Description of ENV_VAR_2
53
+ .\" .El
54
+ .Sh FILES \" File used or created by the topic of the man page
55
+ .Bl -tag -width "/Users/joeuser/Library/really_long_file_name" -compact
56
+ .It Pa /usr/share/file_name
57
+ FILE_1 description
58
+ .It Pa /Users/joeuser/Library/really_long_file_name
59
+ FILE_2 description
60
+ .El \" Ends the list
61
+ .\" .Sh DIAGNOSTICS \" May not be needed
62
+ .\" .Bl -diag
63
+ .\" .It Diagnostic Tag
64
+ .\" Diagnostic informtion here.
65
+ .\" .It Diagnostic Tag
66
+ .\" Diagnostic informtion here.
67
+ .\" .El
68
+ .Sh SEE ALSO
69
+ .\" List links in ascending order by section, alphabetically within a section.
70
+ .\" Please do not reference files that do not exist without filing a bug report
71
+ .Xr a 1 ,
72
+ .Xr b 1 ,
73
+ .Xr c 1 ,
74
+ .Xr a 2 ,
75
+ .Xr b 2 ,
76
+ .Xr a 3 ,
77
+ .Xr b 3
78
+ .\" .Sh BUGS \" Document known, unremedied bugs
79
+ .\" .Sh HISTORY \" Document history if command behaves in a unique manner
@@ -0,0 +1,21 @@
1
+ //
2
+ // main.m
3
+ // GuardXcodeTest
4
+ //
5
+ // Created by Kyle Isom on 16/03/2012.
6
+ //
7
+
8
+ #import <Foundation/Foundation.h>
9
+
10
+ int main(int argc, const char * argv[])
11
+ {
12
+
13
+ @autoreleasepool {
14
+
15
+ // insert code here...
16
+ NSLog(@"Hello, World!");
17
+
18
+ }
19
+ return 0;
20
+ }
21
+
@@ -0,0 +1,238 @@
1
+ // !$*UTF8*$!
2
+ {
3
+ archiveVersion = 1;
4
+ classes = {
5
+ };
6
+ objectVersion = 46;
7
+ objects = {
8
+
9
+ /* Begin PBXBuildFile section */
10
+ 27C9929D1513CD0A00134440 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 27C9929C1513CD0A00134440 /* Foundation.framework */; };
11
+ 27C992A01513CD0A00134440 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 27C9929F1513CD0A00134440 /* main.m */; };
12
+ 27C992A41513CD0A00134440 /* GuardXcodeTest.1 in CopyFiles */ = {isa = PBXBuildFile; fileRef = 27C992A31513CD0A00134440 /* GuardXcodeTest.1 */; };
13
+ /* End PBXBuildFile section */
14
+
15
+ /* Begin PBXCopyFilesBuildPhase section */
16
+ 27C992961513CD0A00134440 /* CopyFiles */ = {
17
+ isa = PBXCopyFilesBuildPhase;
18
+ buildActionMask = 2147483647;
19
+ dstPath = /usr/share/man/man1/;
20
+ dstSubfolderSpec = 0;
21
+ files = (
22
+ 27C992A41513CD0A00134440 /* GuardXcodeTest.1 in CopyFiles */,
23
+ );
24
+ runOnlyForDeploymentPostprocessing = 1;
25
+ };
26
+ /* End PBXCopyFilesBuildPhase section */
27
+
28
+ /* Begin PBXFileReference section */
29
+ 27C992981513CD0A00134440 /* GuardXcodeTest */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = GuardXcodeTest; sourceTree = BUILT_PRODUCTS_DIR; };
30
+ 27C9929C1513CD0A00134440 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
31
+ 27C9929F1513CD0A00134440 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
32
+ 27C992A21513CD0A00134440 /* GuardXcodeTest-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "GuardXcodeTest-Prefix.pch"; sourceTree = "<group>"; };
33
+ 27C992A31513CD0A00134440 /* GuardXcodeTest.1 */ = {isa = PBXFileReference; lastKnownFileType = text.man; path = GuardXcodeTest.1; sourceTree = "<group>"; };
34
+ /* End PBXFileReference section */
35
+
36
+ /* Begin PBXFrameworksBuildPhase section */
37
+ 27C992951513CD0A00134440 /* Frameworks */ = {
38
+ isa = PBXFrameworksBuildPhase;
39
+ buildActionMask = 2147483647;
40
+ files = (
41
+ 27C9929D1513CD0A00134440 /* Foundation.framework in Frameworks */,
42
+ );
43
+ runOnlyForDeploymentPostprocessing = 0;
44
+ };
45
+ /* End PBXFrameworksBuildPhase section */
46
+
47
+ /* Begin PBXGroup section */
48
+ 27C9928D1513CD0A00134440 = {
49
+ isa = PBXGroup;
50
+ children = (
51
+ 27C9929E1513CD0A00134440 /* GuardXcodeTest */,
52
+ 27C9929B1513CD0A00134440 /* Frameworks */,
53
+ 27C992991513CD0A00134440 /* Products */,
54
+ );
55
+ sourceTree = "<group>";
56
+ };
57
+ 27C992991513CD0A00134440 /* Products */ = {
58
+ isa = PBXGroup;
59
+ children = (
60
+ 27C992981513CD0A00134440 /* GuardXcodeTest */,
61
+ );
62
+ name = Products;
63
+ sourceTree = "<group>";
64
+ };
65
+ 27C9929B1513CD0A00134440 /* Frameworks */ = {
66
+ isa = PBXGroup;
67
+ children = (
68
+ 27C9929C1513CD0A00134440 /* Foundation.framework */,
69
+ );
70
+ name = Frameworks;
71
+ sourceTree = "<group>";
72
+ };
73
+ 27C9929E1513CD0A00134440 /* GuardXcodeTest */ = {
74
+ isa = PBXGroup;
75
+ children = (
76
+ 27C9929F1513CD0A00134440 /* main.m */,
77
+ 27C992A31513CD0A00134440 /* GuardXcodeTest.1 */,
78
+ 27C992A11513CD0A00134440 /* Supporting Files */,
79
+ );
80
+ path = GuardXcodeTest;
81
+ sourceTree = "<group>";
82
+ };
83
+ 27C992A11513CD0A00134440 /* Supporting Files */ = {
84
+ isa = PBXGroup;
85
+ children = (
86
+ 27C992A21513CD0A00134440 /* GuardXcodeTest-Prefix.pch */,
87
+ );
88
+ name = "Supporting Files";
89
+ sourceTree = "<group>";
90
+ };
91
+ /* End PBXGroup section */
92
+
93
+ /* Begin PBXNativeTarget section */
94
+ 27C992971513CD0A00134440 /* GuardXcodeTest */ = {
95
+ isa = PBXNativeTarget;
96
+ buildConfigurationList = 27C992A71513CD0A00134440 /* Build configuration list for PBXNativeTarget "GuardXcodeTest" */;
97
+ buildPhases = (
98
+ 27C992941513CD0A00134440 /* Sources */,
99
+ 27C992951513CD0A00134440 /* Frameworks */,
100
+ 27C992961513CD0A00134440 /* CopyFiles */,
101
+ );
102
+ buildRules = (
103
+ );
104
+ dependencies = (
105
+ );
106
+ name = GuardXcodeTest;
107
+ productName = GuardXcodeTest;
108
+ productReference = 27C992981513CD0A00134440 /* GuardXcodeTest */;
109
+ productType = "com.apple.product-type.tool";
110
+ };
111
+ /* End PBXNativeTarget section */
112
+
113
+ /* Begin PBXProject section */
114
+ 27C9928F1513CD0A00134440 /* Project object */ = {
115
+ isa = PBXProject;
116
+ attributes = {
117
+ LastUpgradeCheck = 0440;
118
+ };
119
+ buildConfigurationList = 27C992921513CD0A00134440 /* Build configuration list for PBXProject "GuardXcodeTest" */;
120
+ compatibilityVersion = "Xcode 3.2";
121
+ developmentRegion = English;
122
+ hasScannedForEncodings = 0;
123
+ knownRegions = (
124
+ en,
125
+ );
126
+ mainGroup = 27C9928D1513CD0A00134440;
127
+ productRefGroup = 27C992991513CD0A00134440 /* Products */;
128
+ projectDirPath = "";
129
+ projectRoot = "";
130
+ targets = (
131
+ 27C992971513CD0A00134440 /* GuardXcodeTest */,
132
+ );
133
+ };
134
+ /* End PBXProject section */
135
+
136
+ /* Begin PBXSourcesBuildPhase section */
137
+ 27C992941513CD0A00134440 /* Sources */ = {
138
+ isa = PBXSourcesBuildPhase;
139
+ buildActionMask = 2147483647;
140
+ files = (
141
+ 27C992A01513CD0A00134440 /* main.m in Sources */,
142
+ );
143
+ runOnlyForDeploymentPostprocessing = 0;
144
+ };
145
+ /* End PBXSourcesBuildPhase section */
146
+
147
+ /* Begin XCBuildConfiguration section */
148
+ 27C992A51513CD0A00134440 /* Debug */ = {
149
+ isa = XCBuildConfiguration;
150
+ buildSettings = {
151
+ ALWAYS_SEARCH_USER_PATHS = NO;
152
+ ARCHS = "$(ARCHS_STANDARD_64_BIT)";
153
+ CLANG_ENABLE_OBJC_ARC = YES;
154
+ COPY_PHASE_STRIP = NO;
155
+ GCC_C_LANGUAGE_STANDARD = gnu99;
156
+ GCC_DYNAMIC_NO_PIC = NO;
157
+ GCC_ENABLE_OBJC_EXCEPTIONS = YES;
158
+ GCC_OPTIMIZATION_LEVEL = 0;
159
+ GCC_PREPROCESSOR_DEFINITIONS = (
160
+ "DEBUG=1",
161
+ "$(inherited)",
162
+ );
163
+ GCC_SYMBOLS_PRIVATE_EXTERN = NO;
164
+ GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
165
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
166
+ GCC_WARN_ABOUT_RETURN_TYPE = YES;
167
+ GCC_WARN_UNINITIALIZED_AUTOS = YES;
168
+ GCC_WARN_UNUSED_VARIABLE = YES;
169
+ MACOSX_DEPLOYMENT_TARGET = 10.8;
170
+ ONLY_ACTIVE_ARCH = YES;
171
+ SDKROOT = macosx;
172
+ };
173
+ name = Debug;
174
+ };
175
+ 27C992A61513CD0A00134440 /* Release */ = {
176
+ isa = XCBuildConfiguration;
177
+ buildSettings = {
178
+ ALWAYS_SEARCH_USER_PATHS = NO;
179
+ ARCHS = "$(ARCHS_STANDARD_64_BIT)";
180
+ CLANG_ENABLE_OBJC_ARC = YES;
181
+ COPY_PHASE_STRIP = YES;
182
+ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
183
+ GCC_C_LANGUAGE_STANDARD = gnu99;
184
+ GCC_ENABLE_OBJC_EXCEPTIONS = YES;
185
+ GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
186
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
187
+ GCC_WARN_ABOUT_RETURN_TYPE = YES;
188
+ GCC_WARN_UNINITIALIZED_AUTOS = YES;
189
+ GCC_WARN_UNUSED_VARIABLE = YES;
190
+ MACOSX_DEPLOYMENT_TARGET = 10.8;
191
+ SDKROOT = macosx;
192
+ };
193
+ name = Release;
194
+ };
195
+ 27C992A81513CD0A00134440 /* Debug */ = {
196
+ isa = XCBuildConfiguration;
197
+ buildSettings = {
198
+ ARCHS = "$(ARCHS_STANDARD_64_BIT)";
199
+ GCC_PRECOMPILE_PREFIX_HEADER = YES;
200
+ GCC_PREFIX_HEADER = "GuardXcodeTest/GuardXcodeTest-Prefix.pch";
201
+ PRODUCT_NAME = "$(TARGET_NAME)";
202
+ };
203
+ name = Debug;
204
+ };
205
+ 27C992A91513CD0A00134440 /* Release */ = {
206
+ isa = XCBuildConfiguration;
207
+ buildSettings = {
208
+ ARCHS = "$(ARCHS_STANDARD_64_BIT)";
209
+ GCC_PRECOMPILE_PREFIX_HEADER = YES;
210
+ GCC_PREFIX_HEADER = "GuardXcodeTest/GuardXcodeTest-Prefix.pch";
211
+ PRODUCT_NAME = "$(TARGET_NAME)";
212
+ };
213
+ name = Release;
214
+ };
215
+ /* End XCBuildConfiguration section */
216
+
217
+ /* Begin XCConfigurationList section */
218
+ 27C992921513CD0A00134440 /* Build configuration list for PBXProject "GuardXcodeTest" */ = {
219
+ isa = XCConfigurationList;
220
+ buildConfigurations = (
221
+ 27C992A51513CD0A00134440 /* Debug */,
222
+ 27C992A61513CD0A00134440 /* Release */,
223
+ );
224
+ defaultConfigurationIsVisible = 0;
225
+ defaultConfigurationName = Release;
226
+ };
227
+ 27C992A71513CD0A00134440 /* Build configuration list for PBXNativeTarget "GuardXcodeTest" */ = {
228
+ isa = XCConfigurationList;
229
+ buildConfigurations = (
230
+ 27C992A81513CD0A00134440 /* Debug */,
231
+ 27C992A91513CD0A00134440 /* Release */,
232
+ );
233
+ defaultConfigurationIsVisible = 0;
234
+ };
235
+ /* End XCConfigurationList section */
236
+ };
237
+ rootObject = 27C9928F1513CD0A00134440 /* Project object */;
238
+ }
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <Workspace
3
+ version = "1.0">
4
+ <FileRef
5
+ location = "self:GuardXcodeTest.xcodeproj">
6
+ </FileRef>
7
+ </Workspace>
@@ -0,0 +1,85 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <Scheme
3
+ version = "1.3">
4
+ <BuildAction
5
+ parallelizeBuildables = "YES"
6
+ buildImplicitDependencies = "YES">
7
+ <BuildActionEntries>
8
+ <BuildActionEntry
9
+ buildForTesting = "YES"
10
+ buildForRunning = "YES"
11
+ buildForProfiling = "YES"
12
+ buildForArchiving = "YES"
13
+ buildForAnalyzing = "YES">
14
+ <BuildableReference
15
+ BuildableIdentifier = "primary"
16
+ BlueprintIdentifier = "27C992971513CD0A00134440"
17
+ BuildableName = "GuardXcodeTest"
18
+ BlueprintName = "GuardXcodeTest"
19
+ ReferencedContainer = "container:GuardXcodeTest.xcodeproj">
20
+ </BuildableReference>
21
+ </BuildActionEntry>
22
+ </BuildActionEntries>
23
+ </BuildAction>
24
+ <TestAction
25
+ selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
26
+ selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
27
+ shouldUseLaunchSchemeArgsEnv = "YES"
28
+ buildConfiguration = "Debug">
29
+ <Testables>
30
+ </Testables>
31
+ <MacroExpansion>
32
+ <BuildableReference
33
+ BuildableIdentifier = "primary"
34
+ BlueprintIdentifier = "27C992971513CD0A00134440"
35
+ BuildableName = "GuardXcodeTest"
36
+ BlueprintName = "GuardXcodeTest"
37
+ ReferencedContainer = "container:GuardXcodeTest.xcodeproj">
38
+ </BuildableReference>
39
+ </MacroExpansion>
40
+ </TestAction>
41
+ <LaunchAction
42
+ selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
43
+ selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
44
+ launchStyle = "0"
45
+ useCustomWorkingDirectory = "NO"
46
+ buildConfiguration = "Debug"
47
+ ignoresPersistentStateOnLaunch = "NO"
48
+ debugDocumentVersioning = "YES"
49
+ allowLocationSimulation = "YES">
50
+ <BuildableProductRunnable>
51
+ <BuildableReference
52
+ BuildableIdentifier = "primary"
53
+ BlueprintIdentifier = "27C992971513CD0A00134440"
54
+ BuildableName = "GuardXcodeTest"
55
+ BlueprintName = "GuardXcodeTest"
56
+ ReferencedContainer = "container:GuardXcodeTest.xcodeproj">
57
+ </BuildableReference>
58
+ </BuildableProductRunnable>
59
+ <AdditionalOptions>
60
+ </AdditionalOptions>
61
+ </LaunchAction>
62
+ <ProfileAction
63
+ shouldUseLaunchSchemeArgsEnv = "YES"
64
+ savedToolIdentifier = ""
65
+ useCustomWorkingDirectory = "NO"
66
+ buildConfiguration = "Release"
67
+ debugDocumentVersioning = "YES">
68
+ <BuildableProductRunnable>
69
+ <BuildableReference
70
+ BuildableIdentifier = "primary"
71
+ BlueprintIdentifier = "27C992971513CD0A00134440"
72
+ BuildableName = "GuardXcodeTest"
73
+ BlueprintName = "GuardXcodeTest"
74
+ ReferencedContainer = "container:GuardXcodeTest.xcodeproj">
75
+ </BuildableReference>
76
+ </BuildableProductRunnable>
77
+ </ProfileAction>
78
+ <AnalyzeAction
79
+ buildConfiguration = "Debug">
80
+ </AnalyzeAction>
81
+ <ArchiveAction
82
+ buildConfiguration = "Release"
83
+ revealArchiveInOrganizer = "YES">
84
+ </ArchiveAction>
85
+ </Scheme>
@@ -0,0 +1,22 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+ <plist version="1.0">
4
+ <dict>
5
+ <key>SchemeUserState</key>
6
+ <dict>
7
+ <key>GuardXcodeTest.xcscheme</key>
8
+ <dict>
9
+ <key>orderHint</key>
10
+ <integer>0</integer>
11
+ </dict>
12
+ </dict>
13
+ <key>SuppressBuildableAutocreation</key>
14
+ <dict>
15
+ <key>27C992971513CD0A00134440</key>
16
+ <dict>
17
+ <key>primary</key>
18
+ <true/>
19
+ </dict>
20
+ </dict>
21
+ </dict>
22
+ </plist>
data/test/data/main.m ADDED
@@ -0,0 +1,21 @@
1
+ //
2
+ // main.m
3
+ // GuardXcodeTest
4
+ //
5
+ // Created by Kyle Isom on 16/03/2012.
6
+ //
7
+
8
+ #import <Foundation/Foundation.h>
9
+
10
+ int main(int argc, const char * argv[])
11
+ {
12
+
13
+ @autoreleasepool {
14
+
15
+ // insert code here...
16
+ NSLog(@"Hello, World!");
17
+
18
+ }
19
+ return 0;
20
+ }
21
+
@@ -0,0 +1,22 @@
1
+ //
2
+ // main.m
3
+ // GuardXcodeTest
4
+ //
5
+ // Created by Kyle Isom on 16/03/2012.
6
+ //
7
+
8
+ #import <Foundation/Foundation.h>
9
+
10
+ int main(int argc, const char * argv[])
11
+ {
12
+
13
+ @autoreleasepool {
14
+
15
+ // insert code here...
16
+ NSLog(@"Hello, World!");
17
+ foo
18
+
19
+ }
20
+ return 0;
21
+ }
22
+
@@ -0,0 +1,21 @@
1
+ //
2
+ // main.m
3
+ // GuardXcodeTest
4
+ //
5
+ // Created by Kyle Isom on 16/03/2012.
6
+ //
7
+
8
+ #import <Foundation/Foundation.h>
9
+
10
+ int main(int argc, const char * argv[])
11
+ {
12
+
13
+ @autoreleasepool {
14
+
15
+ // insert code here...
16
+ NSLog(@"Hello, World!");
17
+
18
+ }
19
+ return 0;
20
+ }
21
+
@@ -0,0 +1,22 @@
1
+ //
2
+ // main.m
3
+ // GuardXcodeTest
4
+ //
5
+ // Created by Kyle Isom on 16/03/2012.
6
+ //
7
+
8
+ #import <Foundation/Foundation.h>
9
+
10
+ int main(int argc, const char * argv[])
11
+ {
12
+
13
+ @autoreleasepool {
14
+
15
+ // insert code here...
16
+ NSLog(@"Hello, World!");
17
+ int foo;
18
+
19
+ }
20
+ return 0;
21
+ }
22
+
@@ -0,0 +1,23 @@
1
+ //
2
+ // main.m
3
+ // GuardXcodeTest
4
+ //
5
+ // Created by Kyle Isom on 16/03/2012.
6
+ //
7
+
8
+ #import <Foundation/Foundation.h>
9
+
10
+ int main(int argc, const char * argv[])
11
+ {
12
+
13
+ @autoreleasepool {
14
+
15
+ // insert code here...
16
+ NSLog(@"Hello, World!");
17
+ int foo;
18
+ foo
19
+
20
+ }
21
+ return 0;
22
+ }
23
+
@@ -0,0 +1,44 @@
1
+ require 'test/unit'
2
+ require 'guard/xcode'
3
+
4
+ class TestBuild < Test::Unit::TestCase
5
+ def setup
6
+ @xcode_test_path = 'test/GuardXcodeTest'
7
+ @toplevel = Dir.pwd
8
+ @builder = Guard::Xcode.new [], :quiet => true, :clean => true, :all => true
9
+ end
10
+
11
+ def teardown
12
+ @res = nil
13
+ @builder = nil
14
+ Dir.chdir @toplevel
15
+ `cp test/data/main.m "#{@xcode_test_path}/GuardXcodeTest/main.m"`
16
+ end
17
+
18
+ def run_with_new_main(mainfile)
19
+ `cp "#{mainfile}" "#{@xcode_test_path}/GuardXcodeTest/main.m"`
20
+ assert $? == 0, "copy of #{mainfile} failed: returned #{$?}, expected 0"
21
+ Dir.chdir(@xcode_test_path)
22
+ return @builder.run_build(@builder.get_build_line)
23
+ end
24
+
25
+ def test_good
26
+ res = run_with_new_main 'test/data/main_good.m'
27
+ assert res.empty?
28
+ end
29
+
30
+ def test_warnings
31
+ res = run_with_new_main 'test/data/main_warnings.m'
32
+ assert res == [:warnings], "expected: #{[:warnings]}, got #{res}"
33
+ end
34
+
35
+ def test_errors
36
+ res = run_with_new_main 'test/data/main_error.m'
37
+ assert res == [:errors], "expected: #{[:warnings]}, got #{res}"
38
+ end
39
+
40
+ def test_warnings_and_errors
41
+ res = run_with_new_main 'test/data/main_warnings_error.m'
42
+ assert res == [:errors, :warnings], "expected: #{[:errors, :warnings]}, got #{res}"
43
+ end
44
+ end
@@ -0,0 +1,34 @@
1
+ require 'test/unit'
2
+ require 'guard/xcode'
3
+
4
+ class XcodeTestBuildLines < Test::Unit::TestCase
5
+ def test_target_build_line
6
+ target = 'xcodebuild -target MyApp build'
7
+ targetGuard = Guard::Xcode.new [], :target =>'MyApp'
8
+ assert target == targetGuard.get_build_line
9
+ end
10
+
11
+ def test_config_build_line
12
+ config = 'xcodebuild -configuration MyConfig build'
13
+ configGuard = Guard::Xcode.new [], :configuration => 'MyConfig'
14
+ assert config == configGuard.get_build_line, "expected #{config} but got #{configGuard.get_build_line}"
15
+ end
16
+
17
+ def test_scheme_build_line
18
+ scheme = 'xcodebuild -scheme MyScheme build'
19
+ schemeGuard = Guard::Xcode.new [], :scheme => 'MyScheme'
20
+ assert scheme == schemeGuard.get_build_line
21
+ end
22
+
23
+ def test_arch_build_line
24
+ arch = 'xcodebuild -arch x86_64 build'
25
+ archGuard = Guard::Xcode.new [], :arch => 'x86_64'
26
+ assert arch == archGuard.get_build_line
27
+ end
28
+
29
+ def test_all_build_line
30
+ all = 'xcodebuild -alltargets build'
31
+ allGuard = Guard::Xcode.new [], :all => true
32
+ assert all == allGuard.get_build_line
33
+ end
34
+ end
metadata ADDED
@@ -0,0 +1,86 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: guard-xcode
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Kyle Isom
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-03-17 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: guard
16
+ requirement: &70171788474760 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: *70171788474760
25
+ description: Build an Xcode project when source files change.
26
+ email:
27
+ - coder@kyleisom.net
28
+ executables: []
29
+ extensions: []
30
+ extra_rdoc_files:
31
+ - LICENSE.md
32
+ - README.md
33
+ files:
34
+ - .gitignore
35
+ - Gemfile
36
+ - LICENSE.md
37
+ - README.md
38
+ - Rakefile
39
+ - guard-xcode.gemspec
40
+ - lib/.rspec
41
+ - lib/guard-xcode.rb
42
+ - lib/guard/xcode.rb
43
+ - lib/guard/xcode/templates/Guardfile
44
+ - lib/guard/xcode/version.rb
45
+ - test/GuardXcodeTest/GuardXcodeTest.xcodeproj/project.pbxproj
46
+ - test/GuardXcodeTest/GuardXcodeTest.xcodeproj/project.xcworkspace/contents.xcworkspacedata
47
+ - test/GuardXcodeTest/GuardXcodeTest.xcodeproj/project.xcworkspace/xcuserdata/kyle.xcuserdatad/UserInterfaceState.xcuserstate
48
+ - test/GuardXcodeTest/GuardXcodeTest.xcodeproj/xcuserdata/kyle.xcuserdatad/xcschemes/GuardXcodeTest.xcscheme
49
+ - test/GuardXcodeTest/GuardXcodeTest.xcodeproj/xcuserdata/kyle.xcuserdatad/xcschemes/xcschememanagement.plist
50
+ - test/GuardXcodeTest/GuardXcodeTest/GuardXcodeTest-Prefix.pch
51
+ - test/GuardXcodeTest/GuardXcodeTest/GuardXcodeTest.1
52
+ - test/GuardXcodeTest/GuardXcodeTest/main.m
53
+ - test/data/main.m
54
+ - test/data/main_error.m
55
+ - test/data/main_good.m
56
+ - test/data/main_warnings.m
57
+ - test/data/main_warnings_error.m
58
+ - test/test_build.rb
59
+ - test/test_build_lines.rb
60
+ homepage: https://github.com/kisom/guard-xcode
61
+ licenses:
62
+ - ISC
63
+ - public domain
64
+ post_install_message:
65
+ rdoc_options: []
66
+ require_paths:
67
+ - lib
68
+ required_ruby_version: !ruby/object:Gem::Requirement
69
+ none: false
70
+ requirements:
71
+ - - ! '>='
72
+ - !ruby/object:Gem::Version
73
+ version: '0'
74
+ required_rubygems_version: !ruby/object:Gem::Requirement
75
+ none: false
76
+ requirements:
77
+ - - ! '>='
78
+ - !ruby/object:Gem::Version
79
+ version: '0'
80
+ requirements: []
81
+ rubyforge_project:
82
+ rubygems_version: 1.8.15
83
+ signing_key:
84
+ specification_version: 3
85
+ summary: Run Xcode builds when source files change.
86
+ test_files: []