mire 0.1.1 → 0.1.2
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.
- checksums.yaml +4 -4
- data/.travis.yml +11 -0
- data/CHANGELOG.md +6 -0
- data/README.md +5 -0
- data/lib/mire.rb +1 -1
- data/lib/mire/cli.rb +53 -27
- data/lib/mire/version.rb +1 -1
- data/mire.gemspec +0 -1
- metadata +3 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1603bd748f593fd4a5423f5461f266cf09d04a0f
|
4
|
+
data.tar.gz: 781777b904e415c5fd27a5be2c26db943cdaa776
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 969308cbf177d9a4d7c6ad4b6600a39610025048a4c4ac4f5085428863f1fd7c5dd27aab40e18831654f02318b4514a0e0d9dcd0b59445cda1f2e0d5f63dce59
|
7
|
+
data.tar.gz: f4f47838e4382c4aaee2d91529f37c285ff6d534074600dc4ac35cc4be22d91c68c74b951babfc0da57923555f65fc4269676b686808015a2483e6950933cde7
|
data/.travis.yml
ADDED
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,12 @@
|
|
2
2
|
|
3
3
|
## master (unreleased)
|
4
4
|
|
5
|
+
## 0.1.2
|
6
|
+
|
7
|
+
* Add travis configuration and build status image
|
8
|
+
* Remove slop to solve dependency problem
|
9
|
+
* Add version (-v, --version) cli option
|
10
|
+
|
5
11
|
## 0.1.1
|
6
12
|
|
7
13
|
* Add configuration option to exclude files / folders from analyzing
|
data/README.md
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
[](https://travis-ci.org/xing/mire)
|
3
|
+
[](https://codeclimate.com/github/xing/mire)
|
5
|
+
|
1
6
|
# mire [ˈmɪʀɛ]
|
2
7
|
|
3
8
|
mire analyzes a Ruby project and helps you to find dependencies, call
|
data/lib/mire.rb
CHANGED
data/lib/mire/cli.rb
CHANGED
@@ -2,37 +2,55 @@ module Mire
|
|
2
2
|
# Command line interface for mire
|
3
3
|
class CLI
|
4
4
|
class << self
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
exit
|
18
|
-
end
|
19
|
-
opts.on('-u', '--unused', 'Check for unused methods') do
|
20
|
-
unused
|
21
|
-
exit
|
22
|
-
end
|
23
|
-
opts.on('-i', '--initialize', 'Create initial configuration file') do
|
24
|
-
init
|
25
|
-
exit
|
26
|
-
end
|
27
|
-
end
|
5
|
+
METHODS = [
|
6
|
+
[:analyze, 'Analyze ruby project'],
|
7
|
+
[:check, 'Check term and find usages', arguments: [:term]],
|
8
|
+
[:unused, 'Check for unused methods'],
|
9
|
+
[:init, 'Create initial configuration file'],
|
10
|
+
[:help, 'Show this help'],
|
11
|
+
[:version, 'Prints out version']
|
12
|
+
]
|
13
|
+
|
14
|
+
def parse
|
15
|
+
return help unless ARGV[0]
|
16
|
+
fail UnknownCommand if unknown_command?
|
28
17
|
|
29
|
-
|
30
|
-
|
31
|
-
|
18
|
+
METHODS.each do |command, _description, _config|
|
19
|
+
next unless options(command).include?(ARGV[0])
|
20
|
+
arguments = ARGV
|
21
|
+
arguments.shift
|
22
|
+
send(command, *arguments)
|
23
|
+
end
|
24
|
+
rescue UnknownCommand
|
25
|
+
puts "Unknown command Argument.\n\n"
|
26
|
+
help
|
27
|
+
rescue MissingArgument
|
28
|
+
puts "Missing Argument.\n\n"
|
29
|
+
help
|
32
30
|
end
|
33
31
|
|
34
32
|
private
|
35
33
|
|
34
|
+
def unknown_command?
|
35
|
+
METHODS.none? { |command, _, _| options(command).include?(ARGV[0]) }
|
36
|
+
end
|
37
|
+
|
38
|
+
def help
|
39
|
+
puts "Usage:\n mire [option]\n\n"
|
40
|
+
puts 'Options:'
|
41
|
+
|
42
|
+
METHODS.each do |command, description, config|
|
43
|
+
config ||= {}
|
44
|
+
arguments = config[:arguments] || []
|
45
|
+
opts = "#{options(command).join(', ')} #{arguments.join(' ').upcase}"
|
46
|
+
puts " #{opts}#{' ' * (25 - opts.length)}#{description}"
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
def version
|
51
|
+
puts Mire::VERSION
|
52
|
+
end
|
53
|
+
|
36
54
|
def init
|
37
55
|
Mire::Configuration.copy_example
|
38
56
|
puts "Configuration file #{Mire::Configuration::FILE} created"
|
@@ -47,7 +65,8 @@ module Mire
|
|
47
65
|
analyzer.save
|
48
66
|
end
|
49
67
|
|
50
|
-
def check(f)
|
68
|
+
def check(f = nil)
|
69
|
+
fail MissingArgument unless f
|
51
70
|
puts "Checking term #{f}"
|
52
71
|
occurrence = Output::Occurrence.new
|
53
72
|
puts occurrence.check(f)
|
@@ -58,6 +77,13 @@ module Mire
|
|
58
77
|
occurrence = Output::Unused.new
|
59
78
|
puts occurrence.check
|
60
79
|
end
|
80
|
+
|
81
|
+
def options(command)
|
82
|
+
["-#{command[0]}", "--#{command}"]
|
83
|
+
end
|
61
84
|
end
|
85
|
+
|
86
|
+
class MissingArgument < Exception; end
|
87
|
+
class UnknownCommand < Exception; end
|
62
88
|
end
|
63
89
|
end
|
data/lib/mire/version.rb
CHANGED
data/mire.gemspec
CHANGED
@@ -22,7 +22,6 @@ Gem::Specification.new do |spec|
|
|
22
22
|
spec.require_paths = ['lib']
|
23
23
|
|
24
24
|
spec.add_runtime_dependency 'parser'
|
25
|
-
spec.add_runtime_dependency 'slop', '~> 4.0'
|
26
25
|
spec.add_runtime_dependency 'ruby-progressbar'
|
27
26
|
spec.add_runtime_dependency 'haml-lint'
|
28
27
|
spec.add_development_dependency 'bundler', '~> 1.7'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mire
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nils Gemeinhardt
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-06-
|
12
|
+
date: 2015-06-10 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: parser
|
@@ -25,20 +25,6 @@ dependencies:
|
|
25
25
|
- - ">="
|
26
26
|
- !ruby/object:Gem::Version
|
27
27
|
version: '0'
|
28
|
-
- !ruby/object:Gem::Dependency
|
29
|
-
name: slop
|
30
|
-
requirement: !ruby/object:Gem::Requirement
|
31
|
-
requirements:
|
32
|
-
- - "~>"
|
33
|
-
- !ruby/object:Gem::Version
|
34
|
-
version: '4.0'
|
35
|
-
type: :runtime
|
36
|
-
prerelease: false
|
37
|
-
version_requirements: !ruby/object:Gem::Requirement
|
38
|
-
requirements:
|
39
|
-
- - "~>"
|
40
|
-
- !ruby/object:Gem::Version
|
41
|
-
version: '4.0'
|
42
28
|
- !ruby/object:Gem::Dependency
|
43
29
|
name: ruby-progressbar
|
44
30
|
requirement: !ruby/object:Gem::Requirement
|
@@ -165,6 +151,7 @@ files:
|
|
165
151
|
- ".gitignore"
|
166
152
|
- ".rubocop.yml"
|
167
153
|
- ".rubocop_todo.yml"
|
154
|
+
- ".travis.yml"
|
168
155
|
- CHANGELOG.md
|
169
156
|
- Gemfile
|
170
157
|
- LICENSE.txt
|