pluto 1.2.3 → 1.3.0
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/Manifest.txt +11 -11
- data/README.md +25 -23
- data/Rakefile +1 -1
- data/bin/pluto +0 -0
- data/lib/pluto/cli/main.rb +381 -411
- data/lib/pluto/cli/opts.rb +38 -13
- data/lib/pluto/cli/sysinfo.rb +2 -2
- data/lib/pluto/cli/version.rb +2 -3
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 12c68dae2b3404d2b6bfb5e90d65988a817e05f0
|
4
|
+
data.tar.gz: 63865f5cb4df9d9fa5a6757bc68cdcb895efc732
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a2c924baf3e216458ccf3ce8f4234a91a791d3c58f6759fff098681671da13ad07fa93011f7c3fa9c50c6688ce33e5054770f09075ad53df654d5767c023a366
|
7
|
+
data.tar.gz: 9bbb372a6a0804b804d4eebe3e12e71915d5a9d6d3d244c1fa4674b3c7bffcb05dd05c5ef5cb382b977c1c2f67a816b0c49fca72f4363e75435a8c281f45e6e0
|
data/Manifest.txt
CHANGED
@@ -1,11 +1,11 @@
|
|
1
|
-
HISTORY.md
|
2
|
-
Manifest.txt
|
3
|
-
README.md
|
4
|
-
Rakefile
|
5
|
-
bin/pluto
|
6
|
-
lib/pluto.rb
|
7
|
-
lib/pluto/cli/main.rb
|
8
|
-
lib/pluto/cli/opts.rb
|
9
|
-
lib/pluto/cli/sysinfo.rb
|
10
|
-
lib/pluto/cli/updater.rb
|
11
|
-
lib/pluto/cli/version.rb
|
1
|
+
HISTORY.md
|
2
|
+
Manifest.txt
|
3
|
+
README.md
|
4
|
+
Rakefile
|
5
|
+
bin/pluto
|
6
|
+
lib/pluto.rb
|
7
|
+
lib/pluto/cli/main.rb
|
8
|
+
lib/pluto/cli/opts.rb
|
9
|
+
lib/pluto/cli/sysinfo.rb
|
10
|
+
lib/pluto/cli/updater.rb
|
11
|
+
lib/pluto/cli/version.rb
|
data/README.md
CHANGED
@@ -8,12 +8,12 @@ from published web feeds.
|
|
8
8
|
* gem :: [rubygems.org/gems/pluto](https://rubygems.org/gems/pluto)
|
9
9
|
* rdoc :: [rubydoc.info/gems/pluto](http://rubydoc.info/gems/pluto)
|
10
10
|
* templates :: [github.com/planet-templates](https://github.com/planet-templates)
|
11
|
-
* forum :: [groups.google.com/group/
|
11
|
+
* forum :: [groups.google.com/group/wwwmake](http://groups.google.com/group/wwwmake)
|
12
12
|
|
13
13
|
|
14
14
|
## Usage
|
15
15
|
|
16
|
-
|
16
|
+
```
|
17
17
|
NAME
|
18
18
|
pluto - another planet generator - lets you build web pages from published web feeds
|
19
19
|
|
@@ -35,12 +35,12 @@ COMMANDS
|
|
35
35
|
merge, m - Merge planet template pack
|
36
36
|
about, a - (Debug) Show more version info
|
37
37
|
help - Shows a list of commands or help for one command
|
38
|
-
|
38
|
+
```
|
39
39
|
|
40
40
|
|
41
41
|
#### `build` Command
|
42
42
|
|
43
|
-
|
43
|
+
```
|
44
44
|
NAME
|
45
45
|
build - Build planet
|
46
46
|
|
@@ -51,20 +51,20 @@ COMMAND OPTIONS
|
|
51
51
|
-o, --output=PATH - Output Path (default: .)
|
52
52
|
-t, --template=MANIFEST - Template Manifest (default: blank)
|
53
53
|
-d, --dbpath=PATH - Database path (default: .)
|
54
|
-
-n, --dbname=NAME - Database name (default:
|
54
|
+
-n, --dbname=NAME - Database name (default: planet.db)
|
55
55
|
|
56
56
|
EXAMPLE
|
57
57
|
pluto build ruby.ini
|
58
58
|
pluto build ruby.ini --template news
|
59
|
-
pluto b ruby
|
60
|
-
pluto b ruby -t news
|
61
|
-
pluto b # will use
|
62
|
-
|
59
|
+
pluto b ruby.ini
|
60
|
+
pluto b ruby.ini -t news
|
61
|
+
pluto b # will use planet.ini if present
|
62
|
+
```
|
63
63
|
|
64
64
|
|
65
65
|
#### `list` Command
|
66
66
|
|
67
|
-
|
67
|
+
```
|
68
68
|
NAME
|
69
69
|
list - List installed template packs
|
70
70
|
|
@@ -74,12 +74,12 @@ SYNOPSIS
|
|
74
74
|
EXAMPLE
|
75
75
|
pluto list
|
76
76
|
pluto ls
|
77
|
-
|
77
|
+
```
|
78
78
|
|
79
79
|
|
80
80
|
#### `install` Command
|
81
81
|
|
82
|
-
|
82
|
+
```
|
83
83
|
NAME
|
84
84
|
install - Install template pack
|
85
85
|
|
@@ -88,31 +88,31 @@ SYNOPSIS
|
|
88
88
|
|
89
89
|
EXAMPLE
|
90
90
|
pluto install news # install "river of news" template pack
|
91
|
-
|
91
|
+
```
|
92
92
|
|
93
93
|
|
94
94
|
#### `update` Command
|
95
95
|
|
96
|
-
|
96
|
+
```
|
97
97
|
NAME
|
98
98
|
update - Update planet feeds
|
99
99
|
|
100
100
|
COMMAND OPTIONS
|
101
101
|
-d, --dbpath=PATH - Database path (default: .)
|
102
|
-
-n, --dbname=NAME - Database name (default:
|
102
|
+
-n, --dbname=NAME - Database name (default: planet.db)
|
103
103
|
|
104
104
|
SYNOPSIS
|
105
105
|
pluto [global options] update FILE
|
106
106
|
|
107
107
|
EXAMPLE
|
108
108
|
pluto update ruby.ini
|
109
|
-
pluto u ruby
|
110
|
-
|
109
|
+
pluto u ruby.ini
|
110
|
+
```
|
111
111
|
|
112
112
|
|
113
113
|
#### `merge` Command
|
114
114
|
|
115
|
-
|
115
|
+
```
|
116
116
|
NAME
|
117
117
|
merge - Merge planet template pack
|
118
118
|
|
@@ -123,14 +123,14 @@ COMMAND OPTIONS
|
|
123
123
|
-o, --output=PATH - Output Path (default: .)
|
124
124
|
-t, --template=MANIFEST - Template Manifest (default: blank)
|
125
125
|
-d, --dbpath=PATH - Database path (default: .)
|
126
|
-
-n, --dbname=NAME - Database name (default:
|
126
|
+
-n, --dbname=NAME - Database name (default: planet.db)
|
127
127
|
|
128
128
|
EXAMPLE
|
129
129
|
pluto merge ruby.ini
|
130
130
|
pluto merge ruby.ini --template news
|
131
|
-
pluto m ruby
|
132
|
-
pluto m ruby -t news
|
133
|
-
|
131
|
+
pluto m ruby.ini
|
132
|
+
pluto m ruby.ini -t news
|
133
|
+
```
|
134
134
|
|
135
135
|
|
136
136
|
## Install
|
@@ -142,10 +142,12 @@ Just install the gem:
|
|
142
142
|
|
143
143
|
## License
|
144
144
|
|
145
|
+

|
146
|
+
|
145
147
|
The `pluto` scripts are dedicated to the public domain.
|
146
148
|
Use it as you please with no restrictions whatsoever.
|
147
149
|
|
148
150
|
## Questions? Comments?
|
149
151
|
|
150
|
-
Send them along to the [
|
152
|
+
Send them along to the [wwwmake Forum/Mailing List](http://groups.google.com/group/wwwmake).
|
151
153
|
Thanks!
|
data/Rakefile
CHANGED
@@ -11,7 +11,7 @@ Hoe.spec 'pluto' do
|
|
11
11
|
self.urls = ['https://github.com/feedreader/pluto']
|
12
12
|
|
13
13
|
self.author = 'Gerald Bauer'
|
14
|
-
self.email = '
|
14
|
+
self.email = 'wwwmake@googlegroups.com'
|
15
15
|
|
16
16
|
# switch extension to .markdown for gihub formatting
|
17
17
|
self.readme_file = 'README.md'
|
data/bin/pluto
CHANGED
File without changes
|
data/lib/pluto/cli/main.rb
CHANGED
@@ -1,411 +1,381 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
require 'gli'
|
4
|
-
|
5
|
-
|
6
|
-
include GLI::App
|
7
|
-
|
8
|
-
program_desc 'another planet generator (lets you build web pages from published web feeds)'
|
9
|
-
version PlutoCli::VERSION
|
10
|
-
|
11
|
-
|
12
|
-
## some setup code
|
13
|
-
|
14
|
-
LogUtils::Logger.root.level = :info # set logging level to info
|
15
|
-
|
16
|
-
logger = LogUtils::Logger.root
|
17
|
-
|
18
|
-
|
19
|
-
opts = Pluto::Opts.new
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
######
|
24
|
-
# begin
|
25
|
-
# move to pluto for reuse (e.g. in rakefile)
|
26
|
-
|
27
|
-
def load_config( name )
|
28
|
-
config = INI.load_file( name )
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
c.
|
123
|
-
c.
|
124
|
-
c.
|
125
|
-
|
126
|
-
|
127
|
-
c.
|
128
|
-
c.
|
129
|
-
c.
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
c.
|
184
|
-
|
185
|
-
c.
|
186
|
-
c.
|
187
|
-
|
188
|
-
c.
|
189
|
-
|
190
|
-
c.
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
#
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
c.desc '
|
237
|
-
c.arg_name '
|
238
|
-
c.
|
239
|
-
|
240
|
-
|
241
|
-
c.
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
end
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
puts PlutoCli.banner
|
384
|
-
|
385
|
-
LogUtils::Logger.root.level = :debug if opts.verbose?
|
386
|
-
|
387
|
-
logger.debug " executing command #{c.name}"
|
388
|
-
true
|
389
|
-
end
|
390
|
-
|
391
|
-
|
392
|
-
post do |global,c,o,args|
|
393
|
-
logger.debug " executed command #{c.name}"
|
394
|
-
true
|
395
|
-
end
|
396
|
-
|
397
|
-
|
398
|
-
on_error do |e|
|
399
|
-
puts
|
400
|
-
puts "*** error: #{e.message}"
|
401
|
-
puts
|
402
|
-
|
403
|
-
## todo/fix: find a better way to print; just raise exception e.g. raise e - why? why not??
|
404
|
-
## puts e.backtrace.inspect if opts.verbose?
|
405
|
-
raise e if opts.verbose?
|
406
|
-
|
407
|
-
false # skip default error handling
|
408
|
-
end
|
409
|
-
|
410
|
-
|
411
|
-
exit run(ARGV)
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'gli'
|
4
|
+
|
5
|
+
|
6
|
+
include GLI::App
|
7
|
+
|
8
|
+
program_desc 'another planet generator (lets you build web pages from published web feeds)'
|
9
|
+
version PlutoCli::VERSION
|
10
|
+
|
11
|
+
|
12
|
+
## some setup code
|
13
|
+
|
14
|
+
LogUtils::Logger.root.level = :info # set logging level to info
|
15
|
+
|
16
|
+
logger = LogUtils::Logger.root
|
17
|
+
|
18
|
+
|
19
|
+
opts = Pluto::Opts.new
|
20
|
+
|
21
|
+
|
22
|
+
|
23
|
+
######
|
24
|
+
# begin
|
25
|
+
# move to pluto for reuse (e.g. in rakefile)
|
26
|
+
|
27
|
+
def load_config( name )
|
28
|
+
config = INI.load_file( name )
|
29
|
+
config
|
30
|
+
end
|
31
|
+
|
32
|
+
# end
|
33
|
+
# move to pluto for reuse (e.g. in rakefile)
|
34
|
+
###########################
|
35
|
+
|
36
|
+
|
37
|
+
|
38
|
+
|
39
|
+
## "global" options (switches/flags)
|
40
|
+
|
41
|
+
desc '(Debug) Show debug messages'
|
42
|
+
switch [:verbose, :debug], negatable: false
|
43
|
+
|
44
|
+
|
45
|
+
## todo/check:
|
46
|
+
## use quiet (warn) and quieter (error) - why? why not?
|
47
|
+
## use quiet for warn level (not error) as default - why? why not?
|
48
|
+
|
49
|
+
desc 'Only show errors and fatal messages'
|
50
|
+
switch [:q, :quiet, :err, :error], negatable: false
|
51
|
+
|
52
|
+
desc 'Only show warnings, errors and fatal messages'
|
53
|
+
switch [:w, :warn], negatable: false
|
54
|
+
|
55
|
+
|
56
|
+
|
57
|
+
desc 'Configuration Path'
|
58
|
+
arg_name 'PATH'
|
59
|
+
default_value opts.config_path
|
60
|
+
flag [:c, :config]
|
61
|
+
|
62
|
+
|
63
|
+
### note: mostly for debugging lets you fetch individual feeds
|
64
|
+
desc 'Fetch feeds'
|
65
|
+
arg_name 'FEED', multiple: true ## todo/fix: check multiple will not print typeo???
|
66
|
+
command [:fetch, :f] do |c|
|
67
|
+
|
68
|
+
c.desc 'Database path'
|
69
|
+
c.arg_name 'PATH'
|
70
|
+
c.default_value opts.db_path
|
71
|
+
c.flag [:d, :dbpath]
|
72
|
+
|
73
|
+
c.desc 'Database name'
|
74
|
+
c.arg_name 'NAME'
|
75
|
+
c.default_value opts.db_name
|
76
|
+
c.flag [:n, :dbname]
|
77
|
+
|
78
|
+
c.action do |g,o,args|
|
79
|
+
logger.debug 'hello from fetch command'
|
80
|
+
|
81
|
+
## turn on debug flag by default; no need to passing --verbose
|
82
|
+
LogUtils::Logger.root.level = :debug
|
83
|
+
opts.verbose = true
|
84
|
+
|
85
|
+
# add dbname as opts property
|
86
|
+
|
87
|
+
#####
|
88
|
+
# todo: add into method for reuse for build/merge/fetch
|
89
|
+
# all use the same code
|
90
|
+
|
91
|
+
db_config = {
|
92
|
+
adapter: 'sqlite3',
|
93
|
+
database: "#{opts.db_path}/#{opts.db_name}"
|
94
|
+
}
|
95
|
+
|
96
|
+
Pluto.connect( db_config )
|
97
|
+
|
98
|
+
args.each do |arg|
|
99
|
+
feed_rec = Pluto::Model::Feed.find_by_key!( arg )
|
100
|
+
|
101
|
+
puts "feed_rec:"
|
102
|
+
pp feed_rec
|
103
|
+
|
104
|
+
fetcher = Pluto::FeedFetcherBasic.new
|
105
|
+
fetcher.debug = true # by default debug is true (only used for debuggin! - save feed to file, etc.)
|
106
|
+
|
107
|
+
feed = fetcher.fetch( feed_rec )
|
108
|
+
## pp feed
|
109
|
+
end
|
110
|
+
|
111
|
+
puts 'Done.'
|
112
|
+
end
|
113
|
+
end # command fetch
|
114
|
+
|
115
|
+
|
116
|
+
|
117
|
+
## note: same as build (but without step 1) fetch)
|
118
|
+
desc 'Merge planet template pack'
|
119
|
+
arg_name 'FILE', multiple: true ## todo/fix: check multiple will not print typeo???
|
120
|
+
command [:merge, :m] do |c|
|
121
|
+
|
122
|
+
c.desc 'Output Path'
|
123
|
+
c.arg_name 'PATH'
|
124
|
+
c.default_value opts.output_path
|
125
|
+
c.flag [:o,:output]
|
126
|
+
|
127
|
+
c.desc 'Template Manifest'
|
128
|
+
c.arg_name 'MANIFEST'
|
129
|
+
c.default_value opts.manifest
|
130
|
+
c.flag [:t, :template]
|
131
|
+
|
132
|
+
c.desc 'Database path'
|
133
|
+
c.arg_name 'PATH'
|
134
|
+
c.default_value opts.db_path
|
135
|
+
c.flag [:d, :dbpath]
|
136
|
+
|
137
|
+
c.desc 'Database name'
|
138
|
+
c.arg_name 'NAME'
|
139
|
+
c.flag [:n, :dbname]
|
140
|
+
|
141
|
+
|
142
|
+
c.action do |g,o,args|
|
143
|
+
logger.debug 'hello from merge command'
|
144
|
+
|
145
|
+
## note: no more "magic" - remove expand_config_args!! - always pass in planet.ini or similar
|
146
|
+
## args = expand_config_args( args ) # add missing .ini|.yml extension if missing or add default config (e.g. pluto.ini)
|
147
|
+
|
148
|
+
args.each do |arg|
|
149
|
+
name = File.basename( arg, '.*' )
|
150
|
+
|
151
|
+
#####
|
152
|
+
# todo: add into method for reuse for build/merge/fetch
|
153
|
+
# all use the same code
|
154
|
+
|
155
|
+
db_name = opts.db_name? ? opts.db_name : "#{name}.db"
|
156
|
+
|
157
|
+
db_config = {
|
158
|
+
adapter: 'sqlite3',
|
159
|
+
database: "#{opts.db_path}/#{db_name}"
|
160
|
+
}
|
161
|
+
|
162
|
+
Pluto.connect( db_config )
|
163
|
+
|
164
|
+
config = load_config( arg )
|
165
|
+
if opts.verbose?
|
166
|
+
puts "dump >#{name}<:"
|
167
|
+
pp config
|
168
|
+
end
|
169
|
+
|
170
|
+
Pluto::Formatter.new( opts, config ).run( name )
|
171
|
+
end
|
172
|
+
|
173
|
+
puts 'Done.'
|
174
|
+
end
|
175
|
+
end # command merge
|
176
|
+
|
177
|
+
|
178
|
+
## note: same as build (but without step 2) merge)
|
179
|
+
desc 'Update planet feeds'
|
180
|
+
arg_name 'FILE', multiple: true ## todo/fix: check multiple will not print typeo???
|
181
|
+
command [:update, :up, :u] do |c|
|
182
|
+
|
183
|
+
c.desc 'Database path'
|
184
|
+
c.arg_name 'PATH'
|
185
|
+
c.default_value opts.db_path
|
186
|
+
c.flag [:d, :dbpath]
|
187
|
+
|
188
|
+
c.desc 'Database name'
|
189
|
+
c.arg_name 'NAME'
|
190
|
+
c.flag [:n, :dbname]
|
191
|
+
|
192
|
+
|
193
|
+
c.action do |g,o,args|
|
194
|
+
logger.debug 'hello from update command'
|
195
|
+
|
196
|
+
## note: no more "magic" - remove expand_config_args!! - always pass in planet.ini or similar
|
197
|
+
## args = expand_config_args( args ) # add missing .ini|.yml extension if missing or add default config (e.g. pluto.ini)
|
198
|
+
|
199
|
+
args.each do |arg|
|
200
|
+
name = File.basename( arg, '.*' )
|
201
|
+
|
202
|
+
#####
|
203
|
+
# todo: add into method for reuse for build/merge/fetch
|
204
|
+
# all use the same code
|
205
|
+
|
206
|
+
db_name = opts.db_name? ? opts.db_name : "#{name}.db"
|
207
|
+
|
208
|
+
db_config = {
|
209
|
+
adapter: 'sqlite3',
|
210
|
+
database: "#{opts.db_path}/#{db_name}"
|
211
|
+
}
|
212
|
+
|
213
|
+
# Note: use ! version w/ auto-migrate! - why? why not??
|
214
|
+
## just use regular connect??
|
215
|
+
Pluto.connect!( db_config )
|
216
|
+
|
217
|
+
config = load_config( arg )
|
218
|
+
if opts.verbose?
|
219
|
+
puts "dump >#{name}<:"
|
220
|
+
pp config
|
221
|
+
end
|
222
|
+
|
223
|
+
Pluto::Updater.new( opts, config ).run( name )
|
224
|
+
end
|
225
|
+
|
226
|
+
puts 'Done.'
|
227
|
+
end
|
228
|
+
end # command fetch
|
229
|
+
|
230
|
+
|
231
|
+
|
232
|
+
desc 'Build planet'
|
233
|
+
arg_name 'FILE', multiple: true ## todo/fix: check multiple will not print typeo???
|
234
|
+
command [:build, :b] do |c|
|
235
|
+
|
236
|
+
c.desc 'Output Path'
|
237
|
+
c.arg_name 'PATH'
|
238
|
+
c.default_value opts.output_path
|
239
|
+
c.flag [:o,:output]
|
240
|
+
|
241
|
+
c.desc 'Template Manifest'
|
242
|
+
c.arg_name 'MANIFEST'
|
243
|
+
c.default_value opts.manifest
|
244
|
+
c.flag [:t, :template]
|
245
|
+
|
246
|
+
c.desc 'Database path'
|
247
|
+
c.arg_name 'PATH'
|
248
|
+
c.default_value opts.db_path
|
249
|
+
c.flag [:d, :dbpath]
|
250
|
+
|
251
|
+
c.desc 'Database name'
|
252
|
+
c.arg_name 'NAME'
|
253
|
+
c.flag [:n, :dbname]
|
254
|
+
|
255
|
+
|
256
|
+
c.action do |g,o,args|
|
257
|
+
logger.debug 'hello from build command'
|
258
|
+
|
259
|
+
## note: no more "magic" - remove expand_config_args!! - always pass in planet.ini or similar
|
260
|
+
## args = expand_config_args( args ) # add missing .ini|.yml extension if missing or add default config (e.g. pluto.ini)
|
261
|
+
|
262
|
+
args.each do |arg|
|
263
|
+
name = File.basename( arg, '.*' )
|
264
|
+
|
265
|
+
db_name = opts.db_name? ? opts.db_name : "#{name}.db"
|
266
|
+
|
267
|
+
db_config = {
|
268
|
+
adapter: 'sqlite3',
|
269
|
+
database: "#{opts.db_path}/#{db_name}"
|
270
|
+
}
|
271
|
+
|
272
|
+
# Note: use ! version w/ auto-migrate!
|
273
|
+
Pluto.connect!( db_config )
|
274
|
+
|
275
|
+
config = load_config( arg )
|
276
|
+
if opts.verbose?
|
277
|
+
puts "dump >#{name}<:"
|
278
|
+
pp config
|
279
|
+
end
|
280
|
+
|
281
|
+
Pluto::Updater.new( opts, config ).run( name )
|
282
|
+
Pluto::Formatter.new( opts, config ).run( name )
|
283
|
+
end
|
284
|
+
|
285
|
+
puts 'Done.'
|
286
|
+
end
|
287
|
+
end # command build
|
288
|
+
|
289
|
+
|
290
|
+
desc 'List installed template packs'
|
291
|
+
command [:list,:ls,:l] do |c|
|
292
|
+
|
293
|
+
c.action do |g,o,args|
|
294
|
+
logger.debug 'hello from list command'
|
295
|
+
|
296
|
+
Pluto::Lister.new( opts ).list
|
297
|
+
end
|
298
|
+
end
|
299
|
+
|
300
|
+
|
301
|
+
desc 'Install template pack'
|
302
|
+
arg_name 'MANIFEST', multiple: true
|
303
|
+
command [:install,:i] do |c|
|
304
|
+
|
305
|
+
c.action do |g,o,args|
|
306
|
+
logger.debug 'hello from install command'
|
307
|
+
|
308
|
+
args.each do |arg|
|
309
|
+
Pluto::Installer.new( opts ).install( arg ) ## todo: remove opts merge into config
|
310
|
+
end
|
311
|
+
end
|
312
|
+
end
|
313
|
+
|
314
|
+
|
315
|
+
desc '(Debug) Show more version info'
|
316
|
+
skips_pre
|
317
|
+
command [:about,:a] do |c|
|
318
|
+
c.action do
|
319
|
+
logger.debug 'hello from about command'
|
320
|
+
|
321
|
+
Pluto::SysInfo.new( opts ).dump
|
322
|
+
end
|
323
|
+
end
|
324
|
+
|
325
|
+
|
326
|
+
desc '(Debug) Show global options, options, arguments for test command'
|
327
|
+
command :test do |c|
|
328
|
+
c.action do |g,o,args|
|
329
|
+
puts 'hello from test command'
|
330
|
+
puts 'g/global_options:'
|
331
|
+
pp g
|
332
|
+
puts 'o/options:'
|
333
|
+
pp o
|
334
|
+
puts 'args:'
|
335
|
+
pp args
|
336
|
+
end
|
337
|
+
end
|
338
|
+
|
339
|
+
|
340
|
+
|
341
|
+
pre do |g,c,o,args|
|
342
|
+
opts.merge_gli_options!( g )
|
343
|
+
opts.merge_gli_options!( o )
|
344
|
+
|
345
|
+
puts PlutoCli.banner
|
346
|
+
|
347
|
+
if opts.verbose?
|
348
|
+
LogUtils::Logger.root.level = :debug
|
349
|
+
elsif opts.warn?
|
350
|
+
LogUtils::Logger.root.level = :warn
|
351
|
+
elsif opts.quiet?
|
352
|
+
LogUtils::Logger.root.level = :error
|
353
|
+
else
|
354
|
+
## do nothing; keep :info level (default)
|
355
|
+
end
|
356
|
+
|
357
|
+
logger.debug " executing command #{c.name}"
|
358
|
+
true
|
359
|
+
end
|
360
|
+
|
361
|
+
|
362
|
+
post do |global,c,o,args|
|
363
|
+
logger.debug " executed command #{c.name}"
|
364
|
+
true
|
365
|
+
end
|
366
|
+
|
367
|
+
|
368
|
+
on_error do |e|
|
369
|
+
puts
|
370
|
+
puts "*** error: #{e.message}"
|
371
|
+
puts
|
372
|
+
|
373
|
+
## todo/fix: find a better way to print; just raise exception e.g. raise e - why? why not??
|
374
|
+
## puts e.backtrace.inspect if opts.verbose?
|
375
|
+
raise e if opts.verbose?
|
376
|
+
|
377
|
+
false # skip default error handling
|
378
|
+
end
|
379
|
+
|
380
|
+
|
381
|
+
exit run(ARGV)
|
data/lib/pluto/cli/opts.rb
CHANGED
@@ -10,10 +10,27 @@ class Opts
|
|
10
10
|
|
11
11
|
|
12
12
|
def merge_gli_options!( options={} )
|
13
|
-
|
13
|
+
###
|
14
|
+
# todo/check: renamve verbose to debug and quiet to error - why? why not?
|
15
|
+
# use a single (internal) variable for log level - why? why not?
|
16
|
+
|
17
|
+
if options[:verbose] == true ## debug level
|
18
|
+
@verbose = @warn = @quiet = true
|
19
|
+
end
|
20
|
+
|
21
|
+
if options[:warn] == true ## warn level
|
22
|
+
@warn = @quiet = true
|
23
|
+
@verbose = false
|
24
|
+
end
|
25
|
+
|
26
|
+
if options[:quiet] == true ## error level (for now) - why? why not?
|
27
|
+
@quiet = true
|
28
|
+
@verbose = @warn = false
|
29
|
+
end
|
30
|
+
|
14
31
|
|
15
32
|
@db_path = options[:dbpath] if options[:dbpath].present?
|
16
|
-
|
33
|
+
|
17
34
|
if options[:dbname].present?
|
18
35
|
##########
|
19
36
|
# note: c.default_value '<PLANET>.db e.g. ruby.db'
|
@@ -41,20 +58,28 @@ class Opts
|
|
41
58
|
def manifest=(value) @manifest = value; end
|
42
59
|
def manifest() @manifest || 'blank' ; end
|
43
60
|
|
44
|
-
def verbose=(value)
|
45
|
-
@verbose = true # note: always assumes true for now; default is false
|
46
|
-
end
|
47
61
|
|
48
|
-
|
49
|
-
|
50
|
-
end
|
62
|
+
## # note: always assumes true for now for verbose/quiet/warn; default is false
|
63
|
+
def verbose=(value) @verbose = true; end
|
64
|
+
def verbose?() @verbose || false; end
|
65
|
+
def debug?() @verbose || false; end ## add debug? alias for verbose
|
66
|
+
|
67
|
+
def warn=(value) @warn = true; end
|
68
|
+
def warn?() @warn || false; end
|
69
|
+
|
70
|
+
def quiet=(value) @quiet = true; end ## use error/error? - why? why not?
|
71
|
+
def quiet?() @quiet || false; end
|
72
|
+
def error?() @quiet || false; end ## add error? alias for quiet
|
73
|
+
|
74
|
+
|
75
|
+
|
51
76
|
|
52
77
|
def config_path=(value)
|
53
78
|
@config_path = value
|
54
79
|
end
|
55
|
-
|
80
|
+
|
56
81
|
def config_path
|
57
|
-
##
|
82
|
+
## note: defaults to ~/.pluto
|
58
83
|
@config_path || File.join( Env.home, '.pluto' )
|
59
84
|
end
|
60
85
|
|
@@ -62,7 +87,7 @@ class Opts
|
|
62
87
|
def output_path=(value)
|
63
88
|
@output_path = value
|
64
89
|
end
|
65
|
-
|
90
|
+
|
66
91
|
def output_path
|
67
92
|
@output_path || '.'
|
68
93
|
end
|
@@ -75,10 +100,10 @@ class Opts
|
|
75
100
|
def map_fetch_shortcut( key )
|
76
101
|
# NB: always returns an array!!! 0,1 or more entries
|
77
102
|
# - no value - return empty ary
|
78
|
-
|
103
|
+
|
79
104
|
## todo: normalize key???
|
80
105
|
value = @shortcuts.fetch( key, nil )
|
81
|
-
|
106
|
+
|
82
107
|
if value.nil?
|
83
108
|
[]
|
84
109
|
elsif value.kind_of?( String )
|
data/lib/pluto/cli/sysinfo.rb
CHANGED
@@ -10,7 +10,7 @@ class SysInfo
|
|
10
10
|
def initialize( opts )
|
11
11
|
@opts = opts
|
12
12
|
end
|
13
|
-
|
13
|
+
|
14
14
|
attr_reader :opts
|
15
15
|
|
16
16
|
|
@@ -44,7 +44,7 @@ EOS
|
|
44
44
|
# dump Pluto settings
|
45
45
|
# config.dump
|
46
46
|
# puts
|
47
|
-
|
47
|
+
|
48
48
|
|
49
49
|
## todo: add more gem version info
|
50
50
|
# todo: add logutils version
|
data/lib/pluto/cli/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pluto
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gerald Bauer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-11-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pluto-models
|
@@ -114,17 +114,17 @@ dependencies:
|
|
114
114
|
requirements:
|
115
115
|
- - "~>"
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version: '3.
|
117
|
+
version: '3.16'
|
118
118
|
type: :development
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
122
|
- - "~>"
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version: '3.
|
124
|
+
version: '3.16'
|
125
125
|
description: pluto - Another Planet Generator (Lets You Build Web Pages from Published
|
126
126
|
Web Feeds)
|
127
|
-
email:
|
127
|
+
email: wwwmake@googlegroups.com
|
128
128
|
executables:
|
129
129
|
- pluto
|
130
130
|
extensions: []
|
@@ -166,7 +166,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
166
166
|
version: '0'
|
167
167
|
requirements: []
|
168
168
|
rubyforge_project:
|
169
|
-
rubygems_version: 2.
|
169
|
+
rubygems_version: 2.5.2
|
170
170
|
signing_key:
|
171
171
|
specification_version: 4
|
172
172
|
summary: pluto - Another Planet Generator
|