ruby-beautify 0.91.0 → 0.92.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +0 -11
- data/RELEASE.md +13 -0
- data/bin/rbeautify +17 -15
- data/lib/ruby-beautify.rb +0 -6
- data/lib/ruby-beautify/version.rb +1 -1
- data/spec/spec_helper.rb +1 -1
- metadata +3 -5
- data/lib/ruby-beautify/app.rb +0 -14
- data/lib/ruby-beautify/cli.rb +0 -56
- data/lib/ruby-beautify/filemagic.rb +0 -12
data/README.md
CHANGED
@@ -4,16 +4,6 @@ This gem provides a cli binary named 'rbeautify' that will pretty up ruby code.
|
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
7
|
-
Add this line to your application's Gemfile:
|
8
|
-
|
9
|
-
gem 'ruby-beautify'
|
10
|
-
|
11
|
-
And then execute:
|
12
|
-
|
13
|
-
$ bundle
|
14
|
-
|
15
|
-
Or install it yourself as:
|
16
|
-
|
17
7
|
$ gem install ruby-beautify
|
18
8
|
|
19
9
|
## Usage
|
@@ -34,7 +24,6 @@ It has help:
|
|
34
24
|
|
35
25
|
$ rbeautify -h
|
36
26
|
|
37
|
-
|
38
27
|
## Contributing
|
39
28
|
|
40
29
|
1. Fork it
|
data/RELEASE.md
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
# Release Notes
|
2
|
+
|
3
|
+
#### 0.92.0
|
4
|
+
* Renamed a require in rspec so they would work again.
|
5
|
+
* Dropped filemagic since this already has excellent file parsing and is platform agnostic.
|
6
|
+
* Dropped the rest of app.rb, since it wasn't adding anything but line count at this point.
|
7
|
+
* Added a RELEASE.md to track changes as I go.
|
8
|
+
* Dropped the unneeded yajl and sys-proctree deps since it doesn't use them.
|
9
|
+
|
10
|
+
#### 0.91.0
|
11
|
+
* Stripped out the few bits of my cli stuff that I used and dropped app.rb, cli.rb and filemagic.rb, since all the functionality was present elsewhere.
|
12
|
+
* Fixed up the gem related files, generating a proper gemspec, fixed the deps.
|
13
|
+
* Fixed up the README.md to give a few usage examples and brief explanation.
|
data/bin/rbeautify
CHANGED
@@ -3,23 +3,25 @@ require 'ruby-beautify'
|
|
3
3
|
|
4
4
|
include RBeautify
|
5
5
|
|
6
|
-
|
7
|
-
|
6
|
+
Options = OptionParser.new do |opts|
|
7
|
+
opts.on("-V", "--version", "Print version") { |version| puts RBeautify::VERSION;exit 0}
|
8
|
+
opts.banner = "Usage: print ruby into a pretty format, or break trying."
|
9
|
+
end
|
8
10
|
Options.parse!
|
9
11
|
|
10
12
|
if ARGV.empty?
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
13
|
+
begin
|
14
|
+
puts RBeautify.beautify_string :ruby, STDIN
|
15
|
+
rescue Exception => e
|
16
|
+
puts e.message
|
17
|
+
exit
|
18
|
+
end
|
17
19
|
else
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
20
|
+
ARGV.each do |f|
|
21
|
+
if File.exist? f
|
22
|
+
puts RBeautify.beautify_string :ruby, open(f).read
|
23
|
+
else
|
24
|
+
puts "No such file: #{f}"
|
25
|
+
end
|
26
|
+
end
|
25
27
|
end
|
data/lib/ruby-beautify.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
@@ -5,7 +5,7 @@ rescue LoadError
|
|
5
5
|
require 'rspec'
|
6
6
|
end
|
7
7
|
require 'yaml'
|
8
|
-
require File.dirname(__FILE__) + '/../lib/
|
8
|
+
require File.dirname(__FILE__) + '/../lib/ruby-beautify.rb'
|
9
9
|
|
10
10
|
module RBeautifyMatchers
|
11
11
|
# Adds more descriptive failure messages to the dynamic be_valid matcher
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-beautify
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.92.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -12,7 +12,7 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date: 2012-07-
|
15
|
+
date: 2012-07-10 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: rspec
|
@@ -73,17 +73,15 @@ files:
|
|
73
73
|
- Gemfile
|
74
74
|
- LICENSE
|
75
75
|
- README.md
|
76
|
+
- RELEASE.md
|
76
77
|
- Rakefile
|
77
78
|
- bin/rbeautify
|
78
79
|
- lib/beautifier.rb
|
79
80
|
- lib/ruby-beautify.rb
|
80
|
-
- lib/ruby-beautify/app.rb
|
81
81
|
- lib/ruby-beautify/block_end.rb
|
82
82
|
- lib/ruby-beautify/block_matcher.rb
|
83
83
|
- lib/ruby-beautify/block_start.rb
|
84
|
-
- lib/ruby-beautify/cli.rb
|
85
84
|
- lib/ruby-beautify/config/ruby.rb
|
86
|
-
- lib/ruby-beautify/filemagic.rb
|
87
85
|
- lib/ruby-beautify/language.rb
|
88
86
|
- lib/ruby-beautify/line.rb
|
89
87
|
- lib/ruby-beautify/version.rb
|
data/lib/ruby-beautify/app.rb
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
module RBeautify
|
2
|
-
class Application
|
3
|
-
attr_accessor :banner
|
4
|
-
attr_accessor :long_description
|
5
|
-
|
6
|
-
# return the name of the app, for now this is just the cmd ran, later it will be
|
7
|
-
# something generated but more unique.
|
8
|
-
def name
|
9
|
-
$0.split("/").last
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
App = RBeautify::Application.new
|
14
|
-
end
|
data/lib/ruby-beautify/cli.rb
DELETED
@@ -1,56 +0,0 @@
|
|
1
|
-
require 'optparse'
|
2
|
-
|
3
|
-
module RBeautify
|
4
|
-
class OptBlob
|
5
|
-
def initialize
|
6
|
-
@options = {}
|
7
|
-
|
8
|
-
@parser = OptionParser.new do |opts|
|
9
|
-
opts.banner = App.banner
|
10
|
-
|
11
|
-
opts.on("-V", "--version", "Print version") { |version| @options[:version] = true}
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
#TODO figure out a more dynamic way to include the parser and hash table.
|
16
|
-
def []=(key, value)
|
17
|
-
@options[key] = value
|
18
|
-
end
|
19
|
-
|
20
|
-
def [](key)
|
21
|
-
@options[key]
|
22
|
-
end
|
23
|
-
|
24
|
-
# This will build an on/off option with a default value set to false.
|
25
|
-
def bool_on(word, description = "")
|
26
|
-
Options[word.to_sym] = false
|
27
|
-
@parser.on "-#{word.chars.first}", "--[no]#{word}", description do |o|
|
28
|
-
Options[word.to_sym] == o
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
# This is the parser value on lifted up.
|
33
|
-
def on(*opts, &block)
|
34
|
-
@parser.on(*opts, &block)
|
35
|
-
end
|
36
|
-
|
37
|
-
def parse!
|
38
|
-
@parser.banner = App.banner
|
39
|
-
@parser.parse!
|
40
|
-
|
41
|
-
if @options[:version]
|
42
|
-
puts App.version
|
43
|
-
exit 0
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
def on_pry
|
48
|
-
if @options[:pry]
|
49
|
-
require 'pry'
|
50
|
-
binding.pry
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
Options = OptBlob.new
|
56
|
-
end
|