umu 0.1.2 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +15 -6
- data/CHANGELOG.md +22 -1
- data/Gemfile.lock +14 -1
- data/README.md +14 -10
- data/lib/umu/beautifica/assets/color.rb +1 -0
- data/lib/umu/beautifica/assets/template.rb +15 -3
- data/lib/umu/core/inputter.rb +1 -0
- data/lib/umu/core/selector.rb +1 -1
- data/lib/umu/generators/{application_record.rb → application_record_maker.rb} +5 -4
- data/lib/umu/generators/{benchmark.rb → benchmark_maker.rb} +7 -5
- data/lib/umu/generators/{channel.rb → channel_maker.rb} +6 -5
- data/lib/umu/generators/{controller.rb → controller_maker.rb} +7 -5
- data/lib/umu/generators/{helper.rb → helper_maker.rb} +5 -4
- data/lib/umu/generators/{job.rb → job_maker.rb} +5 -4
- data/lib/umu/generators/{mailbox.rb → mailbox_maker.rb} +6 -5
- data/lib/umu/generators/{mailer.rb → mailer_maker.rb} +6 -5
- data/lib/umu/generators/{migration.rb → migration_maker.rb} +6 -6
- data/lib/umu/generators/{model.rb → model_maker.rb} +8 -7
- data/lib/umu/generators/{resource.rb → resource_maker.rb} +7 -8
- data/lib/umu/generators/{task.rb → task_maker.rb} +6 -5
- data/lib/umu/generators.rb +34 -58
- data/lib/umu/version.rb +1 -1
- data/lib/umu.rb +7 -4
- data/umu.gemspec +2 -2
- metadata +20 -20
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b732fe56cc1c56176ef9053e8a5dfb30b4f814b5626b789dd083bec905b46043
|
4
|
+
data.tar.gz: fe9a20417e6f41e321be0514d99b3d584de03d961cf277dcf1a4b95bb428d633
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cefd9243e9c650c721e77476aeb6e68fa2ca4c2c76eea6612880b6cccede1e6d04ee8e5b03465a7270302773054b5b14b98655c878ad045742b5a10867fcd42a
|
7
|
+
data.tar.gz: de2eaa14281f6fc86dd38ba056eddbe34233ffa8ba0a120daee866f24cb78d8b18cb4d3fbb7444bff52b0d8eb2b8c2a3d46d84745402b181f4d98c6b14baf09d
|
data/.rubocop.yml
CHANGED
@@ -1,13 +1,22 @@
|
|
1
1
|
AllCops:
|
2
2
|
TargetRubyVersion: 2.6
|
3
|
+
Exclude:
|
4
|
+
- 'Gemfile'
|
5
|
+
- 'Rakefile'
|
6
|
+
- 'umu.gemspec'
|
7
|
+
- 'bin/console'
|
8
|
+
- 'exe/umu'
|
9
|
+
- 'lib/umu/version.rb'
|
3
10
|
|
4
|
-
Style/StringLiterals:
|
5
|
-
|
6
|
-
|
11
|
+
# Style/StringLiterals:
|
12
|
+
# Enabled: true
|
13
|
+
# EnforcedStyle: single_quotes
|
7
14
|
|
8
|
-
Style/StringLiteralsInInterpolation:
|
9
|
-
|
10
|
-
|
15
|
+
# Style/StringLiteralsInInterpolation:
|
16
|
+
# Enabled: true
|
17
|
+
# EnforcedStyle: double_quotes
|
18
|
+
Style/FrozenStringLiteralComment:
|
19
|
+
Enabled: false
|
11
20
|
|
12
21
|
Layout/LineLength:
|
13
22
|
Max: 120
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,26 @@
|
|
1
1
|
## [Unreleased]
|
2
2
|
|
3
|
+
- Language setting
|
4
|
+
|
5
|
+
## [0.1.4] - 2023-03-05
|
6
|
+
|
7
|
+
- fix some bug
|
8
|
+
- refactor
|
9
|
+
- fill spec
|
10
|
+
- modify some setting
|
11
|
+
|
12
|
+
## [0.1.3] - 2023-03-01
|
13
|
+
|
14
|
+
- fix:folder name && some bug is RoR
|
15
|
+
|
16
|
+
## [0.1.2] - 2023-02-28
|
17
|
+
|
18
|
+
- add activesupport in to .gemspec
|
19
|
+
|
20
|
+
## [0.1.1] - 2023-02-28
|
21
|
+
|
22
|
+
- add run command
|
23
|
+
|
3
24
|
## [0.1.0] - 2023-02-28
|
4
25
|
|
5
|
-
- Initial release
|
26
|
+
- Initial release
|
data/Gemfile.lock
CHANGED
@@ -1,14 +1,24 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
umu (0.1.
|
4
|
+
umu (0.1.3)
|
5
|
+
activesupport (>= 3.0.0)
|
5
6
|
|
6
7
|
GEM
|
7
8
|
remote: https://rubygems.org/
|
8
9
|
specs:
|
10
|
+
activesupport (7.0.4.2)
|
11
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
12
|
+
i18n (>= 1.6, < 2)
|
13
|
+
minitest (>= 5.1)
|
14
|
+
tzinfo (~> 2.0)
|
9
15
|
ast (2.4.2)
|
16
|
+
concurrent-ruby (1.2.2)
|
10
17
|
diff-lcs (1.5.0)
|
18
|
+
i18n (1.12.0)
|
19
|
+
concurrent-ruby (~> 1.0)
|
11
20
|
json (2.6.3)
|
21
|
+
minitest (5.17.0)
|
12
22
|
parallel (1.22.1)
|
13
23
|
parser (3.2.1.0)
|
14
24
|
ast (~> 2.4.1)
|
@@ -42,10 +52,13 @@ GEM
|
|
42
52
|
rubocop-ast (1.26.0)
|
43
53
|
parser (>= 3.2.1.0)
|
44
54
|
ruby-progressbar (1.11.0)
|
55
|
+
tzinfo (2.0.6)
|
56
|
+
concurrent-ruby (~> 1.0)
|
45
57
|
unicode-display_width (2.4.2)
|
46
58
|
|
47
59
|
PLATFORMS
|
48
60
|
x86_64-darwin-19
|
61
|
+
x86_64-darwin-21
|
49
62
|
|
50
63
|
DEPENDENCIES
|
51
64
|
rake (~> 13.0)
|
data/README.md
CHANGED
@@ -1,8 +1,11 @@
|
|
1
|
-
# Umu
|
1
|
+
# Umu (prototype)
|
2
2
|
|
3
|
-
|
3
|
+
Umu is a framework that supports you to make & run command in Ruby on Rails
|
4
|
+
|
5
|
+
|
6
|
+
|
7
|
+
https://user-images.githubusercontent.com/78460152/222332886-50337710-4fc8-4437-b82a-f1a64edd95f3.mov
|
4
8
|
|
5
|
-
TODO: Delete this and the text above, and describe your gem
|
6
9
|
|
7
10
|
## Installation
|
8
11
|
|
@@ -10,13 +13,14 @@ Install the gem and add to the application's Gemfile by executing:
|
|
10
13
|
|
11
14
|
$ bundle add umu
|
12
15
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
16
|
+
or
|
17
|
+
```ruby
|
18
|
+
group :development, :test do
|
19
|
+
gem 'umu'
|
20
|
+
end
|
21
|
+
```
|
17
22
|
## Usage
|
18
|
-
|
19
|
-
TODO: Write usage instructions here
|
23
|
+
bundle exec umu
|
20
24
|
|
21
25
|
## Development
|
22
26
|
|
@@ -26,7 +30,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
26
30
|
|
27
31
|
## Contributing
|
28
32
|
|
29
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
33
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/chen-196-hub/umu. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/chen-196-hub/umu/blob/main/CODE_OF_CONDUCT.md).
|
30
34
|
|
31
35
|
## License
|
32
36
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require_relative 'color'
|
4
|
-
|
4
|
+
# Template module is a module for stringIO.
|
5
5
|
module Template
|
6
6
|
include Color
|
7
7
|
def pointer(boolean)
|
@@ -13,11 +13,23 @@ module Template
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def checker(boolean, str)
|
16
|
-
boolean ? "(○) #{
|
16
|
+
boolean ? "(○) #{syan(str)}" : "( ) #{str}"
|
17
17
|
end
|
18
18
|
|
19
19
|
def hover(boolen, str)
|
20
20
|
boolen ? green(str) : str
|
21
21
|
end
|
22
|
-
|
22
|
+
|
23
|
+
def command(generator_name, target_name = '', sub_items = '', options = '')
|
24
|
+
target_name = " #{target_name}" unless target_name.empty?
|
25
|
+
sub_items = " #{sub_items}" unless sub_items.empty?
|
26
|
+
options = " #{options}" unless options.empty?
|
27
|
+
"rails generate #{generator_name}" + target_name + sub_items + options
|
28
|
+
end
|
29
|
+
|
30
|
+
def show_command(generator_name, target_name = '', sub_items = '', options = '')
|
31
|
+
puts green('>') + " #{command(generator_name, target_name, sub_items, options)}"
|
32
|
+
end
|
33
|
+
|
34
|
+
module_function :pointer, :checker, :hover, :cover, :show_command, :command
|
23
35
|
end
|
data/lib/umu/core/inputter.rb
CHANGED
data/lib/umu/core/selector.rb
CHANGED
@@ -4,6 +4,7 @@ require 'io/console'
|
|
4
4
|
require_relative '../beautifica/beautifica'
|
5
5
|
|
6
6
|
module Umu
|
7
|
+
# Selector is a module for selecting items.
|
7
8
|
class Selector
|
8
9
|
extend Template
|
9
10
|
def self.radio(opts = [], content = '')
|
@@ -47,7 +48,6 @@ module Umu
|
|
47
48
|
while (key = $stdin.getch) != "\C-c"
|
48
49
|
if key == "\e"
|
49
50
|
second_key = $stdin.getch
|
50
|
-
|
51
51
|
if second_key == '['
|
52
52
|
key = $stdin.getch
|
53
53
|
case key
|
@@ -4,20 +4,21 @@ require_relative '../core/inputter'
|
|
4
4
|
require_relative '../core/selector'
|
5
5
|
require_relative '../beautifica/beautifica'
|
6
6
|
|
7
|
-
module
|
7
|
+
# ApplicationRecordMaker is a module for generating application_record.
|
8
|
+
module ApplicationRecordMaker
|
8
9
|
class << self
|
9
10
|
include Template
|
10
11
|
def generator
|
11
|
-
|
12
|
+
show_command('application_record')
|
12
13
|
is_make_options = Umu::Selector.single_choice('オプションを追加しますか?')
|
13
14
|
cover(1)
|
14
15
|
options = ''
|
15
16
|
options = Umu::Inputter.input('オプションを入力してください', true) if is_make_options
|
16
17
|
cover(1) if is_make_options
|
17
|
-
command =
|
18
|
+
command = command('application_record', options)
|
18
19
|
cover(1)
|
19
20
|
puts command
|
20
|
-
confirm_content = '
|
21
|
+
confirm_content = '上記コマンドを実行しますか?'
|
21
22
|
run_command = Umu::Selector.single_choice(confirm_content)
|
22
23
|
cover(1)
|
23
24
|
puts confirm_content + (run_command ? 'はい' : 'いいえ')
|
@@ -2,19 +2,21 @@ require_relative '../core/inputter'
|
|
2
2
|
require_relative '../core/selector'
|
3
3
|
require_relative '../beautifica/beautifica'
|
4
4
|
|
5
|
-
module
|
5
|
+
# BenchmarkMaker is a module for generating benchmark.
|
6
|
+
module BenchmarkMaker
|
6
7
|
class << self
|
7
8
|
include Template
|
8
9
|
def generator
|
9
|
-
benchmark_name = Umu::Inputter.input('ベンチマーク名を入力してください (例:
|
10
|
+
benchmark_name = Umu::Inputter.input('ベンチマーク名を入力してください (例:benchmark_name)')
|
10
11
|
cover(1)
|
11
|
-
|
12
|
-
confirm_content = '
|
12
|
+
show_command('benchmark', benchmark_name)
|
13
|
+
confirm_content = '上記コマンドを実行しますか?'
|
13
14
|
run_command = Umu::Selector.single_choice(confirm_content)
|
14
15
|
cover(1)
|
16
|
+
command = command('benchmark', benchmark_name)
|
15
17
|
puts confirm_content + (run_command ? 'はい' : 'いいえ')
|
16
18
|
system(command) if run_command
|
17
19
|
true
|
18
20
|
end
|
19
21
|
end
|
20
|
-
end
|
22
|
+
end
|
@@ -4,13 +4,14 @@ require_relative '../core/inputter'
|
|
4
4
|
require_relative '../core/selector'
|
5
5
|
require_relative '../beautifica/beautifica'
|
6
6
|
|
7
|
-
module
|
7
|
+
# ChannelMaker is a module for generating channel.
|
8
|
+
module ChannelMaker
|
8
9
|
class << self
|
9
10
|
include Template
|
10
11
|
def generator
|
11
|
-
channel_name = Umu::Inputter.input('チャネル名を入力してください (例:
|
12
|
+
channel_name = Umu::Inputter.input('チャネル名を入力してください (例:channel_name)')
|
12
13
|
cover(1)
|
13
|
-
|
14
|
+
show_command('channel', channel_name)
|
14
15
|
make_action = Umu::Selector.single_choice('アクションを追加しますか?')
|
15
16
|
cover(1)
|
16
17
|
actions = []
|
@@ -19,7 +20,7 @@ module Channel
|
|
19
20
|
cover(1)
|
20
21
|
actions << action_name
|
21
22
|
cover(1)
|
22
|
-
|
23
|
+
show_command('channel', channel_name, actions.join(' '))
|
23
24
|
make_action = Umu::Selector.single_choice('追加続きますか?')
|
24
25
|
cover(1)
|
25
26
|
end
|
@@ -29,7 +30,7 @@ module Channel
|
|
29
30
|
options = ''
|
30
31
|
options = Umu::Inputter.input('オプションを入力してください', true) if is_make_options
|
31
32
|
cover(1) if is_make_options
|
32
|
-
command =
|
33
|
+
command = command('channel', channel_name, actions.join(' '), options)
|
33
34
|
cover(1)
|
34
35
|
puts command
|
35
36
|
confirm_content = '上記コマンド実行しますか?'
|
@@ -4,7 +4,8 @@ require_relative '../core/inputter'
|
|
4
4
|
require_relative '../core/selector'
|
5
5
|
require_relative '../beautifica/beautifica'
|
6
6
|
|
7
|
-
module
|
7
|
+
# ControllerMaker is a module for generating controller.
|
8
|
+
module ControllerMaker
|
8
9
|
class << self
|
9
10
|
include Template
|
10
11
|
ACTIONS = %w[
|
@@ -20,14 +21,15 @@ module Controller
|
|
20
21
|
controller_name = Umu::Inputter.input('コントローラー名を入力してください (複数)')
|
21
22
|
cover(1)
|
22
23
|
puts "#=> rails generate controller #{controller_name}"
|
24
|
+
show_command('controller', controller_name)
|
23
25
|
make_actions = Umu::Selector.single_choice('アクション生成しますか?')
|
24
26
|
cover(1)
|
25
27
|
actions = []
|
26
28
|
if make_actions
|
27
|
-
actions = Umu::Selector.checkbox(ACTIONS, '
|
29
|
+
actions = Umu::Selector.checkbox(ACTIONS, 'アクションを選択してください。<スペースキーで選択できます>')
|
28
30
|
cover(1)
|
29
31
|
cover(1)
|
30
|
-
|
32
|
+
show_command('controller', controller_name, actions.join(' '))
|
31
33
|
if actions.include?('other')
|
32
34
|
make_action = true
|
33
35
|
actions.delete('other')
|
@@ -35,7 +37,7 @@ module Controller
|
|
35
37
|
original_action_name = Umu::Inputter.input('アクション名を入力してください', true, actions)
|
36
38
|
actions << original_action_name
|
37
39
|
cover(2)
|
38
|
-
|
40
|
+
show_command('controller', controller_name, actions.join(' '))
|
39
41
|
make_action = Umu::Selector.single_choice('作り続けますか?')
|
40
42
|
cover(1)
|
41
43
|
end
|
@@ -46,7 +48,7 @@ module Controller
|
|
46
48
|
cover(1)
|
47
49
|
options = Umu::Inputter.input('オプションを入力してください', true) if is_make_options
|
48
50
|
cover(1) if is_make_options
|
49
|
-
command =
|
51
|
+
command = command('controller', controller_name, actions.join(' '), options)
|
50
52
|
cover(1)
|
51
53
|
puts command
|
52
54
|
confirm_content = '上記コマンド実行しますか?'
|
@@ -4,19 +4,20 @@ require_relative '../core/inputter'
|
|
4
4
|
require_relative '../core/selector'
|
5
5
|
require_relative '../beautifica/beautifica'
|
6
6
|
|
7
|
-
module
|
7
|
+
# HelperMaker is a module for generating helper.
|
8
|
+
module HelperMaker
|
8
9
|
class << self
|
9
10
|
include Template
|
10
11
|
def generator
|
11
|
-
helper_name = Umu::Inputter.input('ヘルパー名を入力してください (例:
|
12
|
+
helper_name = Umu::Inputter.input('ヘルパー名を入力してください (例:helper_name)')
|
12
13
|
cover(1)
|
13
|
-
|
14
|
+
show_command('helper', helper_name)
|
14
15
|
is_make_options = Umu::Selector.single_choice('オプションを追加しますか?')
|
15
16
|
cover(1)
|
16
17
|
options = ''
|
17
18
|
options = Umu::Inputter.input('オプションを入力してください', true) if is_make_options
|
18
19
|
cover(1) if is_make_options
|
19
|
-
command =
|
20
|
+
command = command('helper', helper_name, options)
|
20
21
|
cover(1)
|
21
22
|
puts command
|
22
23
|
confirm_content = '上記コマンド実行しますか?'
|
@@ -4,19 +4,20 @@ require_relative '../core/inputter'
|
|
4
4
|
require_relative '../core/selector'
|
5
5
|
require_relative '../beautifica/beautifica'
|
6
6
|
|
7
|
-
module
|
7
|
+
# JobMaker is a module for generating job.
|
8
|
+
module JobMaker
|
8
9
|
class << self
|
9
10
|
include Template
|
10
11
|
def generator
|
11
|
-
job_name = Umu::Inputter.input('ジョブ名を入力してください (例:
|
12
|
+
job_name = Umu::Inputter.input('ジョブ名を入力してください (例:job_name)')
|
12
13
|
cover(1)
|
13
|
-
|
14
|
+
show_command('job', job_name)
|
14
15
|
is_make_options = Umu::Selector.single_choice('オプションを追加しますか?')
|
15
16
|
cover(1)
|
16
17
|
options = ''
|
17
18
|
options = Umu::Inputter.input('オプションを入力してください', true) if is_make_options
|
18
19
|
cover(1) if is_make_options
|
19
|
-
command =
|
20
|
+
command = command('job', job_name, options)
|
20
21
|
cover(1)
|
21
22
|
puts command
|
22
23
|
confirm_content = '上記コマンド実行しますか?'
|
@@ -4,19 +4,20 @@ require_relative '../core/inputter'
|
|
4
4
|
require_relative '../core/selector'
|
5
5
|
require_relative '../beautifica/beautifica'
|
6
6
|
|
7
|
-
module
|
7
|
+
# MailboxMaker is a module for generating mailbox.
|
8
|
+
module MailboxMaker
|
8
9
|
class << self
|
9
10
|
include Template
|
10
11
|
def generator
|
11
|
-
mailbox_name = Umu::Inputter.input('メールボックス名を入力してください (例:
|
12
|
+
mailbox_name = Umu::Inputter.input('メールボックス名を入力してください (例:mailbox_name)')
|
12
13
|
cover(1)
|
13
|
-
|
14
|
+
show_command('mailbox', mailbox_name)
|
14
15
|
is_make_options = Umu::Selector.single_choice('オプションを追加しますか?')
|
15
16
|
cover(1)
|
16
17
|
options = ''
|
17
18
|
options = Umu::Inputter.input('オプションを入力してください', true) if is_make_options
|
18
19
|
cover(1) if is_make_options
|
19
|
-
command =
|
20
|
+
command = command('mailbox', mailbox_name, options)
|
20
21
|
cover(1)
|
21
22
|
puts command
|
22
23
|
confirm_content = '上記コマンド実行しますか?'
|
@@ -27,4 +28,4 @@ module Mailbox
|
|
27
28
|
true
|
28
29
|
end
|
29
30
|
end
|
30
|
-
end
|
31
|
+
end
|
@@ -4,13 +4,14 @@ require_relative '../core/inputter'
|
|
4
4
|
require_relative '../core/selector'
|
5
5
|
require_relative '../beautifica/beautifica'
|
6
6
|
|
7
|
-
module
|
7
|
+
# MailerMaker is a module for generating mailer.
|
8
|
+
module MailerMaker
|
8
9
|
class << self
|
9
10
|
include Template
|
10
11
|
def generator
|
11
|
-
mailer_name = Umu::Inputter.input('メーラー名を入力してください (例:
|
12
|
+
mailer_name = Umu::Inputter.input('メーラー名を入力してください (例:mailer_name)')
|
12
13
|
cover(1)
|
13
|
-
|
14
|
+
show_command('mailer', mailer_name)
|
14
15
|
make_action = Umu::Selector.single_choice('アクションを追加しますか?')
|
15
16
|
cover(1)
|
16
17
|
actions = []
|
@@ -19,7 +20,7 @@ module Mailer
|
|
19
20
|
cover(1)
|
20
21
|
actions << action_name
|
21
22
|
cover(1)
|
22
|
-
|
23
|
+
show_command('mailer', mailer_name, actions.join(' '))
|
23
24
|
make_action = Umu::Selector.single_choice('追加続きますか?')
|
24
25
|
cover(1)
|
25
26
|
end
|
@@ -28,7 +29,7 @@ module Mailer
|
|
28
29
|
options = ''
|
29
30
|
options = Umu::Inputter.input('オプションを入力してください', true) if is_make_options
|
30
31
|
cover(1) if is_make_options
|
31
|
-
command =
|
32
|
+
command = command('mailer', mailer_name, actions.join(' '), options)
|
32
33
|
cover(1)
|
33
34
|
puts command
|
34
35
|
confirm_content = '上記コマンド実行しますか?'
|
@@ -4,7 +4,8 @@ require_relative '../core/inputter'
|
|
4
4
|
require_relative '../core/selector'
|
5
5
|
require_relative '../beautifica/beautifica'
|
6
6
|
|
7
|
-
module
|
7
|
+
# MigrationMaker is a module for generating migration.
|
8
|
+
module MigrationMaker
|
8
9
|
class << self
|
9
10
|
include Template
|
10
11
|
COLUMN_TYPE = %w[
|
@@ -24,25 +25,24 @@ module Migration
|
|
24
25
|
def generator
|
25
26
|
migration_name = Umu::Inputter.input('マイグレーション名を入力してください(例: AddNameToUsers・Users)')
|
26
27
|
cover(1)
|
27
|
-
|
28
|
+
show_command('migration', migration_name)
|
28
29
|
is_make_column = Umu::Selector.single_choice('カラム生成しますか?')
|
29
30
|
cover(1)
|
30
31
|
columns = []
|
31
32
|
while is_make_column
|
32
33
|
columns << make_column
|
33
|
-
|
34
|
+
show_command('migration', migration_name, columns.join(' '))
|
34
35
|
is_make_column = Umu::Selector.single_choice('作り続けますか?')
|
35
36
|
cover(1)
|
36
37
|
end
|
37
|
-
|
38
|
+
show_command('migration', migration_name, columns.join(' '))
|
38
39
|
cover(1)
|
39
40
|
is_make_options = Umu::Selector.single_choice('オプションを追加しますか?')
|
40
41
|
cover(1)
|
41
42
|
options = ''
|
42
43
|
options = Umu::Inputter.input('オプションを入力してください', true) if is_make_options
|
43
44
|
cover(1) if is_make_options
|
44
|
-
|
45
|
-
command = "rails generate migration #{migration_name} " + columns.join(' ') + " #{options}"
|
45
|
+
command = command('migration', migration_name, columns.join(' '), options)
|
46
46
|
cover(1)
|
47
47
|
puts command
|
48
48
|
confirm_content = '上記コマンド実行しますか?'
|
@@ -4,7 +4,8 @@ require_relative '../core/inputter'
|
|
4
4
|
require_relative '../core/selector'
|
5
5
|
require_relative '../beautifica/beautifica'
|
6
6
|
|
7
|
-
module
|
7
|
+
# ModelMaker is a module for generating model.
|
8
|
+
module ModelMaker
|
8
9
|
class << self
|
9
10
|
include Template
|
10
11
|
COLUMN_TYPE = %w[
|
@@ -24,18 +25,18 @@ module Model
|
|
24
25
|
def generator
|
25
26
|
model_name = Umu::Inputter.input('モデル名を入力してください (単数)')
|
26
27
|
cover(1)
|
27
|
-
|
28
|
+
show_command('model', model_name)
|
28
29
|
is_make_column = Umu::Selector.single_choice('カラム生成しますか?')
|
29
30
|
cover(1)
|
30
31
|
columns = []
|
31
32
|
while is_make_column
|
32
|
-
columns <<
|
33
|
-
|
33
|
+
columns << make_column
|
34
|
+
show_command('model', model_name, columns.join(' '))
|
34
35
|
is_make_column = Umu::Selector.single_choice('作り続けますか?')
|
35
36
|
cover(1)
|
36
37
|
end
|
37
38
|
|
38
|
-
|
39
|
+
show_command('model', model_name, columns.join(' '))
|
39
40
|
cover(1)
|
40
41
|
is_make_options = Umu::Selector.single_choice('オプションを追加しますか?')
|
41
42
|
cover(1)
|
@@ -43,7 +44,7 @@ module Model
|
|
43
44
|
options = Umu::Inputter.input('オプションを入力してください', true) if is_make_options
|
44
45
|
cover(1) if is_make_options
|
45
46
|
|
46
|
-
command =
|
47
|
+
command = command('model', model_name, columns.join(' '), options)
|
47
48
|
cover(1)
|
48
49
|
puts command
|
49
50
|
confirm_content = '上記コマンド実行しますか?'
|
@@ -54,7 +55,7 @@ module Model
|
|
54
55
|
true
|
55
56
|
end
|
56
57
|
|
57
|
-
def
|
58
|
+
def make_column
|
58
59
|
colum_name = Umu::Inputter.input('カラム名を入力してください')
|
59
60
|
cover(1)
|
60
61
|
type = Umu::Selector.radio(COLUMN_TYPE, 'タイプを選んでください')
|
@@ -1,9 +1,9 @@
|
|
1
|
-
|
2
1
|
require_relative '../core/inputter'
|
3
2
|
require_relative '../core/selector'
|
4
3
|
require_relative '../beautifica/beautifica'
|
5
4
|
|
6
|
-
module
|
5
|
+
# ResourceMaker is a module for generating resource.
|
6
|
+
module ResourceMaker
|
7
7
|
class << self
|
8
8
|
include Template
|
9
9
|
COLUMN_TYPE = %w[
|
@@ -23,17 +23,17 @@ module Resource
|
|
23
23
|
def generator
|
24
24
|
resource_name = Umu::Inputter.input('リソース名を入力してください (単数)')
|
25
25
|
cover(1)
|
26
|
-
|
26
|
+
show_command('resource', resource_name)
|
27
27
|
is_make_column = Umu::Selector.single_choice('カラム生成しますか?')
|
28
28
|
cover(1)
|
29
29
|
columns = []
|
30
30
|
while is_make_column
|
31
31
|
columns << make_colum
|
32
|
-
|
32
|
+
show_command('resource', resource_name, columns.join(' '))
|
33
33
|
is_make_column = Umu::Selector.single_choice('作り続けますか?')
|
34
34
|
cover(1)
|
35
35
|
end
|
36
|
-
|
36
|
+
show_command('resource', resource_name, columns.join(' '))
|
37
37
|
cover(1)
|
38
38
|
|
39
39
|
is_make_options = Umu::Selector.single_choice('オプションを追加しますか?')
|
@@ -41,8 +41,7 @@ module Resource
|
|
41
41
|
options = ''
|
42
42
|
options = Umu::Inputter.input('オプションを入力してください', true) if is_make_options
|
43
43
|
cover(1) if is_make_options
|
44
|
-
|
45
|
-
command = "rails generate resource #{resource_name} " + "#{columns.join(' ')}" + " #{options}"
|
44
|
+
command = command('resource', resource_name, columns.join(' '), options)
|
46
45
|
cover(1)
|
47
46
|
puts command
|
48
47
|
confirm_content = '上記コマンド実行しますか?'
|
@@ -61,4 +60,4 @@ module Resource
|
|
61
60
|
"#{colum_name}:#{type}"
|
62
61
|
end
|
63
62
|
end
|
64
|
-
end
|
63
|
+
end
|
@@ -4,13 +4,14 @@ require_relative '../core/inputter'
|
|
4
4
|
require_relative '../core/selector'
|
5
5
|
require_relative '../beautifica/beautifica'
|
6
6
|
|
7
|
-
module
|
7
|
+
# TaskMaker is a module for generating task.
|
8
|
+
module TaskMaker
|
8
9
|
class << self
|
9
10
|
include Template
|
10
11
|
def generator
|
11
|
-
task_name = Umu::Inputter.input('タスク名を入力してください (例:
|
12
|
+
task_name = Umu::Inputter.input('タスク名を入力してください (例:task_name)')
|
12
13
|
cover(1)
|
13
|
-
|
14
|
+
show_command('task', task_name)
|
14
15
|
make_action = Umu::Selector.single_choice('アクションを追加しますか?')
|
15
16
|
cover(1)
|
16
17
|
actions = []
|
@@ -19,7 +20,7 @@ module Task
|
|
19
20
|
cover(1)
|
20
21
|
actions << action_name
|
21
22
|
cover(1)
|
22
|
-
|
23
|
+
show_command('task', task_name, actions.join(' '))
|
23
24
|
make_action = Umu::Selector.single_choice('追加続きますか?')
|
24
25
|
cover(1)
|
25
26
|
end
|
@@ -29,7 +30,7 @@ module Task
|
|
29
30
|
options = ''
|
30
31
|
options = Umu::Inputter.input('オプションを入力してください', true) if is_make_options
|
31
32
|
cover(1) if is_make_options
|
32
|
-
command =
|
33
|
+
command = command('task', task_name, actions.join(' '), options)
|
33
34
|
cover(1)
|
34
35
|
puts command
|
35
36
|
confirm_content = '上記コマンド実行しますか?'
|
data/lib/umu/generators.rb
CHANGED
@@ -1,66 +1,42 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative 'generators/
|
4
|
-
require_relative 'generators/
|
5
|
-
require_relative 'generators/
|
6
|
-
require_relative 'generators/
|
7
|
-
require_relative 'generators/
|
8
|
-
require_relative 'generators/
|
9
|
-
require_relative 'generators/
|
10
|
-
require_relative 'generators/
|
11
|
-
require_relative 'generators/
|
12
|
-
require_relative 'generators/
|
13
|
-
require_relative 'generators/
|
14
|
-
require_relative 'generators/
|
3
|
+
require_relative 'generators/model_maker'
|
4
|
+
require_relative 'generators/controller_maker'
|
5
|
+
require_relative 'generators/migration_maker'
|
6
|
+
require_relative 'generators/application_record_maker'
|
7
|
+
require_relative 'generators/helper_maker'
|
8
|
+
require_relative 'generators/channel_maker'
|
9
|
+
require_relative 'generators/job_maker'
|
10
|
+
require_relative 'generators/task_maker'
|
11
|
+
require_relative 'generators/mailer_maker'
|
12
|
+
require_relative 'generators/mailbox_maker'
|
13
|
+
require_relative 'generators/benchmark_maker'
|
14
|
+
require_relative 'generators/resource_maker'
|
15
15
|
|
16
16
|
module Umu
|
17
|
+
##
|
18
|
+
# Umu is a tool for automatically generating Rails code.
|
17
19
|
module Generators
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
def self.channel
|
39
|
-
Channel.generator
|
40
|
-
end
|
41
|
-
|
42
|
-
def self.job
|
43
|
-
Job.generator
|
44
|
-
end
|
45
|
-
|
46
|
-
def self.task
|
47
|
-
Task.generator
|
48
|
-
end
|
49
|
-
|
50
|
-
def self.mailer
|
51
|
-
Mailer.generator
|
52
|
-
end
|
53
|
-
|
54
|
-
def self.mailbox
|
55
|
-
Mailbox.generator
|
56
|
-
end
|
57
|
-
|
58
|
-
def self.benchmark
|
59
|
-
Benchmark.generator
|
60
|
-
end
|
61
|
-
|
62
|
-
def self.resource
|
63
|
-
Resource.generator
|
20
|
+
GENERATORS = {
|
21
|
+
model: ModelMaker,
|
22
|
+
controller: ControllerMaker,
|
23
|
+
migration: MigrationMaker,
|
24
|
+
application_record: ApplicationRecordMaker,
|
25
|
+
helper: HelperMaker,
|
26
|
+
channel: ChannelMaker,
|
27
|
+
job: JobMaker,
|
28
|
+
task: TaskMaker,
|
29
|
+
mailer: MailerMaker,
|
30
|
+
mailbox: MailboxMaker,
|
31
|
+
benchmark: BenchmarkMaker,
|
32
|
+
resource: ResourceMaker
|
33
|
+
}.freeze
|
34
|
+
|
35
|
+
def self.run(target)
|
36
|
+
generator = GENERATORS[target.to_sym].generator
|
37
|
+
raise "Invalid target #{target}" unless generator
|
38
|
+
|
39
|
+
generator
|
64
40
|
end
|
65
41
|
end
|
66
42
|
end
|
data/lib/umu/version.rb
CHANGED
data/lib/umu.rb
CHANGED
@@ -4,18 +4,21 @@ require_relative 'umu/core/selector'
|
|
4
4
|
require_relative 'umu/core/inputter'
|
5
5
|
require_relative 'umu/generators'
|
6
6
|
require_relative 'umu/beautifica/beautifica'
|
7
|
-
require_relative
|
7
|
+
require_relative 'umu/version'
|
8
8
|
|
9
|
+
##
|
10
|
+
# UmuはRailsのコードを自動生成するためのツールです。
|
9
11
|
module Umu
|
10
12
|
class Error < StandardError; end
|
11
13
|
include Umu::Generators
|
12
14
|
extend Color
|
13
15
|
def self.generator
|
14
|
-
items = %w[model controller migration application_record helper channel job task mailer mailbox benchmark
|
15
|
-
|
16
|
+
items = %w[model controller migration application_record helper channel job task mailer mailbox benchmark
|
17
|
+
resource].freeze
|
18
|
+
content = "#{green('?')} 何を生成しますか?"
|
16
19
|
target = Umu::Selector.radio(items, content)
|
17
20
|
puts "\e[2A"
|
18
21
|
puts "#{content} #{green(target)}"
|
19
|
-
Umu::Generators.
|
22
|
+
Umu::Generators.run(target)
|
20
23
|
end
|
21
24
|
end
|
data/umu.gemspec
CHANGED
@@ -5,12 +5,12 @@ require_relative "lib/umu/version"
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = "umu"
|
7
7
|
spec.version = Umu::VERSION
|
8
|
-
spec.authors = ["
|
8
|
+
spec.authors = ["Kuan-Hung Chen"]
|
9
9
|
spec.email = ["kankou.chin@gmail.com"]
|
10
10
|
|
11
11
|
spec.summary = "A framework for make Ruby on Rails's command."
|
12
12
|
spec.description = <<-DESCRIPTION
|
13
|
-
Umu is a framework that supports
|
13
|
+
Umu is a framework that supports you to make command in Ruby on Rails.
|
14
14
|
DESCRIPTION
|
15
15
|
spec.homepage = "https://github.com/chen-196-hub/umu"
|
16
16
|
spec.license = "MIT"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: umu
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
8
|
-
autorequire:
|
7
|
+
- Kuan-Hung Chen
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-03-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -24,7 +24,7 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 3.0.0
|
27
|
-
description: " Umu is a framework that supports
|
27
|
+
description: " Umu is a framework that supports you to make command in Ruby on
|
28
28
|
Rails.\n"
|
29
29
|
email:
|
30
30
|
- kankou.chin@gmail.com
|
@@ -51,18 +51,18 @@ files:
|
|
51
51
|
- lib/umu/core/selector.rb
|
52
52
|
- lib/umu/core/validation.rb
|
53
53
|
- lib/umu/generators.rb
|
54
|
-
- lib/umu/generators/
|
55
|
-
- lib/umu/generators/
|
56
|
-
- lib/umu/generators/
|
57
|
-
- lib/umu/generators/
|
58
|
-
- lib/umu/generators/
|
59
|
-
- lib/umu/generators/
|
60
|
-
- lib/umu/generators/
|
61
|
-
- lib/umu/generators/
|
62
|
-
- lib/umu/generators/
|
63
|
-
- lib/umu/generators/
|
64
|
-
- lib/umu/generators/
|
65
|
-
- lib/umu/generators/
|
54
|
+
- lib/umu/generators/application_record_maker.rb
|
55
|
+
- lib/umu/generators/benchmark_maker.rb
|
56
|
+
- lib/umu/generators/channel_maker.rb
|
57
|
+
- lib/umu/generators/controller_maker.rb
|
58
|
+
- lib/umu/generators/helper_maker.rb
|
59
|
+
- lib/umu/generators/job_maker.rb
|
60
|
+
- lib/umu/generators/mailbox_maker.rb
|
61
|
+
- lib/umu/generators/mailer_maker.rb
|
62
|
+
- lib/umu/generators/migration_maker.rb
|
63
|
+
- lib/umu/generators/model_maker.rb
|
64
|
+
- lib/umu/generators/resource_maker.rb
|
65
|
+
- lib/umu/generators/task_maker.rb
|
66
66
|
- lib/umu/version.rb
|
67
67
|
- sig/umu.rbs
|
68
68
|
- umu.gemspec
|
@@ -73,7 +73,7 @@ metadata:
|
|
73
73
|
homepage_uri: https://github.com/chen-196-hub/umu
|
74
74
|
source_code_uri: https://github.com/chen-196-hub/umu
|
75
75
|
changelog_uri: https://github.com/chen-196-hub/umu/blob/master/CHANGELOG.md
|
76
|
-
post_install_message:
|
76
|
+
post_install_message:
|
77
77
|
rdoc_options: []
|
78
78
|
require_paths:
|
79
79
|
- lib
|
@@ -88,8 +88,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '0'
|
90
90
|
requirements: []
|
91
|
-
rubygems_version: 3.
|
92
|
-
signing_key:
|
91
|
+
rubygems_version: 3.4.6
|
92
|
+
signing_key:
|
93
93
|
specification_version: 4
|
94
94
|
summary: A framework for make Ruby on Rails's command.
|
95
95
|
test_files: []
|