stowm 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,39 @@
1
+ ;; #-*- mode: nendo; syntax: scheme -*-;;
2
+ ;; Basic utility library functions
3
+ (require "digest/sha1")
4
+
5
+ ;; `regex' is a string or Regexp class.
6
+ ;; returns ( $0-string $1-string $2-string $3-string ... )
7
+ (define (stowm-regex-match regex str)
8
+ (let1 regex (if (regexp? regex)
9
+ regex
10
+ (string->regexp regex))
11
+ (let1 matchdata (rxmatch regex str)
12
+ (if matchdata
13
+ (matchdata.to_a.to_list)
14
+ #f))))
15
+
16
+ ;; execute shell script specified by string
17
+ (define (stowm-exec-sh script . disp)
18
+ (let* ((digest (Digest::SHA1.hexdigest script))
19
+ (tmpfile (sprintf "/tmp/stowm_script.%s.sh" digest)))
20
+ (with-open
21
+ tmpfile
22
+ (lambda (f)
23
+ (f.puts script))
24
+ "w")
25
+ (if (car disp) (printf "---BEGIN---(%s)\n" tmpfile))
26
+ (.system (+ "bash " tmpfile))
27
+ (if (car disp) (print "---END---"))
28
+ (File.delete tmpfile)
29
+ ))
30
+
31
+ ;; list directory without "." and ".." file.
32
+ (define (stowm-get-dir-entries path)
33
+ (filter
34
+ (lambda (x)
35
+ (not (or (x.match "[/]?[.]$")
36
+ (x.match "[/]?[.][.]$")
37
+ (x.match "^[.]"))))
38
+ (to-list (Dir.entries path))))
39
+
@@ -0,0 +1,395 @@
1
+ #
2
+ # This file is nendo's compiled library file.
3
+ # generated "nendo -c src" command.
4
+ #
5
+
6
+ trampCall(
7
+ begin
8
+ embedBacktraceInfo( "./lib/stowm/util.nnd", 3 );
9
+ delayCall( '_require', 'require',
10
+ begin
11
+ if @global_lisp_binding.has_key?('_require') then
12
+ trampCall(@_require)
13
+ else raise NameError.new( "Error: undefined variable require", "require" ) end
14
+ rescue => __e ; __e.set_backtrace( ["./lib/stowm/util.nnd:3"] + __e.backtrace ) ; raise __e
15
+ end ,
16
+ [
17
+ "digest/sha1"
18
+ ]
19
+ )
20
+ end
21
+ )
22
+ #--------------------
23
+
24
+ trampCall(
25
+ begin #execFunc
26
+ def self._stowm_MIMARKregex_MIMARKmatch_METHOD( origname, pred, args ) lispMethodEntry( origname, true ) ; ret = callProcedure( '_stowm_MIMARKregex_MIMARKmatch', origname, pred, args ) ; lispMethodExit( origname, true ) ; return ret end
27
+ @global_lisp_binding['_stowm_MIMARKregex_MIMARKmatch'] = self.method( :_stowm_MIMARKregex_MIMARKmatch_METHOD )
28
+ @_stowm_MIMARKregex_MIMARKmatch =
29
+ trampCall(
30
+ Proc.new { |_regex,_str|
31
+ begin #makeLet
32
+ ___lambda = lambda { |_regex|
33
+ begin #makeLet
34
+ ___lambda = lambda { |_matchdata|
35
+ if (
36
+ begin
37
+ trampCall(_matchdata)
38
+ rescue => __e ; __e.set_backtrace( ["./lib/stowm/util.nnd:12"] + __e.backtrace ) ; raise __e
39
+ end
40
+ ) then
41
+ begin
42
+ trampCall(_matchdata).to_a.to_list(
43
+ )
44
+ rescue => __e ; __e.set_backtrace( ["./lib/stowm/util.nnd:13"] + __e.backtrace ) ; raise __e
45
+ end
46
+ else
47
+ false
48
+ end
49
+ } ; ___lambda.call(
50
+ begin
51
+ embedBacktraceInfo( "./lib/stowm/util.nnd", 11 );
52
+ trampCall( self._rxmatch_METHOD( 'rxmatch',
53
+ begin
54
+ if @global_lisp_binding.has_key?('_rxmatch') then
55
+ trampCall(@_rxmatch)
56
+ else raise NameError.new( "Error: undefined variable rxmatch", "rxmatch" ) end
57
+ rescue => __e ; __e.set_backtrace( ["./lib/stowm/util.nnd:11"] + __e.backtrace ) ; raise __e
58
+ end ,
59
+ [
60
+ begin
61
+ trampCall(_regex)
62
+ rescue => __e ; __e.set_backtrace( ["./lib/stowm/util.nnd:11"] + __e.backtrace ) ; raise __e
63
+ end ,
64
+ begin
65
+ trampCall(_str)
66
+ rescue => __e ; __e.set_backtrace( ["./lib/stowm/util.nnd:11"] + __e.backtrace ) ; raise __e
67
+ end
68
+ ]
69
+ ))
70
+ end
71
+ )
72
+ end
73
+ } ; ___lambda.call(
74
+ if (
75
+ begin
76
+ embedBacktraceInfo( "./lib/stowm/util.nnd", 8 );
77
+ trampCall( self._regexp_QUMARK_METHOD( 'regexp?',
78
+ begin
79
+ if @global_lisp_binding.has_key?('_regexp_QUMARK') then
80
+ trampCall(@_regexp_QUMARK)
81
+ else raise NameError.new( "Error: undefined variable regexp?", "regexp?" ) end
82
+ rescue => __e ; __e.set_backtrace( ["./lib/stowm/util.nnd:8"] + __e.backtrace ) ; raise __e
83
+ end ,
84
+ [
85
+ begin
86
+ trampCall(_regex)
87
+ rescue => __e ; __e.set_backtrace( ["./lib/stowm/util.nnd:8"] + __e.backtrace ) ; raise __e
88
+ end
89
+ ]
90
+ ))
91
+ end
92
+ ) then
93
+ begin
94
+ trampCall(_regex)
95
+ rescue => __e ; __e.set_backtrace( ["./lib/stowm/util.nnd:9"] + __e.backtrace ) ; raise __e
96
+ end
97
+ else
98
+ begin
99
+ embedBacktraceInfo( "./lib/stowm/util.nnd", 10 );
100
+ delayCall( '_string_MIMARK_GTMARKregexp', 'string->regexp',
101
+ begin
102
+ if @global_lisp_binding.has_key?('_string_MIMARK_GTMARKregexp') then
103
+ trampCall(@_string_MIMARK_GTMARKregexp)
104
+ else raise NameError.new( "Error: undefined variable string->regexp", "string->regexp" ) end
105
+ rescue => __e ; __e.set_backtrace( ["./lib/stowm/util.nnd:10"] + __e.backtrace ) ; raise __e
106
+ end ,
107
+ [
108
+ begin
109
+ trampCall(_regex)
110
+ rescue => __e ; __e.set_backtrace( ["./lib/stowm/util.nnd:10"] + __e.backtrace ) ; raise __e
111
+ end
112
+ ]
113
+ )
114
+ end
115
+ end
116
+ )
117
+ end
118
+ }
119
+ )
120
+ end
121
+ )
122
+ #--------------------
123
+
124
+ trampCall(
125
+ begin #execFunc
126
+ def self._stowm_MIMARKexec_MIMARKsh_METHOD( origname, pred, args ) lispMethodEntry( origname, true ) ; ret = callProcedure( '_stowm_MIMARKexec_MIMARKsh', origname, pred, args ) ; lispMethodExit( origname, true ) ; return ret end
127
+ @global_lisp_binding['_stowm_MIMARKexec_MIMARKsh'] = self.method( :_stowm_MIMARKexec_MIMARKsh_METHOD )
128
+ @_stowm_MIMARKexec_MIMARKsh =
129
+ trampCall(
130
+ Proc.new { |_script,*__rest__| _disp = __rest__[0] ;
131
+ begin #makeLet
132
+ ___lambda = lambda { |_digest|
133
+ begin #makeLet
134
+ ___lambda = lambda { |_tmpfile|
135
+ begin
136
+ embedBacktraceInfo( "./lib/stowm/util.nnd", 20 );
137
+ trampCall( self._with_MIMARKopen_METHOD( 'with-open',
138
+ begin
139
+ if @global_lisp_binding.has_key?('_with_MIMARKopen') then
140
+ trampCall(@_with_MIMARKopen)
141
+ else raise NameError.new( "Error: undefined variable with-open", "with-open" ) end
142
+ rescue => __e ; __e.set_backtrace( ["./lib/stowm/util.nnd:20"] + __e.backtrace ) ; raise __e
143
+ end ,
144
+ [
145
+ begin
146
+ trampCall(_tmpfile)
147
+ rescue => __e ; __e.set_backtrace( ["./lib/stowm/util.nnd:21"] + __e.backtrace ) ; raise __e
148
+ end ,
149
+ Proc.new { |_f|
150
+ begin
151
+ trampCall(_f).puts(
152
+ begin
153
+ trampCall(_script)
154
+ rescue => __e ; __e.set_backtrace( ["./lib/stowm/util.nnd:23"] + __e.backtrace ) ; raise __e
155
+ end
156
+ )
157
+ rescue => __e ; __e.set_backtrace( ["./lib/stowm/util.nnd:23"] + __e.backtrace ) ; raise __e
158
+ end
159
+ } ,
160
+ "w"
161
+ ]
162
+ ))
163
+ end
164
+ if (
165
+ begin
166
+ embedBacktraceInfo( "./lib/stowm/util.nnd", 25 );
167
+ _car(
168
+ begin
169
+ trampCall(_disp)
170
+ rescue => __e ; __e.set_backtrace( ["./lib/stowm/util.nnd:25"] + __e.backtrace ) ; raise __e
171
+ end
172
+ )
173
+ end
174
+ ) then
175
+ begin
176
+ embedBacktraceInfo( "./lib/stowm/util.nnd", 25 );
177
+ trampCall( self._printf_METHOD( 'printf',
178
+ begin
179
+ if @global_lisp_binding.has_key?('_printf') then
180
+ trampCall(@_printf)
181
+ else raise NameError.new( "Error: undefined variable printf", "printf" ) end
182
+ rescue => __e ; __e.set_backtrace( ["./lib/stowm/util.nnd:25"] + __e.backtrace ) ; raise __e
183
+ end ,
184
+ [
185
+ "---BEGIN---(%s)
186
+ " ,
187
+ begin
188
+ trampCall(_tmpfile)
189
+ rescue => __e ; __e.set_backtrace( ["./lib/stowm/util.nnd:25"] + __e.backtrace ) ; raise __e
190
+ end
191
+ ]
192
+ ))
193
+ end
194
+ end
195
+ begin
196
+ trampCall(Kernel).system(
197
+ begin
198
+ embedBacktraceInfo( "./lib/stowm/util.nnd", 26 );
199
+ (
200
+ "bash " +
201
+ begin
202
+ trampCall(_tmpfile)
203
+ rescue => __e ; __e.set_backtrace( ["./lib/stowm/util.nnd:26"] + __e.backtrace ) ; raise __e
204
+ end
205
+ )
206
+ end
207
+ )
208
+ rescue => __e ; __e.set_backtrace( ["./lib/stowm/util.nnd:26"] + __e.backtrace ) ; raise __e
209
+ end
210
+ if (
211
+ begin
212
+ embedBacktraceInfo( "./lib/stowm/util.nnd", 27 );
213
+ _car(
214
+ begin
215
+ trampCall(_disp)
216
+ rescue => __e ; __e.set_backtrace( ["./lib/stowm/util.nnd:27"] + __e.backtrace ) ; raise __e
217
+ end
218
+ )
219
+ end
220
+ ) then
221
+ begin
222
+ embedBacktraceInfo( "./lib/stowm/util.nnd", 27 );
223
+ _print(
224
+ "---END---"
225
+ )
226
+ end
227
+ end
228
+ begin
229
+ trampCall(File).delete(
230
+ begin
231
+ trampCall(_tmpfile)
232
+ rescue => __e ; __e.set_backtrace( ["./lib/stowm/util.nnd:28"] + __e.backtrace ) ; raise __e
233
+ end
234
+ )
235
+ rescue => __e ; __e.set_backtrace( ["./lib/stowm/util.nnd:28"] + __e.backtrace ) ; raise __e
236
+ end
237
+ } ; ___lambda.call(
238
+ begin
239
+ embedBacktraceInfo( "./lib/stowm/util.nnd", 19 );
240
+ trampCall( self._sprintf_METHOD( 'sprintf',
241
+ begin
242
+ if @global_lisp_binding.has_key?('_sprintf') then
243
+ trampCall(@_sprintf)
244
+ else raise NameError.new( "Error: undefined variable sprintf", "sprintf" ) end
245
+ rescue => __e ; __e.set_backtrace( ["./lib/stowm/util.nnd:19"] + __e.backtrace ) ; raise __e
246
+ end ,
247
+ [
248
+ "/tmp/stowm_script.%s.sh" ,
249
+ begin
250
+ trampCall(_digest)
251
+ rescue => __e ; __e.set_backtrace( ["./lib/stowm/util.nnd:19"] + __e.backtrace ) ; raise __e
252
+ end
253
+ ]
254
+ ))
255
+ end
256
+ )
257
+ end
258
+ } ; ___lambda.call(
259
+ begin
260
+ trampCall(Digest::SHA1).hexdigest(
261
+ begin
262
+ trampCall(_script)
263
+ rescue => __e ; __e.set_backtrace( ["./lib/stowm/util.nnd:18"] + __e.backtrace ) ; raise __e
264
+ end
265
+ )
266
+ rescue => __e ; __e.set_backtrace( ["./lib/stowm/util.nnd:18"] + __e.backtrace ) ; raise __e
267
+ end
268
+ )
269
+ end
270
+ }
271
+ )
272
+ end
273
+ )
274
+ #--------------------
275
+
276
+ trampCall(
277
+ begin #execFunc
278
+ def self._stowm_MIMARKget_MIMARKdir_MIMARKentries_METHOD( origname, pred, args ) lispMethodEntry( origname, true ) ; ret = callProcedure( '_stowm_MIMARKget_MIMARKdir_MIMARKentries', origname, pred, args ) ; lispMethodExit( origname, true ) ; return ret end
279
+ @global_lisp_binding['_stowm_MIMARKget_MIMARKdir_MIMARKentries'] = self.method( :_stowm_MIMARKget_MIMARKdir_MIMARKentries_METHOD )
280
+ @_stowm_MIMARKget_MIMARKdir_MIMARKentries =
281
+ trampCall(
282
+ Proc.new { |_path|
283
+ begin
284
+ embedBacktraceInfo( "./lib/stowm/util.nnd", 33 );
285
+ delayCall( '_filter', 'filter',
286
+ begin
287
+ if @global_lisp_binding.has_key?('_filter') then
288
+ trampCall(@_filter)
289
+ else raise NameError.new( "Error: undefined variable filter", "filter" ) end
290
+ rescue => __e ; __e.set_backtrace( ["./lib/stowm/util.nnd:33"] + __e.backtrace ) ; raise __e
291
+ end ,
292
+ [
293
+ Proc.new { |_x|
294
+ begin
295
+ embedBacktraceInfo( "./lib/stowm/util.nnd", 35 );
296
+ _not(
297
+ begin #makeLet
298
+ ___lambda = lambda { |___gensym__647e1909ee9b53b5ba1ef80b65074bbce8690d16_30004|
299
+ if (
300
+ begin
301
+ trampCall(___gensym__647e1909ee9b53b5ba1ef80b65074bbce8690d16_30004)
302
+ rescue => __e ; __e.set_backtrace( [":1"] + __e.backtrace ) ; raise __e
303
+ end
304
+ ) then
305
+ begin
306
+ trampCall(___gensym__647e1909ee9b53b5ba1ef80b65074bbce8690d16_30004)
307
+ rescue => __e ; __e.set_backtrace( [":1"] + __e.backtrace ) ; raise __e
308
+ end
309
+ else
310
+ begin #makeLet
311
+ ___lambda = lambda { |___gensym__647e1909ee9b53b5ba1ef80b65074bbce8690d16_30005|
312
+ if (
313
+ begin
314
+ trampCall(___gensym__647e1909ee9b53b5ba1ef80b65074bbce8690d16_30005)
315
+ rescue => __e ; __e.set_backtrace( [":1"] + __e.backtrace ) ; raise __e
316
+ end
317
+ ) then
318
+ begin
319
+ trampCall(___gensym__647e1909ee9b53b5ba1ef80b65074bbce8690d16_30005)
320
+ rescue => __e ; __e.set_backtrace( [":1"] + __e.backtrace ) ; raise __e
321
+ end
322
+ else
323
+ begin #makeLet
324
+ ___lambda = lambda { |___gensym__647e1909ee9b53b5ba1ef80b65074bbce8690d16_30006|
325
+ if (
326
+ begin
327
+ trampCall(___gensym__647e1909ee9b53b5ba1ef80b65074bbce8690d16_30006)
328
+ rescue => __e ; __e.set_backtrace( [":1"] + __e.backtrace ) ; raise __e
329
+ end
330
+ ) then
331
+ begin
332
+ trampCall(___gensym__647e1909ee9b53b5ba1ef80b65074bbce8690d16_30006)
333
+ rescue => __e ; __e.set_backtrace( [":1"] + __e.backtrace ) ; raise __e
334
+ end
335
+ else
336
+ false
337
+ end
338
+ } ; ___lambda.call(
339
+ begin
340
+ trampCall(_x).match(
341
+ "^[.]"
342
+ )
343
+ rescue => __e ; __e.set_backtrace( ["./lib/stowm/util.nnd:37"] + __e.backtrace ) ; raise __e
344
+ end
345
+ )
346
+ end
347
+ end
348
+ } ; ___lambda.call(
349
+ begin
350
+ trampCall(_x).match(
351
+ "[/]?[.][.]$"
352
+ )
353
+ rescue => __e ; __e.set_backtrace( ["./lib/stowm/util.nnd:36"] + __e.backtrace ) ; raise __e
354
+ end
355
+ )
356
+ end
357
+ end
358
+ } ; ___lambda.call(
359
+ begin
360
+ trampCall(_x).match(
361
+ "[/]?[.]$"
362
+ )
363
+ rescue => __e ; __e.set_backtrace( ["./lib/stowm/util.nnd:35"] + __e.backtrace ) ; raise __e
364
+ end
365
+ )
366
+ end
367
+ )
368
+ end
369
+ } ,
370
+ begin
371
+ embedBacktraceInfo( "./lib/stowm/util.nnd", 38 );
372
+ _to_MIMARKlist(
373
+ begin
374
+ trampCall(Dir).entries(
375
+ begin
376
+ trampCall(_path)
377
+ rescue => __e ; __e.set_backtrace( ["./lib/stowm/util.nnd:38"] + __e.backtrace ) ; raise __e
378
+ end
379
+ )
380
+ rescue => __e ; __e.set_backtrace( ["./lib/stowm/util.nnd:38"] + __e.backtrace ) ; raise __e
381
+ end
382
+ )
383
+ end
384
+ ]
385
+ )
386
+ end
387
+ }
388
+ )
389
+ end
390
+ )
391
+
392
+
393
+ # -------------------------------------------------------
394
+ # [EOF]
395
+ # -------------------------------------------------------
@@ -0,0 +1,5 @@
1
+ module Stowm
2
+
3
+ VERSION = '0.8.0'
4
+
5
+ end
data/lib/stowm.rb ADDED
@@ -0,0 +1,35 @@
1
+ #!/usr/bin/env ruby
2
+ # -*- encoding: utf-8 -*-
3
+ #
4
+ # stowm.rb - "root file of stowm"
5
+ #
6
+ # Copyright (c) 2014-2014 Kiyoka Nishiyama <kiyoka@sumibi.org>
7
+ #
8
+ # Redistribution and use in source and binary forms, with or without
9
+ # modification, are permitted provided that the following conditions
10
+ # are met:
11
+ #
12
+ # 1. Redistributions of source code must retain the above copyright
13
+ # notice, this list of conditions and the following disclaimer.
14
+ #
15
+ # 2. Redistributions in binary form must reproduce the above copyright
16
+ # notice, this list of conditions and the following disclaimer in the
17
+ # documentation and/or other materials provided with the distribution.
18
+ #
19
+ # 3. Neither the name of the authors nor the names of its contributors
20
+ # may be used to endorse or promote products derived from this
21
+ # software without specific prior written permission.
22
+ #
23
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24
+ # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25
+ # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
26
+ # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
27
+ # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
28
+ # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
29
+ # TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
30
+ # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
31
+ # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
32
+ # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
33
+ # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34
+ #
35
+ require 'stowm/version.rb'
metadata ADDED
@@ -0,0 +1,75 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: stowm
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.8.0
5
+ platform: ruby
6
+ authors:
7
+ - Kiyoka Nishiyama
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-04-06 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: nendo
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '='
18
+ - !ruby/object:Gem::Version
19
+ version: 0.7.3
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '='
25
+ - !ruby/object:Gem::Version
26
+ version: 0.7.3
27
+ description: Stowm is a stow manager.
28
+ email: kiyoka@sumibi.org
29
+ executables:
30
+ - stowm
31
+ extensions: []
32
+ extra_rdoc_files:
33
+ - README.md
34
+ files:
35
+ - README.md
36
+ - bin/stowm
37
+ - lib/stowm.rb
38
+ - lib/stowm/env.nnd
39
+ - lib/stowm/env.nndc
40
+ - lib/stowm/listutil.nnd
41
+ - lib/stowm/listutil.nndc
42
+ - lib/stowm/main.nnd
43
+ - lib/stowm/main.nndc
44
+ - lib/stowm/parseutil.nnd
45
+ - lib/stowm/parseutil.nndc
46
+ - lib/stowm/specfile.nnd
47
+ - lib/stowm/specfile.nndc
48
+ - lib/stowm/util.nnd
49
+ - lib/stowm/util.nndc
50
+ - lib/stowm/version.rb
51
+ homepage: http://github.com/kiyoka/stowm
52
+ licenses:
53
+ - New BSD
54
+ metadata: {}
55
+ post_install_message:
56
+ rdoc_options: []
57
+ require_paths:
58
+ - lib
59
+ required_ruby_version: !ruby/object:Gem::Requirement
60
+ requirements:
61
+ - - ">="
62
+ - !ruby/object:Gem::Version
63
+ version: '0'
64
+ required_rubygems_version: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ requirements: []
70
+ rubyforge_project:
71
+ rubygems_version: 2.4.5
72
+ signing_key:
73
+ specification_version: 4
74
+ summary: Stowm is a stow manager.
75
+ test_files: []