runfile 0.3.1 → 0.3.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 +1 -0
- data/lib/runfile/runfile_helper.rb +17 -3
- data/lib/runfile/runner.rb +1 -1
- data/lib/runfile/util.rb +3 -20
- data/lib/runfile/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b2a0ccfa3a80cd356498b5a90abc45d2f799e36c
|
4
|
+
data.tar.gz: 343fb0c27e72cd670943ba0a8050efe92d3ccaf0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e172263529326fc9fd885faea650cacb0cbd08ffa35fe3222f9ffae3f42f73cd3fa642cbe74ad911ef0fad91286113f3aa04758b625744706aa0d04316bb9e69
|
7
|
+
data.tar.gz: bb064103aefc63311412ed55344c75183c8727d08304916013830a5840e252d8914588880aa7e9680cbb37023a9a53732ee576f999459724e83057f6339b4bc6
|
data/README.md
CHANGED
@@ -2,6 +2,7 @@ Runfile - If Rake and Docopt had a baby
|
|
2
2
|
=======================================
|
3
3
|
|
4
4
|
[![Gem Version](https://badge.fury.io/rb/runfile.svg)](http://badge.fury.io/rb/runfile)
|
5
|
+
[![Build Status](https://travis-ci.org/DannyBen/runfile.svg?branch=master)](https://travis-ci.org/DannyBen/runfile)
|
5
6
|
|
6
7
|
A beautiful command line application framework.
|
7
8
|
Rake-inspired, Docopt inside.
|
@@ -53,15 +53,21 @@ module Runfile
|
|
53
53
|
end
|
54
54
|
end
|
55
55
|
|
56
|
-
# Find all *.
|
56
|
+
# Find all *.runfile files in in our search difrectories
|
57
57
|
def find_runfiles
|
58
|
-
|
58
|
+
result = []
|
59
|
+
dirs = runfile_folders
|
60
|
+
dirs.each do |d|
|
61
|
+
found = Dir[File.join(d, '*.runfile')]
|
62
|
+
result << found unless found.empty?
|
63
|
+
end
|
64
|
+
return result.empty? ? false : result.flatten.uniq
|
59
65
|
end
|
60
66
|
|
61
67
|
# Show some helpful tips, and a list of available runfiles
|
62
68
|
def show_make_help(runfiles)
|
63
69
|
say "!txtpur!Runfile engine v#{Runfile::VERSION}"
|
64
|
-
runfiles.size <
|
70
|
+
runfiles.size < 3 and say "\nTip: Type '!txtblu!run make!txtrst!' or '!txtblu!run make name!txtrst!' to create a runfile.\nFor global access, place !txtblu!named.runfiles!txtrst! in ~/runfile/ or in /etc/runfile/ or anywhere in the PATH."
|
65
71
|
if runfiles.empty?
|
66
72
|
say "\n!txtred!Runfile not found."
|
67
73
|
else
|
@@ -78,5 +84,13 @@ module Runfile
|
|
78
84
|
end
|
79
85
|
end
|
80
86
|
end
|
87
|
+
|
88
|
+
# Return array of folders we should search for runfiles
|
89
|
+
def runfile_folders
|
90
|
+
dirs = path_dirs
|
91
|
+
dirs.insert 0, Dir.pwd, "#{Dir.home}/runfile", "/etc/runfile"
|
92
|
+
dirs
|
93
|
+
end
|
94
|
+
|
81
95
|
end
|
82
96
|
end
|
data/lib/runfile/runner.rb
CHANGED
@@ -19,7 +19,7 @@ module Runfile
|
|
19
19
|
@superspace = nil # used when filename != Runfile
|
20
20
|
@last_usage = nil # dsl: usage
|
21
21
|
@last_help = nil # dsl: help
|
22
|
-
@namespace = nil # dsl:
|
22
|
+
@namespace = nil # dsl: command
|
23
23
|
@actions = {} # dsl: action
|
24
24
|
@options = {} # dsl: option
|
25
25
|
@name = "Runfile" # dsl: name
|
data/lib/runfile/util.rb
CHANGED
@@ -1,29 +1,12 @@
|
|
1
1
|
module Runfile
|
2
|
-
|
3
2
|
# Debug print and exit
|
4
3
|
def d(obj)
|
5
4
|
p obj
|
6
5
|
exit
|
7
6
|
end
|
8
7
|
|
9
|
-
#
|
10
|
-
def
|
11
|
-
ENV['PATH'].split(File::PATH_SEPARATOR)
|
12
|
-
candidate = File.join(d, file)
|
13
|
-
return candidate if File.exist? candidate
|
14
|
-
end
|
15
|
-
false
|
16
|
-
end
|
17
|
-
|
18
|
-
# Find all files matching a pattern in any of the path directories
|
19
|
-
def find_all_in_path(pattern, include_cwd=true)
|
20
|
-
result = []
|
21
|
-
dirs = ENV['PATH'].split(File::PATH_SEPARATOR)
|
22
|
-
dirs.insert(0, Dir.pwd) if include_cwd
|
23
|
-
dirs.each do |d|
|
24
|
-
found = Dir[File.join(d, pattern)]
|
25
|
-
result << found unless found.empty?
|
26
|
-
end
|
27
|
-
return result.empty? ? false : result.flatten.uniq
|
8
|
+
# Return an array of path directories
|
9
|
+
def path_dirs
|
10
|
+
ENV['PATH'].split(File::PATH_SEPARATOR)
|
28
11
|
end
|
29
12
|
end
|
data/lib/runfile/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: runfile
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Danny Ben Shitrit
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-06-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: colsole
|
@@ -58,14 +58,14 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
61
|
+
version: '0.2'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '0'
|
68
|
+
version: '0.2'
|
69
69
|
description: A beautiful command line application framework. Rake-inspired, Docopt
|
70
70
|
inside.
|
71
71
|
email: db@dannyben.com
|