syntax_fix 0.0.2 → 0.0.3
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.
- data/README.md +1 -4
- data/Rakefile +5 -0
- data/bin/syntax_fix +7 -2
- data/lib/syntax_fix.rb +3 -3
- data/lib/syntax_fix/checker.rb +2 -2
- data/lib/syntax_fix/version.rb +1 -1
- metadata +11 -15
data/README.md
CHANGED
@@ -32,7 +32,4 @@ Usage
|
|
32
32
|
|
33
33
|
`-v` or `--verbose` - be verbose about the actions
|
34
34
|
|
35
|
-
|
36
|
-
============
|
37
|
-
|
38
|
-
If you consider to contribute to syntax_fix gem, please try to cover your code with tests
|
35
|
+
`-p [PATH]` or `--path [PATH]` - specify the relative path to start actions from
|
data/Rakefile
CHANGED
data/bin/syntax_fix
CHANGED
@@ -11,9 +11,14 @@ optparse = OptionParser.new do |opts|
|
|
11
11
|
opts.on( '-v', '--verbose', 'Be verbose about the actions' ) do
|
12
12
|
checker.verbose = true
|
13
13
|
end
|
14
|
+
opts.on( '-p [PATH]', '--path [PATH]', 'Specify the relative path to start actions from' ) do |path|
|
15
|
+
checker.rel_path = path
|
16
|
+
end
|
17
|
+
checker.rel_path ||= '.'
|
14
18
|
end
|
15
19
|
optparse.parse!
|
16
20
|
|
17
21
|
puts 'Reading files...' if checker.verbose
|
18
|
-
|
19
|
-
|
22
|
+
path = File.expand_path(checker.rel_path)
|
23
|
+
checker.fix_code(path)
|
24
|
+
puts 'Done!' if checker.verbose
|
data/lib/syntax_fix.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
1
2
|
$:.push File.expand_path(File.dirname(__FILE__))
|
2
3
|
require "syntax_fix/version"
|
3
|
-
|
4
|
-
|
5
|
-
SyntaxFix.autoload :DirFile, 'syntax_fix/dir_file.rb'
|
4
|
+
require 'syntax_fix/checker.rb'
|
5
|
+
require 'syntax_fix/dir_file.rb'
|
data/lib/syntax_fix/checker.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
module SyntaxFix
|
2
2
|
class Checker
|
3
|
-
attr_accessor :verbose
|
3
|
+
attr_accessor :verbose, :rel_path
|
4
4
|
|
5
5
|
def fix_code(path)
|
6
6
|
Dir.foreach(path) do |name|
|
@@ -11,7 +11,7 @@ module SyntaxFix
|
|
11
11
|
|
12
12
|
private
|
13
13
|
def fix_file(current_item)
|
14
|
-
return
|
14
|
+
return unless current_item.correct_file?
|
15
15
|
content = current_item.read_file
|
16
16
|
fixed_content = fix_syntax(content)
|
17
17
|
if content != fixed_content
|
data/lib/syntax_fix/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: syntax_fix
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-12-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
16
|
-
requirement:
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,7 +21,12 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements:
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
25
30
|
description: Replace Ruby 1.8 syntax with the Ruby 1.9 syntax all over the project
|
26
31
|
email:
|
27
32
|
- parizhskiy@gmail.com
|
@@ -71,17 +76,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
71
76
|
version: '0'
|
72
77
|
requirements: []
|
73
78
|
rubyforge_project: syntax_fix
|
74
|
-
rubygems_version: 1.8.
|
79
|
+
rubygems_version: 1.8.24
|
75
80
|
signing_key:
|
76
81
|
specification_version: 3
|
77
82
|
summary: Replace Ruby 1.8 syntax with the modern one
|
78
|
-
test_files:
|
79
|
-
- spec/fixtures/nested/nested.rb
|
80
|
-
- spec/fixtures/nested/not_rb.txt
|
81
|
-
- spec/fixtures/not_rb.dat
|
82
|
-
- spec/fixtures/test.rb
|
83
|
-
- spec/fixtures/test/fixed_test.txt
|
84
|
-
- spec/fixtures/test/test.rb
|
85
|
-
- spec/spec_helper.rb
|
86
|
-
- spec/specs/checker_spec.rb
|
87
|
-
- spec/specs/dir_file_spec.rb
|
83
|
+
test_files: []
|