cog 0.0.17 → 0.0.18

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/bin/cog +32 -19
  2. data/lib/cog/generator.rb +2 -2
  3. data/lib/cog/version.rb +1 -1
  4. metadata +3 -3
data/bin/cog CHANGED
@@ -23,22 +23,29 @@ command :init do |c|
23
23
  end
24
24
  end
25
25
 
26
- desc 'Create a generator (or leave name blank to list project generators)'
27
- arg_name 'name'
26
+ desc 'List or create generators for the current project'
28
27
  command [:generator, :gen] do |c|
29
28
 
30
- c.desc 'which tool to use to create the generator'
31
- c.arg_name 'tool_name'
32
- c.default_value 'basic'
33
- c.flag :tool
29
+ c.default_command :list
34
30
 
35
- c.action do |global_options, options, args|
36
- if args.empty?
37
- # List
31
+ c.desc 'List generators for the current project'
32
+ c.command :list do |sub|
33
+ sub.action do |global_options, option, args|
38
34
  x = Cog::Generator.list global_options[:v]
39
35
  puts x.join "\n" unless x.empty?
40
- else
41
- # Create
36
+ end
37
+ end
38
+
39
+ c.desc 'Create a new generator for the current project'
40
+ c.arg_name 'generator_name'
41
+ c.command :new do |sub|
42
+
43
+ sub.desc 'which tool to use to create the generator'
44
+ sub.arg_name 'tool_name'
45
+ sub.default_value 'basic'
46
+ sub.flag :tool
47
+
48
+ sub.action do |global_options, options, args|
42
49
  args.each do |name|
43
50
  Cog::Generator.create name, :tool => options[:tool], :verbose => global_options[:v]
44
51
  end
@@ -46,18 +53,24 @@ command [:generator, :gen] do |c|
46
53
  end
47
54
  end
48
55
 
49
- desc 'Create a tool (or leave name blank to list available tools)'
50
- arg_name 'name'
56
+ desc 'List or create DSLs known as cog tools'
51
57
  skips_pre
52
58
  command :tool do |c|
53
-
54
- c.action do |global_options, options, args|
55
- if args.empty?
56
- # List
59
+
60
+ c.default_command :list
61
+
62
+ c.desc 'List the available tools'
63
+ c.command :list do |sub|
64
+ sub.action do |global_options, options, args|
57
65
  x = Cog::Tool.list global_options[:v]
58
66
  puts x.join "\n" unless x.empty?
59
- else
60
- # Create
67
+ end
68
+ end
69
+
70
+ c.desc 'Create a new tool'
71
+ c.arg_name 'tool_name'
72
+ c.command :new do |sub|
73
+ sub.action do |global_options, options, args|
61
74
  args.each do |name|
62
75
  Cog::Tool.create name
63
76
  end
@@ -132,7 +132,7 @@ module Cog
132
132
  def copy_if_missing(src, dest)
133
133
  unless File.exists? dest
134
134
  FileUtils.cp src, dest
135
- STDOUT.write "Created #{dest}\n".color(:white)
135
+ STDOUT.write "Created #{dest}\n".color(:green)
136
136
  end
137
137
  end
138
138
 
@@ -141,7 +141,7 @@ module Cog
141
141
  path = File.join path_components
142
142
  unless File.exists? path
143
143
  FileUtils.mkdir_p path
144
- STDOUT.write "Created #{path}\n".color(:white)
144
+ STDOUT.write "Created #{path}\n".color(:green)
145
145
  end
146
146
  end
147
147
 
@@ -1,3 +1,3 @@
1
1
  module Cog
2
- VERSION = '0.0.17' unless const_defined? :VERSION
2
+ VERSION = '0.0.18' unless const_defined? :VERSION
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cog
3
3
  version: !ruby/object:Gem::Version
4
- hash: 61
4
+ hash: 59
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 17
10
- version: 0.0.17
9
+ - 18
10
+ version: 0.0.18
11
11
  platform: ruby
12
12
  authors:
13
13
  - Kevin Tonon