pebblex 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -10,13 +10,13 @@ Unfortunately, there's no development environment for the created project struct
10
10
  With the help of `pebblex` you can take advantage of Xcode or [AppCode][AppCode] to develop your Pebble watch faces or apps directly from a convenient IDE.
11
11
  The command line tool will create a `.xcodeproj` that contains the needed search paths, resources and .c files to start right away. Each time you build your watch app from the IDE, all warnings and errors of the underlying ´pebble build` command will be presented right in the editor.
12
12
 
13
- With [AppCode][AppCode] you can even build, install the `.pbw` to your watch, and look at the live logs as a one-step action directly from your IDE!
13
+ With [AppCode][AppCode] (or the latest Xcode6-Beta) you can even build, install the `.pbw` to your watch, and look at the live logs as a one-step action directly from your IDE!
14
14
 
15
15
  ## Installation
16
16
 
17
17
  Install the Ruby Gem:
18
18
 
19
- sudo gem install pebblex
19
+ gem install pebblex
20
20
 
21
21
  ## Usage
22
22
 
@@ -32,7 +32,7 @@ you can easily create an Xcode project file
32
32
 
33
33
  As part of the project file, `pebblex xcode` will create a target "Pebble" that builds your project right from the IDE. After each build, all warnings and errors will be propagated back right into your editor.
34
34
 
35
- Lucky [AppCode][AppCode] users: `pebblex` automatically creates a run configuration to build, deploy and look at the logs directly from the IDE! Make sure to set `PEBBLE_PHONE` before you push the play button.
35
+ Lucky [AppCode][AppCode] (and now Xcode6-beta) users: `pebblex` automatically creates a run configuration to build, deploy and look at the logs directly from the IDE! Make sure to set `PEBBLE_PHONE` before you push the play button.
36
36
 
37
37
  ## Contributing
38
38
 
data/lib/pebble_x/cli.rb CHANGED
@@ -31,8 +31,12 @@ module PebbleX
31
31
  end
32
32
 
33
33
  desc "debug", "Loads PBW and logs output from connected watch"
34
+ option :phone
35
+ option :pebble_id
34
36
  def debug
35
37
  pebble = command_helper PebbleX::Pebble
38
+ pebble.phone = options[:phone] if options[:phone]
39
+ pebble.pebble_id = options[:pebble_id] if options[:pebble_id]
36
40
  exit(pebble.debug)
37
41
  end
38
42
 
@@ -33,7 +33,7 @@ class Xcodeproj::XCScheme
33
33
  alias construct_buildable_name_without_legacy_target construct_buildable_name
34
34
 
35
35
  def construct_buildable_name_with_legacy_target(build_target)
36
- if build_target.isa
36
+ if build_target.is_a? Xcodeproj::Project::Object::PBXLegacyTarget
37
37
  build_target.name
38
38
  else
39
39
  construct_buildable_name_without_legacy_target build_target
@@ -2,6 +2,8 @@ module PebbleX
2
2
  class Pebble
3
3
 
4
4
  attr_accessor :verbose
5
+ attr_accessor :phone
6
+ attr_accessor :pebble_id
5
7
 
6
8
  def initialize(environment)
7
9
  @pebble_cmd = environment.pebble_cmd
@@ -44,8 +46,10 @@ module PebbleX
44
46
  sleep(0.5) # phone's Pebble app needs some time before it accepts new connections
45
47
  end
46
48
 
47
- def pebble_call(args)
49
+ def pebble_call(args, requires_connection=false)
48
50
  kill_pebble
51
+ args += " --phone=#{@phone}" if requires_connection and @phone
52
+ args += " --pebble_id=#{@pebble_id}" if requires_connection and @pebble_id
49
53
  sys_call("#{@pebble_cmd} #{args}")
50
54
  end
51
55
 
@@ -54,11 +58,11 @@ module PebbleX
54
58
  end
55
59
 
56
60
  def install
57
- pebble_call('install')
61
+ pebble_call('install', true)
58
62
  end
59
63
 
60
64
  def logs
61
- pebble_call('logs')
65
+ pebble_call('logs', true)
62
66
  end
63
67
 
64
68
  def debug
@@ -1,3 +1,3 @@
1
1
  module PebbleX
2
- VERSION = '0.0.5'
2
+ VERSION = '0.0.6'
3
3
  end
@@ -65,6 +65,8 @@ module PebbleX
65
65
  launch_action = scheme.instance_variable_get :@launch_action
66
66
  launch_action.attributes["useCustomWorkingDirectory"] = "YES"
67
67
  launch_action.attributes["customWorkingDirectory"] = @directory
68
+ launch_action.attributes["selectedDebuggerIdentifier"] = ""
69
+ launch_action.attributes["selectedLauncherIdentifier"] = "Xcode.IDEFoundation.Launcher.PosixSpawn"
68
70
  path_runnable = launch_action.add_element "PathRunnable"
69
71
  path_runnable.attributes["FilePath"] = @pebblex_cmd
70
72
  command_line_arguments = launch_action.add_element "CommandLineArguments"
data/spec/cli_spec.rb CHANGED
@@ -28,7 +28,7 @@ describe 'CLI' do
28
28
  end
29
29
  end
30
30
 
31
- describe 'build' do
31
+ describe 'debug' do
32
32
  it 'delegates to pebble debug' do
33
33
  pebble = double 'pebble'
34
34
  expect(pebble).to receive(:debug).and_return 23
@@ -38,6 +38,31 @@ describe 'CLI' do
38
38
  expect(c).to receive(:exit).with(23)
39
39
  c.debug
40
40
  end
41
+
42
+ it 'passes --phone to pebble debug' do
43
+ pebble = double 'pebble'
44
+ expect(pebble).to receive(:phone=).with "1234"
45
+ expect(pebble).to receive(:debug).and_return 23
46
+
47
+ c = PebbleX::CLI.new
48
+ expect(c).to receive(:command_helper).with(PebbleX::Pebble).and_return(pebble)
49
+ allow(c).to receive(:options).and_return({:phone => "1234"})
50
+ expect(c).to receive(:exit).with(23)
51
+ c.debug
52
+ end
53
+
54
+ it 'passes --pebble_id to pebble debug' do
55
+ pebble = double 'pebble'
56
+ expect(pebble).to receive(:pebble_id=).with "some_id"
57
+ expect(pebble).to receive(:debug).and_return 23
58
+
59
+ c = PebbleX::CLI.new
60
+ expect(c).to receive(:command_helper).with(PebbleX::Pebble).and_return(pebble)
61
+ allow(c).to receive(:options).and_return({:pebble_id => "some_id"})
62
+ expect(c).to receive(:exit).with(23)
63
+ c.debug
64
+ end
65
+
41
66
  end
42
67
 
43
68
  describe 'pebble_cmd' do
data/spec/pebble_spec.rb CHANGED
@@ -22,6 +22,33 @@ describe 'Pebble' do
22
22
  expect(p).to receive(:sys_call).with('path/to/pebble foo')
23
23
  p.pebble_call('foo')
24
24
  end
25
+
26
+ it 'ignores phone and pebble-id if no connection required' do
27
+ p = PebbleX::Pebble.new(e)
28
+ p.phone = 'phone'
29
+ p.pebble_id = 'pebble_id'
30
+ expect(p).to receive(:kill_pebble)
31
+ expect(p).to receive(:sys_call).with('path/to/pebble foo')
32
+ p.pebble_call('foo', false)
33
+ end
34
+
35
+ it 'passes phone if connection required' do
36
+ p = PebbleX::Pebble.new(e)
37
+ p.phone = '1234'
38
+ expect(p).to receive(:kill_pebble)
39
+ expect(p).to receive(:sys_call).with('path/to/pebble foo --phone=1234')
40
+ p.pebble_call('foo', true)
41
+ end
42
+
43
+ it 'passes pebble-id if connection required' do
44
+ p = PebbleX::Pebble.new(e)
45
+ p.pebble_id = 'some_id'
46
+ expect(p).to receive(:kill_pebble)
47
+ expect(p).to receive(:sys_call).with('path/to/pebble foo --pebble_id=some_id')
48
+ p.pebble_call('foo', true)
49
+ end
50
+
51
+
25
52
  end
26
53
 
27
54
  describe 'debug' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pebblex
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-02-28 00:00:00.000000000 Z
12
+ date: 2014-06-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: thor
@@ -177,3 +177,4 @@ test_files:
177
177
  - spec/fixtures/project_with_js/wscript
178
178
  - spec/pebble_spec.rb
179
179
  - spec/xcode_spec.rb
180
+ has_rdoc: