pebblex 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,17 +1,16 @@
1
- # PebbleX [![Build Status](https://travis-ci.org/HBehrens/pebblex.png)](https://travis-ci.org/HBehrens/pebblex)
1
+ # PebbleX [![Build Status](https://travis-ci.org/HBehrens/pebblex.png)](https://travis-ci.org/HBehrens/pebblex)[![Gem Version](https://badge.fury.io/rb/pebblex.png)](http://badge.fury.io/rb/pebblex)
2
2
 
3
- A small command line tool to add functionality the `pebble` command is missing right now.
4
- Ideally, there will be no need for `pebblex` in the future, anymore.
3
+ A small command line tool to use Xcode and [AppCode][AppCode] as development environment for the [Pebble smartwatch SDK](https://developer.getpebble.com/2/). It's based on the SDK's official `pebble` command that steadily evolves and might contain some of the functionality `pebblex` introduces by itself in the future. Ideally, there will be no need for `pebblex` at some point, anymore.
5
4
 
6
5
  ## Background
7
6
 
8
7
  The [Pebble SDK](https://developer.getpebble.com/2/) comes with a powerful command line tool `pebble` to create, build and analyze pebble projects.
9
8
  Unfortunately, there's no development environment for the created project structure.
10
9
 
11
- 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.
12
- The command line tool will create a `.xcodeproj` that contains the needed search paths, resources and .c files to start right away.
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
+ 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.
13
12
 
14
- 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] 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!
15
14
 
16
15
  ## Installation
17
16
 
@@ -21,30 +20,26 @@ Install the Ruby Gem:
21
20
 
22
21
  ## Usage
23
22
 
24
- After creating a new pebble project
23
+ After creating a new pebble project (as described in the [Pebble tutorial](https://developer.getpebble.com/2/getting-started/hello-world/))
25
24
 
26
- pebble new-project myproject --javascript
25
+ pebble new-project hello_world
26
+ cd hello_world
27
27
 
28
- you can easily create xcode project file
28
+ you can easily create an Xcode project file
29
29
 
30
- cd myproject
31
30
  pebblex xcode
32
- open myproject.xcodeproj
31
+ open hello_world.xcodeproj
33
32
 
34
- The `pebblex xcode` command will also 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.
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.
35
34
 
36
-
37
- ### Optional: AppCode
38
-
39
- If you are using, [AppCode](AppCode) you can even deploy and look at the logs directly from the IDE! Make these adjustments to the run configuration to do so:
40
-
41
- ![alt tag](https://raw.github.com/HBehrens/pebblex/master/images/AppCodeRunConfig.png)
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.
42
36
 
43
37
  ## Contributing
44
38
 
45
39
  1. Fork it ( https://github.com/HBehrens/pebblex/fork )
46
40
  2. Create your feature branch (`git checkout -b my-new-feature`)
47
- 3. Build and test PebbleX locally (`rake build && rake install`)
41
+ 3. Make sure to test your changes (`rake spec`)
42
+ 3. Build and try PebbleX locally (`rake build && rake install`)
48
43
  3. Commit your changes (`git commit -am 'Add some feature'`)
49
44
  4. Push to the branch (`git push origin my-new-feature`)
50
45
  5. Create a new Pull Request
data/lib/pebble_x.rb CHANGED
@@ -2,6 +2,7 @@ require 'pebble_x/version'
2
2
  require 'pebble_x/cli'
3
3
  require 'pebble_x/xcode'
4
4
  require 'pebble_x/pebble'
5
+ require 'pebble_x/monkey_patches'
5
6
 
6
7
  module PebbleX
7
8
  end
data/lib/pebble_x/cli.rb CHANGED
@@ -18,7 +18,7 @@ module PebbleX
18
18
  end
19
19
  map %w(-v --version) => :version
20
20
 
21
- desc "xcode", "Creates and Xcode project file"
21
+ desc "xcode", "Creates an Xcode project file"
22
22
  def xcode
23
23
  xcode = command_helper PebbleX::Xcode
24
24
  xcode.create_project
@@ -83,4 +83,4 @@ module PebbleX
83
83
 
84
84
  end
85
85
 
86
- end
86
+ end
@@ -0,0 +1,45 @@
1
+ require 'xcodeproj'
2
+ require 'xcodeproj/scheme'
3
+
4
+ class Xcodeproj::XCScheme::XML_Fromatter
5
+ def write_element(node, output)
6
+ @indentation = 3
7
+ output << ' '*@level
8
+ output << "<#{node.expanded_name}"
9
+
10
+ @level += @indentation
11
+ node.attributes.each_attribute do |attr|
12
+ output << "\n"
13
+ output << ' '*@level
14
+ output << attr.to_string.sub(/=/, ' = ') # here's the patch (sub instead of gsub)
15
+ end unless node.attributes.empty?
16
+
17
+ output << ">"
18
+
19
+ output << "\n"
20
+ node.children.each { |child|
21
+ next if child.kind_of?(REXML::Text) and child.to_s.strip.length == 0
22
+ write(child, output)
23
+ output << "\n"
24
+ }
25
+ @level -= @indentation
26
+ output << ' '*@level
27
+ output << "</#{node.expanded_name}>"
28
+ end
29
+ end
30
+
31
+
32
+ class Xcodeproj::XCScheme
33
+ alias construct_buildable_name_without_legacy_target construct_buildable_name
34
+
35
+ def construct_buildable_name_with_legacy_target(build_target)
36
+ if build_target.isa
37
+ build_target.name
38
+ else
39
+ construct_buildable_name_without_legacy_target build_target
40
+ end
41
+ end
42
+
43
+ alias construct_buildable_name construct_buildable_name_with_legacy_target
44
+
45
+ end
@@ -1,3 +1,3 @@
1
1
  module PebbleX
2
- VERSION = "0.0.4"
2
+ VERSION = '0.0.5'
3
3
  end
@@ -22,7 +22,9 @@ module PebbleX
22
22
 
23
23
  Dir.chdir(@directory) # TODO: popd at the end of this method
24
24
 
25
- project = Xcodeproj::Project.new(@project_name+'.xcodeproj')
25
+ project_filename = @project_name+'.xcodeproj'
26
+ puts "Creating #{project_filename}"
27
+ project = Xcodeproj::Project.new(project_filename)
26
28
 
27
29
  # will add pebble sdk headers and build/src/resource_ids.auto.h to search path
28
30
  project.build_configuration_list.set_setting('HEADER_SEARCH_PATHS', [File.join(@pebble_sdk_dir, 'Pebble/include'), 'build'])
@@ -57,6 +59,24 @@ module PebbleX
57
59
  # clean up xcode project ('products' group must remain due to fake iOS target)
58
60
  project.frameworks_group.remove_from_project
59
61
 
62
+ # run configuration for Pebble target
63
+ scheme = Xcodeproj::XCScheme.new
64
+ scheme.add_build_target legacy_target
65
+ launch_action = scheme.instance_variable_get :@launch_action
66
+ launch_action.attributes["useCustomWorkingDirectory"] = "YES"
67
+ launch_action.attributes["customWorkingDirectory"] = @directory
68
+ path_runnable = launch_action.add_element "PathRunnable"
69
+ path_runnable.attributes["FilePath"] = @pebblex_cmd
70
+ command_line_arguments = launch_action.add_element "CommandLineArguments"
71
+ command_line_argument = command_line_arguments.add_element "CommandLineArgument"
72
+ command_line_argument.attributes["argument"] = "debug --pebble_sdk=#{@pebble_sdk_dir}"
73
+ command_line_argument.attributes["isEnabled"] = "YES"
74
+ # remove unneeded elements
75
+ for s in [:@test_action, :@profile_action].each do
76
+ scheme.doc.elements[1].delete_element(scheme.instance_variable_get s)
77
+ end
78
+ scheme.save_as(project.path, legacy_target.name, false)
79
+
60
80
  project.save
61
81
 
62
82
  project
data/pebblex.gemspec CHANGED
@@ -8,8 +8,8 @@ Gem::Specification.new do |spec|
8
8
  spec.version = PebbleX::VERSION
9
9
  spec.authors = ["Heiko Behrens"]
10
10
  spec.email = ["HeikoBehrens@gmx.de"]
11
- spec.summary = %q{Some additions to the pebble CLI.}
12
- spec.description = %q{For now, it can create and Xcode project from a pebble dir. In future, some other convenience commands will be added.}
11
+ spec.summary = %q{Enables Pebble development with Xcode and AppCode.}
12
+ spec.description = %q{Creates an Xcode project from a pebble project 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. With 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
13
  spec.homepage = "https://github.com/hbehrens/pebblex"
14
14
  spec.license = "MIT"
15
15
 
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.4
4
+ version: 0.0.5
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-26 00:00:00.000000000 Z
12
+ date: 2014-02-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: thor
@@ -107,8 +107,12 @@ dependencies:
107
107
  - - ! '>='
108
108
  - !ruby/object:Gem::Version
109
109
  version: '0'
110
- description: For now, it can create and Xcode project from a pebble dir. In future,
111
- some other convenience commands will be added.
110
+ description: Creates an Xcode project from a pebble project that contains the needed
111
+ search paths, resources and .c files to start right away. Each time you build your
112
+ watch app from the IDE, all warnings and errors of the underlying ´pebble build`
113
+ command will be presented right in the editor. With AppCode you can even build,
114
+ install the .pbw to your watch, and look at the live logs as a one-step action directly
115
+ from your IDE!
112
116
  email:
113
117
  - HeikoBehrens@gmx.de
114
118
  executables:
@@ -124,9 +128,9 @@ files:
124
128
  - README.md
125
129
  - Rakefile
126
130
  - bin/pebblex
127
- - images/AppCodeRunConfig.png
128
131
  - lib/pebble_x.rb
129
132
  - lib/pebble_x/cli.rb
133
+ - lib/pebble_x/monkey_patches.rb
130
134
  - lib/pebble_x/pebble.rb
131
135
  - lib/pebble_x/version.rb
132
136
  - lib/pebble_x/xcode.rb
@@ -163,7 +167,7 @@ rubyforge_project:
163
167
  rubygems_version: 1.8.23
164
168
  signing_key:
165
169
  specification_version: 3
166
- summary: Some additions to the pebble CLI.
170
+ summary: Enables Pebble development with Xcode and AppCode.
167
171
  test_files:
168
172
  - spec/cli_spec.rb
169
173
  - spec/fixtures/project_with_js/.gitignore
Binary file