mister_bin 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +8 -3
- data/lib/mister_bin/commands.rb +5 -1
- data/lib/mister_bin/path_helper.rb +29 -0
- data/lib/mister_bin/version.rb +1 -1
- data/lib/mister_bin.rb +3 -3
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e87b4752236683e3e699872c4d324ab6d715234789459211b12cbd5238192a13
|
4
|
+
data.tar.gz: 58588e6731278f5e1c8f9802f2186eec49333d54836992782437be643a07829e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f212bb72a9f67c744250135248f4bd2890142e8c11fde10c9fc9d1dbf25400cfdfa3e016e8ba89446ccea2053e089444d06b95d369d3c11f2ed6f0b557ef6ebd
|
7
|
+
data.tar.gz: aa0f21c1fe5cbfba66b9bf1042073eadfe12fd7ce5ef8f47620f63a287c314d8a47891fdb2a611f7daf68ee37889565fbbb0aa4b37a417741f409270f293d975
|
data/README.md
CHANGED
@@ -22,8 +22,13 @@ Design Goals
|
|
22
22
|
--------------------------------------------------
|
23
23
|
|
24
24
|
- Provide an easy and minimalistic DSL for building command line utilities.
|
25
|
-
-
|
25
|
+
- Drastically reduce the need for boilerplate code and unnecessary wrappers
|
26
|
+
involved in building command line utilities.
|
27
|
+
- Provide a mechanism for separating each command and subcommand to its
|
28
|
+
own file.
|
26
29
|
- Support the ability to extend a given command from different sources.
|
30
|
+
- Allow gem developers to easily add command line interface to their gems.
|
31
|
+
- Allow for easy and straight forward testing of the generated CLI.
|
27
32
|
|
28
33
|
|
29
34
|
|
@@ -90,8 +95,8 @@ You will need to create these files:
|
|
90
95
|
3. `git-repo-create.rb`
|
91
96
|
4. `git-repo-delete.rb`
|
92
97
|
|
93
|
-
Alternatively, if you prefer to handle all `repo` subcommands in a single
|
94
|
-
file,
|
98
|
+
Alternatively, if you prefer to handle all `repo` subcommands in a single
|
99
|
+
file, simply implement these instead:
|
95
100
|
|
96
101
|
1. `git`
|
97
102
|
2. `git-status.rb`
|
data/lib/mister_bin/commands.rb
CHANGED
@@ -41,7 +41,11 @@ module MisterBin
|
|
41
41
|
end
|
42
42
|
|
43
43
|
def files
|
44
|
-
@files ||=
|
44
|
+
@files ||= path_helper.search("#{basename}-*.rb")
|
45
|
+
end
|
46
|
+
|
47
|
+
def path_helper
|
48
|
+
@path_helper ||= PathHelper.new(additional_dir: basedir)
|
45
49
|
end
|
46
50
|
end
|
47
51
|
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module MisterBin
|
2
|
+
|
3
|
+
class PathHelper
|
4
|
+
attr_reader :pathspec, :additional_dir
|
5
|
+
|
6
|
+
def initialize(additional_dir: nil, pathspec: nil)
|
7
|
+
@additional_dir = additional_dir
|
8
|
+
@pathspec = pathspec || ENV['PATH']
|
9
|
+
end
|
10
|
+
|
11
|
+
def search(glob)
|
12
|
+
result = []
|
13
|
+
paths.each { |path| result += Dir["#{path}/#{glob}"] }
|
14
|
+
result
|
15
|
+
end
|
16
|
+
|
17
|
+
def paths
|
18
|
+
@paths ||= paths!
|
19
|
+
end
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
def paths!
|
24
|
+
result = pathspec.split File::PATH_SEPARATOR
|
25
|
+
result.push additional_dir if additional_dir
|
26
|
+
result
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
data/lib/mister_bin/version.rb
CHANGED
data/lib/mister_bin.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
require 'mister_bin/commands'
|
2
1
|
require 'mister_bin/command'
|
2
|
+
require 'mister_bin/commands'
|
3
|
+
require 'mister_bin/docopt_maker'
|
4
|
+
require 'mister_bin/path_helper'
|
3
5
|
require 'mister_bin/runner'
|
4
|
-
|
5
6
|
require 'mister_bin/script'
|
6
|
-
require 'mister_bin/docopt_maker'
|
7
7
|
|
8
8
|
require 'byebug' if ENV['BYEBUG']
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mister_bin
|
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
|
- Danny Ben Shitrit
|
@@ -175,6 +175,7 @@ files:
|
|
175
175
|
- lib/mister_bin/command.rb
|
176
176
|
- lib/mister_bin/commands.rb
|
177
177
|
- lib/mister_bin/docopt_maker.rb
|
178
|
+
- lib/mister_bin/path_helper.rb
|
178
179
|
- lib/mister_bin/runner.rb
|
179
180
|
- lib/mister_bin/script.rb
|
180
181
|
- lib/mister_bin/version.rb
|