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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4b8d1335452e9e1c70cea059ebac5b1743adf73d
4
- data.tar.gz: 0884aebdc5d2be2953a3b17a9f0b7fc433868bab
3
+ metadata.gz: b2a0ccfa3a80cd356498b5a90abc45d2f799e36c
4
+ data.tar.gz: 343fb0c27e72cd670943ba0a8050efe92d3ccaf0
5
5
  SHA512:
6
- metadata.gz: c7868a1d609c16a0bc51cfa1eaa8e9b4cf16fa2f5fcae8d27df78535a940644a0bc16cd3be0858989b051e7cfbfd75f417d5ee8fbd19f08853be611c24b2def5
7
- data.tar.gz: 5b034f814a152e651aea2a06ed9db2401476612b803ec61e34eaac6fa2597d993770e33c24dc5949dc0825473d2a8f59af3356447da2c994085efa97b0bb51de
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 *.runfiles path-wide
56
+ # Find all *.runfile files in in our search difrectories
57
57
  def find_runfiles
58
- find_all_in_path '*.runfile'
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 < 5 and say "\nTip: Type '!txtblu!run make!txtrst!' or '!txtblu!run make name!txtrst!' to create a runfile.\n Place !txtblu!named.runfiles!txtrst! anywhere in the PATH for global access."
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
@@ -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: #command
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
- # Find a single file in any of the path directories
10
- def find_in_path(file)
11
- ENV['PATH'].split(File::PATH_SEPARATOR).any? do |d|
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
@@ -1,3 +1,3 @@
1
1
  module Runfile
2
- VERSION = "0.3.1"
2
+ VERSION = "0.3.2"
3
3
  end
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.1
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-05-30 00:00:00.000000000 Z
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