runfile 0.6.0 → 0.6.1
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/README.md +11 -10
- data/lib/runfile.rb +1 -0
- data/lib/runfile/runfile_helper.rb +35 -13
- data/lib/runfile/runner.rb +3 -2
- data/lib/runfile/settings.rb +27 -0
- data/lib/runfile/version.rb +1 -1
- metadata +19 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c3a9ac4d26448820b0d60e8cc43d02256de42d82
|
4
|
+
data.tar.gz: 5363a4b2a3f513693178f1f2d21b8a93f4946ca2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1a6cc42619f4b37c8e73df76af4dd81164e1718a37f93d3049cf4ba420aa828946bc139a5a3544e090659e48afe3cda804c1ff701555aa3ff03d3b698e6f7581
|
7
|
+
data.tar.gz: eced22d6cb4bc351e0f9cf121db680a7c30b7ed90f23e12502cd71e4bfeca247641fc0425de979409b61cf2568de72eab3d4969daf0948a04547ffb1af6fa4df
|
data/README.md
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
Runfile - If Rake and Docopt had a baby
|
2
|
-
|
2
|
+
==================================================
|
3
3
|
|
4
4
|
[](http://badge.fury.io/rb/runfile)
|
5
5
|
[](https://travis-ci.org/DannyBen/runfile)
|
@@ -25,21 +25,22 @@ You create a `Runfile`, and execute commands with
|
|
25
25
|
|
26
26
|
---
|
27
27
|
|
28
|
-
|
28
|
+
Install
|
29
|
+
--------------------------------------------------
|
29
30
|
|
30
31
|
$ gem install runfile
|
31
32
|
|
32
33
|
|
33
|
-
|
34
|
-
|
34
|
+
Quick Start
|
35
|
+
--------------------------------------------------
|
35
36
|
|
36
37
|
$ run make # create a new Runfile
|
37
38
|
$ run --help # show the usage patterns
|
38
39
|
$ vi Runfile # edit the Runfile
|
39
40
|
|
40
41
|
|
41
|
-
|
42
|
-
|
42
|
+
Example
|
43
|
+
--------------------------------------------------
|
43
44
|
|
44
45
|
The most minimal `Runfile` looks like this:
|
45
46
|
|
@@ -85,8 +86,8 @@ Options:
|
|
85
86
|
```
|
86
87
|
|
87
88
|
|
88
|
-
|
89
|
-
|
89
|
+
Runfile per project or global Runfiles
|
90
|
+
--------------------------------------------------
|
90
91
|
|
91
92
|
In addition to the per project `Runfile` files, it is also possible to
|
92
93
|
create global runfiles that are accessible to you only or to anybody on
|
@@ -105,8 +106,8 @@ for global (named) runfiles.
|
|
105
106
|
Read more in the [Runfile Location and Filename wiki page](https://github.com/DannyBen/runfile/wiki/Runfile-Location-and-Filename)
|
106
107
|
|
107
108
|
|
108
|
-
|
109
|
-
|
109
|
+
Documentation
|
110
|
+
--------------------------------------------------
|
110
111
|
|
111
112
|
- [Learn by Example](https://github.com/DannyBen/runfile/tree/master/examples)
|
112
113
|
- [Runfile Command Reference](https://github.com/DannyBen/runfile/wiki/Runfile-Command-Reference)
|
data/lib/runfile.rb
CHANGED
@@ -31,11 +31,16 @@ module Runfile
|
|
31
31
|
runfile and return runfile
|
32
32
|
end
|
33
33
|
|
34
|
-
# if we are here, offer some help and advice
|
35
|
-
|
34
|
+
# if we are here, offer some help and advice and show a list
|
35
|
+
# of possible runfiles to run.
|
36
|
+
show_make_help runfiles, settings.folder
|
36
37
|
return false
|
37
38
|
end
|
38
39
|
|
40
|
+
def purge_settings
|
41
|
+
@settings = OpenStruct.new
|
42
|
+
end
|
43
|
+
|
39
44
|
private
|
40
45
|
|
41
46
|
# Create a new runfile in the current directory. We can either
|
@@ -53,7 +58,7 @@ module Runfile
|
|
53
58
|
end
|
54
59
|
end
|
55
60
|
|
56
|
-
# Find all *.runfile files in
|
61
|
+
# Find all *.runfile files in our search difrectories
|
57
62
|
def find_runfiles
|
58
63
|
result = []
|
59
64
|
dirs = runfile_folders
|
@@ -65,14 +70,16 @@ module Runfile
|
|
65
70
|
end
|
66
71
|
|
67
72
|
# Show some helpful tips, and a list of available runfiles
|
68
|
-
def show_make_help(runfiles)
|
69
|
-
say "!txtpur!Runfile engine v#{Runfile::VERSION}"
|
70
|
-
runfiles.size < 3 and
|
73
|
+
def show_make_help(runfiles, compact=false)
|
74
|
+
say "!txtpur!Runfile engine v#{Runfile::VERSION}" unless compact
|
75
|
+
if runfiles.size < 3 and !compact
|
76
|
+
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/."
|
77
|
+
end
|
71
78
|
if runfiles.empty?
|
72
79
|
say "\n!txtred!Runfile not found."
|
73
80
|
else
|
74
81
|
say ""
|
75
|
-
say_runfile_list runfiles
|
82
|
+
say_runfile_list runfiles, compact
|
76
83
|
end
|
77
84
|
end
|
78
85
|
|
@@ -81,7 +88,14 @@ module Runfile
|
|
81
88
|
# This trick allows searching in subfolders recursively, including
|
82
89
|
# one level of symlinked folder
|
83
90
|
subdirs = '**{,/*/**}'
|
84
|
-
|
91
|
+
|
92
|
+
# If there is a '.runfile' settings file with a folder definition
|
93
|
+
# in it, use it. Otherwise, search globally.
|
94
|
+
if settings.folder
|
95
|
+
["#{settings.folder}/#{subdirs}"]
|
96
|
+
else
|
97
|
+
[Dir.pwd, "#{Dir.home}/runfile/#{subdirs}", "/etc/runfile/#{subdirs}"]
|
98
|
+
end
|
85
99
|
end
|
86
100
|
|
87
101
|
# [UNUSED] Same as runfile_folders, but including PATH
|
@@ -92,19 +106,27 @@ module Runfile
|
|
92
106
|
end
|
93
107
|
|
94
108
|
# Output the list of available runfiles
|
95
|
-
def say_runfile_list(runfiles)
|
109
|
+
def say_runfile_list(runfiles, compact=false)
|
96
110
|
runfile_paths = runfiles.map { |f| File.dirname f }
|
97
111
|
max = runfile_paths.max_by(&:length).size
|
98
112
|
width, height = detect_terminal_size
|
99
113
|
runfiles.each do |f|
|
100
114
|
f[/([^\/]+).runfile$/]
|
101
115
|
command = "run #{$1}"
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
116
|
+
if compact
|
117
|
+
say " !txtgrn!#{command}!txtrst!"
|
118
|
+
else
|
119
|
+
spacer_size = width - max - command.size - 6
|
120
|
+
spacer_size = [1, spacer_size].max
|
121
|
+
spacer = '.' * spacer_size
|
122
|
+
say " !txtgrn!#{command}!txtrst! #{spacer} #{File.dirname f}"
|
123
|
+
end
|
106
124
|
end
|
107
125
|
end
|
108
126
|
|
127
|
+
def settings
|
128
|
+
@settings ||= Settings.new.as_struct
|
129
|
+
end
|
130
|
+
|
109
131
|
end
|
110
132
|
end
|
data/lib/runfile/runner.rb
CHANGED
@@ -30,12 +30,12 @@ module Runfile
|
|
30
30
|
|
31
31
|
# Return a singleton Runner instance.
|
32
32
|
def self.instance
|
33
|
-
@@instance
|
34
|
-
@@instance
|
33
|
+
@@instance ||= self.new
|
35
34
|
end
|
36
35
|
|
37
36
|
# Load and execute a Runfile call.
|
38
37
|
def execute(argv, filename='Runfile')
|
38
|
+
@ignore_settings = !filename
|
39
39
|
filename and File.file?(filename) or handle_no_runfile argv
|
40
40
|
begin
|
41
41
|
load filename
|
@@ -141,6 +141,7 @@ module Runfile
|
|
141
141
|
# on our part, or the name of a runfile to execute.
|
142
142
|
def handle_no_runfile(argv)
|
143
143
|
maker = RunfileHelper.new
|
144
|
+
maker.purge_settings if @ignore_settings
|
144
145
|
runfile = maker.handle argv
|
145
146
|
if runfile
|
146
147
|
@superspace = argv[0]
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'ostruct'
|
2
|
+
require 'yaml'
|
3
|
+
|
4
|
+
module Runfile
|
5
|
+
|
6
|
+
# The Settings class handles '.runfile' YAML config files.
|
7
|
+
# If found in the current directory, we will use their content.
|
8
|
+
class Settings
|
9
|
+
def initialize
|
10
|
+
end
|
11
|
+
|
12
|
+
def as_struct
|
13
|
+
OpenStruct.new settings
|
14
|
+
end
|
15
|
+
|
16
|
+
private
|
17
|
+
|
18
|
+
def settings
|
19
|
+
@settings ||= settings!
|
20
|
+
end
|
21
|
+
|
22
|
+
def settings!
|
23
|
+
File.file?('.runfile') ? YAML.load_file('.runfile') : {}
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
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.6.
|
4
|
+
version: 0.6.1
|
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: 2016-
|
11
|
+
date: 2016-04-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: colsole
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '0.
|
19
|
+
version: '0.3'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '0.
|
26
|
+
version: '0.3'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: docopt
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -94,6 +94,20 @@ dependencies:
|
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '4.2'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: similar_text
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: 0.0.4
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: 0.0.4
|
97
111
|
description: Build command line applications per project with ease. Rake-inspired,
|
98
112
|
Docopt inside.
|
99
113
|
email: db@dannyben.com
|
@@ -113,6 +127,7 @@ files:
|
|
113
127
|
- lib/runfile/extensions/exec.rb
|
114
128
|
- lib/runfile/runfile_helper.rb
|
115
129
|
- lib/runfile/runner.rb
|
130
|
+
- lib/runfile/settings.rb
|
116
131
|
- lib/runfile/templates/Runfile
|
117
132
|
- lib/runfile/util.rb
|
118
133
|
- lib/runfile/version.rb
|