xcpretty 0.1.7 → 0.1.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.hound.yml +6 -0
- data/.travis.yml +1 -1
- data/CHANGELOG.md +15 -6
- data/CONTRIBUTING.md +4 -0
- data/README.md +16 -0
- data/Rakefile +1 -1
- data/assets/report.html.erb +1 -1
- data/bin/xcpretty +1 -1
- data/features/fixtures/xcodebuild.log +2989 -2989
- data/features/simple_format.feature +10 -0
- data/features/steps/formatting_steps.rb +27 -2
- data/features/steps/json_steps.rb +4 -5
- data/features/support/env.rb +2 -1
- data/features/test_format.feature +10 -0
- data/lib/xcpretty/formatters/formatter.rb +33 -8
- data/lib/xcpretty/formatters/rspec.rb +5 -0
- data/lib/xcpretty/formatters/simple.rb +22 -0
- data/lib/xcpretty/parser.rb +102 -18
- data/lib/xcpretty/reporters/json_compilation_database.rb +21 -13
- data/lib/xcpretty/snippet.rb +9 -3
- data/lib/xcpretty/syntax.rb +32 -8
- data/lib/xcpretty/version.rb +1 -1
- data/spec/fixtures/NSStringTests.m +1 -1
- data/spec/fixtures/constants.rb +35 -8
- data/spec/xcpretty/formatters/formatter_spec.rb +23 -7
- data/spec/xcpretty/formatters/simple_spec.rb +20 -0
- data/spec/xcpretty/parser_spec.rb +76 -7
- data/spec/xcpretty/snippet_spec.rb +12 -5
- data/spec/xcpretty/syntax_spec.rb +37 -9
- data/vendor/json_pure/parser.rb +1 -1
- data/xcpretty.gemspec +2 -2
- metadata +5 -4
@@ -6,7 +6,7 @@ module XCPretty
|
|
6
6
|
|
7
7
|
it "gets the snippet out of the file path" do
|
8
8
|
path = File.expand_path('spec/fixtures/NSStringTests.m:36')
|
9
|
-
Snippet.from_filepath(path).should ==
|
9
|
+
Snippet.from_filepath(path).contents.should ==
|
10
10
|
<<-EOS
|
11
11
|
it(@"-split: splits with delimiter string, not just a char", ^{
|
12
12
|
[[[@"one / two / three" split:@" / "] should] equal:@[@"one", @"two", @"three"]];
|
@@ -14,24 +14,31 @@ module XCPretty
|
|
14
14
|
EOS
|
15
15
|
end
|
16
16
|
|
17
|
+
it 'saves the file path' do
|
18
|
+
path = File.expand_path('spec/fixtures/NSStringTests.m:36')
|
19
|
+
Snippet.from_filepath(path).file_path.should == path
|
20
|
+
end
|
21
|
+
|
17
22
|
it "doesn't crash when there's nothing to read" do
|
18
23
|
path = File.expand_path('spec/fixtures/NSStringTests.m:64')
|
19
|
-
Snippet.from_filepath(path).should == "\nSPEC_END\n"
|
24
|
+
Snippet.from_filepath(path).contents.should == "\nSPEC_END\n"
|
20
25
|
end
|
21
26
|
|
22
27
|
it "doesn't crash if file path is invalid" do
|
23
28
|
path = 'invalid-path'
|
24
|
-
Snippet.from_filepath(path).should == ''
|
29
|
+
Snippet.from_filepath(path).contents.should == ''
|
25
30
|
end
|
26
31
|
|
27
32
|
it "doesn't crash if a failure is on the first line" do
|
28
33
|
path = File.expand_path('spec/fixtures/NSStringTests.m:0')
|
29
|
-
Snippet.from_filepath(path).should ==
|
34
|
+
Snippet.from_filepath(path).contents.should ==
|
35
|
+
"//\n// NSStringTests.m\n// SampleProject\n"
|
30
36
|
end
|
31
37
|
|
32
38
|
it "doesn't crash if the file has only 1 line" do
|
33
39
|
path = File.expand_path('spec/fixtures/oneliner.m:0')
|
34
|
-
Snippet.from_filepath(path).should ==
|
40
|
+
Snippet.from_filepath(path).contents.should ==
|
41
|
+
"[[[@1 should] equal] @3];\n"
|
35
42
|
end
|
36
43
|
|
37
44
|
end
|
@@ -4,29 +4,57 @@ module XCPretty
|
|
4
4
|
|
5
5
|
describe Syntax do
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
end
|
7
|
+
let(:snippet) { Snippet.new('self.color = [UIColor redColor];', 'test.m') }
|
8
|
+
let(:code) { snippet.contents }
|
10
9
|
|
11
10
|
it "caches the pygments availability" do
|
12
|
-
|
13
|
-
4.times { Syntax.highlight('meh') }
|
11
|
+
Pygments.should_receive(:system).once.and_return(false)
|
12
|
+
4.times { Syntax.highlight(Snippet.new('meh')) }
|
14
13
|
end
|
15
14
|
|
16
15
|
context "pygments are installed" do
|
17
16
|
|
18
|
-
|
19
|
-
|
20
|
-
|
17
|
+
before(:each) do
|
18
|
+
Pygments.stub(:available?).and_return(true)
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'supports highlighting with options' do
|
22
|
+
Pygments.should_receive(:pygmentize).with(code, 'objc', '-f html')
|
23
|
+
Syntax.highlight(snippet, '-f html')
|
24
|
+
end
|
25
|
+
|
26
|
+
it 'highlights objective-c code by filename' do
|
27
|
+
Pygments.should_receive(:pygmentize).with(code, 'objc', '')
|
28
|
+
Syntax.highlight(snippet)
|
21
29
|
end
|
22
30
|
|
31
|
+
it 'highlights objective-c code by default' do
|
32
|
+
Pygments.should_receive(:pygmentize).with(code, 'objc', '')
|
33
|
+
Syntax.highlight(Snippet.new(code))
|
34
|
+
end
|
35
|
+
|
36
|
+
it 'highlights other languages by filename' do
|
37
|
+
test_language 'swift', '.swift'
|
38
|
+
test_language 'c++', '.cc', '.cpp', '.hpp', '.c++', '.cxx'
|
39
|
+
test_language 'objc++', '.mm', '.hh'
|
40
|
+
test_language 'objc', '.m', '.h'
|
41
|
+
test_language 'dylan', '.dyl'
|
42
|
+
test_language 'ruby', '.rb', '.ruby'
|
43
|
+
end
|
44
|
+
|
45
|
+
def test_language(language, *extensions)
|
46
|
+
extensions.each do |extension|
|
47
|
+
Pygments.should_receive(:pygmentize).with(code, language, '')
|
48
|
+
Syntax.highlight(Snippet.new(code, "file#{extension}"))
|
49
|
+
end
|
50
|
+
end
|
23
51
|
end
|
24
52
|
|
25
53
|
context "pygments are not installed" do
|
26
54
|
|
27
55
|
it "prints plain code" do
|
28
56
|
Syntax.stub(:system).and_return(false)
|
29
|
-
Syntax.highlight(
|
57
|
+
Syntax.highlight(snippet).should == 'self.color = [UIColor redColor];'
|
30
58
|
end
|
31
59
|
|
32
60
|
end
|
data/vendor/json_pure/parser.rb
CHANGED
data/xcpretty.gemspec
CHANGED
@@ -7,7 +7,7 @@ Gem::Specification.new do |spec|
|
|
7
7
|
spec.name = "xcpretty"
|
8
8
|
spec.version = XCPretty::VERSION
|
9
9
|
spec.authors = ["Marin Usalj", "Delisa Mason"]
|
10
|
-
spec.email = ["
|
10
|
+
spec.email = ["marin2211@gmail.com", "iskanamagus@gmail.com"]
|
11
11
|
spec.required_ruby_version = '>= 1.8.7'
|
12
12
|
spec.description =
|
13
13
|
%q{
|
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
|
|
18
18
|
and it can also mine Bitcoins.
|
19
19
|
}
|
20
20
|
spec.summary = %q{xcodebuild formatter done right}
|
21
|
-
spec.homepage = "https://github.com/
|
21
|
+
spec.homepage = "https://github.com/supermarin/xcpretty"
|
22
22
|
spec.license = "MIT"
|
23
23
|
|
24
24
|
spec.files = `git ls-files`.split($/)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: xcpretty
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marin Usalj
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2015-03-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -71,7 +71,7 @@ description: "\n Xcodebuild formatter designed to be piped with `xcodebuild`,\n
|
|
71
71
|
thus keeping 100% compatibility.\n\n It has modes for CI, running tests (RSpec
|
72
72
|
dot-style),\n and it can also mine Bitcoins.\n "
|
73
73
|
email:
|
74
|
-
-
|
74
|
+
- marin2211@gmail.com
|
75
75
|
- iskanamagus@gmail.com
|
76
76
|
executables:
|
77
77
|
- xcpretty
|
@@ -79,6 +79,7 @@ extensions: []
|
|
79
79
|
extra_rdoc_files: []
|
80
80
|
files:
|
81
81
|
- ".gitignore"
|
82
|
+
- ".hound.yml"
|
82
83
|
- ".kick"
|
83
84
|
- ".travis.yml"
|
84
85
|
- CHANGELOG.md
|
@@ -145,7 +146,7 @@ files:
|
|
145
146
|
- vendor/json_pure/generator.rb
|
146
147
|
- vendor/json_pure/parser.rb
|
147
148
|
- xcpretty.gemspec
|
148
|
-
homepage: https://github.com/
|
149
|
+
homepage: https://github.com/supermarin/xcpretty
|
149
150
|
licenses:
|
150
151
|
- MIT
|
151
152
|
metadata: {}
|