umu 0.1.3 → 0.1.5
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 +12 -0
- data/Gemfile +2 -0
- data/README.ja.md +52 -0
- data/README.md +24 -5
- data/README.zh.md +51 -0
- data/exe/umu +22 -1
- data/lib/umu/beautifica/assets/color.rb +1 -0
- data/lib/umu/beautifica/assets/template.rb +26 -3
- data/lib/umu/core/inputter.rb +5 -3
- data/lib/umu/core/language_setting.rb +46 -0
- data/lib/umu/core/selector.rb +1 -1
- data/lib/umu/generators/application_record_maker.rb +8 -6
- data/lib/umu/generators/benchmark_maker.rb +8 -5
- data/lib/umu/generators/channel_maker.rb +13 -11
- data/lib/umu/generators/controller_maker.rb +15 -13
- data/lib/umu/generators/helper_maker.rb +9 -7
- data/lib/umu/generators/job_maker.rb +9 -7
- data/lib/umu/generators/mailbox_maker.rb +10 -8
- data/lib/umu/generators/mailer_maker.rb +13 -11
- data/lib/umu/generators/migration_maker.rb +15 -14
- data/lib/umu/generators/model_maker.rb +17 -15
- data/lib/umu/generators/resource_maker.rb +16 -16
- data/lib/umu/generators/task_maker.rb +13 -11
- data/lib/umu/generators.rb +22 -46
- data/lib/umu/locales/en.yml +59 -0
- data/lib/umu/locales/ja.yml +58 -0
- data/lib/umu/locales/zh.yml +58 -0
- data/lib/umu/version.rb +1 -1
- data/lib/umu.rb +13 -7
- data/umu.gemspec +3 -2
- metadata +28 -9
- data/Gemfile.lock +0 -69
@@ -3,28 +3,30 @@
|
|
3
3
|
require_relative '../core/inputter'
|
4
4
|
require_relative '../core/selector'
|
5
5
|
require_relative '../beautifica/beautifica'
|
6
|
+
require 'i18n'
|
6
7
|
|
8
|
+
# MailboxMaker is a module for generating mailbox.
|
7
9
|
module MailboxMaker
|
8
10
|
class << self
|
9
11
|
include Template
|
10
12
|
def generator
|
11
|
-
mailbox_name = Umu::Inputter.input(
|
13
|
+
mailbox_name = Umu::Inputter.input(I18n.t('mailbox.make_name'))
|
12
14
|
cover(1)
|
13
|
-
|
14
|
-
is_make_options = Umu::Selector.single_choice('
|
15
|
+
show_command('mailbox', mailbox_name)
|
16
|
+
is_make_options = Umu::Selector.single_choice(I18n.t('common.make_options'))
|
15
17
|
cover(1)
|
16
18
|
options = ''
|
17
|
-
options = Umu::Inputter.input('
|
19
|
+
options = Umu::Inputter.input(I18n.t('common.add_option'), true) if is_make_options
|
18
20
|
cover(1) if is_make_options
|
19
|
-
command =
|
21
|
+
command = command('mailbox', mailbox_name, options)
|
20
22
|
cover(1)
|
21
23
|
puts command
|
22
|
-
confirm_content = '
|
24
|
+
confirm_content = I18n.t('common.run_command')
|
23
25
|
run_command = Umu::Selector.single_choice(confirm_content)
|
24
26
|
cover(1)
|
25
|
-
puts confirm_content + (run_command ? '
|
27
|
+
puts confirm_content + (run_command ? I18n.t('affirm') : I18n.t('deny'))
|
26
28
|
system(command) if run_command
|
27
29
|
true
|
28
30
|
end
|
29
31
|
end
|
30
|
-
end
|
32
|
+
end
|
@@ -3,38 +3,40 @@
|
|
3
3
|
require_relative '../core/inputter'
|
4
4
|
require_relative '../core/selector'
|
5
5
|
require_relative '../beautifica/beautifica'
|
6
|
+
require 'i18n'
|
6
7
|
|
8
|
+
# MailerMaker is a module for generating mailer.
|
7
9
|
module MailerMaker
|
8
10
|
class << self
|
9
11
|
include Template
|
10
12
|
def generator
|
11
|
-
mailer_name = Umu::Inputter.input(
|
13
|
+
mailer_name = Umu::Inputter.input(I18n.t('mailer.make_name'))
|
12
14
|
cover(1)
|
13
|
-
|
14
|
-
make_action = Umu::Selector.single_choice('
|
15
|
+
show_command('mailer', mailer_name)
|
16
|
+
make_action = Umu::Selector.single_choice(I18n.t('mailer.make_actions'))
|
15
17
|
cover(1)
|
16
18
|
actions = []
|
17
19
|
while make_action
|
18
|
-
action_name = Umu::Inputter.input(
|
20
|
+
action_name = Umu::Inputter.input(I18n.t('mailer.make_action_name'))
|
19
21
|
cover(1)
|
20
22
|
actions << action_name
|
21
23
|
cover(1)
|
22
|
-
|
23
|
-
make_action = Umu::Selector.single_choice('
|
24
|
+
show_command('mailer', mailer_name, actions.join(' '))
|
25
|
+
make_action = Umu::Selector.single_choice(I18n.t('mailer.make_action_continue'))
|
24
26
|
cover(1)
|
25
27
|
end
|
26
|
-
is_make_options = Umu::Selector.single_choice('
|
28
|
+
is_make_options = Umu::Selector.single_choice(I18n.t('common.make_options'))
|
27
29
|
cover(1)
|
28
30
|
options = ''
|
29
|
-
options = Umu::Inputter.input('
|
31
|
+
options = Umu::Inputter.input(I18n.t('common.add_option'), true) if is_make_options
|
30
32
|
cover(1) if is_make_options
|
31
|
-
command =
|
33
|
+
command = command('mailer', mailer_name, actions.join(' '), options)
|
32
34
|
cover(1)
|
33
35
|
puts command
|
34
|
-
confirm_content = '
|
36
|
+
confirm_content = I18n.t('common.run_command')
|
35
37
|
run_command = Umu::Selector.single_choice(confirm_content)
|
36
38
|
cover(1)
|
37
|
-
puts confirm_content + (run_command ? '
|
39
|
+
puts confirm_content + (run_command ? I18n.t('affirm') : I18n.t('deny'))
|
38
40
|
system(command) if run_command
|
39
41
|
true
|
40
42
|
end
|
@@ -3,7 +3,9 @@
|
|
3
3
|
require_relative '../core/inputter'
|
4
4
|
require_relative '../core/selector'
|
5
5
|
require_relative '../beautifica/beautifica'
|
6
|
+
require 'i18n'
|
6
7
|
|
8
|
+
# MigrationMaker is a module for generating migration.
|
7
9
|
module MigrationMaker
|
8
10
|
class << self
|
9
11
|
include Template
|
@@ -22,41 +24,40 @@ module MigrationMaker
|
|
22
24
|
primary_key
|
23
25
|
].freeze
|
24
26
|
def generator
|
25
|
-
migration_name = Umu::Inputter.input(
|
27
|
+
migration_name = Umu::Inputter.input(I18n.t('migration.make_name'))
|
26
28
|
cover(1)
|
27
|
-
|
28
|
-
is_make_column = Umu::Selector.single_choice('
|
29
|
+
show_command('migration', migration_name)
|
30
|
+
is_make_column = Umu::Selector.single_choice(I18n.t('migration.make_column'))
|
29
31
|
cover(1)
|
30
32
|
columns = []
|
31
33
|
while is_make_column
|
32
34
|
columns << make_column
|
33
|
-
|
34
|
-
is_make_column = Umu::Selector.single_choice('
|
35
|
+
show_command('migration', migration_name, columns.join(' '))
|
36
|
+
is_make_column = Umu::Selector.single_choice(I18n.t('migration.make_column_continue'))
|
35
37
|
cover(1)
|
36
38
|
end
|
37
|
-
|
39
|
+
show_command('migration', migration_name, columns.join(' '))
|
38
40
|
cover(1)
|
39
|
-
is_make_options = Umu::Selector.single_choice('
|
41
|
+
is_make_options = Umu::Selector.single_choice(I18n.t('common.make_options'))
|
40
42
|
cover(1)
|
41
43
|
options = ''
|
42
|
-
options = Umu::Inputter.input('
|
44
|
+
options = Umu::Inputter.input(I18n.t('common.add_option'), true) if is_make_options
|
43
45
|
cover(1) if is_make_options
|
44
|
-
|
45
|
-
command = "rails generate migration #{migration_name} " + columns.join(' ') + " #{options}"
|
46
|
+
command = command('migration', migration_name, columns.join(' '), options)
|
46
47
|
cover(1)
|
47
48
|
puts command
|
48
|
-
confirm_content = '
|
49
|
+
confirm_content = I18n.t('common.run_command')
|
49
50
|
run_command = Umu::Selector.single_choice(confirm_content)
|
50
51
|
cover(1)
|
51
|
-
puts confirm_content + (run_command ? '
|
52
|
+
puts confirm_content + (run_command ? I18n.t('affirm') : I18n.t('deny'))
|
52
53
|
system(command) if run_command
|
53
54
|
true
|
54
55
|
end
|
55
56
|
|
56
57
|
def make_column
|
57
|
-
column_name = Umu::Inputter.input('
|
58
|
+
column_name = Umu::Inputter.input(I18n.t('migration.make_column_name'))
|
58
59
|
cover(1)
|
59
|
-
type = Umu::Selector.radio(COLUMN_TYPE, '
|
60
|
+
type = Umu::Selector.radio(COLUMN_TYPE, I18n.t('migration.choose_column_type'))
|
60
61
|
cover(2)
|
61
62
|
"#{column_name}:#{type}"
|
62
63
|
end
|
@@ -3,7 +3,9 @@
|
|
3
3
|
require_relative '../core/inputter'
|
4
4
|
require_relative '../core/selector'
|
5
5
|
require_relative '../beautifica/beautifica'
|
6
|
+
require 'i18n'
|
6
7
|
|
8
|
+
# ModelMaker is a module for generating model.
|
7
9
|
module ModelMaker
|
8
10
|
class << self
|
9
11
|
include Template
|
@@ -22,42 +24,42 @@ module ModelMaker
|
|
22
24
|
primary_key
|
23
25
|
].freeze
|
24
26
|
def generator
|
25
|
-
model_name = Umu::Inputter.input(
|
27
|
+
model_name = Umu::Inputter.input(I18n.t('model.make_name'))
|
26
28
|
cover(1)
|
27
|
-
|
28
|
-
is_make_column = Umu::Selector.single_choice('
|
29
|
+
show_command('model', model_name)
|
30
|
+
is_make_column = Umu::Selector.single_choice(I18n.t('model.make_column'))
|
29
31
|
cover(1)
|
30
32
|
columns = []
|
31
33
|
while is_make_column
|
32
|
-
columns <<
|
33
|
-
|
34
|
-
is_make_column = Umu::Selector.single_choice('
|
34
|
+
columns << make_column
|
35
|
+
show_command('model', model_name, columns.join(' '))
|
36
|
+
is_make_column = Umu::Selector.single_choice(I18n.t('model.make_column_continue'))
|
35
37
|
cover(1)
|
36
38
|
end
|
37
39
|
|
38
|
-
|
40
|
+
show_command('model', model_name, columns.join(' '))
|
39
41
|
cover(1)
|
40
|
-
is_make_options = Umu::Selector.single_choice('
|
42
|
+
is_make_options = Umu::Selector.single_choice(I18n.t('common.make_options'))
|
41
43
|
cover(1)
|
42
44
|
options = ''
|
43
|
-
options = Umu::Inputter.input('
|
45
|
+
options = Umu::Inputter.input(I18n.t('common.add_option'), true) if is_make_options
|
44
46
|
cover(1) if is_make_options
|
45
47
|
|
46
|
-
command =
|
48
|
+
command = command('model', model_name, columns.join(' '), options)
|
47
49
|
cover(1)
|
48
50
|
puts command
|
49
|
-
confirm_content = '
|
51
|
+
confirm_content = I18n.t('common.run_command')
|
50
52
|
run_command = Umu::Selector.single_choice(confirm_content)
|
51
53
|
cover(1)
|
52
|
-
puts confirm_content + (run_command ?
|
54
|
+
puts confirm_content + (run_command ?I18n.t('affirm') : I18n.t('deny'))
|
53
55
|
system(command) if run_command
|
54
56
|
true
|
55
57
|
end
|
56
58
|
|
57
|
-
def
|
58
|
-
colum_name = Umu::Inputter.input('
|
59
|
+
def make_column
|
60
|
+
colum_name = Umu::Inputter.input(I18n.t('model.make_column_name'))
|
59
61
|
cover(1)
|
60
|
-
type = Umu::Selector.radio(COLUMN_TYPE, '
|
62
|
+
type = Umu::Selector.radio(COLUMN_TYPE, I18n.t('model.choose_column_type'))
|
61
63
|
cover(2)
|
62
64
|
"#{colum_name}:#{type}"
|
63
65
|
end
|
@@ -1,8 +1,9 @@
|
|
1
|
-
|
2
1
|
require_relative '../core/inputter'
|
3
2
|
require_relative '../core/selector'
|
4
3
|
require_relative '../beautifica/beautifica'
|
4
|
+
require 'i18n'
|
5
5
|
|
6
|
+
# ResourceMaker is a module for generating resource.
|
6
7
|
module ResourceMaker
|
7
8
|
class << self
|
8
9
|
include Template
|
@@ -21,44 +22,43 @@ module ResourceMaker
|
|
21
22
|
primary_key
|
22
23
|
].freeze
|
23
24
|
def generator
|
24
|
-
resource_name = Umu::Inputter.input(
|
25
|
+
resource_name = Umu::Inputter.input(I18n.t('resource.make_name'))
|
25
26
|
cover(1)
|
26
|
-
|
27
|
-
is_make_column = Umu::Selector.single_choice('
|
27
|
+
show_command('resource', resource_name)
|
28
|
+
is_make_column = Umu::Selector.single_choice(I18n.t('resource.make_column'))
|
28
29
|
cover(1)
|
29
30
|
columns = []
|
30
31
|
while is_make_column
|
31
32
|
columns << make_colum
|
32
|
-
|
33
|
-
is_make_column = Umu::Selector.single_choice('
|
33
|
+
show_command('resource', resource_name, columns.join(' '))
|
34
|
+
is_make_column = Umu::Selector.single_choice(I18n.t('resource.make_column_continue'))
|
34
35
|
cover(1)
|
35
36
|
end
|
36
|
-
|
37
|
+
show_command('resource', resource_name, columns.join(' '))
|
37
38
|
cover(1)
|
38
39
|
|
39
|
-
is_make_options = Umu::Selector.single_choice('
|
40
|
+
is_make_options = Umu::Selector.single_choice(I18n.t('common.make_options'))
|
40
41
|
cover(1)
|
41
42
|
options = ''
|
42
|
-
options = Umu::Inputter.input('
|
43
|
+
options = Umu::Inputter.input(I18n.t('common.add_option'), true) if is_make_options
|
43
44
|
cover(1) if is_make_options
|
44
|
-
|
45
|
-
command = "rails generate resource #{resource_name} " + "#{columns.join(' ')}" + " #{options}"
|
45
|
+
command = command('resource', resource_name, columns.join(' '), options)
|
46
46
|
cover(1)
|
47
47
|
puts command
|
48
|
-
confirm_content = '
|
48
|
+
confirm_content = I18n.t('common.run_command')
|
49
49
|
run_command = Umu::Selector.single_choice(confirm_content)
|
50
50
|
cover(1)
|
51
|
-
puts confirm_content + (run_command ? '
|
51
|
+
puts confirm_content + (run_command ? I18n.t('affirm') : I18n.t('deny'))
|
52
52
|
system(command) if run_command
|
53
53
|
true
|
54
54
|
end
|
55
55
|
|
56
56
|
def make_colum
|
57
|
-
colum_name = Umu::Inputter.input('
|
57
|
+
colum_name = Umu::Inputter.input(I18n.t('resource.make_column_name'))
|
58
58
|
cover(1)
|
59
|
-
type = Umu::Selector.radio(COLUMN_TYPE, '
|
59
|
+
type = Umu::Selector.radio(COLUMN_TYPE, I18n.t('resource.choose_column_type'))
|
60
60
|
cover(2)
|
61
61
|
"#{colum_name}:#{type}"
|
62
62
|
end
|
63
63
|
end
|
64
|
-
end
|
64
|
+
end
|
@@ -3,39 +3,41 @@
|
|
3
3
|
require_relative '../core/inputter'
|
4
4
|
require_relative '../core/selector'
|
5
5
|
require_relative '../beautifica/beautifica'
|
6
|
+
require 'i18n'
|
6
7
|
|
8
|
+
# TaskMaker is a module for generating task.
|
7
9
|
module TaskMaker
|
8
10
|
class << self
|
9
11
|
include Template
|
10
12
|
def generator
|
11
|
-
task_name = Umu::Inputter.input(
|
13
|
+
task_name = Umu::Inputter.input(I18n.t('task.make_name'))
|
12
14
|
cover(1)
|
13
|
-
|
14
|
-
make_action = Umu::Selector.single_choice('
|
15
|
+
show_command('task', task_name)
|
16
|
+
make_action = Umu::Selector.single_choice(I18n.t('task.make_actions'))
|
15
17
|
cover(1)
|
16
18
|
actions = []
|
17
19
|
while make_action
|
18
|
-
action_name = Umu::Inputter.input('
|
20
|
+
action_name = Umu::Inputter.input(I18n.t('task.make_action_name'), true, actions)
|
19
21
|
cover(1)
|
20
22
|
actions << action_name
|
21
23
|
cover(1)
|
22
|
-
|
23
|
-
make_action = Umu::Selector.single_choice('
|
24
|
+
show_command('task', task_name, actions.join(' '))
|
25
|
+
make_action = Umu::Selector.single_choice(I18n.t('task.make_action_continue'))
|
24
26
|
cover(1)
|
25
27
|
end
|
26
28
|
|
27
|
-
is_make_options = Umu::Selector.single_choice('
|
29
|
+
is_make_options = Umu::Selector.single_choice(I18n.t('common.make_options'))
|
28
30
|
cover(1)
|
29
31
|
options = ''
|
30
|
-
options = Umu::Inputter.input('
|
32
|
+
options = Umu::Inputter.input(I18n.t('common.add_option'), true) if is_make_options
|
31
33
|
cover(1) if is_make_options
|
32
|
-
command =
|
34
|
+
command = command('task', task_name, actions.join(' '), options)
|
33
35
|
cover(1)
|
34
36
|
puts command
|
35
|
-
confirm_content = '
|
37
|
+
confirm_content = I18n.t('common.run_command')
|
36
38
|
run_command = Umu::Selector.single_choice(confirm_content)
|
37
39
|
cover(1)
|
38
|
-
puts confirm_content + (run_command ? '
|
40
|
+
puts confirm_content + (run_command ? I18n.t('affirm') : I18n.t('deny'))
|
39
41
|
system(command) if run_command
|
40
42
|
true
|
41
43
|
end
|
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
|
@@ -0,0 +1,59 @@
|
|
1
|
+
en:
|
2
|
+
umu: 'What do you want to Generator?'
|
3
|
+
affirm: 'Yes'
|
4
|
+
deny: 'No'
|
5
|
+
inputter:
|
6
|
+
required: 'Is required'
|
7
|
+
is_overlap: 'is already exists'
|
8
|
+
common:
|
9
|
+
make_options: 'Add options?'
|
10
|
+
add_option: 'Please enter an option'
|
11
|
+
run_command: 'Do you want to execute the above command? '
|
12
|
+
benchmark:
|
13
|
+
make_name: 'Please enter a benchmark name. (ex: benchmark_name)'
|
14
|
+
channel:
|
15
|
+
make_name: 'Please enter a channel name. (ex: channel_name)'
|
16
|
+
make_actions: 'Do you want to add an action? '
|
17
|
+
make_action_name: 'Please enter action name. (ex: subscribed)'
|
18
|
+
make_action_continue: 'Continue to add actions?'
|
19
|
+
controller:
|
20
|
+
make_name: 'Please enter a controller name (Plural)'
|
21
|
+
make_actions: 'Do you want to add an action? '
|
22
|
+
select_actions: 'Please select action. <Pass the <space> to select>'
|
23
|
+
make_action_name: 'Please enter action name.'
|
24
|
+
make_action_continue: 'Continue to add actions?'
|
25
|
+
helper:
|
26
|
+
make_name: 'Please enter a helper name (ex: helper_name)'
|
27
|
+
job:
|
28
|
+
make_name: 'Please enter a job name (ex: job_name)'
|
29
|
+
mailbox:
|
30
|
+
make_name: 'Please enter a mailbox name (ex: mailbox_name)'
|
31
|
+
mailer:
|
32
|
+
make_name: 'Please enter a mailer name (ex: mailer_name)'
|
33
|
+
make_actions: 'Do you want to add action? '
|
34
|
+
make_action_name: 'Please enter action name. (ex: subscribed)'
|
35
|
+
make_action_continue: 'Continue to add actions?'
|
36
|
+
migration:
|
37
|
+
make_name: 'Please enter a migration name(ex: AddNameToUsers・Users)'
|
38
|
+
make_column: 'Do you want to add column?'
|
39
|
+
make_column_name: 'Please enter column name.'
|
40
|
+
choose_column_type: 'Please choose column type'
|
41
|
+
make_column_continue: 'Continue to add colum ?'
|
42
|
+
model:
|
43
|
+
make_name: 'Please enter a model name.'
|
44
|
+
make_column: 'Do you want to add column?'
|
45
|
+
make_column_name: 'Please enter column name.'
|
46
|
+
choose_column_type: 'Please choose column type'
|
47
|
+
make_column_continue: 'Continue to add colum ?'
|
48
|
+
resource:
|
49
|
+
make_name: 'Please enter a resource name.'
|
50
|
+
make_column: 'Do you want to add column?'
|
51
|
+
make_column_name: 'Please enter column name.'
|
52
|
+
choose_column_type: 'Please choose column type.'
|
53
|
+
make_column_continue: 'Continue to add colum ?'
|
54
|
+
task:
|
55
|
+
make_name: 'Please enter a task name'
|
56
|
+
make_actions: 'Do you want to add action? '
|
57
|
+
make_action_name: 'Please enter action name. (ex: action_name)'
|
58
|
+
make_action_continue: 'Continue to add actions?'
|
59
|
+
|
@@ -0,0 +1,58 @@
|
|
1
|
+
ja:
|
2
|
+
umu: '何を生成しますか?'
|
3
|
+
affirm: 'はい'
|
4
|
+
deny: 'いいえ'
|
5
|
+
inputter:
|
6
|
+
required: '必須項目です'
|
7
|
+
is_overlap: 'は重複です'
|
8
|
+
common:
|
9
|
+
make_options: 'オプションを追加しますか?'
|
10
|
+
add_option: 'オプションを入力してください'
|
11
|
+
run_command: '上記コマンドを実行しますか?'
|
12
|
+
benchmark:
|
13
|
+
make_name: 'ベンチマーク名を入力してください (例:benchmark_name)'
|
14
|
+
channel:
|
15
|
+
make_name: 'チャネル名を入力してください (例:channel_name)'
|
16
|
+
make_actions: 'アクションを追加しますか?'
|
17
|
+
make_action_name: 'アクション名を入力してください (例:subscribed)'
|
18
|
+
make_action_continue: 'アクション追加続きますか?'
|
19
|
+
controller:
|
20
|
+
make_name: 'コントローラー名を入力してください (複数)'
|
21
|
+
make_actions: 'アクションを追加しますか?'
|
22
|
+
select_actions: 'アクションを選択してください。<スペースキーで選択できます>'
|
23
|
+
make_action_name: 'アクション名を入力してください'
|
24
|
+
make_action_continue: 'アクション追加続きますか?'
|
25
|
+
helper:
|
26
|
+
make_name: 'ヘルパー名を入力してください (例:helper_name)'
|
27
|
+
job:
|
28
|
+
make_name: 'ジョブ名を入力してください (例:job_name)'
|
29
|
+
mailbox:
|
30
|
+
make_name: 'メールボックス名を入力してください (例:mailbox_name)'
|
31
|
+
mailer:
|
32
|
+
make_name: 'メーラー名を入力してください (例:mailer_name)'
|
33
|
+
make_actions: 'アクションを追加しますか?'
|
34
|
+
make_action_name: 'アクション名を入力してください (例:subscribed)'
|
35
|
+
make_action_continue: 'アクション追加続きますか?'
|
36
|
+
migration:
|
37
|
+
make_name: 'マイグレーション名を入力してください(例: AddNameToUsers・Users)'
|
38
|
+
make_column: 'カラム生成しますか?'
|
39
|
+
make_column_name: 'カラム名を入力してください'
|
40
|
+
choose_column_type: 'タイプを選んでください'
|
41
|
+
make_column_continue: 'カラムを作り続けますか?'
|
42
|
+
model:
|
43
|
+
make_name: 'モデル名を入力してください (単数)'
|
44
|
+
make_column: 'カラム生成しますか?'
|
45
|
+
make_column_name: 'カラム名を入力してください'
|
46
|
+
choose_column_type: 'タイプを選んでください'
|
47
|
+
make_column_continue: 'カラムを作り続けますか?'
|
48
|
+
resource:
|
49
|
+
make_name: 'リソース名を入力してください (単数)'
|
50
|
+
make_column: 'カラム生成しますか?'
|
51
|
+
make_column_name: 'カラム名を入力してください'
|
52
|
+
choose_column_type: 'タイプを選んでください'
|
53
|
+
make_column_continue: 'カラムを作り続けますか?'
|
54
|
+
task:
|
55
|
+
make_name: 'タスク名を入力してください (例:task_name)'
|
56
|
+
make_actions: 'アクションを追加しますか?'
|
57
|
+
make_action_name: 'アクション名を入力してください (例:action_name)'
|
58
|
+
make_action_continue: 'アクション追加続きますか?'
|
@@ -0,0 +1,58 @@
|
|
1
|
+
zh:
|
2
|
+
umu: '請選擇生成類別。'
|
3
|
+
affirm: '是'
|
4
|
+
deny: '不'
|
5
|
+
inputter:
|
6
|
+
required: '必填項目'
|
7
|
+
is_overlap: '重複'
|
8
|
+
common:
|
9
|
+
make_options: '要添加選項嗎?(options)'
|
10
|
+
add_option: '請輸入選項'
|
11
|
+
run_command: '要執行指令嗎?'
|
12
|
+
benchmark:
|
13
|
+
make_name: '請輸入Benchmark名 (例:benchmark_name)'
|
14
|
+
channel:
|
15
|
+
make_name: '請輸入Channel名 (例:channel_name)'
|
16
|
+
make_actions: '要添加Actions嗎?'
|
17
|
+
make_action_name: '請輸入Action名 (例:subscribed)'
|
18
|
+
make_action_continue: '要繼續添加Action嗎?'
|
19
|
+
controller:
|
20
|
+
make_name: '請輸入Controller名 (複数形)'
|
21
|
+
make_actions: '要添加Actions嗎?'
|
22
|
+
select_actions: '請選擇Action <可按空白鍵複選,other可自定義>'
|
23
|
+
make_action_name: '請輸入Action名'
|
24
|
+
make_action_continue: '要繼續添加Action嗎?'
|
25
|
+
helper:
|
26
|
+
make_name: '請輸入Helper名 (例:helper_name)'
|
27
|
+
job:
|
28
|
+
make_name: '請輸入Job名 (例:job_name)'
|
29
|
+
mailbox:
|
30
|
+
make_name: '請輸入MailBox名 (例:mailbox_name)'
|
31
|
+
mailer:
|
32
|
+
make_name: '請輸入Mailer名 (例:mailer_name)'
|
33
|
+
make_actions: '要添加Actions嗎?'
|
34
|
+
make_action_name: '請輸入Action名 (例:subscribed)'
|
35
|
+
make_action_continue: '要繼續添加Action嗎?'
|
36
|
+
migration:
|
37
|
+
make_name: '請輸入Migration名(例: AddNameToUsers・Users)'
|
38
|
+
make_column: '要定義欄位嗎?'
|
39
|
+
make_column_name: '請輸入欄位名'
|
40
|
+
choose_column_type: '請選擇欄位類型'
|
41
|
+
make_column_continue: '要繼續定義欄位馬?'
|
42
|
+
model:
|
43
|
+
make_name: '請輸入Model名(單數形)'
|
44
|
+
make_column: '要定義欄位嗎?'
|
45
|
+
make_column_name: '請輸入欄位名'
|
46
|
+
choose_column_type: '請選擇欄位類型'
|
47
|
+
make_column_continue: '要繼續定義欄位馬?'
|
48
|
+
resource:
|
49
|
+
make_name: '請輸入Resource名(複數形)'
|
50
|
+
make_column: '要定義欄位嗎?'
|
51
|
+
make_column_name: '請輸入欄位名'
|
52
|
+
choose_column_type: '請選擇欄位類型'
|
53
|
+
make_column_continue: '要繼續定義欄位馬?'
|
54
|
+
task:
|
55
|
+
make_name: '請輸入Task名'
|
56
|
+
make_actions: '要添加Actions嗎?'
|
57
|
+
make_action_name: '請輸入Action名 (例:action_name)'
|
58
|
+
make_action_continue: '要繼續添加Action嗎?'
|
data/lib/umu/version.rb
CHANGED
data/lib/umu.rb
CHANGED
@@ -1,21 +1,27 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative
|
4
|
-
require_relative
|
5
|
-
require_relative
|
3
|
+
require_relative 'umu/core/selector'
|
4
|
+
require_relative 'umu/core/inputter'
|
5
|
+
require_relative 'umu/core/language_setting'
|
6
|
+
require_relative 'umu/generators'
|
6
7
|
require_relative 'umu/beautifica/beautifica'
|
7
|
-
require_relative
|
8
|
+
require_relative 'umu/version'
|
9
|
+
require 'i18n'
|
8
10
|
|
11
|
+
##
|
12
|
+
# UmuはRailsのコードを自動生成するためのツールです。
|
9
13
|
module Umu
|
10
14
|
class Error < StandardError; end
|
11
15
|
include Umu::Generators
|
12
16
|
extend Color
|
13
17
|
def self.generator
|
14
|
-
|
15
|
-
|
18
|
+
Umu::LanguageSetting.setup_language
|
19
|
+
items = %w[model controller migration application_record helper channel job task mailer mailbox benchmark
|
20
|
+
resource].freeze
|
21
|
+
content = "#{green('?')} #{I18n.t(:umu)}"
|
16
22
|
target = Umu::Selector.radio(items, content)
|
17
23
|
puts "\e[2A"
|
18
24
|
puts "#{content} #{green(target)}"
|
19
|
-
Umu::Generators.
|
25
|
+
Umu::Generators.run(target)
|
20
26
|
end
|
21
27
|
end
|