pebblex 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +18 -0
- data/.ruby-version +1 -0
- data/.travis.yml +6 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +46 -0
- data/Rakefile +5 -0
- data/bin/pebblex +5 -0
- data/images/AppCodeRunConfig.png +0 -0
- data/lib/pebble_x.rb +8 -0
- data/lib/pebble_x/cli.rb +86 -0
- data/lib/pebble_x/pebble.rb +43 -0
- data/lib/pebble_x/version.rb +3 -0
- data/lib/pebble_x/xcode.rb +66 -0
- data/pebblex.gemspec +28 -0
- data/spec/cli_spec.rb +79 -0
- data/spec/fixtures/project_with_js/.gitignore +3 -0
- data/spec/fixtures/project_with_js/appinfo.json +17 -0
- data/spec/fixtures/project_with_js/src/js/pebble-js-app.js +5 -0
- data/spec/fixtures/project_with_js/src/project_with_js.c +60 -0
- data/spec/fixtures/project_with_js/wscript +24 -0
- data/spec/pebble_spec.rb +44 -0
- data/spec/xcode_spec.rb +53 -0
- metadata +175 -0
data/.gitignore
ADDED
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
1.9.3-p392
|
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Heiko Behrens
|
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.
|
data/README.md
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
# PebbleX [![Build Status](https://travis-ci.org/HBehrens/pebblex.png)](https://travis-ci.org/HBehrens/pebblex)
|
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.
|
5
|
+
|
6
|
+
## Background
|
7
|
+
|
8
|
+
The [Pebble SDK](https://developer.getpebble.com/2/) comes with a powerful command line tool `pebble` to create, build and analyze pebble projects.
|
9
|
+
Unfortunately, there's no development environment for the created project structure.
|
10
|
+
|
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.
|
13
|
+
|
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!
|
15
|
+
|
16
|
+
## Installation
|
17
|
+
|
18
|
+
Install the Ruby Gem:
|
19
|
+
|
20
|
+
sudo gem install pebblex
|
21
|
+
|
22
|
+
## Usage
|
23
|
+
|
24
|
+
After creating a new pebble project, you can easily create an xcode project file
|
25
|
+
|
26
|
+
pebble new-project myproject --javascript
|
27
|
+
cd myproject
|
28
|
+
pebblex xcode
|
29
|
+
open myproject.xcodeproj
|
30
|
+
|
31
|
+
The `pebblex xcode` command will also create a target `pebble` that builds your project right from the IDE.
|
32
|
+
|
33
|
+
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:
|
34
|
+
|
35
|
+
![alt tag](https://raw.github.com/HBehrens/pebblex/master/images/AppCodeRunConfig.png)
|
36
|
+
|
37
|
+
## Contributing
|
38
|
+
|
39
|
+
1. Fork it ( https://github.com/HBehrens/pebblex/fork )
|
40
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
41
|
+
3. Build and test PebbleX locally (`rake build && rake install`)
|
42
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
43
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
44
|
+
5. Create a new Pull Request
|
45
|
+
|
46
|
+
[AppCode]: http://www.jetbrains.com/objc/
|
data/Rakefile
ADDED
data/bin/pebblex
ADDED
Binary file
|
data/lib/pebble_x.rb
ADDED
data/lib/pebble_x/cli.rb
ADDED
@@ -0,0 +1,86 @@
|
|
1
|
+
require 'thor'
|
2
|
+
|
3
|
+
module PebbleX
|
4
|
+
|
5
|
+
class CLI < Thor
|
6
|
+
|
7
|
+
class_option :verbose, :type => :boolean
|
8
|
+
#class_option :version, :type => :boolean, :desc => "Prints version"
|
9
|
+
class_option :pebble_sdk, :banner => "<directory>", :desc => "Sets directory of Pebble SDK (default derived from PATH)"
|
10
|
+
|
11
|
+
def self.exit_on_failure?
|
12
|
+
true
|
13
|
+
end
|
14
|
+
|
15
|
+
desc "version", "Prints the pebblex's version information"
|
16
|
+
def version
|
17
|
+
puts PebbleX::VERSION
|
18
|
+
end
|
19
|
+
map %w(-v --version) => :version
|
20
|
+
|
21
|
+
desc "xcode", "Creates and Xcode project file"
|
22
|
+
def xcode
|
23
|
+
xcode = command_helper PebbleX::Xcode
|
24
|
+
xcode.create_project
|
25
|
+
end
|
26
|
+
|
27
|
+
desc "build", "Builds pebble project"
|
28
|
+
def build
|
29
|
+
pebble = command_helper PebbleX::Pebble
|
30
|
+
exit(pebble.build)
|
31
|
+
end
|
32
|
+
|
33
|
+
desc "debug", "Loads PBW and logs output from connected watch"
|
34
|
+
def debug
|
35
|
+
pebble = command_helper PebbleX::Pebble
|
36
|
+
exit(pebble.debug)
|
37
|
+
end
|
38
|
+
|
39
|
+
# provide recurring logic (based on command line switches) to separate commands
|
40
|
+
no_commands do
|
41
|
+
|
42
|
+
def command_helper(cls)
|
43
|
+
cls.new self
|
44
|
+
end
|
45
|
+
|
46
|
+
def verbose?
|
47
|
+
return options[:verbose]
|
48
|
+
end
|
49
|
+
|
50
|
+
def sys_call(call)
|
51
|
+
`#{call}`
|
52
|
+
end
|
53
|
+
|
54
|
+
def pebble_sdk_dir
|
55
|
+
sdk_dir = options[:pebble_sdk]
|
56
|
+
unless sdk_dir
|
57
|
+
pebble_cmd = sys_call('which pebble').strip
|
58
|
+
if pebble_cmd != ''
|
59
|
+
sdk_dir = File.expand_path('../..', pebble_cmd)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
unless sdk_dir != ''
|
64
|
+
raise ArgumentError, "Make sure the 'pebble' command is on your path or you pass --pebble_sdk."
|
65
|
+
end
|
66
|
+
|
67
|
+
return sdk_dir
|
68
|
+
end
|
69
|
+
|
70
|
+
def pebble_cmd
|
71
|
+
pebble_cmd = File.expand_path('bin/pebble', self.pebble_sdk_dir)
|
72
|
+
unless File.exists?(pebble_cmd)
|
73
|
+
raise ArgumentError, "Cannot find 'pebble' command at #{pebble_cmd}."
|
74
|
+
end
|
75
|
+
return pebble_cmd
|
76
|
+
end
|
77
|
+
|
78
|
+
def pebblex_cmd
|
79
|
+
return $0
|
80
|
+
end
|
81
|
+
|
82
|
+
end
|
83
|
+
|
84
|
+
end
|
85
|
+
|
86
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
module PebbleX
|
2
|
+
class Pebble
|
3
|
+
|
4
|
+
attr_accessor :verbose
|
5
|
+
|
6
|
+
def initialize(environment)
|
7
|
+
@pebble_cmd = environment.pebble_cmd
|
8
|
+
end
|
9
|
+
|
10
|
+
def sys_call(call)
|
11
|
+
`#{call}`
|
12
|
+
$?.exitstatus
|
13
|
+
end
|
14
|
+
|
15
|
+
def kill_pebble
|
16
|
+
sys_call('pkill -f python.*pebble')
|
17
|
+
sleep(0.5) # phone's Pebble app needs some time before it accepts new connections
|
18
|
+
end
|
19
|
+
|
20
|
+
def pebble_call(args)
|
21
|
+
kill_pebble
|
22
|
+
sys_call("#{@pebble_cmd} #{args}")
|
23
|
+
end
|
24
|
+
|
25
|
+
def build
|
26
|
+
pebble_call('build')
|
27
|
+
end
|
28
|
+
|
29
|
+
def install
|
30
|
+
pebble_call('install')
|
31
|
+
end
|
32
|
+
|
33
|
+
def logs
|
34
|
+
pebble_call('logs')
|
35
|
+
end
|
36
|
+
|
37
|
+
def debug
|
38
|
+
r = install
|
39
|
+
r == 0 ? logs : r
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,66 @@
|
|
1
|
+
require 'xcodeproj'
|
2
|
+
|
3
|
+
module PebbleX
|
4
|
+
class Xcode
|
5
|
+
def initialize(environment, directory=nil, project_name=nil)
|
6
|
+
@verbose = environment.verbose?
|
7
|
+
@directory = directory || Dir.getwd
|
8
|
+
@project_name = project_name || File.basename(@directory)
|
9
|
+
@pebblex_cmd = environment.pebblex_cmd
|
10
|
+
@pebble_sdk_dir = environment.pebble_sdk_dir
|
11
|
+
|
12
|
+
unless File.exists?(File.join(@directory, 'appinfo.json'))
|
13
|
+
raise ArgumentError, "The directory '#{@directory}' does not contain a Pebble project."
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def create_project
|
18
|
+
if @verbose
|
19
|
+
puts "creating project in directory #{@directory}"
|
20
|
+
puts "using pebble sdk at #{@pebble_sdk_dir}"
|
21
|
+
end
|
22
|
+
|
23
|
+
Dir.chdir(@directory) # TODO: popd at the end of this method
|
24
|
+
|
25
|
+
project = Xcodeproj::Project.new(@project_name+'.xcodeproj')
|
26
|
+
|
27
|
+
# will add pebble sdk headers and build/src/resource_ids.auto.h to search path
|
28
|
+
project.build_configuration_list.set_setting('HEADER_SEARCH_PATHS', [File.join(@pebble_sdk_dir, 'Pebble/include'), 'build'])
|
29
|
+
|
30
|
+
legacy_target = project.new(Xcodeproj::Project::Object::PBXLegacyTarget)
|
31
|
+
legacy_target.name = 'Pebble'
|
32
|
+
legacy_target.product_name = 'Pebble'
|
33
|
+
|
34
|
+
legacy_target.build_tool_path = @pebblex_cmd
|
35
|
+
legacy_target.build_arguments_string = "build --pebble_sdk=#{@pebble_sdk_dir}"
|
36
|
+
|
37
|
+
legacy_target.build_configuration_list = Xcodeproj::Project::ProjectHelper.configuration_list(project, :osx)
|
38
|
+
project.targets << legacy_target
|
39
|
+
|
40
|
+
# fake iOS target to provide search path
|
41
|
+
ios_target = project.new_target(:application, 'fake-iOS-target', :ios)
|
42
|
+
|
43
|
+
# build project groups
|
44
|
+
group = project.main_group.new_group("sources", "src")
|
45
|
+
|
46
|
+
Dir.glob('src/**/*.{c,h,js}').each do |f|
|
47
|
+
file = group.new_file(f)
|
48
|
+
puts "adding file #{f}" if @verbose
|
49
|
+
if File.extname(f) == '.c'
|
50
|
+
ios_target.add_file_references([file])
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
project.main_group.new_reference('resources') if File.directory?('resources')
|
55
|
+
project.main_group.new_file('appinfo.json')
|
56
|
+
|
57
|
+
# clean up xcode project ('products' group must remain due to fake iOS target)
|
58
|
+
project.frameworks_group.remove_from_project
|
59
|
+
|
60
|
+
project.save
|
61
|
+
|
62
|
+
project
|
63
|
+
end
|
64
|
+
|
65
|
+
end
|
66
|
+
end
|
data/pebblex.gemspec
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'pebble_x/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "pebblex"
|
8
|
+
spec.version = PebbleX::VERSION
|
9
|
+
spec.authors = ["Heiko Behrens"]
|
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.}
|
13
|
+
spec.homepage = "https://github.com/hbehrens/pebblex"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_runtime_dependency(%q<thor>, ["~> 0.18.1"])
|
22
|
+
spec.add_runtime_dependency(%q<xcodeproj>, ["~> 0.14.1"])
|
23
|
+
|
24
|
+
spec.add_development_dependency "bundler", "~> 1.5"
|
25
|
+
spec.add_development_dependency "rspec", "~> 2.14"
|
26
|
+
spec.add_development_dependency "rspec-mocks", "~> 2.14"
|
27
|
+
spec.add_development_dependency "rake"
|
28
|
+
end
|
data/spec/cli_spec.rb
ADDED
@@ -0,0 +1,79 @@
|
|
1
|
+
require 'rspec'
|
2
|
+
require 'pebble_x'
|
3
|
+
|
4
|
+
describe 'CLI' do
|
5
|
+
|
6
|
+
describe 'xcode' do
|
7
|
+
|
8
|
+
it 'calls create_project' do
|
9
|
+
xcode = double 'Xcode'
|
10
|
+
expect(xcode).to receive(:create_project)
|
11
|
+
|
12
|
+
c = PebbleX::CLI.new
|
13
|
+
expect(c).to receive(:command_helper).with(PebbleX::Xcode).and_return(xcode)
|
14
|
+
c.xcode
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
|
19
|
+
describe 'build' do
|
20
|
+
it 'delegates to pebble build' do
|
21
|
+
pebble = double 'pebble'
|
22
|
+
expect(pebble).to receive(:build).and_return 23
|
23
|
+
|
24
|
+
c = PebbleX::CLI.new
|
25
|
+
expect(c).to receive(:command_helper).with(PebbleX::Pebble).and_return(pebble)
|
26
|
+
expect(c).to receive(:exit).with(23)
|
27
|
+
c.build
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
describe 'build' do
|
32
|
+
it 'delegates to pebble debug' do
|
33
|
+
pebble = double 'pebble'
|
34
|
+
expect(pebble).to receive(:debug).and_return 23
|
35
|
+
|
36
|
+
c = PebbleX::CLI.new
|
37
|
+
expect(c).to receive(:command_helper).with(PebbleX::Pebble).and_return(pebble)
|
38
|
+
expect(c).to receive(:exit).with(23)
|
39
|
+
c.debug
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
describe 'pebble_cmd' do
|
44
|
+
|
45
|
+
it 'derives pebble location from pebble_sdk_dir' do
|
46
|
+
c = PebbleX::CLI.new
|
47
|
+
expect(c).to receive(:pebble_sdk_dir).and_return "/path/to/sdk"
|
48
|
+
expect(File).to receive(:exists?).and_return true
|
49
|
+
expect(c.pebble_cmd).to eq "/path/to/sdk/bin/pebble"
|
50
|
+
end
|
51
|
+
|
52
|
+
it 'verifies existence of pebble binary' do
|
53
|
+
c = PebbleX::CLI.new
|
54
|
+
expect(c).to receive(:pebble_sdk_dir).and_return "/path/to/sdk"
|
55
|
+
expect(File).to receive(:exists?).and_return false
|
56
|
+
expect{c.pebble_cmd}.to raise_error
|
57
|
+
end
|
58
|
+
|
59
|
+
end
|
60
|
+
|
61
|
+
|
62
|
+
describe 'pebble_sdk_dir' do
|
63
|
+
it 'uses `which pebble` to determine sdk path' do
|
64
|
+
c = PebbleX::CLI.new
|
65
|
+
expect(c).to receive(:sys_call).with('which pebble').and_return '/path/to/sdk/bin/pebble'
|
66
|
+
expect(c.pebble_sdk_dir).to eq '/path/to/sdk'
|
67
|
+
end
|
68
|
+
|
69
|
+
it 'uses option pebble_sdk if provided' do
|
70
|
+
c = PebbleX::CLI.new
|
71
|
+
expect(c).to_not receive(:sys_call)
|
72
|
+
expect(c).to receive(:options).and_return({:pebble_sdk => "/path/to/sdk"})
|
73
|
+
expect(c.pebble_sdk_dir).to eq '/path/to/sdk'
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
{
|
2
|
+
"uuid": "9665dc7e-4c18-4fbc-9eca-902dc4b42aa5",
|
3
|
+
"shortName": "project_with_js",
|
4
|
+
"longName": "project_with_js",
|
5
|
+
"companyName": "MakeAwesomeHappen",
|
6
|
+
"versionCode": 1,
|
7
|
+
"versionLabel": "1.0.0",
|
8
|
+
"watchapp": {
|
9
|
+
"watchface": false
|
10
|
+
},
|
11
|
+
"appKeys": {
|
12
|
+
"dummy": 0
|
13
|
+
},
|
14
|
+
"resources": {
|
15
|
+
"media": []
|
16
|
+
}
|
17
|
+
}
|
@@ -0,0 +1,60 @@
|
|
1
|
+
#include <pebble.h>
|
2
|
+
|
3
|
+
static Window *window;
|
4
|
+
static TextLayer *text_layer;
|
5
|
+
|
6
|
+
static void select_click_handler(ClickRecognizerRef recognizer, void *context) {
|
7
|
+
text_layer_set_text(text_layer, "Select");
|
8
|
+
}
|
9
|
+
|
10
|
+
static void up_click_handler(ClickRecognizerRef recognizer, void *context) {
|
11
|
+
text_layer_set_text(text_layer, "Up");
|
12
|
+
}
|
13
|
+
|
14
|
+
static void down_click_handler(ClickRecognizerRef recognizer, void *context) {
|
15
|
+
text_layer_set_text(text_layer, "Down");
|
16
|
+
}
|
17
|
+
|
18
|
+
static void click_config_provider(void *context) {
|
19
|
+
window_single_click_subscribe(BUTTON_ID_SELECT, select_click_handler);
|
20
|
+
window_single_click_subscribe(BUTTON_ID_UP, up_click_handler);
|
21
|
+
window_single_click_subscribe(BUTTON_ID_DOWN, down_click_handler);
|
22
|
+
}
|
23
|
+
|
24
|
+
static void window_load(Window *window) {
|
25
|
+
Layer *window_layer = window_get_root_layer(window);
|
26
|
+
GRect bounds = layer_get_bounds(window_layer);
|
27
|
+
|
28
|
+
text_layer = text_layer_create((GRect) { .origin = { 0, 72 }, .size = { bounds.size.w, 20 } });
|
29
|
+
text_layer_set_text(text_layer, "Press a button");
|
30
|
+
text_layer_set_text_alignment(text_layer, GTextAlignmentCenter);
|
31
|
+
layer_add_child(window_layer, text_layer_get_layer(text_layer));
|
32
|
+
}
|
33
|
+
|
34
|
+
static void window_unload(Window *window) {
|
35
|
+
text_layer_destroy(text_layer);
|
36
|
+
}
|
37
|
+
|
38
|
+
static void init(void) {
|
39
|
+
window = window_create();
|
40
|
+
window_set_click_config_provider(window, click_config_provider);
|
41
|
+
window_set_window_handlers(window, (WindowHandlers) {
|
42
|
+
.load = window_load,
|
43
|
+
.unload = window_unload,
|
44
|
+
});
|
45
|
+
const bool animated = true;
|
46
|
+
window_stack_push(window, animated);
|
47
|
+
}
|
48
|
+
|
49
|
+
static void deinit(void) {
|
50
|
+
window_destroy(window);
|
51
|
+
}
|
52
|
+
|
53
|
+
int main(void) {
|
54
|
+
init();
|
55
|
+
|
56
|
+
APP_LOG(APP_LOG_LEVEL_DEBUG, "Done initializing, pushed window: %p", window);
|
57
|
+
|
58
|
+
app_event_loop();
|
59
|
+
deinit();
|
60
|
+
}
|
@@ -0,0 +1,24 @@
|
|
1
|
+
|
2
|
+
#
|
3
|
+
# This file is the default set of rules to compile a Pebble project.
|
4
|
+
#
|
5
|
+
# Feel free to customize this to your needs.
|
6
|
+
#
|
7
|
+
|
8
|
+
top = '.'
|
9
|
+
out = 'build'
|
10
|
+
|
11
|
+
def options(ctx):
|
12
|
+
ctx.load('pebble_sdk')
|
13
|
+
|
14
|
+
def configure(ctx):
|
15
|
+
ctx.load('pebble_sdk')
|
16
|
+
|
17
|
+
def build(ctx):
|
18
|
+
ctx.load('pebble_sdk')
|
19
|
+
|
20
|
+
ctx.pbl_program(source=ctx.path.ant_glob('src/**/*.c'),
|
21
|
+
target='pebble-app.elf')
|
22
|
+
|
23
|
+
ctx.pbl_bundle(elf='pebble-app.elf',
|
24
|
+
js=ctx.path.ant_glob('src/js/**/*.js'))
|
data/spec/pebble_spec.rb
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
require 'rspec'
|
2
|
+
require 'pebble_x'
|
3
|
+
|
4
|
+
describe 'Pebble' do
|
5
|
+
e = nil
|
6
|
+
|
7
|
+
before(:each) do
|
8
|
+
e = double("environment")
|
9
|
+
expect(e).to receive(:pebble_cmd) {'path/to/pebble'}
|
10
|
+
end
|
11
|
+
|
12
|
+
describe 'initialize' do
|
13
|
+
it 'asks environment' do
|
14
|
+
PebbleX::Pebble.new(e)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
describe 'pebble_call' do
|
19
|
+
it 'kills pebble and calls system' do
|
20
|
+
p = PebbleX::Pebble.new(e)
|
21
|
+
expect(p).to receive(:kill_pebble)
|
22
|
+
expect(p).to receive(:sys_call).with('path/to/pebble foo')
|
23
|
+
p.pebble_call('foo')
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
describe 'debug' do
|
28
|
+
|
29
|
+
it 'calls install and logs' do
|
30
|
+
p = PebbleX::Pebble.new(e)
|
31
|
+
expect(p).to receive(:install).and_return(0)
|
32
|
+
expect(p).to receive(:logs).and_return(3)
|
33
|
+
expect(p.debug).to eq 3
|
34
|
+
end
|
35
|
+
|
36
|
+
it 'aborts if install fails' do
|
37
|
+
p = PebbleX::Pebble.new(e)
|
38
|
+
expect(p).to receive(:install).and_return(1)
|
39
|
+
expect(p).to_not receive(:logs)
|
40
|
+
expect(p.debug).to eq 1
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
44
|
+
end
|
data/spec/xcode_spec.rb
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
require 'rspec'
|
2
|
+
require 'pebble_x'
|
3
|
+
require 'tmpdir'
|
4
|
+
|
5
|
+
describe 'Xcode' do
|
6
|
+
|
7
|
+
def prepare_fixture(fixture_name)
|
8
|
+
dest = File.join(Dir.tmpdir, fixture_name)
|
9
|
+
src = File.join(File.dirname(__FILE__), 'fixtures', fixture_name)
|
10
|
+
|
11
|
+
FileUtils.rm_rf(dest)
|
12
|
+
FileUtils.copy_entry(src, dest, remove_destination=true)
|
13
|
+
dest
|
14
|
+
end
|
15
|
+
|
16
|
+
|
17
|
+
def project_with_js
|
18
|
+
@project_with_js ||= prepare_fixture('project_with_js')
|
19
|
+
end
|
20
|
+
@project_with_js = nil
|
21
|
+
|
22
|
+
e = nil
|
23
|
+
|
24
|
+
before(:each) do
|
25
|
+
e = double("environment")
|
26
|
+
@project_with_js = nil
|
27
|
+
expect(e).to receive(:verbose?) {false}
|
28
|
+
expect(e).to receive(:pebble_sdk_dir) {'path/to/pebble_sdk'}
|
29
|
+
expect(e).to receive(:pebblex_cmd) {'path/to/pebblex'}
|
30
|
+
end
|
31
|
+
|
32
|
+
describe 'initialize' do
|
33
|
+
it 'asks environment' do
|
34
|
+
PebbleX::Xcode.new(e, project_with_js, 'some_name')
|
35
|
+
end
|
36
|
+
|
37
|
+
it 'fails on wrong directory' do
|
38
|
+
expect{PebbleX::Xcode.new(e, 'any directory', 'some_name')}.to raise_error
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
describe 'create_project' do
|
43
|
+
|
44
|
+
it 'creates files' do
|
45
|
+
x = PebbleX::Xcode.new(e, project_with_js, 'some_name')
|
46
|
+
p = x.create_project
|
47
|
+
expect(p).to be_a(Xcodeproj::Project)
|
48
|
+
expect(File).to exist(File.join(project_with_js, 'some_name.xcodeproj', 'project.pbxproj'))
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
52
|
+
|
53
|
+
end
|
metadata
ADDED
@@ -0,0 +1,175 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: pebblex
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.3
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Heiko Behrens
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2014-02-26 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: thor
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 0.18.1
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 0.18.1
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: xcodeproj
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ~>
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: 0.14.1
|
38
|
+
type: :runtime
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 0.14.1
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: bundler
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ~>
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '1.5'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '1.5'
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: rspec
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ~>
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '2.14'
|
70
|
+
type: :development
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ~>
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '2.14'
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
name: rspec-mocks
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ~>
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '2.14'
|
86
|
+
type: :development
|
87
|
+
prerelease: false
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ~>
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '2.14'
|
94
|
+
- !ruby/object:Gem::Dependency
|
95
|
+
name: rake
|
96
|
+
requirement: !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
98
|
+
requirements:
|
99
|
+
- - ! '>='
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: '0'
|
102
|
+
type: :development
|
103
|
+
prerelease: false
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ! '>='
|
108
|
+
- !ruby/object:Gem::Version
|
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.
|
112
|
+
email:
|
113
|
+
- HeikoBehrens@gmx.de
|
114
|
+
executables:
|
115
|
+
- pebblex
|
116
|
+
extensions: []
|
117
|
+
extra_rdoc_files: []
|
118
|
+
files:
|
119
|
+
- .gitignore
|
120
|
+
- .ruby-version
|
121
|
+
- .travis.yml
|
122
|
+
- Gemfile
|
123
|
+
- LICENSE.txt
|
124
|
+
- README.md
|
125
|
+
- Rakefile
|
126
|
+
- bin/pebblex
|
127
|
+
- images/AppCodeRunConfig.png
|
128
|
+
- lib/pebble_x.rb
|
129
|
+
- lib/pebble_x/cli.rb
|
130
|
+
- lib/pebble_x/pebble.rb
|
131
|
+
- lib/pebble_x/version.rb
|
132
|
+
- lib/pebble_x/xcode.rb
|
133
|
+
- pebblex.gemspec
|
134
|
+
- spec/cli_spec.rb
|
135
|
+
- spec/fixtures/project_with_js/.gitignore
|
136
|
+
- spec/fixtures/project_with_js/appinfo.json
|
137
|
+
- spec/fixtures/project_with_js/src/js/pebble-js-app.js
|
138
|
+
- spec/fixtures/project_with_js/src/project_with_js.c
|
139
|
+
- spec/fixtures/project_with_js/wscript
|
140
|
+
- spec/pebble_spec.rb
|
141
|
+
- spec/xcode_spec.rb
|
142
|
+
homepage: https://github.com/hbehrens/pebblex
|
143
|
+
licenses:
|
144
|
+
- MIT
|
145
|
+
post_install_message:
|
146
|
+
rdoc_options: []
|
147
|
+
require_paths:
|
148
|
+
- lib
|
149
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
150
|
+
none: false
|
151
|
+
requirements:
|
152
|
+
- - ! '>='
|
153
|
+
- !ruby/object:Gem::Version
|
154
|
+
version: '0'
|
155
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
156
|
+
none: false
|
157
|
+
requirements:
|
158
|
+
- - ! '>='
|
159
|
+
- !ruby/object:Gem::Version
|
160
|
+
version: '0'
|
161
|
+
requirements: []
|
162
|
+
rubyforge_project:
|
163
|
+
rubygems_version: 1.8.23
|
164
|
+
signing_key:
|
165
|
+
specification_version: 3
|
166
|
+
summary: Some additions to the pebble CLI.
|
167
|
+
test_files:
|
168
|
+
- spec/cli_spec.rb
|
169
|
+
- spec/fixtures/project_with_js/.gitignore
|
170
|
+
- spec/fixtures/project_with_js/appinfo.json
|
171
|
+
- spec/fixtures/project_with_js/src/js/pebble-js-app.js
|
172
|
+
- spec/fixtures/project_with_js/src/project_with_js.c
|
173
|
+
- spec/fixtures/project_with_js/wscript
|
174
|
+
- spec/pebble_spec.rb
|
175
|
+
- spec/xcode_spec.rb
|