xclisten 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 374baf4cf8e109c0bcce7da6a8a6424129c79a05
4
- data.tar.gz: 99060e03939a3eb604eea4fab5e024b0ef78ec14
3
+ metadata.gz: 8e693e76df1b3e221efd66d3c749ed743ebd072f
4
+ data.tar.gz: 1b6b3ebd296d38be6c85c8722ca209382815b92d
5
5
  SHA512:
6
- metadata.gz: de764a81432718f40e53d2633ec49d36adb102085f32d418eb4f5efa20372d47d7afc25d15a6b56975b2d29eeb1e366e1213636e0e28e29ca85047a860b564a6
7
- data.tar.gz: db901ec8e72df859f299c563ed06d14ab66f3a730f7da85a4e0093702654f18f35a9fe65ded12825becbed4c2845aef3a06f41e7758a82a132029501190378ef
6
+ metadata.gz: 5190bcd8452d66d23ac6f3699237c3044ecd833b259d63cf52c7ea8cf26dfd4d9a955d10ed0b03bd43750f7a1c16885e4c6b0b6f1f1a5281b60ded191d0c011d
7
+ data.tar.gz: 347bb661ad2b919b8c093deef3410da3a5a6533ee9e37c0b9acc1070897d6eef3483f54fa58db60ed032d656e4a9283dbbccf5154dc5999a788d5473a9ab60dd
data/README.md CHANGED
@@ -33,7 +33,8 @@ Usage: xclisten [optional flags]
33
33
  --osx Run with OSX sdk (without simulator)
34
34
  --ios [DEFAULT] Run with iOS sdk
35
35
  -d, --device Simulated device [iphone5s, iphone5, iphone4]. Default is iphone5s
36
- -s, --scheme BYOS (Bring your own scheme)
36
+ -s, --scheme SCHEME BYOS (Bring your own scheme)
37
+ -w, --workspace WORKSPACE BYOW (Bring your own workspace)
37
38
  -h, --help Show this message
38
39
  -v, --version Show version
39
40
  ```
@@ -1,4 +1,4 @@
1
1
  class XCListen
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
4
4
 
data/lib/xclisten.rb CHANGED
@@ -23,19 +23,19 @@ class XCListen
23
23
  }
24
24
 
25
25
  def workspace_path
26
- @workspace_path ||= Dir.glob("**/*.xcworkspace").select {|p| !p.include? "xcodeproj"}.first
26
+ @workspace_path ||= Dir.glob("**/*.xcworkspace").sort_by(&:length).first
27
27
  end
28
28
 
29
29
  def project_name
30
- File.basename(workspace_path, ".*") if workspace_path
30
+ @project_name ||= File.basename(workspace_path, ".*") if workspace_path
31
31
  end
32
32
 
33
33
  def xcodebuild
34
- "xcodebuild -workspace #{@workspace} -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
- Dir.chdir(File.dirname(workspace_path)) do
38
+ Dir.chdir(File.dirname(workspace)) do
39
39
  system 'pod install'
40
40
  puts 'Giving Xcode some time to index...'
41
41
  sleep 10
@@ -60,7 +60,7 @@ class XCListen
60
60
 
61
61
  def listen
62
62
  validate_run
63
- puts "Started xclistening to #{workspace_path}"
63
+ puts "Started xclistening to #{workspace}"
64
64
  ignored = [/.git/, /.xc(odeproj|workspace|userdata|scheme|config)/, /.lock$/, /\.txt$/, /\.log$/]
65
65
 
66
66
  listener = Listen.to(Dir.pwd, :ignore => ignored) do |modified, added, removed|
@@ -10,10 +10,18 @@ class XCListen
10
10
  end
11
11
  end
12
12
 
13
+ before(:all) do
14
+ @base_dir = Dir.pwd
15
+ end
16
+
17
+ after(:each) do
18
+ Dir.chdir(@base_dir)
19
+ end
20
+
13
21
  context "Defaults" do
14
22
 
15
23
  before(:each) do
16
- Dir.stub(:glob).and_return(['SampleProject.xcworkspace'])
24
+ Dir.chdir('fixtures/ObjectiveRecord')
17
25
  @xclisten = XCListen.new
18
26
  end
19
27
 
@@ -26,13 +34,18 @@ class XCListen
26
34
  end
27
35
 
28
36
  it "uses the first found workspace by default" do
29
- @xclisten.workspace.should == 'SampleProject.xcworkspace'
37
+ @xclisten.workspace.should == 'Example/SampleProject.xcworkspace'
30
38
  end
31
39
 
32
40
  it "uses iphonesimulator sdk by default" do
33
41
  @xclisten.sdk.should == 'iphonesimulator'
34
42
  end
35
43
 
44
+ it "listens to the closest workspace instead of alphabetically" do
45
+ Dir.chdir("#{@base_dir}/fixtures/MadeUpProject")
46
+ XCListen.new.workspace.should == 'MadeUpProject.xcworkspace'
47
+ end
48
+
36
49
  end
37
50
 
38
51
  it "initializes with device" do
@@ -74,14 +87,6 @@ class XCListen
74
87
 
75
88
  context "finding the right workspace" do
76
89
 
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
90
  it "works with one level deep workspace" do
86
91
  Dir.chdir('fixtures/ObjectiveRecord')
87
92
  XCListen.new.workspace.should == 'Example/SampleProject.xcworkspace'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xclisten
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marin Usalj
@@ -98,6 +98,11 @@ files:
98
98
  - README.md
99
99
  - Rakefile
100
100
  - bin/xclisten
101
+ - fixtures/MadeUpProject/Dependencies/AwesomeDependency/Awesome.xcodeproj/meh
102
+ - fixtures/MadeUpProject/Dependencies/AwesomeDependency/Awesome.xcworkspace/meh
103
+ - fixtures/MadeUpProject/MadeUpProject.xcodeproj/meh
104
+ - fixtures/MadeUpProject/MadeUpProject.xcodeproj/project.xcworkspace/contents.xcworkspacedata
105
+ - fixtures/MadeUpProject/MadeUpProject.xcworkspace/meh
101
106
  - lib/xclisten.rb
102
107
  - lib/xclisten/shell_task.rb
103
108
  - lib/xclisten/version.rb
@@ -128,5 +133,10 @@ signing_key:
128
133
  specification_version: 4
129
134
  summary: Run ObjectiveC tests each time you hit save
130
135
  test_files:
136
+ - fixtures/MadeUpProject/Dependencies/AwesomeDependency/Awesome.xcodeproj/meh
137
+ - fixtures/MadeUpProject/Dependencies/AwesomeDependency/Awesome.xcworkspace/meh
138
+ - fixtures/MadeUpProject/MadeUpProject.xcodeproj/meh
139
+ - fixtures/MadeUpProject/MadeUpProject.xcodeproj/project.xcworkspace/contents.xcworkspacedata
140
+ - fixtures/MadeUpProject/MadeUpProject.xcworkspace/meh
131
141
  - spec/lib/xclisten_spec.rb
132
142
  has_rdoc: