runfile 0.4.1 → 0.5.0

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: 1e111538a4979749e713b04fb8923319832a1476
4
- data.tar.gz: babe075877cfb3303216c5fa0b28a57610a421b4
3
+ metadata.gz: 0980ca227f78853f3dcf034253d57a0ac61f5cc0
4
+ data.tar.gz: c5548ead96c34f0dbcfa59a48d64153463b5b75e
5
5
  SHA512:
6
- metadata.gz: 61066ce548063ca59745775f689da55dc4e621e0966eb137981d0296e49e47e59625b24cfc84b2d4972303f2e69d8669979836178730544b06a1304cc0b15431
7
- data.tar.gz: 5b833eb34b1bbe3efd9c49c15ff83ef854f70fad6ed315a104d4e810f092bcffc362706b190dc14c898c46993482fdba566cf829dbe676e977d0a161d1a7b558
6
+ metadata.gz: 1a960d00b7663752bb7e6f7264323c2d5e654fac533f391dc54c1dcced5e1aa9e171e7cd55f199855fe908e64660b2680d5aa63c646aeffd2c252ae2c119d223
7
+ data.tar.gz: 367511ebf703bb821a5acec2742e8371d0459e0f7adbb4998871cf40044792aa5646be49b06993ab82588aa060c3d42c7ebcde59e97d57a4bec56198a09ca5fe
@@ -29,7 +29,8 @@ module Runfile
29
29
  # and options we have collected from the Runfile DSL.
30
30
  def docopt
31
31
  width, height = detect_terminal_size
32
- doc = ["#{@name} #{@version}"]
32
+ doc = []
33
+ doc << (@version ? "#{@name} #{@version}" : "#{@name}")
33
34
  doc << "#{@summary}" if @summary
34
35
  doc += docopt_usage
35
36
  doc += docopt_commands width
@@ -43,10 +44,11 @@ module Runfile
43
44
  @actions.each do |name, action|
44
45
  doc << " run #{action.usage}" unless action.usage == false
45
46
  end
47
+ basic_flags = @version ? "(-h|--help|--version)" : "(-h|--help)"
46
48
  if @superspace
47
- doc << " run #{@superspace} (-h|--help|--version)\n"
49
+ doc << " run #{@superspace} #{basic_flags}\n"
48
50
  else
49
- doc << " run (-h|--help|--version)\n"
51
+ doc << " run #{basic_flags}\n"
50
52
  end
51
53
  doc
52
54
  end
@@ -70,7 +72,7 @@ module Runfile
70
72
  def docopt_options(width)
71
73
  @options['Options'] = {} unless @options['Options']
72
74
  @options['Options']['-h --help'] = 'Show this screen'
73
- @options['Options']['--version'] = 'Show version number'
75
+ @options['Options']['--version'] = 'Show version number' if @version
74
76
 
75
77
  doc = []
76
78
  @options.each do |scope, values|
@@ -58,7 +58,7 @@ module Runfile
58
58
  result = []
59
59
  dirs = runfile_folders
60
60
  dirs.each do |d|
61
- found = Dir[File.join(d, '**/*.runfile')]
61
+ found = Dir[File.join(d, '*.runfile')]
62
62
  result << found unless found.empty?
63
63
  end
64
64
  return result.empty? ? false : result.flatten.uniq
@@ -76,9 +76,12 @@ module Runfile
76
76
  end
77
77
  end
78
78
 
79
- # Return array of folders we should search for runfiles
79
+ # Return array of folders we should search in for runfiles.
80
80
  def runfile_folders
81
- [Dir.pwd, "#{Dir.home}/runfile", "/etc/runfile"]
81
+ # This trick allows searching in subfolders recursively, including
82
+ # one level of symlinked folder
83
+ subdirs = '**{,/*/**}'
84
+ [Dir.pwd, "#{Dir.home}/runfile/#{subdirs}", "/etc/runfile/#{subdirs}"]
82
85
  end
83
86
 
84
87
  # [UNUSED] Same as runfile_folders, but including PATH
@@ -23,7 +23,7 @@ module Runfile
23
23
  @actions = {} # dsl: action
24
24
  @options = {} # dsl: option
25
25
  @name = "Runfile" # dsl: name
26
- @version = "0.0.0" # dsl: version
26
+ @version = false # dsl: version
27
27
  @summary = false # dsl: summary
28
28
  end
29
29
 
@@ -1,3 +1,3 @@
1
1
  module Runfile
2
- VERSION = "0.4.1"
2
+ VERSION = "0.5.0"
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.4.1
4
+ version: 0.5.0
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-10-30 00:00:00.000000000 Z
11
+ date: 2015-11-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: colsole