Skip to content

Commit 01d224d

Browse files
committed
Vendor - upgrade ruby-beautify to v0.97.3
1 parent d128f4e commit 01d224d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+949
-1731
lines changed

app/server/sonicpi/lib/sonicpi/spider.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -543,7 +543,7 @@ def __complete_snippet_or_indent_lines(workspace_id, buf, start_line, finish_lin
543543
end
544544

545545
# Beautify buffer
546-
beautiful = RBeautify.beautify_string :ruby, buf_lines.join
546+
beautiful = RubyBeautify.pretty_string buf_lines.join, indent_token: " ", indent_count: 2
547547

548548
# calculate amount of whitespace at start of beautified line
549549
beautiful_lines = beautiful.lines.to_a
@@ -587,7 +587,7 @@ def __beautify_buffer(id, buf, line, index, first_line)
587587
prev_ws_len = prev_line[/\A */].size
588588

589589
# Beautify buffer
590-
beautiful = RBeautify.beautify_string :ruby, buf
590+
beautiful = RubyBeautify.pretty_string buf, indent_token: " ", indent_count: 2
591591

592592
# calculate amount of whitespace at start of beautified line
593593
beautiful_lines = beautiful.lines.to_a
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
Gemfile.lock
2+
pkg/*
3+
tmp/*
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
--color
2+
--format documentation
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
language: ruby
2+
rvm:
3+
- "2.0.0"
4+
- "2.1.0"
5+
branches:
6+
only:
7+
- master
8+
- dev
9+
script: bundle exec rspec spec
10+
addons:
11+
code_climate:
12+
repo_token: 596a4a033e7deae1bfd5e84da4c803ef81134158764a48b02279fe97eb83fcf4
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
How to contribute to this project.
2+
3+
## Thin rules (to be made into sections)
4+
5+
* Work off the dev branch, not master.
6+
* Pull requests should be named something related to PR, `hotfix-XXX` or `feature-YYY`.
7+
* Do not edit the `version.rb` or the `gemspec`.
8+
* All pull requests have to pass tests on `travis-ci` before I'll consider merging them.
9+
* for tests of the actual parser, make sure you include a new `usage_scenario`, not update an existing one. I'll merge stuff as it gets cluttered.
10+
11+
## Formatting and style
12+
13+
Run all your code through `ruby-beautify` with default settings before committing.
14+
15+
This should work (and if it doesn't, please let me know)
16+
17+
`ruby-beautify --overwrite lib/**/*.rb bin/ruby-beautify spec/**/*_spec.rb spec/**/*_helper.rb`
18+
19+
Which should pretty up only the code files, and not our test files. This will help insure pretty commits and that they will be accepted.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
source 'https://rubygems.org'
2+
3+
# Specify your gem's dependencies in ruby-beautify.gemspec
4+
gemspec
5+
6+
group :development do
7+
gem 'guard', require:false
8+
gem 'guard-rspec', require:false
9+
gem 'guard-bundler', require:false
10+
gem 'pry', require:false
11+
gem "codeclimate-test-reporter", group: :test, require: nil
12+
end
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
guard :bundler do
2+
watch('Gemfile')
3+
watch(/^.+\.gemspec/)
4+
end
5+
6+
guard :rspec, cmd: 'rspec' do
7+
watch('bin/ruby-beautify') { "spec" }
8+
watch(%r{^spec/.+_spec\.rb$})
9+
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
10+
watch('spec/spec_helper.rb') { "spec" }
11+
end
File renamed without changes.
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
# Ruby Beautify [![Build Status](https://travis-ci.org/erniebrodeur/ruby-beautify.png?branch=master)](https://travis-ci.org/erniebrodeur/ruby-beautify) [![Gitter](https://badges.gitter.im/Join Chat.svg)](https://gitter.im/erniebrodeur/ruby-beautify?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
2+
3+
This gem provides a cli binary named 'ruby-beautify' that will pretty up ruby code.
4+
5+
Currenty, 'rbeautify' is included for backwards compatibility but will likely be phased out at some point.
6+
7+
## Installation
8+
9+
`gem install ruby-beautify`
10+
11+
## Usage
12+
13+
To Pretty up a file:
14+
15+
`ruby-beautify filename`
16+
17+
Without a filename it reads from STDIN, suitable for piping:
18+
19+
`curl https://raw.githubusercontent.com/erniebrodeur/ruby-beautify/master/spec/monolithic_example.rb | ruby-beautify`
20+
21+
It has help:
22+
23+
`ruby-beautify --help`
24+
25+
You can pick your indent character:
26+
27+
`ruby-beautify --(t)abs`
28+
29+
`ruby-beautify --(s)paces`
30+
31+
You can also pick the count of characters:
32+
33+
`ruby-beautify --indent_(c)ount 1`
34+
35+
Examples:
36+
37+
`ruby-beautify -c 2 -s filename`
38+
39+
`ruby-beautify filename`
40+
41+
`ruby-beautify -t -c 2 filename`
42+
43+
## Advanced Usage
44+
45+
You can over write files in place, this is useful for doing an entire directory of files at once. This will not over write any files that fail syntax check.
46+
47+
`ruby-beautify --overwrite **/*.rb`
48+
49+
## Configuration file
50+
51+
It can use a configuration file like some of the other ruby projects out there. The config file consists of each argument on a new line. Something like this:
52+
53+
```
54+
--spaces
55+
--indent_count=2
56+
```
57+
58+
Note, you'll have to add the equal sign between value and argument (tricky bit, that).
59+
60+
Placing this into a `.ruby-beautify` anywhere in your tree (like git) will work. This allows you to put it at the root of a project and have it change the defaults anywhere in the project.
61+
62+
## Bugs
63+
64+
Please feel free to open issues, I am actively working on this project again, thanks entirely to the ripper gem.
65+
66+
The gaps are getting smaller. I think we have most of the basic ruby use cases in place. I don't use rails/dsl's too often so I haven't tested those. I suspect it should 'just work' since the way we do syntax matching is really agnostic to what a DSL can change.
67+
68+
## Todo
69+
70+
* Add vim style comment hinting.
71+
* add specs/pipe testing (epic).
72+
* remove the link to rbeautify (by 1.0).
73+
74+
Longer term I'd like to do some more to assignment, line wrapping, and spacing in/around keywords.
75+
76+
## Contributing
77+
78+
Please see the [Contribution Guide](CONTRIB.md) file for specifics on how to contribute to this project.
79+
80+
# History
81+
82+
The original analyzer is available at: http://www.arachnoid.com/ruby/rubyBeautifier.html.
83+
84+
My work is based off of this sublime-text2 plugin: https://github.com/CraigWilliams/BeautifyRuby but cleaned up and made suitable for use directly in a shell.
85+
86+
I've recently re-written this to use the stdlib `ripper` gem to do the lexical analyzing. Consequently I've dropped all of the old legacy code that did this.
File renamed without changes.

0 commit comments

Comments
 (0)