mo 1.0.4 → 1.2.0
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 +7 -6
- data/lib/mo.rb +28 -3
- data/lib/mo/version.rb +1 -1
- metadata +18 -2
data/README.md
CHANGED
@@ -20,12 +20,13 @@ gem "mo", "~>1.0"
|
|
20
20
|
Usage: mo [OPTIONS] COMMAND [ARGS]
|
21
21
|
|
22
22
|
Available commands:
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
23
|
+
check_rspec_files_name Check rspec's files name
|
24
|
+
check_syntax Check ruby syntax.
|
25
|
+
eighty_column Print files with more than 80 columns
|
26
|
+
encoding Add utf-8 encoding on files that don't have it
|
27
|
+
help Displays help for a command
|
28
|
+
rocketless Convert ruby hashes to 1.9 style.
|
29
|
+
whitespace Clean-up trailing whitespaces.
|
29
30
|
|
30
31
|
Options:
|
31
32
|
-h, --help Displays this help message
|
data/lib/mo.rb
CHANGED
@@ -4,13 +4,12 @@ require 'boson/runner'
|
|
4
4
|
module Mo
|
5
5
|
class Runner < Boson::Runner
|
6
6
|
RUBY_FILES = %w[**/*.ru **/*.rake Gemfile **/*.rb]
|
7
|
+
SPEC_FILES = %w[spec/**/*.rb]
|
7
8
|
JS_FILES = %w[**/*.js **/*.coffee]
|
8
9
|
TPL_FILES = %w[**/*.haml **/*.erb **/*.slim **/*.jade]
|
9
10
|
DOC_FILES = %w[**/*.md **/*.txt **/*.textile]
|
10
11
|
ALL_FILES = RUBY_FILES + JS_FILES + DOC_FILES + TPL_FILES
|
11
12
|
|
12
|
-
@@compiler_ruby = `which ruby`.strip
|
13
|
-
|
14
13
|
desc "Clean-up trailing whitespaces."
|
15
14
|
def whitespace
|
16
15
|
(RUBY_FILES + JS_FILES + TPL_FILES).map { |glob| Dir[glob] }.flatten.each do |file|
|
@@ -64,9 +63,35 @@ module Mo
|
|
64
63
|
RUBY_FILES.map { |glob| Dir[glob] }.flatten.each do |file|
|
65
64
|
if File.readable? file
|
66
65
|
puts " * #{file}"
|
67
|
-
puts `#{
|
66
|
+
puts `#{which('ruby')} -wc #{file}`.chomp
|
68
67
|
end
|
69
68
|
end
|
70
69
|
end
|
70
|
+
|
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 spec/fixtures spec/spec_helper.rb]
|
74
|
+
SPEC_FILES.map {|glob| Dir[glob]}.flatten.each {|file|
|
75
|
+
if !file.include?("_spec.rb") && !ignores_dirs.any? {|dir| file.include?(dir)}
|
76
|
+
puts " * #{file}"
|
77
|
+
end
|
78
|
+
}
|
79
|
+
end
|
80
|
+
|
81
|
+
# Cross-platform way of finding an executable in the $PATH.
|
82
|
+
# Taken from
|
83
|
+
# http://stackoverflow.com/questions/2108727/which-in-ruby-checking-if-program-exists-in-path-from-ruby
|
84
|
+
#
|
85
|
+
# which('ruby') #=> /usr/bin/ruby
|
86
|
+
def which(cmd)
|
87
|
+
exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']
|
88
|
+
ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|
|
89
|
+
exts.each { |ext|
|
90
|
+
exe = "#{path}/#{cmd}#{ext}"
|
91
|
+
return exe if File.executable? exe
|
92
|
+
}
|
93
|
+
end
|
94
|
+
return nil
|
95
|
+
end
|
71
96
|
end
|
72
97
|
end
|
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.0
|
4
|
+
version: 1.2.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:
|
12
|
+
date: 2013-01-18 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: minitest
|
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
|
description: Mo helps you keep your rails project clean.
|
31
47
|
email: jboyer@af83.com
|
32
48
|
executables:
|