xclisten 0.0.3 → 0.0.4

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c22544587e1cd66bc74c2efc30277fc4585d678b
4
- data.tar.gz: 77643232fcda8643ddaf74a60a495e60f7d26342
3
+ metadata.gz: 374baf4cf8e109c0bcce7da6a8a6424129c79a05
4
+ data.tar.gz: 99060e03939a3eb604eea4fab5e024b0ef78ec14
5
5
  SHA512:
6
- metadata.gz: ae89b027b5536f46e230c65c6eba628de77bc2c2a8e20d6071cfd6cdf117ce68045c0a10eba7932dc17051c03b86d0f77a97afd6a9430d02f7e8c7a0120c5e9f
7
- data.tar.gz: 0a3b5d0679bde7510bbfe90aa6c91e4f5d0cee52090ec9c435e8abf8113bcadeaa0030eed11fc9bd2d20964d1e4da8f794c7623923ac12c0ff58696b14172ca3
6
+ metadata.gz: de764a81432718f40e53d2633ec49d36adb102085f32d418eb4f5efa20372d47d7afc25d15a6b56975b2d29eeb1e366e1213636e0e28e29ca85047a860b564a6
7
+ data.tar.gz: db901ec8e72df859f299c563ed06d14ab66f3a730f7da85a4e0093702654f18f35a9fe65ded12825becbed4c2845aef3a06f41e7758a82a132029501190378ef
data/.gitmodules ADDED
@@ -0,0 +1,12 @@
1
+ [submodule "fixtures/ReactiveCocoa"]
2
+ path = fixtures/ReactiveCocoa
3
+ url = https://github.com/ReactiveCocoa/ReactiveCocoa.git
4
+ [submodule "fixtures/Kiwi"]
5
+ path = fixtures/Kiwi
6
+ url = https://github.com/allending/Kiwi.git
7
+ [submodule "fixtures/ObjectiveRecord"]
8
+ path = fixtures/ObjectiveRecord
9
+ url = https://github.com/mneorr/ObjectiveRecord.git
10
+ [submodule "fixtures/AFNetworking"]
11
+ path = fixtures/AFNetworking
12
+ url = https://github.com/AFNetworking/AFNetworking.git
data/.travis.yml ADDED
@@ -0,0 +1,3 @@
1
+ rvm: 2.1.0
2
+ script: rake ci
3
+
data/CHANGELOG.md CHANGED
@@ -1,5 +1,25 @@
1
1
  # Changelog
2
2
 
