ruboty-megen 1.0.2 → 1.0.3
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/CHANGELOG.md +6 -0
- data/README.md +28 -4
- data/bin/ruboty-megen +32 -31
- data/lib/ruboty/gen/readme.rb +63 -4
- data/lib/ruboty/gen/version.rb +1 -1
- data/sample/README_emoji.md +89 -0
- data/spec/ruboty/gen/readme_spec.rb +77 -1
- 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: 80435792af6109ec46237cc9b2a3ce2f7cf7c223
|
4
|
+
data.tar.gz: 2aa2cd6a156e691cdac79e3a702cbeb6ffc3b1b7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f168b4143afe14dc377f6398cdff1506a40524f96df2c820271548010e74202eba153c5bd3f5cf4415ef4762efe3d5fb81a42b24538eddda60c19362acc40541
|
7
|
+
data.tar.gz: 89905c3e731720778fa567cf46e736ee1c937da84c37015f99b1e3a8254b7120e1b9d6f9011dcddb432858fa5e92b2cdf9712e6c8516a59e8bc08d59f3be73f8
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -8,7 +8,16 @@ Generate README.md for Ruboty Handler + Actions plugin.
|
|
8
8
|
|
9
9
|
[Ruboty](https://github.com/r7kamura/ruboty) is Chat bot framework. Ruby + Bot = Ruboty
|
10
10
|
|
11
|
-
##
|
11
|
+
## :notes: Image
|
12
|
+
Rubotyme => README.md
|
13
|
+
|
14
|
+
:tshirt::jeans::grey_question::grey_question::grey_question::tophat:
|
15
|
+
:tophat::mans_shoe::arrow_right::collision::arrow_right::man:
|
16
|
+
:man::grey_question::grey_question::grey_question::grey_question::tshirt:
|
17
|
+
:grey_question::grey_question::grey_question::grey_question::grey_question::jeans:
|
18
|
+
:grey_question::grey_question::grey_question::grey_question::grey_question::mans_shoe:
|
19
|
+
|
20
|
+
## :arrow_down: Installation
|
12
21
|
|
13
22
|
Add this line to your application's Gemfile:
|
14
23
|
|
@@ -24,7 +33,7 @@ Or install it yourself as:
|
|
24
33
|
|
25
34
|
$ gem install ruboty-megen
|
26
35
|
|
27
|
-
## Rubotyme
|
36
|
+
## :blue_book: Rubotyme
|
28
37
|
### Setting File Parameters
|
29
38
|
|
30
39
|
|key|value|example|
|
@@ -42,7 +51,7 @@ Or install it yourself as:
|
|
42
51
|
|commands/command description|Ruboty::Handler.on description|output empty message N lines (<count> times)|
|
43
52
|
|commands/command example|Ruboty::Handler.on example|example usage|
|
44
53
|
|
45
|
-
## Usage
|
54
|
+
## :scroll: Usage
|
46
55
|
### init
|
47
56
|
generate Rubotyme template file.
|
48
57
|
|
@@ -132,7 +141,22 @@ $ ruboty-megen generate
|
|
132
141
|
|
133
142
|
[sample output ruboty-ume README](./sample/README.md)
|
134
143
|
|
135
|
-
|
144
|
+
### generate with emoji option
|
145
|
+
generate Ruboty Handler + Action README.md template with emoji headings
|
146
|
+
|
147
|
+
* edit Rubotyme file (previous case)
|
148
|
+
|
149
|
+
* generate README
|
150
|
+
|
151
|
+
~~~
|
152
|
+
$ ruboty-megen generate --emoji
|
153
|
+
~~~
|
154
|
+
|
155
|
+
* output
|
156
|
+
|
157
|
+
[sample output ruboty-ume README](./sample/README_emoji.md)
|
158
|
+
|
159
|
+
## :two_men_holding_hands: Contributing :two_women_holding_hands:
|
136
160
|
|
137
161
|
1. Fork it ( https://github.com/tbpgr/ruboty_megen/fork )
|
138
162
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
data/bin/ruboty-megen
CHANGED
@@ -1,31 +1,32 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# encoding: utf-8
|
3
|
-
|
4
|
-
require 'ruboty/gen'
|
5
|
-
require 'ruboty/gen/version'
|
6
|
-
require 'thor'
|
7
|
-
|
8
|
-
module Ruboty
|
9
|
-
# = RubotyMegen CLI
|
10
|
-
class CLI < Thor
|
11
|
-
class_option :help, type: :boolean, aliases: '-h', desc: 'help message.'
|
12
|
-
class_option :version, type: :boolean, desc: 'version'
|
13
|
-
|
14
|
-
desc 'generate', 'Generate README.md template'
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
end
|
30
|
-
|
31
|
-
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# encoding: utf-8
|
3
|
+
|
4
|
+
require 'ruboty/gen'
|
5
|
+
require 'ruboty/gen/version'
|
6
|
+
require 'thor'
|
7
|
+
|
8
|
+
module Ruboty
|
9
|
+
# = RubotyMegen CLI
|
10
|
+
class CLI < Thor
|
11
|
+
class_option :help, type: :boolean, aliases: '-h', desc: 'help message.'
|
12
|
+
class_option :version, type: :boolean, desc: 'version'
|
13
|
+
|
14
|
+
desc 'generate', 'Generate README.md template'
|
15
|
+
option :emoji, type: :boolean, desc: 'Generate README.md template with emoji headings'
|
16
|
+
def generate
|
17
|
+
Ruboty::Gen::Readme.generate(options)
|
18
|
+
end
|
19
|
+
|
20
|
+
desc 'init', 'generate Rubotyme template'
|
21
|
+
def init
|
22
|
+
Ruboty::Gen::Readme.init
|
23
|
+
end
|
24
|
+
|
25
|
+
desc 'version', 'version'
|
26
|
+
def version
|
27
|
+
p Ruboty::Gen::VERSION
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
Ruboty::CLI.start(ARGV)
|
data/lib/ruboty/gen/readme.rb
CHANGED
@@ -135,6 +135,60 @@ Or install it yourself as:
|
|
135
135
|
|
136
136
|
## Contributing
|
137
137
|
|
138
|
+
1. Fork it ( https://github.com/<%=user_name%>/ruboty-<%=gem_name%>/fork )
|
139
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
140
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
141
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
142
|
+
5. Create a new Pull Request
|
143
|
+
EOS
|
144
|
+
|
145
|
+
RUBOTY_README_EMOJI_TEMPLATE = <<-EOS
|
146
|
+
# Ruboty::<%=gem_class_name%>
|
147
|
+
|
148
|
+
An Ruboty Handler + Actions to <%=title%>.
|
149
|
+
|
150
|
+
[Ruboty](https://github.com/r7kamura/ruboty) is Chat bot framework. Ruby + Bot = Ruboty
|
151
|
+
|
152
|
+
## :arrow_down: Installation
|
153
|
+
|
154
|
+
Add this line to your application's Gemfile:
|
155
|
+
|
156
|
+
```ruby
|
157
|
+
gem 'ruboty-<%=gem_name%>'
|
158
|
+
```
|
159
|
+
|
160
|
+
And then execute:
|
161
|
+
|
162
|
+
$ bundle
|
163
|
+
|
164
|
+
Or install it yourself as:
|
165
|
+
|
166
|
+
$ gem install ruboty-<%=gem_name%>
|
167
|
+
|
168
|
+
|
169
|
+
## :cl: Commands
|
170
|
+
|
171
|
+
|Command|Pattern|Description|
|
172
|
+
|:--|:--|:--|
|
173
|
+
<%=command_table%>
|
174
|
+
|
175
|
+
## :scroll: Usage
|
176
|
+
<%=usages%>
|
177
|
+
|
178
|
+
## :earth_asia: ENV
|
179
|
+
|
180
|
+
|Name|Description|
|
181
|
+
|:--|:--|
|
182
|
+
<%=env_table%>
|
183
|
+
|
184
|
+
## :couple: Dependency
|
185
|
+
|
186
|
+
|Name|Description|
|
187
|
+
|:--|:--|
|
188
|
+
<%=dependency_table%>
|
189
|
+
|
190
|
+
## :two_men_holding_hands: Contributing :two_women_holding_hands:
|
191
|
+
|
138
192
|
1. Fork it ( https://github.com/<%=user_name%>/ruboty-<%=gem_name%>/fork )
|
139
193
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
140
194
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
@@ -150,11 +204,11 @@ Or install it yourself as:
|
|
150
204
|
end
|
151
205
|
|
152
206
|
# generate ruboty README.md template.
|
153
|
-
def self.generate
|
207
|
+
def self.generate(options = {})
|
154
208
|
src = read_dsl
|
155
209
|
dsl = Ruboty::Dsl.new
|
156
210
|
dsl.instance_eval src
|
157
|
-
src = apply(dsl.ruboty_megen)
|
211
|
+
src = apply(dsl.ruboty_megen, options)
|
158
212
|
File.open(README, 'w:utf-8') { |file|file.puts src }
|
159
213
|
end
|
160
214
|
|
@@ -164,7 +218,7 @@ Or install it yourself as:
|
|
164
218
|
private_class_method :read_dsl
|
165
219
|
|
166
220
|
# rubocop:disable UselessAssignment
|
167
|
-
def self.apply(config)
|
221
|
+
def self.apply(config, options)
|
168
222
|
gem_class_name = config.gem_class_name
|
169
223
|
gem_name = config.gem_name
|
170
224
|
title = config.title
|
@@ -174,7 +228,7 @@ Or install it yourself as:
|
|
174
228
|
dependency_table = dependency_table(config.dependencies)
|
175
229
|
user_name = config.user_name
|
176
230
|
|
177
|
-
erb = ERB.new(
|
231
|
+
erb = ERB.new(choose_template(options))
|
178
232
|
erb.result(binding)
|
179
233
|
end
|
180
234
|
private_class_method :apply
|
@@ -227,6 +281,11 @@ Or install it yourself as:
|
|
227
281
|
texts.map { |e| e.gsub('|', '|') }
|
228
282
|
end
|
229
283
|
private_class_method :normalize_markdown_table
|
284
|
+
|
285
|
+
def self.choose_template(options)
|
286
|
+
options[:emoji] ? RUBOTY_README_EMOJI_TEMPLATE : RUBOTY_README_TEMPLATE
|
287
|
+
end
|
288
|
+
private_class_method :choose_template
|
230
289
|
end
|
231
290
|
end
|
232
291
|
end
|
data/lib/ruboty/gen/version.rb
CHANGED
@@ -0,0 +1,89 @@
|
|
1
|
+
# Ruboty::Ume
|
2
|
+
|
3
|
+
An Ruboty Handler + Actions to An Ruboty Handler + Actions to output N line messages..
|
4
|
+
|
5
|
+
[Ruboty](https://github.com/r7kamura/ruboty) is Chat bot framework. Ruby + Bot = Ruboty
|
6
|
+
|
7
|
+
## :arrow_down: Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'ruboty-ume'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install ruboty-ume
|
22
|
+
|
23
|
+
|
24
|
+
## :cl: Commands
|
25
|
+
|
26
|
+
|Command|Pattern|Description|
|
27
|
+
|:--|:--|:--|
|
28
|
+
|[ume](#ume)|/ume (?<count>.*?)z/|output empty message N lines (<count> times)|
|
29
|
+
|[umec](#umec)|/umec (?<text>.+?) (?<count>.*?)z/|output <text> message N lines (<count> times)|
|
30
|
+
|
31
|
+
## :scroll: Usage
|
32
|
+
### ume
|
33
|
+
* output empty message N lines (<count> times)
|
34
|
+
|
35
|
+
~~~
|
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
|
+
.
|
48
|
+
~~~
|
49
|
+
|
50
|
+
### umec
|
51
|
+
* output <text> message N lines (<count> times)
|
52
|
+
|
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
|
67
|
+
|
68
|
+
~~~
|
69
|
+
|
70
|
+
## :earth_asia: ENV
|
71
|
+
|
72
|
+
|Name|Description|
|
73
|
+
|:--|:--|
|
74
|
+
|ENV1|ENV1 desc|
|
75
|
+
|ENV2|ENV2 desc|
|
76
|
+
|
77
|
+
## :couple: Dependency
|
78
|
+
|
79
|
+
|Name|Description|
|
80
|
+
|:--|:--|
|
81
|
+
|dependency2|dependency2 description|
|
82
|
+
|
83
|
+
## :two_men_holding_hands: Contributing :two_women_holding_hands:
|
84
|
+
|
85
|
+
1. Fork it ( https://github.com/tbpgr/ruboty-ume/fork )
|
86
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
87
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
88
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
89
|
+
5. Create a new Pull Request
|
@@ -62,6 +62,7 @@ end
|
|
62
62
|
{
|
63
63
|
case_no: 1,
|
64
64
|
case_title: 'valid case',
|
65
|
+
options: {},
|
65
66
|
expected: <<-EOS
|
66
67
|
# Ruboty::SampleGem
|
67
68
|
|
@@ -126,6 +127,81 @@ example2_2
|
|
126
127
|
|
127
128
|
## Contributing
|
128
129
|
|
130
|
+
1. Fork it ( https://github.com/tbpgr/ruboty-sample_gem/fork )
|
131
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
132
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
133
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
134
|
+
5. Create a new Pull Request
|
135
|
+
EOS
|
136
|
+
},
|
137
|
+
{
|
138
|
+
case_no: 1,
|
139
|
+
case_title: 'valid case',
|
140
|
+
options: { emoji: true },
|
141
|
+
expected: <<-EOS
|
142
|
+
# Ruboty::SampleGem
|
143
|
+
|
144
|
+
An Ruboty Handler + Actions to output sample messages.
|
145
|
+
|
146
|
+
[Ruboty](https://github.com/r7kamura/ruboty) is Chat bot framework. Ruby + Bot = Ruboty
|
147
|
+
|
148
|
+
## :arrow_down: Installation
|
149
|
+
|
150
|
+
Add this line to your application's Gemfile:
|
151
|
+
|
152
|
+
```ruby
|
153
|
+
gem 'ruboty-sample_gem'
|
154
|
+
```
|
155
|
+
|
156
|
+
And then execute:
|
157
|
+
|
158
|
+
$ bundle
|
159
|
+
|
160
|
+
Or install it yourself as:
|
161
|
+
|
162
|
+
$ gem install ruboty-sample_gem
|
163
|
+
|
164
|
+
|
165
|
+
## :cl: Commands
|
166
|
+
|
167
|
+
|Command|Pattern|Description|
|
168
|
+
|:--|:--|:--|
|
169
|
+
|[command1](#command1)|/command1 | hoge/|command1 description|
|
170
|
+
|[command2](#command2)|/command2 | hoge/|command2 description|
|
171
|
+
|
172
|
+
## :scroll: Usage
|
173
|
+
### command1
|
174
|
+
* command1 description
|
175
|
+
|
176
|
+
~~~
|
177
|
+
example1_1
|
178
|
+
example1_2
|
179
|
+
~~~
|
180
|
+
|
181
|
+
### command2
|
182
|
+
* command2 description
|
183
|
+
|
184
|
+
~~~
|
185
|
+
example2_1
|
186
|
+
example2_2
|
187
|
+
~~~
|
188
|
+
|
189
|
+
## :earth_asia: ENV
|
190
|
+
|
191
|
+
|Name|Description|
|
192
|
+
|:--|:--|
|
193
|
+
|ENV1|ENV1 description|
|
194
|
+
|ENV2|ENV2 description|
|
195
|
+
|
196
|
+
## :couple: Dependency
|
197
|
+
|
198
|
+
|Name|Description|
|
199
|
+
|:--|:--|
|
200
|
+
|dependency1 name|dependency1 description|
|
201
|
+
|dependency2 name|dependency2 description|
|
202
|
+
|
203
|
+
## :two_men_holding_hands: Contributing :two_women_holding_hands:
|
204
|
+
|
129
205
|
1. Fork it ( https://github.com/tbpgr/ruboty-sample_gem/fork )
|
130
206
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
131
207
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
@@ -144,7 +220,7 @@ example2_2
|
|
144
220
|
# nothing
|
145
221
|
|
146
222
|
# -- when --
|
147
|
-
Ruboty::Gen::Readme.generate
|
223
|
+
Ruboty::Gen::Readme.generate(c[:options])
|
148
224
|
actual = File.open(Ruboty::Gen::Readme::README, 'r:utf-8') { |e|e.read }
|
149
225
|
|
150
226
|
# -- then --
|
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.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- tbpgr
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-12-
|
11
|
+
date: 2014-12-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -110,6 +110,7 @@ files:
|
|
110
110
|
- lib/ruboty/models/env.rb
|
111
111
|
- ruboty-megen.gemspec
|
112
112
|
- sample/README.md
|
113
|
+
- sample/README_emoji.md
|
113
114
|
- sample/Rubotyme
|
114
115
|
- spec/ruboty/gen/readme_spec.rb
|
115
116
|
- spec/spec_helper.rb
|