umu 0.1.3 → 0.1.4
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/.rubocop.yml +15 -6
- data/CHANGELOG.md +9 -0
- data/Gemfile.lock +2 -1
- data/README.md +6 -0
- 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_maker.rb +4 -3
- data/lib/umu/generators/benchmark_maker.rb +6 -4
- data/lib/umu/generators/channel_maker.rb +5 -4
- data/lib/umu/generators/controller_maker.rb +6 -4
- data/lib/umu/generators/helper_maker.rb +4 -3
- data/lib/umu/generators/job_maker.rb +4 -3
- data/lib/umu/generators/mailbox_maker.rb +5 -4
- data/lib/umu/generators/mailer_maker.rb +5 -4
- data/lib/umu/generators/migration_maker.rb +5 -5
- data/lib/umu/generators/model_maker.rb +7 -6
- data/lib/umu/generators/resource_maker.rb +6 -7
- data/lib/umu/generators/task_maker.rb +5 -4
- data/lib/umu/generators.rb +22 -46
- data/lib/umu/version.rb +1 -1
- data/lib/umu.rb +7 -4
- data/umu.gemspec +2 -2
- metadata +8 -8
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
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,12 @@
|
|
1
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
|
8
|
+
|
9
|
+
|
4
10
|
## Installation
|
5
11
|
|
6
12
|
Install the gem and add to the application's Gemfile by executing:
|
@@ -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
|
+
# ApplicationRecordMaker is a module for generating application_record.
|
7
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
|
+
# BenchmarkMaker is a module for generating benchmark.
|
5
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
|
+
# ChannelMaker is a module for generating channel.
|
7
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 ChannelMaker
|
|
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 ChannelMaker
|
|
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,6 +4,7 @@ require_relative '../core/inputter'
|
|
4
4
|
require_relative '../core/selector'
|
5
5
|
require_relative '../beautifica/beautifica'
|
6
6
|
|
7
|
+
# ControllerMaker is a module for generating controller.
|
7
8
|
module ControllerMaker
|
8
9
|
class << self
|
9
10
|
include Template
|
@@ -20,14 +21,15 @@ module ControllerMaker
|
|
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 ControllerMaker
|
|
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 ControllerMaker
|
|
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
|
+
# HelperMaker is a module for generating helper.
|
7
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
|
+
# JobMaker is a module for generating job.
|
7
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
|
+
# MailboxMaker is a module for generating mailbox.
|
7
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 MailboxMaker
|
|
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
|
+
# MailerMaker is a module for generating mailer.
|
7
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 MailerMaker
|
|
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 MailerMaker
|
|
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,6 +4,7 @@ require_relative '../core/inputter'
|
|
4
4
|
require_relative '../core/selector'
|
5
5
|
require_relative '../beautifica/beautifica'
|
6
6
|
|
7
|
+
# MigrationMaker is a module for generating migration.
|
7
8
|
module MigrationMaker
|
8
9
|
class << self
|
9
10
|
include Template
|
@@ -24,25 +25,24 @@ module MigrationMaker
|
|
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,6 +4,7 @@ require_relative '../core/inputter'
|
|
4
4
|
require_relative '../core/selector'
|
5
5
|
require_relative '../beautifica/beautifica'
|
6
6
|
|
7
|
+
# ModelMaker is a module for generating model.
|
7
8
|
module ModelMaker
|
8
9
|
class << self
|
9
10
|
include Template
|
@@ -24,18 +25,18 @@ module ModelMaker
|
|
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 ModelMaker
|
|
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 ModelMaker
|
|
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,8 +1,8 @@
|
|
1
|
-
|
2
1
|
require_relative '../core/inputter'
|
3
2
|
require_relative '../core/selector'
|
4
3
|
require_relative '../beautifica/beautifica'
|
5
4
|
|
5
|
+
# ResourceMaker is a module for generating resource.
|
6
6
|
module ResourceMaker
|
7
7
|
class << self
|
8
8
|
include Template
|
@@ -23,17 +23,17 @@ module ResourceMaker
|
|
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 ResourceMaker
|
|
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 ResourceMaker
|
|
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
|
+
# TaskMaker is a module for generating task.
|
7
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 TaskMaker
|
|
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 TaskMaker
|
|
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
@@ -14,53 +14,29 @@ require_relative 'generators/benchmark_maker'
|
|
14
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
|
-
ModelMaker
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
def self.channel
|
39
|
-
ChannelMaker.generator
|
40
|
-
end
|
41
|
-
|
42
|
-
def self.job
|
43
|
-
JobMaker.generator
|
44
|
-
end
|
45
|
-
|
46
|
-
def self.task
|
47
|
-
TaskMaker.generator
|
48
|
-
end
|
49
|
-
|
50
|
-
def self.mailer
|
51
|
-
MailerMaker.generator
|
52
|
-
end
|
53
|
-
|
54
|
-
def self.mailbox
|
55
|
-
MailboxMaker.generator
|
56
|
-
end
|
57
|
-
|
58
|
-
def self.benchmark
|
59
|
-
BenchmarkMaker.generator
|
60
|
-
end
|
61
|
-
|
62
|
-
def self.resource
|
63
|
-
ResourceMaker.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-03-
|
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
|
@@ -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: []
|