rufo 0.4.1 → 0.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -0
- data/CHANGELOG.md +10 -1
- data/README.md +5 -1
- data/lib/rufo/formatter.rb +27 -18
- data/lib/rufo/version.rb +1 -1
- data/rufo.gemspec +1 -1
- metadata +5 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: db1dcca141aa241d1f18e99eb17cab04fe26a2f922fbcd0272c371b43f62459d
|
4
|
+
data.tar.gz: 5319a68334194f410d607a24425584ed114c9fb775908fa9f09eb37101d31da8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9ba69ebe856e99f8a0a2d1bd467b0b61e1e12f7d0b3c0dd26d4e0de2b2d4adb5804fdf864904dcf5bccc05afe2e5607f67a4f8be28d9dc5d5004b955ff76d96c
|
7
|
+
data.tar.gz: 276167c342eeddcf7e45608a9219029216081c34a0021aeb35504d4239078ac0a8f31f667d255a76fb384ee7d801857d64954ac7c8abebb0d37bec8120039554
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -10,7 +10,16 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|
10
10
|
|
11
11
|
### Added
|
12
12
|
|
13
|
-
## [0.4.
|
13
|
+
## [0.4.2] - 2019-01-22
|
14
|
+
|
15
|
+
### Fixed
|
16
|
+
- Fix bug: Rufo indents squiggly HEREDOC incorrectly causing bad formating (issue [136](https://github.com/ruby-formatter/rufo/issues/136))
|
17
|
+
|
18
|
+
### Added
|
19
|
+
|
20
|
+
- Chore: Added ruby 2.6.0 to CI test runs.
|
21
|
+
|
22
|
+
## [0.4.1] - 2018-10-27
|
14
23
|
|
15
24
|
### Fixed
|
16
25
|
- Fix bug for double colon operator in method definition (issue [#120](https://github.com/ruby-formatter/rufo/issues/120))
|
data/README.md
CHANGED
@@ -120,7 +120,11 @@ so they look good.
|
|
120
120
|
### Format files or directories
|
121
121
|
|
122
122
|
```
|
123
|
-
|
123
|
+
# All directories (recursive)
|
124
|
+
$ rufo .
|
125
|
+
|
126
|
+
# Specific file or directory
|
127
|
+
$ rufo [file or directory name]
|
124
128
|
```
|
125
129
|
|
126
130
|
### Format STDIN
|
data/lib/rufo/formatter.rb
CHANGED
@@ -245,25 +245,32 @@ class Rufo::Formatter
|
|
245
245
|
if heredoc && tilde && broken_ripper_version?
|
246
246
|
@squiggly_flag = true
|
247
247
|
end
|
248
|
-
|
249
|
-
if heredoc && tilde &&
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
end
|
254
|
-
skip_ignored_space
|
255
|
-
if current_token_kind == :on_tstring_content
|
256
|
-
check :on_tstring_content
|
257
|
-
consume_token_value(current_token_value)
|
258
|
-
next_token
|
259
|
-
end
|
248
|
+
looking_at_newline = current_token_kind == :on_tstring_content && current_token_value == "\n"
|
249
|
+
if heredoc && tilde && !@last_was_newline && looking_at_newline
|
250
|
+
check :on_tstring_content
|
251
|
+
consume_token_value(current_token_value)
|
252
|
+
next_token
|
260
253
|
else
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
254
|
+
# For heredocs with tilde we sometimes need to align the contents
|
255
|
+
if heredoc && tilde && @last_was_newline
|
256
|
+
unless (current_token_value == "\n" ||
|
257
|
+
current_token_kind == :on_heredoc_end)
|
258
|
+
write_indent(next_indent)
|
259
|
+
end
|
260
|
+
skip_ignored_space
|
261
|
+
if current_token_kind == :on_tstring_content
|
262
|
+
check :on_tstring_content
|
263
|
+
consume_token_value(current_token_value)
|
264
|
+
next_token
|
265
|
+
end
|
266
|
+
else
|
267
|
+
while (current_token_kind == :on_ignored_sp) ||
|
268
|
+
(current_token_kind == :on_tstring_content) ||
|
269
|
+
(current_token_kind == :on_embexpr_beg)
|
270
|
+
check current_token_kind
|
271
|
+
break if current_token_kind == :on_embexpr_beg
|
272
|
+
consume_token current_token_kind
|
273
|
+
end
|
267
274
|
end
|
268
275
|
end
|
269
276
|
when :string_content
|
@@ -638,6 +645,8 @@ class Rufo::Formatter
|
|
638
645
|
return if string.include?("\\")
|
639
646
|
# don't format strings that contain our quote character
|
640
647
|
return if string.include?(quote_char)
|
648
|
+
return if string.include?('#{')
|
649
|
+
return if string.include?('#$')
|
641
650
|
true
|
642
651
|
end
|
643
652
|
|
data/lib/rufo/version.rb
CHANGED
data/rufo.gemspec
CHANGED
@@ -22,7 +22,7 @@ Gem::Specification.new do |spec|
|
|
22
22
|
spec.require_paths = ["lib"]
|
23
23
|
spec.required_ruby_version = '>= 2.3.5'
|
24
24
|
|
25
|
-
spec.add_development_dependency "bundler", "
|
25
|
+
spec.add_development_dependency "bundler", ">= 1.15"
|
26
26
|
spec.add_development_dependency "rake", "~> 10.0"
|
27
27
|
spec.add_development_dependency "rspec", "~> 3.0"
|
28
28
|
spec.add_development_dependency "guard-rspec", "~> 4.0"
|
metadata
CHANGED
@@ -1,27 +1,27 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rufo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ary Borenszweig
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-01-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '1.15'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.15'
|
27
27
|
- !ruby/object:Gem::Dependency
|
@@ -120,8 +120,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
120
120
|
- !ruby/object:Gem::Version
|
121
121
|
version: '0'
|
122
122
|
requirements: []
|
123
|
-
|
124
|
-
rubygems_version: 2.7.3
|
123
|
+
rubygems_version: 3.0.1
|
125
124
|
signing_key:
|
126
125
|
specification_version: 4
|
127
126
|
summary: Ruby code formatter
|