quik 0.2.2 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Manifest.txt +1 -0
- data/README.md +29 -5
- data/lib/quik.rb +1 -0
- data/lib/quik/catalog.rb +56 -0
- data/lib/quik/cli/main.rb +26 -0
- data/lib/quik/version.rb +2 -2
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aeea40491434548dcde1a5c1ddb0bda4aa398aad
|
4
|
+
data.tar.gz: 40a2bce8ab9174efbb4b7891706dfe25abcd9caf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 84085b8406a1f652b92d8f8b0a52247293ead73284ff35b3b6a25a078289747bc5132e142172eb921550133a94b8dfc7bcdd297d71b5653668f834c3284b789c
|
7
|
+
data.tar.gz: 322f1477876bbc91fdf1de5a48b2bd4f74b2819c2a6c85aa1d05803aa8f5c0e6456ce7f4c9170c1168039743befbb9b22dd78f07b3ac5031f7ef8afe7f474554
|
data/Manifest.txt
CHANGED
data/README.md
CHANGED
@@ -26,7 +26,7 @@ SYNOPSIS
|
|
26
26
|
quik [global options] command [command options] [arguments...]
|
27
27
|
|
28
28
|
VERSION
|
29
|
-
0.
|
29
|
+
0.3.0
|
30
30
|
|
31
31
|
GLOBAL OPTIONS
|
32
32
|
--help - Show this message
|
@@ -35,17 +35,41 @@ GLOBAL OPTIONS
|
|
35
35
|
--version - Display the program version
|
36
36
|
|
37
37
|
COMMANDS
|
38
|
-
|
38
|
+
list, ls, l - List ruby quick starter scripts
|
39
|
+
new, n - Run ruby quick starter script
|
39
40
|
|
40
|
-
help
|
41
|
-
test
|
41
|
+
help - Shows a list of commands or help for one command
|
42
|
+
test - (Debug) Test command suite
|
42
43
|
```
|
43
44
|
|
44
45
|
|
45
46
|
### Commands
|
46
47
|
|
48
|
+
[List Wizards](#list-wizard-command---list-ls-l) •
|
47
49
|
[New Wizard](#new-wizard-command---new-n)
|
48
50
|
|
51
|
+
|
52
|
+
#### List Wizards Command - `list`, `ls`, `l`
|
53
|
+
|
54
|
+
Use:
|
55
|
+
|
56
|
+
```
|
57
|
+
$ quik list # or
|
58
|
+
$ quik ls # or
|
59
|
+
$ quik l # or
|
60
|
+
$ qk l
|
61
|
+
```
|
62
|
+
|
63
|
+
Resulting in:
|
64
|
+
|
65
|
+
```
|
66
|
+
1..gem .:. Gem Quick Starter Template
|
67
|
+
2..gem-hoe .:. Gem Quick Starter Template (Hoe Classic Edition)
|
68
|
+
3..sinatra .:. Sinatra Quick Starter Template
|
69
|
+
...
|
70
|
+
```
|
71
|
+
|
72
|
+
|
49
73
|
#### New Wizard Command - `new`, `n`
|
50
74
|
|
51
75
|
To run a quick starter template wizard script
|
@@ -83,7 +107,7 @@ folder.
|
|
83
107
|
|
84
108
|
**More Quick Starter Wizard Scripts**
|
85
109
|
|
86
|
-
For more ruby quick starter scripts, see the [Rubyref Scripts](https://github.com/rubyref/scripts) library.
|
110
|
+
For more ruby quick starter scripts, see the [Rubyref's Scripts](https://github.com/rubyref/scripts) library.
|
87
111
|
|
88
112
|
For static site (e.g. jekyll) quick starter scripts, see the [Mr. Hyde's Scripts](https://github.com/mrhydescripts/scripts) library.
|
89
113
|
|
data/lib/quik.rb
CHANGED
data/lib/quik/catalog.rb
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
module Quik
|
4
|
+
|
5
|
+
class Catalog
|
6
|
+
|
7
|
+
def self.from_url( src )
|
8
|
+
worker = Fetcher::Worker.new
|
9
|
+
text = worker.read_utf8!( src )
|
10
|
+
self.from_string( text )
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.from_file( path )
|
14
|
+
## read in themes catalog
|
15
|
+
text = File.read( path ) ## fix: use File.read_utf8 ??
|
16
|
+
self.from_string( text )
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.from_string( text )
|
20
|
+
self.new( text )
|
21
|
+
end
|
22
|
+
|
23
|
+
|
24
|
+
def initialize( text )
|
25
|
+
@scripts = YAML.load( text )
|
26
|
+
end
|
27
|
+
|
28
|
+
def list( filter=nil )
|
29
|
+
## pp filter
|
30
|
+
|
31
|
+
@scripts.each_with_index do |h,i|
|
32
|
+
name = h['name']
|
33
|
+
summary = h['summary']
|
34
|
+
|
35
|
+
line = ''
|
36
|
+
line << " %3d" % (i+1)
|
37
|
+
line << "..%-10s" % name
|
38
|
+
line << " .:. #{summary}"
|
39
|
+
|
40
|
+
if filter
|
41
|
+
## note: ignore case (upper/lower/downcase) for now
|
42
|
+
## filter on name/title and
|
43
|
+
## tags for now
|
44
|
+
if name.downcase.index(filter.downcase) != nil || ## note: 0 is match found on index 0; only nil is not found
|
45
|
+
summary.downcase.index(filter.downcase) != nil
|
46
|
+
puts line
|
47
|
+
end
|
48
|
+
else
|
49
|
+
puts line
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end # method filter
|
53
|
+
|
54
|
+
end # class Catalog
|
55
|
+
|
56
|
+
end # module Quik
|
data/lib/quik/cli/main.rb
CHANGED
@@ -47,6 +47,18 @@ desc '(Debug) Dry run; run script in simulation for testing'
|
|
47
47
|
switch [:test, :dry_run], negatable: false
|
48
48
|
|
49
49
|
|
50
|
+
def self.fetch_catalog
|
51
|
+
## scripts_dir = "#{Quik.root}/test/data"
|
52
|
+
## catalog = Catalog.new( "#{scripts_dir}/scripts.yml" )
|
53
|
+
|
54
|
+
url = "https://github.com/rubyref/scripts/raw/master/scripts.yml"
|
55
|
+
|
56
|
+
puts "GET #{url}".bold.green ## output network access in green bold
|
57
|
+
|
58
|
+
catalog = Catalog.from_url( url )
|
59
|
+
catalog
|
60
|
+
end
|
61
|
+
|
50
62
|
def self.fetch_script( name )
|
51
63
|
|
52
64
|
## first try local version in working folder
|
@@ -69,6 +81,20 @@ def self.fetch_script( name )
|
|
69
81
|
end
|
70
82
|
|
71
83
|
|
84
|
+
|
85
|
+
desc "List ruby quick starter scripts"
|
86
|
+
arg_name 'QUERY' # optional search query/filter
|
87
|
+
command [:list,:ls,:l] do |c|
|
88
|
+
|
89
|
+
c.action do |g,o,args|
|
90
|
+
## read in scripts diretory
|
91
|
+
catalog = fetch_catalog
|
92
|
+
catalog.list( args[0] ) ## note: pass in filter e.g. args[0]; may be nil (no filter)
|
93
|
+
puts 'Done.'
|
94
|
+
end # action
|
95
|
+
end # command list
|
96
|
+
|
97
|
+
|
72
98
|
desc "Run ruby quick starter script"
|
73
99
|
arg_name 'NAME' # required theme name
|
74
100
|
command [:new,:n] do |c|
|
data/lib/quik/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: quik
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.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: 2015-08-
|
11
|
+
date: 2015-08-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: logutils
|
@@ -129,6 +129,7 @@ files:
|
|
129
129
|
- bin/quik
|
130
130
|
- lib/quik.rb
|
131
131
|
- lib/quik/builder.rb
|
132
|
+
- lib/quik/catalog.rb
|
132
133
|
- lib/quik/cli/main.rb
|
133
134
|
- lib/quik/cli/opts.rb
|
134
135
|
- lib/quik/colors.rb
|