objc 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: b7f7ebe28d44622983f8eb769014fc9bf89eee79
4
+ data.tar.gz: 6bf65a15e5de66e6ad876d6328d9712e5ad4957a
5
+ SHA512:
6
+ metadata.gz: 1a32dd4bcb52d3449818474bb34f4e3fbea8c9f6e1c60c86c982538197a1641dd24a17608a467a33b4bf318277318170245cd96623316d35480d776bb54bcc92
7
+ data.tar.gz: ceba1e26642b2348ba52e9306612319d26cb71b9eb63bc542f4e5eba56978bb435d6bb469687cea93244636b0c5ccdeff0012630cc919cce2d29b54faf3b65c1
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in objc.gemspec
4
+ gemspec
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Franklin Webber
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,38 @@
1
+ # Objc
2
+
3
+ This gem is a test suite runner for Objective-C files to allow for the easy
4
+ execution of a test suite without the hassle of managing an Xcode Project File
5
+
6
+ ## Installation
7
+
8
+ Install the gem
9
+
10
+ $ gem install objc
11
+
12
+ Install [xctool](https://github.com/facebook/xctool)
13
+
14
+ ## Usage
15
+
16
+ $ objc Anagram
17
+
18
+ The `objc` binary will find and run the tests for the following files: `Anagram.h`,
19
+ `Anagram.m` and `AnagramTest.m`.
20
+
21
+ More specifically the following occurs:
22
+
23
+ * Finds the files matching the specified prefix (e.g. `Anagram.h`,
24
+ `Anagram.m` and `AnagramTest.m`)
25
+ * An Xcode Project, managed by the gem, is copied to to a tmp location on the
26
+ system.
27
+ * Using the [xcoder](https://github.com/rayh/xcoder) the project file is
28
+ manipulated and the found files are added.
29
+ * Using [xctool](https://github.com/facebook/xctool) the tests from the
30
+ project file are executed.
31
+
32
+ ## Contributing
33
+
34
+ 1. Fork it
35
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
36
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
37
+ 4. Push to the branch (`git push origin my-new-feature`)
38
+ 5. Create new Pull Request
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,19 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ path = __FILE__
4
+ $:.unshift(File.join(File.dirname(File.expand_path(path)), '..', 'lib'))
5
+ require 'objc'
6
+
7
+ if ARGV.length == 1
8
+ Objc::Test.with(ARGV[0])
9
+ else
10
+ puts %{
11
+
12
+ The `objc` binary requires that you provide a file prefix so that it is
13
+ able to find the: header file; source file; and test file.
14
+
15
+ $ objc Anagram
16
+
17
+ This will find the following: Anagram.h; Anagram.m; and AnagramTest.m
18
+ }
19
+ end
@@ -0,0 +1,24 @@
1
+ require 'xcoder'
2
+ require 'tmpdir'
3
+
4
+ require "objc/version"
5
+ require 'objc/source_files'
6
+ require 'objc/xcode_project'
7
+
8
+ module Objc
9
+ module Test
10
+ extend self
11
+
12
+ def with(filePrefix)
13
+ puts "Looking for all files with prefix: #{filePrefix}"
14
+
15
+ files = SourceFiles.new(filePrefix)
16
+
17
+ project = XcodeProject.new
18
+ project.install!
19
+ project.add(files)
20
+ project.execute!
21
+ end
22
+
23
+ end
24
+ end
@@ -0,0 +1,43 @@
1
+ module Objc
2
+ module Test
3
+
4
+ class SourceFiles
5
+ def initialize(prefix)
6
+ @prefix = prefix
7
+ end
8
+
9
+ attr_reader :prefix
10
+
11
+ def source_file
12
+ "#{prefix}.m"
13
+ end
14
+
15
+ def source_file_path
16
+ File.expand_path(source_file)
17
+ end
18
+
19
+ def header_file
20
+ "#{prefix}.h"
21
+ end
22
+
23
+ def header_file_path
24
+ File.expand_path(header_file)
25
+ end
26
+
27
+ def test_file
28
+ "#{prefix}Test.m"
29
+ end
30
+
31
+ def test_file_path
32
+ File.expand_path(test_file)
33
+ end
34
+
35
+ def data
36
+ [ { 'name' => source_file, 'path' => source_file_path },
37
+ { 'name' => header_file, 'path' => header_file_path },
38
+ { 'name' => test_file, 'path' => test_file_path } ]
39
+ end
40
+ end
41
+
42
+ end
43
+ end
@@ -0,0 +1,3 @@
1
+ module Objc
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,77 @@
1
+ module Objc
2
+ module Test
3
+ class XcodeProject
4
+
5
+ def install!
6
+ clean
7
+ extract
8
+ end
9
+
10
+
11
+ def add(files)
12
+ project = Xcode.project(project_path)
13
+
14
+ puts "Loading files into #{project} at #{project_path}"
15
+
16
+ target = project.target(target_name)
17
+ test_group = project.group(group_name)
18
+
19
+ source_files_in_project = files.data.map do |path_data|
20
+ test_group.create_file path_data
21
+ end
22
+
23
+ files_required_to_be_built = source_files_in_project.reject do |file|
24
+ file.name.end_with?("h")
25
+ end
26
+
27
+ target.sources_build_phase do
28
+ files_required_to_be_built.each do |source_file|
29
+ add_build_file source_file
30
+ end
31
+ end
32
+
33
+ project.save!
34
+ end
35
+
36
+
37
+ def execute!
38
+ puts `xctool -project #{project_path} -scheme IgnoreThisTarget test`
39
+ end
40
+
41
+
42
+ private
43
+
44
+ def clean
45
+ `rm -rf #{project_root}`
46
+ end
47
+
48
+ def extract
49
+ `tar -xvf #{project_template_tar_file} -C #{temp_path} > /dev/null 2>&1`
50
+ end
51
+
52
+ def temp_path
53
+ @temp_path ||= Dir.tmpdir
54
+ end
55
+
56
+ def project_template_tar_file
57
+ File.expand_path(File.join(__FILE__,"..","..","..","template","template-project.tar"))
58
+ end
59
+
60
+ def project_root
61
+ File.expand_path(File.join(temp_path,"ExercismTestFixture"))
62
+ end
63
+
64
+ def project_path
65
+ File.expand_path(File.join(project_root,"ExercismTestFixture.xcodeproj"))
66
+ end
67
+
68
+ def target_name
69
+ 'test-suite'
70
+ end
71
+
72
+ def group_name
73
+ 'test-suite'
74
+ end
75
+ end
76
+ end
77
+ end
@@ -0,0 +1,26 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'objc/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "objc"
8
+ spec.version = Objc::VERSION
9
+ spec.authors = ["Franklin Webber"]
10
+ spec.email = ["franklin.webber@gmail.com"]
11
+ spec.description = %q{This gem is a test suite runner for Objective-C files to allow for the easy
12
+ execution of a test suite without the hassle of managing an Xcode Project File. This allows you to work on your source files outside of a Xcode project but still have them tested. This is useful when when you want to practice Objective-C without the hassle of Xcode.}
13
+ spec.summary = %q{This gem is a test suite runner for Objective-C files to allow for the easy
14
+ execution of a test suite without the hassle of managing an Xcode Project File}
15
+ spec.homepage = "https://github.com/burtlo/objc"
16
+ spec.license = "MIT"
17
+
18
+ spec.files = `git ls-files`.split($/)
19
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
20
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
21
+ spec.require_paths = ["lib"]
22
+
23
+ spec.add_development_dependency "bundler", "~> 1.3"
24
+ spec.add_development_dependency "rake"
25
+ spec.add_development_dependency "xcoder"
26
+ end
metadata ADDED
@@ -0,0 +1,102 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: objc
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Franklin Webber
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-10-22 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.3'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.3'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: xcoder
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ description: |-
56
+ This gem is a test suite runner for Objective-C files to allow for the easy
57
+ execution of a test suite without the hassle of managing an Xcode Project File. This allows you to work on your source files outside of a Xcode project but still have them tested. This is useful when when you want to practice Objective-C without the hassle of Xcode.
58
+ email:
59
+ - franklin.webber@gmail.com
60
+ executables:
61
+ - objc
62
+ extensions: []
63
+ extra_rdoc_files: []
64
+ files:
65
+ - .gitignore
66
+ - Gemfile
67
+ - LICENSE.txt
68
+ - README.md
69
+ - Rakefile
70
+ - bin/objc
71
+ - lib/objc.rb
72
+ - lib/objc/source_files.rb
73
+ - lib/objc/version.rb
74
+ - lib/objc/xcode_project.rb
75
+ - objc.gemspec
76
+ - template/template-project.tar
77
+ homepage: https://github.com/burtlo/objc
78
+ licenses:
79
+ - MIT
80
+ metadata: {}
81
+ post_install_message:
82
+ rdoc_options: []
83
+ require_paths:
84
+ - lib
85
+ required_ruby_version: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - '>='
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ required_rubygems_version: !ruby/object:Gem::Requirement
91
+ requirements:
92
+ - - '>='
93
+ - !ruby/object:Gem::Version
94
+ version: '0'
95
+ requirements: []
96
+ rubyforge_project:
97
+ rubygems_version: 2.1.9
98
+ signing_key:
99
+ specification_version: 4
100
+ summary: This gem is a test suite runner for Objective-C files to allow for the easy
101
+ execution of a test suite without the hassle of managing an Xcode Project File
102
+ test_files: []