quik 0.2.2 → 0.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 65fe26ef815eb90f5e1de85b2412b3fa7dde87a9
4
- data.tar.gz: 23ed7b59e429b71018274ab205ac136f5fad91c2
3
+ metadata.gz: aeea40491434548dcde1a5c1ddb0bda4aa398aad
4
+ data.tar.gz: 40a2bce8ab9174efbb4b7891706dfe25abcd9caf
5
5
  SHA512:
6
- metadata.gz: 81293ea7a0377d720b2b1406c1c975c516c20575655e0220056cbd3437a8860da7d8aac0570a1ed58ed3b5cfbc939ed1e5672701c1869313fce1afcb25204db7
7
- data.tar.gz: 476d30c40d69977c8bff72faa98b8e7f9f83fa2de2b48fd56d9ed04d60af2ef8c2631bf44d2a4cb2299b7bc517de72fa62fe14d656796fc086e5c866866cb6ca
6
+ metadata.gz: 84085b8406a1f652b92d8f8b0a52247293ead73284ff35b3b6a25a078289747bc5132e142172eb921550133a94b8dfc7bcdd297d71b5653668f834c3284b789c
7
+ data.tar.gz: 322f1477876bbc91fdf1de5a48b2bd4f74b2819c2a6c85aa1d05803aa8f5c0e6456ce7f4c9170c1168039743befbb9b22dd78f07b3ac5031f7ef8afe7f474554
@@ -6,6 +6,7 @@ bin/qk
6
6
  bin/quik
7
7
  lib/quik.rb
8
8
  lib/quik/builder.rb
9
+ lib/quik/catalog.rb
9
10
  lib/quik/cli/main.rb
10
11
  lib/quik/cli/opts.rb
11
12
  lib/quik/colors.rb
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.1.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
- new, n - Run ruby quick starter script
38
+ list, ls, l - List ruby quick starter scripts
39
+ new, n - Run ruby quick starter script
39
40
 
40
- help - Shows a list of commands or help for one command
41
- test - (Debug) Test command suite
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
 
@@ -17,6 +17,7 @@ require 'gli'
17
17
 
18
18
  # our own code
19
19
  require 'quik/version' # let version always go first
20
+ require 'quik/catalog'
20
21
  require 'quik/package'
21
22
  require 'quik/merger'
22
23
  require 'quik/config'
@@ -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
@@ -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|
@@ -3,8 +3,8 @@
3
3
  module Quik
4
4
 
5
5
  MAJOR = 0 ## todo: namespace inside version or something - why? why not??
6
- MINOR = 2
7
- PATCH = 2
6
+ MINOR = 3
7
+ PATCH = 0
8
8
  VERSION = [MAJOR,MINOR,PATCH].join('.')
9
9
 
10
10
  def self.version
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.2.2
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-22 00:00:00.000000000 Z
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