3
+ # 0.0.4
4
+
5
+ ##### Enhancements
6
+
7
+ * Search for `.xcworkspace` recursively |
8
+ [Delisa Mason](https://github.com/kattrali) |
9
+ [#8](https://github.com/mneorr/xclisten/pull/8)
10
+ * Added some tests and CI integration \o/
11
+ * Added `--workspace -w` flag to specify a custom workspace location
12
+ * Specified `macosx` sdk rather than nothing on OSX builds
13
+
14
+
15
+ # 0.0.3
16
+
17
+ ##### Enhancements
18
+
19
+ * Use lower-level fork and exec for spawning xcodebuild
20
+ * Support for custom schemes
21
+ * Support for custom devices (iphone5s, iphone5, iphone4)
22
+
3
23
  # 0.0.2
4
24
 
5
25
  ##### Bug Fixes
data/README.md CHANGED
@@ -1,4 +1,5 @@
1
1
  # XCListen
2
+ [![Build Status](https://travis-ci.org/mneorr/xclisten.png?branch=master)](https://travis-ci.org/mneorr/xclisten)
2
3
 
3
4
  A zero-configuration filesystem watcher for ObjectiveC. It determines your workspace and scheme automatically, and:
4
5
 
@@ -25,6 +26,17 @@ Simple, huh?
25
26
 
26
27
  If you have an OSX project, you'll want to run it with `--osx` flag.
27
28
 
29
+ ## Flags
30
+
31
+ ``` bash
32
+ Usage: xclisten [optional flags]
33
+ --osx Run with OSX sdk (without simulator)
34
+ --ios [DEFAULT] Run with iOS sdk
35
+ -d, --device Simulated device [iphone5s, iphone5, iphone4]. Default is iphone5s
36
+ -s, --scheme BYOS (Bring your own scheme)
37
+ -h, --help Show this message
38
+ -v, --version Show version
39
+ ```
28
40
 
29
41
  ## Something went wrong!
30
42
 
@@ -32,6 +44,5 @@ No worries, just `tail -f xcodebuild_error.log` and let us know what's happening
32
44
 
33
45
  ## TODO
34
46
 
35
- - Device flag (choose between iphone5s, iPad, iPad Air,...)
36
47
  - Support non-cocoapods projects, when there's no .xcworkspace
37
48
  - Acceptance tests
data/Rakefile CHANGED
@@ -1 +1,15 @@
1
1
  require "bundler/gem_tasks"
2
+
3
+ task :spec do
4
+ sh 'rspec spec --color --format nested'
5
+ end
6
+
7
+ task :cucumber do
8
+ sh 'cucumber'
9
+ end
10
+
11
+ task :ci do
12
+ Rake::Task[:spec].invoke
13
+ #Rake::Task[:cucumber].invoke
14
+ end
15
+
data/bin/xclisten CHANGED
@@ -11,19 +11,22 @@ require 'optparse'
11
11
  @options = {}
12
12
 
13
13
  OptionParser.new do |opts|
14
- opts.banner = "Usage: xcodebuild [options] | xcpretty"
14
+ opts.banner = "Usage: xclisten [optional flags]"
15
15
  opts.on('--osx', 'Run with OSX sdk (without simulator)') do
16
- @options[:sdk] = ''
16
+ @options[:sdk] = 'macosx'
17
17
  end
18
18
  opts.on('--ios', '[DEFAULT] Run with iOS sdk') do
19
- @options[:sdk] = '-sdk iphonesimulator'
19
+ @options[:sdk] = 'iphonesimulator'
20
20
  end
21
21
  opts.on('-d', '--device', 'Simulated device [iphone5s, iphone5, iphone4]. Default is iphone5s') do |device|
22
22
  @options[:device] = device
23
23
  end
24
- opts.on('-s', '--scheme', 'BYOS (Bring your own scheme)') do |scheme|
24
+ opts.on('-s', '--scheme SCHEME', 'BYOS (Bring your own scheme)') do |scheme|
25
25
  @options[:scheme] = scheme
26
26
  end
27
+ opts.on('-w', '--workspace WORKSPACE', 'BYOW (Bring your own workspace)') do |workspace|
28
+ @options[:workspace] = workspace
29
+ end
27
30
  opts.on_tail('-h', '--help', 'Show this message') { puts opts; exit }
28
31
  opts.on_tail("-v", "--version", "Show version") { puts XCListen::VERSION; exit }
29
32
  opts.parse!
@@ -31,6 +34,5 @@ end
31
34
 
32
35
  pid = fork { XCListen.new(@options).listen }
33
36
  trap("SIGINT") { Process.kill(9, pid) }
34
-
35
37
  Process.wait(pid)
36
38
 
@@ -1,4 +1,4 @@
1
1
  class XCListen
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
4
4
 
data/lib/xclisten.rb CHANGED
@@ -7,11 +7,13 @@ class XCListen
7
7
  attr_reader :device
8
8
  attr_reader :scheme
9
9
  attr_reader :sdk
10
+ attr_reader :workspace
10
11
 
11
12
  def initialize(opts = {})
12
13
  @device = IOS_DEVICES[opts[:device]] || IOS_DEVICES['iphone5s']
13
14
  @scheme = opts[:scheme] || project_name
14
15
  @sdk = opts[:sdk] || 'iphonesimulator'
16
+ @workspace = opts[:workspace] || workspace_path
15
17
  end
16
18
 
17
19
  IOS_DEVICES = {
@@ -20,31 +22,45 @@ class XCListen
20
22
  'iphone4' => 'iPhone Retina (3.5-inch)'
21
23
  }
22
24
 
23
- #TODO: make this recursive
24
- def workspace_name
25
- Dir.entries(Dir.pwd).detect { |f| f =~ /.xcworkspace/ }
25
+ def workspace_path
26
+ @workspace_path ||= Dir.glob("**/*.xcworkspace").select {|p| !p.include? "xcodeproj"}.first
26
27
  end
27
28
 
28
- #TODO: when workspace_name gets recursive, use `basename`
29
29
  def project_name
30
- workspace_name.split('.').first
30
+ File.basename(workspace_path, ".*") if workspace_path
31
31
  end
32
32
 
33
33
  def xcodebuild
34
- "xcodebuild -workspace #{workspace_name} -scheme #{@scheme} -sdk #{@sdk} -destination 'name=#{@device}'"
34
+ "xcodebuild -workspace #{@workspace} -scheme #{@scheme} -sdk #{@sdk} -destination 'name=#{@device}'"
35
35
  end
36
36
 
37
37
  def install_pods
38
- system 'pod install'
39
- puts 'Giving Xcode some time to index...'
40
- sleep 10
38
+ Dir.chdir(File.dirname(workspace_path)) do
39
+ system 'pod install'
40
+ puts 'Giving Xcode some time to index...'
41
+ sleep 10
42
+ end
41
43
  end
42
44
 
43
45
  def run_tests
44
46
  ShellTask.run("#{xcodebuild} test 2> xcodebuild_error.log | xcpretty -tc")
45
47
  end
46
48
 
49
+ #TODO TEST THIS SPIKE
50
+ def validate_run
51
+ unless can_run?
52
+ puts "[!] No xcworkspace found in this directory (or any child directories)"
53
+ exit 1
54
+ end
55
+ end
56
+
57
+ def can_run?
58
+ project_name && !project_name.empty?
59
+ end
60
+
47
61
  def listen
62
+ validate_run
63
+ puts "Started xclistening to #{workspace_path}"
48
64
  ignored = [/.git/, /.xc(odeproj|workspace|userdata|scheme|config)/, /.lock$/, /\.txt$/, /\.log$/]
49
65
 
50
66
  listener = Listen.to(Dir.pwd, :ignore => ignored) do |modified, added, removed|
@@ -10,13 +10,10 @@ class XCListen
10
10
  end
11
11
  end
12
12
 
13
- before(:each) do
14
- Dir.stub(:entries).and_return(['SampleProject.xcworkspace'])
15
- end
16
-
17
13
  context "Defaults" do
18
14
 
19
15
  before(:each) do
16
+ Dir.stub(:glob).and_return(['SampleProject.xcworkspace'])
20
17
  @xclisten = XCListen.new
21
18
  end
22
19
 
@@ -28,6 +25,10 @@ class XCListen
28
25
  @xclisten.scheme.should == 'SampleProject'
29
26
  end
30
27
 
28
+ it "uses the first found workspace by default" do
29
+ @xclisten.workspace.should == 'SampleProject.xcworkspace'
30
+ end
31
+
31
32
  it "uses iphonesimulator sdk by default" do
32
33
  @xclisten.sdk.should == 'iphonesimulator'
33
34
  end
@@ -39,6 +40,11 @@ class XCListen
39
40
  xclisten.device.should == 'iPhone Retina (4-inch)'
40
41
  end
41
42
 
43
+ it "initializes with a different workspace" do
44
+ xclisten = XCListen.new(:workspace => 'Example/Sample.xcworkspace')
45
+ xclisten.workspace.should == 'Example/Sample.xcworkspace'
46
+ end
47
+
42
48
  it "initializes with a different scheme" do
43
49
  xclisten = XCListen.new(:scheme => 'AnotherScheme')
44
50
  xclisten.scheme.should == 'AnotherScheme'
@@ -50,8 +56,41 @@ class XCListen
50
56
  end
51
57
 
52
58
  it 'uses xcodebuild with given flags' do
59
+ flags = {
60
+ :workspace => 'Example/Sample.xcworkspace',
61
+ :scheme => 'kif',
62
+ :sdk => 'macosx',
63
+ :device => 'name=iPhone Retina (4-inch 64-bit)'
64
+ }
65
+ xclisten = XCListen.new(flags)
66
+ xclisten.xcodebuild.should == "xcodebuild -workspace #{flags[:workspace]} -scheme #{flags[:scheme]} -sdk #{flags[:sdk]} -destination '#{flags[:device]}'"
67
+ end
68
+
69
+ it "knows if it can run" do
70
+ Dir.stub(:glob).and_return([""])
53
71
  xclisten = XCListen.new
54
- xclisten.xcodebuild.should == "xcodebuild -workspace SampleProject.xcworkspace -scheme SampleProject -sdk iphonesimulator -destination 'name=iPhone Retina (4-inch 64-bit)'"
72
+ xclisten.can_run?.should be_false
73
+ end
74
+
75
+ context "finding the right workspace" do
76
+
77
+ before(:all) do
78
+ @base_dir = Dir.pwd
79
+ end
80
+
81
+ after(:each) do
82
+ Dir.chdir(@base_dir)
83
+ end
84
+
85
+ it "works with one level deep workspace" do
86
+ Dir.chdir('fixtures/ObjectiveRecord')
87
+ XCListen.new.workspace.should == 'Example/SampleProject.xcworkspace'
88
+ end
89
+
90
+ it "works with xcworkspace in the same directory" do
91
+ Dir.chdir('fixtures/AFNetworking')
92
+ XCListen.new.workspace.should == 'AFNetworking.xcworkspace'
93
+ end
55
94
  end
56
95
  end
57
96
 
data/xclisten.gemspec CHANGED
@@ -15,12 +15,14 @@ Gem::Specification.new do |spec|
15
15
 
16
16
  spec.files = `git ls-files`.split($/)
17
17
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
- spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features|fixtures)/})
19
19
  spec.require_paths = ["lib"]
20
20
 
21
21
  spec.add_runtime_dependency "listen", "~> 2.4"
22
22
  spec.add_runtime_dependency "xcpretty", "~> 0.1"
23
23
 
24
24
  spec.add_development_dependency "bundler", "~> 1.5"
25
+ spec.add_development_dependency "rspec"
26
+ spec.add_development_dependency "rake"
25
27
  end
26
28
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xclisten
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marin Usalj
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-06 00:00:00.000000000 Z
11
+ date: 2014-01-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: listen
@@ -52,6 +52,34 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '1.5'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rake
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
55
83
  description: Zero configuration file watcher for Objective-C that runs tests, installs
56
84
  Pods each time you save a file
57
85
  email:
@@ -62,6 +90,8 @@ extensions: []
62
90
  extra_rdoc_files: []
63
91
  files:
64
92
  - ".gitignore"
93
+ - ".gitmodules"
94
+ - ".travis.yml"
65
95
  - CHANGELOG.md
66
96
  - Gemfile
67
97
  - LICENSE.txt
@@ -99,3 +129,4 @@ specification_version: 4
99
129
  summary: Run ObjectiveC tests each time you hit save
100
130
  test_files:
101
131
  - spec/lib/xclisten_spec.rb
132
+ has_rdoc: