oreilly-snippets 0.0.16 → 0.0.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +8 -8
- data/lib/oreilly/snippets.rb +9 -0
- data/lib/oreilly/snippets/version.rb +1 -1
- data/spec/fixtures/really_long_line.rb +1 -0
- data/spec/process_spec.rb +16 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MmMyOTRhMGMxZTllMjFkN2VhMzZkMzg3ZTdhZmQyYzU0MDE0NjE3OQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NmYxN2YxYTYzZDk2Nzc4YzIxNWY3Y2RlNzIzODJkYTgyNDViZDYwNg==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
Mjc2NTU2MDEwMWI3ZTFmN2Q2MzcyYWFiMmU0NzhmYjliM2M4YjYxNzQxMjNi
|
10
|
+
NmY5MzNlZWE2NjQ1ODNjMjk5MDY3Yjg5Zjk2ZTk5MmE4Mjc2ODM4Y2U4M2I4
|
11
|
+
ZDQwOGIxOWQyMzZiZWIwZmQ1NjdkMzA2ZTdmOTUyNDRlMmY0ZmQ=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZWQyZWQzY2RiYWY1ZjZlNDNjOTg0NWQ0MWRlODY4NmM0ZWY2MGYwMTY3NzJk
|
14
|
+
NmY0NGM2Y2E0NzJhNzJjYjhjYjc2YmYwZmRlMmRiMjQ4NWE0Yzg1ZDk3MDNk
|
15
|
+
ZjcxMjA4NDc4NzY1ODFjODE4YzEzYTA2ZjFkN2FkNDU4YTFkYjM=
|
data/lib/oreilly/snippets.rb
CHANGED
@@ -111,6 +111,15 @@ module Oreilly
|
|
111
111
|
end
|
112
112
|
rv = lines.join "\n"
|
113
113
|
end
|
114
|
+
|
115
|
+
if ENV['OREILLY_SNIPPETS_DEBUG_LONG_LINES']
|
116
|
+
rv.split( /\n/ ).each_with_index do |l,i|
|
117
|
+
if l.length > 70
|
118
|
+
raise "Line #{i+1} is too long: #{l.length} characters long"
|
119
|
+
end
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
114
123
|
rv
|
115
124
|
end
|
116
125
|
|
@@ -0,0 +1 @@
|
|
1
|
+
abc def abc def abc def abc def abc def abc def abc def abc def abc def abc def abc def
|
data/spec/process_spec.rb
CHANGED
@@ -13,6 +13,13 @@ Put any descriptive text you want here. It will be replaced with the
|
|
13
13
|
snippet~~~~
|
14
14
|
END
|
15
15
|
|
16
|
+
LONG_LINES = <<END
|
17
|
+
[filename="../spec/fixtures/really_long_lines.rb"]
|
18
|
+
snippet~~~~
|
19
|
+
Put any descriptive text you want here. It will be replaced with the
|
20
|
+
snippet~~~~
|
21
|
+
END
|
22
|
+
|
16
23
|
|
17
24
|
WITH_SHA = <<END
|
18
25
|
[filename="#{ROOT}", language="js", sha="c863f786f5959799d7c:test.js"]
|
@@ -322,6 +329,15 @@ describe Oreilly::Snippets do
|
|
322
329
|
end
|
323
330
|
end
|
324
331
|
|
332
|
+
describe "#warnlonglines" do
|
333
|
+
it "should warn you if there is a really long line of code" do
|
334
|
+
ENV['OREILLY_SNIPPETS_DEBUG_LONG_LINES'] = "1"
|
335
|
+
lambda {
|
336
|
+
Oreilly::Snippets.process( LONG_LINES )
|
337
|
+
}.should raise_error
|
338
|
+
end
|
339
|
+
end
|
340
|
+
|
325
341
|
describe "#flatten" do
|
326
342
|
before( :each ) do
|
327
343
|
@with_spaces = File.read( "spec/fixtures/with_spaces.rb" )
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: oreilly-snippets
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.17
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Dawson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-09-
|
11
|
+
date: 2015-09-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -77,6 +77,7 @@ files:
|
|
77
77
|
- spec/fixtures/normalize_callouts.js
|
78
78
|
- spec/fixtures/normalize_callouts.rb
|
79
79
|
- spec/fixtures/normalize_callouts_long.js
|
80
|
+
- spec/fixtures/really_long_line.rb
|
80
81
|
- spec/fixtures/with_spaces.rb
|
81
82
|
- spec/fixtures/with_tabs.rb
|
82
83
|
- spec/process_spec.rb
|
@@ -114,6 +115,7 @@ test_files:
|
|
114
115
|
- spec/fixtures/normalize_callouts.js
|
115
116
|
- spec/fixtures/normalize_callouts.rb
|
116
117
|
- spec/fixtures/normalize_callouts_long.js
|
118
|
+
- spec/fixtures/really_long_line.rb
|
117
119
|
- spec/fixtures/with_spaces.rb
|
118
120
|
- spec/fixtures/with_tabs.rb
|
119
121
|
- spec/process_spec.rb
|