pebblex 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -21,14 +21,20 @@ Install the Ruby Gem:
21
21
 
22
22
  ## Usage
23
23
 
24
- After creating a new pebble project, you can easily create an xcode project file
24
+ After creating a new pebble project
25
25
 
26
26
  pebble new-project myproject --javascript
27
+
28
+ you can easily create xcode project file
29
+
27
30
  cd myproject
28
31
  pebblex xcode
29
32
  open myproject.xcodeproj
30
33
 
31
- The `pebblex xcode` command will also create a target `pebble` that builds your project right from the IDE.
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.
35
+
36
+
37
+ ### Optional: AppCode
32
38
 
33
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:
34
40
 
@@ -7,9 +7,36 @@ module PebbleX
7
7
  @pebble_cmd = environment.pebble_cmd
8
8
  end
9
9
 
10
+ def pwd
11
+ Dir.pwd
12
+ end
13
+
14
+ def process_sys_call_line(line)
15
+ return line unless line
16
+ line.gsub %r{^(.*?)(:\d+:(\d+:)? (warning|error):)} do |full_match,foo|
17
+ File.expand_path($1, File.join(pwd, 'build')) + $2
18
+ end
19
+ end
20
+
10
21
  def sys_call(call)
11
- `#{call}`
12
- $?.exitstatus
22
+ r, io = IO.pipe
23
+ fork do
24
+ system(call, out: io, err: io)
25
+ io.puts $?.exitstatus
26
+ end
27
+
28
+ io.close
29
+ exit_status = nil
30
+ r.each_line do |l|
31
+ if r.eof?
32
+ exit_status = l.to_i
33
+ else
34
+ l = process_sys_call_line(l)
35
+ $stderr.puts l if l
36
+ end
37
+ end
38
+
39
+ exit_status
13
40
  end
14
41
 
15
42
  def kill_pebble
@@ -1,3 +1,3 @@
1
1
  module PebbleX
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
data/spec/pebble_spec.rb CHANGED
@@ -41,4 +41,20 @@ describe 'Pebble' do
41
41
  end
42
42
 
43
43
  end
44
+
45
+
46
+ it 'processes sys_call_output' do
47
+ p = PebbleX::Pebble.new(e)
48
+ allow(p).to receive(:pwd).and_return '/path/to/project'
49
+ expect(p.process_sys_call_line nil).to eq nil
50
+ expect(p.process_sys_call_line '').to eq ''
51
+
52
+ error_in = "../src/test.c:12:5: error: implicit declaration of function 'text_layer_set_text2'"
53
+ error_out = "/path/to/project/src/test.c:12:5: error: implicit declaration of function 'text_layer_set_text2'"
54
+ expect(p.process_sys_call_line error_in).to eq error_out
55
+
56
+ warning_in = "../src/test.c:11:13: warning: unused variable 'i' [-Wunused-variable]"
57
+ warning_out = "/path/to/project/src/test.c:11:13: warning: unused variable 'i' [-Wunused-variable]"
58
+ expect(p.process_sys_call_line warning_in).to eq warning_out
59
+ end
44
60
  end
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.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: