ruboty-megen 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -1
- data/README.md +31 -0
- data/lib/ruboty/gen/readme.rb +9 -3
- data/lib/ruboty/gen/version.rb +1 -1
- data/lib/ruboty/models/command.rb +34 -30
- data/sample/README.md +25 -2
- data/sample/Rubotyme +64 -39
- data/spec/ruboty/gen/readme_spec.rb +12 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cd9e3845a22ba4ba906e9b3bb805e77cd9201ad3
|
4
|
+
data.tar.gz: 6dd40f19d972f8adfcacb34a1847a2a4a3f8d34e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 61160373f68d4194112f616d568a78954bd0ff5f3572d59f1ac26f5f73930cbab293a200bfc6c8e96c510d6923b3e6f799c2b44a4f55d47cc936aa287181f4d3
|
7
|
+
data.tar.gz: 8c6dec855603d32473f6622196a6b1bc50f5cdb92113296d2f90724573be57cce4aa529fa61e0f5e2d5bb43f78e5c7b1a7291e87ecff0692c13d88e230baff53
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -40,6 +40,7 @@ Or install it yourself as:
|
|
40
40
|
|commands/command name|Ruboty::Handler.on name|ume|
|
41
41
|
|commands/command pattern|Ruboty::Handler.on pattern|/ume (?<count>.*?)\z/ |
|
42
42
|
|commands/command description|Ruboty::Handler.on description|output empty message N lines (<count> times)|
|
43
|
+
|commands/command example|Ruboty::Handler.on example|example usage|
|
43
44
|
|
44
45
|
## Usage
|
45
46
|
### init
|
@@ -82,12 +83,42 @@ command do |c|
|
|
82
83
|
c.name "ume"
|
83
84
|
c.pattern "/ume (?<count>.*?)\z/"
|
84
85
|
c.description "output empty message N lines (<count> times)"
|
86
|
+
c.example <<-EOS
|
87
|
+
> ruboty help
|
88
|
+
ruboty /ume (?<count>.*?)\z/ - output empty message N lines (<count> times)
|
89
|
+
> ruboty ume 3
|
90
|
+
.
|
91
|
+
.
|
92
|
+
.
|
93
|
+
> ruboty ume 5
|
94
|
+
.
|
95
|
+
.
|
96
|
+
.
|
97
|
+
.
|
98
|
+
.
|
99
|
+
EOS
|
85
100
|
end
|
86
101
|
|
87
102
|
command do |c|
|
88
103
|
c.name "umec"
|
89
104
|
c.pattern "/umec (?<text>.+?) (?<count>.*?)\z/"
|
90
105
|
c.description "output <text> message N lines (<count> times)"
|
106
|
+
c.example <<-EOS
|
107
|
+
> ruboty help
|
108
|
+
ruboty /umec (?<text>.+?) (?<count>.*?)\z/ - output <text> message N lines (<count> times)
|
109
|
+
> ruboty umec hoge 3
|
110
|
+
hoge
|
111
|
+
hoge
|
112
|
+
hoge
|
113
|
+
|
114
|
+
> ruboty umec hoge 5
|
115
|
+
hoge
|
116
|
+
hoge
|
117
|
+
hoge
|
118
|
+
hoge
|
119
|
+
hoge
|
120
|
+
|
121
|
+
EOS
|
91
122
|
end
|
92
123
|
~~~
|
93
124
|
|
data/lib/ruboty/gen/readme.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
require 'erb'
|
3
3
|
|
4
|
+
# rubocop:disable LineLength
|
4
5
|
module Ruboty
|
5
6
|
module Gen
|
6
7
|
# ReadmeGen Core
|
7
8
|
class Readme
|
8
|
-
# rubocop:disable LineLength
|
9
9
|
README = 'README.md'
|
10
10
|
RUBOTY_MEGEN_FILE = 'Rubotyme'
|
11
11
|
RUBOTY_MEGEN_TEMPLATE = <<-EOS
|
@@ -80,6 +80,11 @@ command do |c|
|
|
80
80
|
# description allow only String
|
81
81
|
# description's default value => ""
|
82
82
|
c.description ""
|
83
|
+
|
84
|
+
# example
|
85
|
+
# example allow only String
|
86
|
+
# example's default value => ""
|
87
|
+
c.example ""
|
83
88
|
end
|
84
89
|
EOS
|
85
90
|
|
@@ -136,7 +141,6 @@ Or install it yourself as:
|
|
136
141
|
4. Push to the branch (`git push origin my-new-feature`)
|
137
142
|
5. Create a new Pull Request
|
138
143
|
EOS
|
139
|
-
# rubocop:enable LineLength
|
140
144
|
|
141
145
|
# generate Rubotymegenfile to current directory.
|
142
146
|
def self.init
|
@@ -191,7 +195,8 @@ Or install it yourself as:
|
|
191
195
|
usages = commands.each_with_object([]) do |e, memo|
|
192
196
|
name = e.read_name
|
193
197
|
description = e.read_description
|
194
|
-
|
198
|
+
example = e.read_example
|
199
|
+
row = ["### #{name}", "* #{description}", '', '~~~', example.chomp, '~~~']
|
195
200
|
memo << row.join("\n")
|
196
201
|
end
|
197
202
|
usages.join("\n\n")
|
@@ -225,3 +230,4 @@ Or install it yourself as:
|
|
225
230
|
end
|
226
231
|
end
|
227
232
|
end
|
233
|
+
# rubocop:enable LineLength
|
data/lib/ruboty/gen/version.rb
CHANGED
@@ -1,30 +1,34 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
|
3
|
-
module Ruboty
|
4
|
-
module Models
|
5
|
-
# Command
|
6
|
-
class Command
|
7
|
-
def initialize
|
8
|
-
@name, @pattern, @description = ''
|
9
|
-
end
|
10
|
-
|
11
|
-
def name(name)
|
12
|
-
@name = name
|
13
|
-
end
|
14
|
-
|
15
|
-
def pattern(pattern)
|
16
|
-
@pattern = pattern
|
17
|
-
end
|
18
|
-
|
19
|
-
def description(description)
|
20
|
-
@description = description
|
21
|
-
end
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
end
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
module Ruboty
|
4
|
+
module Models
|
5
|
+
# Command
|
6
|
+
class Command
|
7
|
+
def initialize
|
8
|
+
@name, @pattern, @description = '', @example = ''
|
9
|
+
end
|
10
|
+
|
11
|
+
def name(name)
|
12
|
+
@name = name
|
13
|
+
end
|
14
|
+
|
15
|
+
def pattern(pattern)
|
16
|
+
@pattern = pattern
|
17
|
+
end
|
18
|
+
|
19
|
+
def description(description)
|
20
|
+
@description = description
|
21
|
+
end
|
22
|
+
|
23
|
+
def example(example)
|
24
|
+
@example = example
|
25
|
+
end
|
26
|
+
|
27
|
+
[:name, :pattern, :description, :example].each do |m|
|
28
|
+
define_method :"read_#{m}" do
|
29
|
+
instance_variable_get("@#{m}")
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
data/sample/README.md
CHANGED
@@ -33,13 +33,37 @@ Or install it yourself as:
|
|
33
33
|
* output empty message N lines (<count> times)
|
34
34
|
|
35
35
|
~~~
|
36
|
-
|
36
|
+
> ruboty help
|
37
|
+
ruboty /ume (?<count>.*?)z/ - output empty message N lines (<count> times)
|
38
|
+
> ruboty ume 3
|
39
|
+
.
|
40
|
+
.
|
41
|
+
.
|
42
|
+
> ruboty ume 5
|
43
|
+
.
|
44
|
+
.
|
45
|
+
.
|
46
|
+
.
|
47
|
+
.
|
37
48
|
~~~
|
38
49
|
|
39
50
|
### umec
|
40
51
|
* output <text> message N lines (<count> times)
|
41
52
|
|
42
53
|
~~~
|
54
|
+
> ruboty help
|
55
|
+
ruboty /umec (?<text>.+?) (?<count>.*?)z/ - output <text> message N lines (<count> times)
|
56
|
+
> ruboty umec hoge 3
|
57
|
+
hoge
|
58
|
+
hoge
|
59
|
+
hoge
|
60
|
+
|
61
|
+
> ruboty umec hoge 5
|
62
|
+
hoge
|
63
|
+
hoge
|
64
|
+
hoge
|
65
|
+
hoge
|
66
|
+
hoge
|
43
67
|
|
44
68
|
~~~
|
45
69
|
|
@@ -54,7 +78,6 @@ Or install it yourself as:
|
|
54
78
|
|
55
79
|
|Name|Description|
|
56
80
|
|:--|:--|
|
57
|
-
|dependency1|dependency1 description|
|
58
81
|
|dependency2|dependency2 description|
|
59
82
|
|
60
83
|
## Contributing
|
data/sample/Rubotyme
CHANGED
@@ -1,39 +1,64 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
user_name "tbpgr"
|
3
|
-
|
4
|
-
gem_class_name "Ume"
|
5
|
-
gem_name "ume"
|
6
|
-
|
7
|
-
title "An Ruboty Handler + Actions to output N line messages."
|
8
|
-
|
9
|
-
env do |e|
|
10
|
-
e.name "ENV1"
|
11
|
-
e.description "ENV1 desc"
|
12
|
-
end
|
13
|
-
|
14
|
-
env do |e|
|
15
|
-
e.name "ENV2"
|
16
|
-
e.description "ENV2 desc"
|
17
|
-
end
|
18
|
-
|
19
|
-
dependency do |d|
|
20
|
-
d.name "
|
21
|
-
d.description "
|
22
|
-
end
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
1
|
+
# encoding: utf-8
|
2
|
+
user_name "tbpgr"
|
3
|
+
|
4
|
+
gem_class_name "Ume"
|
5
|
+
gem_name "ume"
|
6
|
+
|
7
|
+
title "An Ruboty Handler + Actions to output N line messages."
|
8
|
+
|
9
|
+
env do |e|
|
10
|
+
e.name "ENV1"
|
11
|
+
e.description "ENV1 desc"
|
12
|
+
end
|
13
|
+
|
14
|
+
env do |e|
|
15
|
+
e.name "ENV2"
|
16
|
+
e.description "ENV2 desc"
|
17
|
+
end
|
18
|
+
|
19
|
+
dependency do |d|
|
20
|
+
d.name "dependency2"
|
21
|
+
d.description "dependency2 description"
|
22
|
+
end
|
23
|
+
|
24
|
+
command do |c|
|
25
|
+
c.name "ume"
|
26
|
+
c.pattern "/ume (?<count>.*?)\z/"
|
27
|
+
c.description "output empty message N lines (<count> times)"
|
28
|
+
c.example <<-EOS
|
29
|
+
> ruboty help
|
30
|
+
ruboty /ume (?<count>.*?)\z/ - output empty message N lines (<count> times)
|
31
|
+
> ruboty ume 3
|
32
|
+
.
|
33
|
+
.
|
34
|
+
.
|
35
|
+
> ruboty ume 5
|
36
|
+
.
|
37
|
+
.
|
38
|
+
.
|
39
|
+
.
|
40
|
+
.
|
41
|
+
EOS
|
42
|
+
end
|
43
|
+
|
44
|
+
command do |c|
|
45
|
+
c.name "umec"
|
46
|
+
c.pattern "/umec (?<text>.+?) (?<count>.*?)\z/"
|
47
|
+
c.description "output <text> message N lines (<count> times)"
|
48
|
+
c.example <<-EOS
|
49
|
+
> ruboty help
|
50
|
+
ruboty /umec (?<text>.+?) (?<count>.*?)\z/ - output <text> message N lines (<count> times)
|
51
|
+
> ruboty umec hoge 3
|
52
|
+
hoge
|
53
|
+
hoge
|
54
|
+
hoge
|
55
|
+
|
56
|
+
> ruboty umec hoge 5
|
57
|
+
hoge
|
58
|
+
hoge
|
59
|
+
hoge
|
60
|
+
hoge
|
61
|
+
hoge
|
62
|
+
|
63
|
+
EOS
|
64
|
+
end
|
@@ -39,12 +39,20 @@ command do |c|
|
|
39
39
|
c.name 'command1'
|
40
40
|
c.pattern '/command1 | hoge/'
|
41
41
|
c.description 'command1 description'
|
42
|
+
c.example <<-EOT
|
43
|
+
example1_1
|
44
|
+
example1_2
|
45
|
+
EOT
|
42
46
|
end
|
43
47
|
|
44
48
|
command do |c|
|
45
49
|
c.name 'command2'
|
46
50
|
c.pattern '/command2 | hoge/'
|
47
51
|
c.description 'command2 description'
|
52
|
+
c.example <<-EOT
|
53
|
+
example2_1
|
54
|
+
example2_2
|
55
|
+
EOT
|
48
56
|
end
|
49
57
|
EOS
|
50
58
|
template
|
@@ -90,14 +98,16 @@ Or install it yourself as:
|
|
90
98
|
* command1 description
|
91
99
|
|
92
100
|
~~~
|
93
|
-
|
101
|
+
example1_1
|
102
|
+
example1_2
|
94
103
|
~~~
|
95
104
|
|
96
105
|
### command2
|
97
106
|
* command2 description
|
98
107
|
|
99
108
|
~~~
|
100
|
-
|
109
|
+
example2_1
|
110
|
+
example2_2
|
101
111
|
~~~
|
102
112
|
|
103
113
|
## ENV
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruboty-megen
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- tbpgr
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-12-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|