yay 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/yay/application.rb +1 -0
- data/lib/yay/errors.rb +18 -4
- data/lib/yay/lexer.rb +11 -5
- data/lib/yay/lexer_regex.rb +1 -1
- data/lib/yay/loader.rb +29 -18
- data/lib/yay/parser.rb +44 -6
- data/lib/yay/parser_gen.rb +57 -54
- data/lib/yay/paths.rb +38 -0
- data/lib/yay/version.rb +2 -2
- metadata +6 -5
data/lib/yay/application.rb
CHANGED
data/lib/yay/errors.rb
CHANGED
@@ -11,9 +11,9 @@ class Yay
|
|
11
11
|
array = @position
|
12
12
|
return "" unless @position
|
13
13
|
length = array.length
|
14
|
-
return "
|
15
|
-
return " on line #{array[1]}, word #{array[0]}" if
|
16
|
-
return "
|
14
|
+
return " in file #{array[2]}, line #{array[1]}, word #{array[0]}" if array[2]
|
15
|
+
return " on line #{array[1]}, word #{array[0]}" if array[1]
|
16
|
+
return " at word #{array[0]}" if array[0]
|
17
17
|
raise "junk position given to exception"
|
18
18
|
end
|
19
19
|
end
|
@@ -30,6 +30,20 @@ class Yay
|
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
33
|
+
class NotAllowedError < Error
|
34
|
+
attr :action
|
35
|
+
attr :path
|
36
|
+
|
37
|
+
def initialize action, path
|
38
|
+
@action = action
|
39
|
+
@path = path
|
40
|
+
end
|
41
|
+
|
42
|
+
def printable_message
|
43
|
+
return "You can't #{action} from here"
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
33
47
|
class CircularReferenceError < Error
|
34
48
|
attr :current
|
35
49
|
attr :path
|
@@ -66,7 +80,7 @@ class Yay
|
|
66
80
|
end
|
67
81
|
|
68
82
|
def printable_message
|
69
|
-
return "Failed to load file \"#{filename}\"#{printable_position}\nPlaced looked
|
83
|
+
return "Failed to load file \"#{filename}\"#{printable_position}\nPlaced looked:\n #{tried.join("\n ")}"
|
70
84
|
end
|
71
85
|
end
|
72
86
|
|
data/lib/yay/lexer.rb
CHANGED
@@ -3,16 +3,22 @@ require 'yay/lexer_regex'
|
|
3
3
|
|
4
4
|
class Yay
|
5
5
|
class Lexer
|
6
|
+
attr :context_name
|
6
7
|
|
7
|
-
def initialize(string="")
|
8
|
-
@position
|
9
|
-
@line
|
8
|
+
def initialize(string="", context_name=nil)
|
9
|
+
@position = 0
|
10
|
+
@line = 1
|
11
|
+
@context_name = context_name
|
10
12
|
|
11
13
|
# default to an empty string scanner. this provides us an endless number
|
12
14
|
# of eofs
|
13
15
|
use_string(string)
|
14
16
|
end
|
15
|
-
|
17
|
+
|
18
|
+
def context_name= value
|
19
|
+
@context_name = value
|
20
|
+
end
|
21
|
+
|
16
22
|
# take a string and begin scanning it
|
17
23
|
def use_string(string)
|
18
24
|
@scanner = StringScanner.new string
|
@@ -57,4 +63,4 @@ class Yay
|
|
57
63
|
return [type, value]
|
58
64
|
end
|
59
65
|
end
|
60
|
-
end
|
66
|
+
end
|
data/lib/yay/lexer_regex.rb
CHANGED
@@ -18,7 +18,7 @@ class Yay
|
|
18
18
|
# keywords
|
19
19
|
[:line , /\bline[s]?\b/i],
|
20
20
|
[:install , /\binstall\b/i],
|
21
|
-
[:
|
21
|
+
[:list_installed , /\b(list|installed)\b/i],
|
22
22
|
[:include , /\b(include|use|load)\b/i],
|
23
23
|
[:and , /(\b(and|but)\b)|,/i],
|
24
24
|
[:verb , /\b(is|are|a|an)\b/],
|
data/lib/yay/loader.rb
CHANGED
@@ -1,41 +1,52 @@
|
|
1
|
+
require 'yay/paths'
|
1
2
|
|
2
3
|
class Yay
|
3
4
|
class Loader
|
4
5
|
def initialize filename
|
5
6
|
@filename = filename
|
6
7
|
end
|
8
|
+
|
9
|
+
def self.default_file_loader
|
10
|
+
return Yay::Loader.new Yay::Paths::DEFAULT_YAYFILE
|
11
|
+
end
|
7
12
|
|
8
13
|
# invoking a new parser and process a string of yay commands
|
9
14
|
# any variables inside the parser context will not affect our own
|
10
15
|
# this is particularly useful when loading files
|
11
|
-
def
|
16
|
+
def parse_string string, context_name
|
12
17
|
# invoke a new parser and return the rules it finds
|
13
|
-
parser = Yay::Parser.new
|
18
|
+
parser = Yay::Parser.new context_name
|
19
|
+
parser.allow_include = true
|
14
20
|
return parser.parse string
|
15
21
|
end
|
16
|
-
|
17
|
-
#
|
18
|
-
def
|
22
|
+
|
23
|
+
# parse a file
|
24
|
+
def parse_file full_path
|
19
25
|
file = File.open(full_path, "rb")
|
20
26
|
contents = file.read
|
21
|
-
return
|
27
|
+
return parse_string contents, full_path
|
22
28
|
end
|
23
29
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
30
|
+
# get the potential target paths
|
31
|
+
def get_potential_resolutions filename
|
32
|
+
paths = Yay::Paths.new
|
33
|
+
dirs = paths.yay_paths
|
34
|
+
|
35
|
+
result = []
|
36
|
+
dirs.each { |path|
|
37
|
+
result.push("#{path}/#{filename}.yay")
|
38
|
+
}
|
39
|
+
|
40
|
+
return result
|
41
|
+
end
|
31
42
|
|
32
|
-
#
|
43
|
+
# try to determine the location of our file
|
33
44
|
def resolve_file filename
|
34
|
-
paths =
|
45
|
+
paths = get_potential_resolutions filename
|
35
46
|
paths.each { |file_name|
|
36
47
|
begin
|
37
48
|
stat = File.stat(file_name)
|
38
|
-
return file_name if stat
|
49
|
+
return file_name if stat.readable?
|
39
50
|
rescue Errno::ENOENT
|
40
51
|
end
|
41
52
|
}
|
@@ -45,8 +56,8 @@ class Yay
|
|
45
56
|
# load a file
|
46
57
|
def load
|
47
58
|
resolved = resolve_file @filename
|
48
|
-
raise Yay::CouldntFindFileError.new @filename,
|
49
|
-
@rules =
|
59
|
+
raise Yay::CouldntFindFileError.new @filename, get_potential_resolutions(@filename) unless resolved
|
60
|
+
@rules = parse_file resolved
|
50
61
|
return @rules
|
51
62
|
end
|
52
63
|
|
data/lib/yay/parser.rb
CHANGED
@@ -5,23 +5,58 @@ require 'yay/rule_set'
|
|
5
5
|
require 'yay/loader'
|
6
6
|
require 'yay/installer'
|
7
7
|
require 'yay/errors'
|
8
|
+
require 'yay/paths'
|
8
9
|
|
9
10
|
class Yay
|
10
11
|
class Parser < Yay::ParserGen
|
11
|
-
|
12
|
+
attr :allow_default
|
13
|
+
attr :allow_install
|
14
|
+
attr :allow_include
|
15
|
+
attr :allow_print
|
16
|
+
|
17
|
+
def initialize context_name=nil
|
18
|
+
@lexer = Yay::Lexer.new
|
19
|
+
@lexer.context_name = context_name
|
20
|
+
end
|
21
|
+
|
22
|
+
def allow_include= value
|
23
|
+
@allow_include = value
|
24
|
+
end
|
25
|
+
|
26
|
+
# load a file from a url
|
27
|
+
def include_file filename
|
28
|
+
raise NotAllowedError.new "include #{filename}", current_position unless @allow_include
|
12
29
|
loader = Yay::Loader.new filename
|
13
30
|
loader.load
|
14
31
|
@ruleset.merge loader.get_rules
|
15
32
|
end
|
16
33
|
|
34
|
+
# install a file from a url
|
17
35
|
def install_file url
|
36
|
+
raise NotAllowedError.new "install #{url}", current_position unless @allow_install
|
18
37
|
installer = Yay::Installer.new url
|
19
38
|
installer.install
|
20
39
|
end
|
21
40
|
|
22
|
-
|
41
|
+
# print the full list of yay files
|
42
|
+
def list_installed
|
43
|
+
raise NotAllowedError.new "list installed yay files", current_position unless @allow_print
|
23
44
|
# TODO
|
24
45
|
end
|
46
|
+
|
47
|
+
# allow all parser actions
|
48
|
+
def allow_all= value
|
49
|
+
@allow_default = @allow_install = @allow_include = @allow_print = value
|
50
|
+
end
|
51
|
+
|
52
|
+
# load the default file. used when the commandline is empty
|
53
|
+
def use_default_file
|
54
|
+
# don't throw an error in this case. it's legitimate for a file to be empty
|
55
|
+
return unless @allow_default
|
56
|
+
loader = Yay::Loader.default_file_loader
|
57
|
+
loader.load
|
58
|
+
@ruleset.merge loader.get_rules
|
59
|
+
end
|
25
60
|
|
26
61
|
def handle_string string
|
27
62
|
string = Regexp::escape(string)
|
@@ -77,7 +112,7 @@ class Yay
|
|
77
112
|
bg = ColourWheel::BG[colour]
|
78
113
|
result.push bg
|
79
114
|
else
|
80
|
-
raise Yay::TooManyColoursError.new fg, bg, colour,
|
115
|
+
raise Yay::TooManyColoursError.new fg, bg, colour, current_position
|
81
116
|
end
|
82
117
|
}
|
83
118
|
result
|
@@ -95,7 +130,6 @@ class Yay
|
|
95
130
|
|
96
131
|
# parse a string
|
97
132
|
def parse(str)
|
98
|
-
@lexer = Yay::Lexer.new unless @lexer
|
99
133
|
@lexer.use_string(str)
|
100
134
|
@ruleset = Yay::RuleSet.new
|
101
135
|
|
@@ -108,9 +142,13 @@ class Yay
|
|
108
142
|
@lexer.next_token
|
109
143
|
end
|
110
144
|
|
111
|
-
|
145
|
+
def current_position
|
146
|
+
return [@lexer.position, @lexer.line, @lexer.context_name]
|
147
|
+
end
|
148
|
+
|
149
|
+
def on_error error_token_id, error_value, cant_touch_this
|
112
150
|
type = token_to_str error_token_id
|
113
|
-
raise Yay::UnexpectedTokenError.new type, error_value,
|
151
|
+
raise Yay::UnexpectedTokenError.new type, error_value, current_position
|
114
152
|
end
|
115
153
|
end
|
116
154
|
end
|
data/lib/yay/parser_gen.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#
|
2
2
|
# DO NOT MODIFY!!!!
|
3
3
|
# This file is automatically generated by racc 1.4.5
|
4
|
-
# from racc grammer file "
|
4
|
+
# from racc grammer file "./../data/grammar.y".
|
5
5
|
#
|
6
6
|
|
7
7
|
require 'racc/parser'
|
@@ -18,8 +18,8 @@ racc_reduce_table = [
|
|
18
18
|
1, 13, :_reduce_none,
|
19
19
|
1, 13, :_reduce_2,
|
20
20
|
2, 13, :_reduce_3,
|
21
|
-
|
22
|
-
0, 13, :
|
21
|
+
1, 13, :_reduce_4,
|
22
|
+
0, 13, :_reduce_5,
|
23
23
|
3, 14, :_reduce_none,
|
24
24
|
1, 14, :_reduce_none,
|
25
25
|
1, 15, :_reduce_none,
|
@@ -47,50 +47,48 @@ racc_reduce_table = [
|
|
47
47
|
|
48
48
|
racc_reduce_n = 30
|
49
49
|
|
50
|
-
racc_shift_n =
|
50
|
+
racc_shift_n = 40
|
51
51
|
|
52
52
|
racc_action_table = [
|
53
|
-
-7, -25,
|
54
|
-
|
55
|
-
|
56
|
-
|
53
|
+
-7, -25, 32, 17, 25, 17, -25, 12, 22, 22,
|
54
|
+
32, 20, 30, 9, 10, 12, 2, 4, 8, 9,
|
55
|
+
10, 12, 28, 35, 19, 29, 29, -2, 17, 37,
|
56
|
+
29, 37 ]
|
57
57
|
|
58
58
|
racc_action_check = [
|
59
|
-
7, 6, 21,
|
60
|
-
23,
|
61
|
-
0, 0,
|
62
|
-
|
59
|
+
7, 6, 21, 17, 10, 9, 6, 21, 6, 7,
|
60
|
+
23, 4, 19, 23, 23, 23, 0, 0, 0, 0,
|
61
|
+
0, 0, 18, 24, 3, 18, 24, 2, 1, 27,
|
62
|
+
29, 34 ]
|
63
63
|
|
64
64
|
racc_action_pointer = [
|
65
|
-
14,
|
66
|
-
nil, nil, nil, nil, nil, nil, -
|
67
|
-
|
68
|
-
nil, nil, nil, nil, nil,
|
69
|
-
nil ]
|
65
|
+
14, 17, 27, 24, 9, nil, -1, 0, nil, -6,
|
66
|
+
2, nil, nil, nil, nil, nil, nil, -8, 17, 12,
|
67
|
+
nil, 0, nil, 8, 18, nil, nil, 19, nil, 22,
|
68
|
+
nil, nil, nil, nil, 21, nil, nil, nil, nil, nil ]
|
70
69
|
|
71
70
|
racc_action_default = [
|
72
|
-
-5, -29, -20, -30, -30, -1, -19, -25,
|
73
|
-
-8, -21, -9, -10, -11, -12, -29, -30, -30,
|
74
|
-
|
75
|
-
|
76
|
-
-15 ]
|
71
|
+
-5, -29, -20, -30, -30, -1, -19, -25, -4, -29,
|
72
|
+
-30, -8, -21, -9, -10, -11, -12, -29, -30, -30,
|
73
|
+
-3, -30, -24, -30, -30, -17, -28, -27, -14, -23,
|
74
|
+
40, -18, -20, -6, -27, -16, -13, -26, -22, -15 ]
|
77
75
|
|
78
76
|
racc_goto_table = [
|
79
|
-
5,
|
80
|
-
nil,
|
81
|
-
nil, nil, nil,
|
77
|
+
5, 18, 27, 36, 21, 23, 31, 3, 34, 24,
|
78
|
+
39, nil, nil, 38, nil, nil, nil, 26, nil, nil,
|
79
|
+
nil, nil, nil, 33 ]
|
82
80
|
|
83
81
|
racc_goto_check = [
|
84
|
-
2, 11, 12, 13, 4, 4, 10, 1,
|
85
|
-
|
82
|
+
2, 11, 12, 13, 4, 4, 10, 1, 12, 11,
|
83
|
+
13, nil, nil, 12, nil, nil, nil, 11, nil, nil,
|
86
84
|
nil, nil, nil, 2 ]
|
87
85
|
|
88
86
|
racc_goto_pointer = [
|
89
87
|
nil, 7, 0, nil, -2, nil, nil, nil, nil, nil,
|
90
|
-
-15, 0, -
|
88
|
+
-15, 0, -16, -24, nil ]
|
91
89
|
|
92
90
|
racc_goto_default = [
|
93
|
-
nil, nil, nil, 7, nil,
|
91
|
+
nil, nil, nil, 7, nil, 11, 13, 14, 15, 16,
|
94
92
|
1, nil, nil, nil, 6 ]
|
95
93
|
|
96
94
|
racc_token_table = {
|
@@ -98,7 +96,7 @@ racc_token_table = {
|
|
98
96
|
Object.new => 1,
|
99
97
|
:literal => 2,
|
100
98
|
:install => 3,
|
101
|
-
:
|
99
|
+
:list_installed => 4,
|
102
100
|
:variable => 5,
|
103
101
|
:include => 6,
|
104
102
|
:regex => 7,
|
@@ -132,7 +130,7 @@ Racc_token_to_s_table = [
|
|
132
130
|
'error',
|
133
131
|
'literal',
|
134
132
|
'install',
|
135
|
-
'
|
133
|
+
'list_installed',
|
136
134
|
'variable',
|
137
135
|
'include',
|
138
136
|
'regex',
|
@@ -164,28 +162,33 @@ Racc_debug_parser = false
|
|
164
162
|
|
165
163
|
# reduce 1 omitted
|
166
164
|
|
167
|
-
module_eval <<'.,.,', '
|
165
|
+
module_eval <<'.,.,', './../data/grammar.y', 6
|
168
166
|
def _reduce_2( val, _values, result )
|
169
|
-
|
167
|
+
include_file val[0]
|
170
168
|
result
|
171
169
|
end
|
172
170
|
.,.,
|
173
171
|
|
174
|
-
module_eval <<'.,.,', '
|
172
|
+
module_eval <<'.,.,', './../data/grammar.y', 7
|
175
173
|
def _reduce_3( val, _values, result )
|
176
|
-
install_file val[1]
|
174
|
+
install_file val[1]
|
177
175
|
result
|
178
176
|
end
|
179
177
|
.,.,
|
180
178
|
|
181
|
-
module_eval <<'.,.,', '
|
179
|
+
module_eval <<'.,.,', './../data/grammar.y', 8
|
182
180
|
def _reduce_4( val, _values, result )
|
183
|
-
|
181
|
+
list_installed
|
184
182
|
result
|
185
183
|
end
|
186
184
|
.,.,
|
187
185
|
|
188
|
-
|
186
|
+
module_eval <<'.,.,', './../data/grammar.y', 9
|
187
|
+
def _reduce_5( val, _values, result )
|
188
|
+
use_default_file
|
189
|
+
result
|
190
|
+
end
|
191
|
+
.,.,
|
189
192
|
|
190
193
|
# reduce 6 omitted
|
191
194
|
|
@@ -201,84 +204,84 @@ module_eval <<'.,.,', 'scripts/../data/grammar.y', 8
|
|
201
204
|
|
202
205
|
# reduce 12 omitted
|
203
206
|
|
204
|
-
module_eval <<'.,.,', '
|
207
|
+
module_eval <<'.,.,', './../data/grammar.y', 20
|
205
208
|
def _reduce_13( val, _values, result )
|
206
209
|
@ruleset.add_match val[0], handle_colours(val[2]), val[3]
|
207
210
|
result
|
208
211
|
end
|
209
212
|
.,.,
|
210
213
|
|
211
|
-
module_eval <<'.,.,', '
|
214
|
+
module_eval <<'.,.,', './../data/grammar.y', 22
|
212
215
|
def _reduce_14( val, _values, result )
|
213
216
|
@ruleset.add_assignment val[0], val[2]
|
214
217
|
result
|
215
218
|
end
|
216
219
|
.,.,
|
217
220
|
|
218
|
-
module_eval <<'.,.,', '
|
221
|
+
module_eval <<'.,.,', './../data/grammar.y', 24
|
219
222
|
def _reduce_15( val, _values, result )
|
220
223
|
@ruleset.add_substitution val[0], handle_colours(val[2]), val[3]
|
221
224
|
result
|
222
225
|
end
|
223
226
|
.,.,
|
224
227
|
|
225
|
-
module_eval <<'.,.,', '
|
228
|
+
module_eval <<'.,.,', './../data/grammar.y', 26
|
226
229
|
def _reduce_16( val, _values, result )
|
227
230
|
@ruleset.add_equivalence val[0], val[2]
|
228
231
|
result
|
229
232
|
end
|
230
233
|
.,.,
|
231
234
|
|
232
|
-
module_eval <<'.,.,', '
|
235
|
+
module_eval <<'.,.,', './../data/grammar.y', 28
|
233
236
|
def _reduce_17( val, _values, result )
|
234
|
-
|
237
|
+
include_file val[1]
|
235
238
|
result
|
236
239
|
end
|
237
240
|
.,.,
|
238
241
|
|
239
|
-
module_eval <<'.,.,', '
|
242
|
+
module_eval <<'.,.,', './../data/grammar.y', 30
|
240
243
|
def _reduce_18( val, _values, result )
|
241
244
|
val[2].unshift(val[0]); result = val[2]
|
242
245
|
result
|
243
246
|
end
|
244
247
|
.,.,
|
245
248
|
|
246
|
-
module_eval <<'.,.,', '
|
249
|
+
module_eval <<'.,.,', './../data/grammar.y', 31
|
247
250
|
def _reduce_19( val, _values, result )
|
248
251
|
result = [val[0]]
|
249
252
|
result
|
250
253
|
end
|
251
254
|
.,.,
|
252
255
|
|
253
|
-
module_eval <<'.,.,', '
|
256
|
+
module_eval <<'.,.,', './../data/grammar.y', 33
|
254
257
|
def _reduce_20( val, _values, result )
|
255
258
|
result = handle_string(val[0])
|
256
259
|
result
|
257
260
|
end
|
258
261
|
.,.,
|
259
262
|
|
260
|
-
module_eval <<'.,.,', '
|
263
|
+
module_eval <<'.,.,', './../data/grammar.y', 34
|
261
264
|
def _reduce_21( val, _values, result )
|
262
265
|
result = handle_regex(val[0])
|
263
266
|
result
|
264
267
|
end
|
265
268
|
.,.,
|
266
269
|
|
267
|
-
module_eval <<'.,.,', '
|
270
|
+
module_eval <<'.,.,', './../data/grammar.y', 36
|
268
271
|
def _reduce_22( val, _values, result )
|
269
272
|
val[1].unshift(val[0].to_sym); result = val[1]
|
270
273
|
result
|
271
274
|
end
|
272
275
|
.,.,
|
273
276
|
|
274
|
-
module_eval <<'.,.,', '
|
277
|
+
module_eval <<'.,.,', './../data/grammar.y', 37
|
275
278
|
def _reduce_23( val, _values, result )
|
276
279
|
result = [val[0].to_sym]
|
277
280
|
result
|
278
281
|
end
|
279
282
|
.,.,
|
280
283
|
|
281
|
-
module_eval <<'.,.,', '
|
284
|
+
module_eval <<'.,.,', './../data/grammar.y', 39
|
282
285
|
def _reduce_24( val, _values, result )
|
283
286
|
result = nil
|
284
287
|
result
|
@@ -287,21 +290,21 @@ module_eval <<'.,.,', 'scripts/../data/grammar.y', 39
|
|
287
290
|
|
288
291
|
# reduce 25 omitted
|
289
292
|
|
290
|
-
module_eval <<'.,.,', '
|
293
|
+
module_eval <<'.,.,', './../data/grammar.y', 42
|
291
294
|
def _reduce_26( val, _values, result )
|
292
295
|
result = true
|
293
296
|
result
|
294
297
|
end
|
295
298
|
.,.,
|
296
299
|
|
297
|
-
module_eval <<'.,.,', '
|
300
|
+
module_eval <<'.,.,', './../data/grammar.y', 43
|
298
301
|
def _reduce_27( val, _values, result )
|
299
302
|
result = false
|
300
303
|
result
|
301
304
|
end
|
302
305
|
.,.,
|
303
306
|
|
304
|
-
module_eval <<'.,.,', '
|
307
|
+
module_eval <<'.,.,', './../data/grammar.y', 45
|
305
308
|
def _reduce_28( val, _values, result )
|
306
309
|
result = nil
|
307
310
|
result
|
data/lib/yay/paths.rb
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'yay/version'
|
3
|
+
|
4
|
+
class Yay
|
5
|
+
|
6
|
+
# some utility functions for finding the current install and .yay paths
|
7
|
+
class Paths
|
8
|
+
|
9
|
+
DEFAULT_YAYFILE = 'default'
|
10
|
+
|
11
|
+
# get the paths to installed gems
|
12
|
+
def gempaths
|
13
|
+
return Gem.path
|
14
|
+
end
|
15
|
+
|
16
|
+
# try to determine where yayfiles might be installed based on a gem path
|
17
|
+
def gempath_to_yaypath gem_path
|
18
|
+
return "#{gem_path}/gems/yay-#{Yay::VERSION}/data/yay"
|
19
|
+
end
|
20
|
+
|
21
|
+
# get all the paths where we might be able to find .yay files
|
22
|
+
def yay_paths
|
23
|
+
result = [local_yay_path]
|
24
|
+
gempaths.each { |v|
|
25
|
+
result.push gempath_to_yaypath(v)
|
26
|
+
}
|
27
|
+
return result
|
28
|
+
end
|
29
|
+
|
30
|
+
# get the path we store local .yay files
|
31
|
+
def local_yay_path
|
32
|
+
raise "ENV[HOME] not found!" unless ENV['HOME']
|
33
|
+
return "#{ENV['HOME']}/.yay"
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
data/lib/yay/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yay
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 4
|
10
|
+
version: 0.0.4
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- jon davey
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-11-
|
18
|
+
date: 2011-11-17 00:00:00 +00:00
|
19
19
|
default_executable:
|
20
20
|
dependencies: []
|
21
21
|
|
@@ -40,6 +40,7 @@ files:
|
|
40
40
|
- lib/yay/errors.rb
|
41
41
|
- lib/yay/parser.rb
|
42
42
|
- lib/yay/loader.rb
|
43
|
+
- lib/yay/paths.rb
|
43
44
|
- lib/yay/colour_wheel.rb
|
44
45
|
- lib/yay/installer.rb
|
45
46
|
- lib/yay/rule_set.rb
|
@@ -78,6 +79,6 @@ rubyforge_project:
|
|
78
79
|
rubygems_version: 1.3.7
|
79
80
|
signing_key:
|
80
81
|
specification_version: 3
|
81
|
-
summary:
|
82
|
+
summary: echo "i like apples" | yay apples are red
|
82
83
|
test_files: []
|
83
84
|
|