mo 1.2.0 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/mo.rb +15 -15
- data/lib/mo/version.rb +1 -1
- metadata +19 -2
data/lib/mo.rb
CHANGED
@@ -12,7 +12,7 @@ module Mo
|
|
12
12
|
|
13
13
|
desc "Clean-up trailing whitespaces."
|
14
14
|
def whitespace
|
15
|
-
|
15
|
+
Dir[*ALL_FILES].each do |file|
|
16
16
|
wsps = false
|
17
17
|
File.open(file).each_line do |line|
|
18
18
|
break if wsps = line.match(/( |\t)*$/).captures.compact.any?
|
@@ -26,7 +26,7 @@ module Mo
|
|
26
26
|
|
27
27
|
desc "Print files with more than 80 columns"
|
28
28
|
def eighty_column
|
29
|
-
|
29
|
+
Dir[*ALL_FILES].each do |file|
|
30
30
|
output = `grep -n '.\\{80,\\}' #{file}`
|
31
31
|
unless output.empty?
|
32
32
|
puts file
|
@@ -37,7 +37,7 @@ module Mo
|
|
37
37
|
|
38
38
|
desc "Convert ruby hashes to 1.9 style."
|
39
39
|
def rocketless
|
40
|
-
|
40
|
+
Dir[*RUBY_FILES].each do |file|
|
41
41
|
source = File.open(file).read
|
42
42
|
regexp = /(?<!return)(?<!:)(?<!\w)(\s+):(\w+)\s*=>/
|
43
43
|
next if source.scan(regexp).any?
|
@@ -49,10 +49,10 @@ module Mo
|
|
49
49
|
|
50
50
|
# Courtesy of changa.
|
51
51
|
desc "Add utf-8 encoding on files that don't have it"
|
52
|
-
def encoding
|
53
|
-
|
54
|
-
if `head -n 1 #{file}|grep '# encoding'`.empty?
|
55
|
-
system "sed -i -r '1 s/^(.*)$/# encoding: utf-8\\n\\1/g' #{file}"
|
52
|
+
def encoding(listener = Kernel)
|
53
|
+
Dir[*RUBY_FILES].each do |file|
|
54
|
+
if `head -n 1 #{file} | grep -E '# encoding\|-\*- coding'`.empty?
|
55
|
+
listener.system "sed -i -r '1 s/^(.*)$/# encoding: utf-8\\n\\1/g' #{file}"
|
56
56
|
puts " * #{file}"
|
57
57
|
end
|
58
58
|
end
|
@@ -60,7 +60,7 @@ module Mo
|
|
60
60
|
|
61
61
|
desc "Check ruby syntax."
|
62
62
|
def check_syntax
|
63
|
-
|
63
|
+
Dir[*RUBY_FILES].each do |file|
|
64
64
|
if File.readable? file
|
65
65
|
puts " * #{file}"
|
66
66
|
puts `#{which('ruby')} -wc #{file}`.chomp
|
@@ -69,13 +69,13 @@ module Mo
|
|
69
69
|
end
|
70
70
|
|
71
71
|
desc "Check rspec's files name"
|
72
|
-
def check_rspec_files_name
|
73
|
-
ignores_dirs = %w[spec/factories spec/mocks spec/support spec/fabricators
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
72
|
+
def check_rspec_files_name(listener = Kernel)
|
73
|
+
ignores_dirs = %w[spec/factories spec/mocks spec/support spec/fabricators
|
74
|
+
spec/fixtures spec/spec_helper.rb]
|
75
|
+
Dir[*SPEC_FILES].each do |file|
|
76
|
+
next if file.match(/_spec.rb$/)
|
77
|
+
listener.puts " * #{file}" unless ignores_dirs.any? {|dir| file.include?(dir) }
|
78
|
+
end
|
79
79
|
end
|
80
80
|
|
81
81
|
# Cross-platform way of finding an executable in the $PATH.
|
data/lib/mo/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-02-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: boson
|
@@ -27,6 +27,22 @@ dependencies:
|
|
27
27
|
- - ! '>='
|
28
28
|
- !ruby/object:Gem::Version
|
29
29
|
version: '0'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: rake
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
type: :development
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
30
46
|
- !ruby/object:Gem::Dependency
|
31
47
|
name: minitest
|
32
48
|
requirement: !ruby/object:Gem::Requirement
|
@@ -80,3 +96,4 @@ signing_key:
|
|
80
96
|
specification_version: 3
|
81
97
|
summary: Mo helps you keep your rails project clean.
|
82
98
|
test_files: []
|
99
|
+
has_rdoc:
|