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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 776a0b0480f5df2a0f5095127e34ca0f0169c9a81ea22b6130e04790dc4eac6f
4
- data.tar.gz: 1ea8a941c281359c41ef34ceb04be4daeb40f125a906d4d65ba5232dcd33255a
3
+ metadata.gz: c30b8e9f827c1dce45f825a8827044ebab3bed6c37280f86bb2600fcccfc200f
4
+ data.tar.gz: bd4df35fdd800e87790918d08b82bb8350ed8c526b1f7d93e87da442a39b1cbb
5
5
  SHA512:
6
- metadata.gz: f661264d1664608362cc0d0cb76f76e9b45a96402e080cdafd1594d148f3a904ac19fdb23038091abff8967447ffe1aa3299ae5a4bbb8856bb67cec83cbedffc
7
- data.tar.gz: 8dcbd4d54d81fc84637a086725d18e96887c9c8482fb48df9d9ccfc9435acab14cadc7643fa8ce5a251dfe773235ec24bf5586212e3a34d2d6a1f3728acb9505
6
+ metadata.gz: 99b493bd5a8717282ccf9941ad3277a91f84796b8d5903b593ce3ad351494519663606f98382e8604effd3f284252c5b98669fcd93f1d1d439ceee52367339ad
7
+ data.tar.gz: 77080e865fb06d981fd4d74d965242592f66a3dd6132b229482f3cd7d71ea28781efd6f8112563c0eefaa06ed66daeaccca1cfb16f0e4d3b08cf8edb71fcb92d
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
- Enabled: true
6
- EnforcedStyle: double_quotes
11
+ # Style/StringLiterals:
12
+ # Enabled: true
13
+ # EnforcedStyle: single_quotes
7
14
 
8
- Style/StringLiteralsInInterpolation:
9
- Enabled: true
10
- EnforcedStyle: double_quotes
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,17 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.1.5]
4
+
5
+ - multilingual localization (en,ja,zh)
6
+ - fix: some bug
7
+
8
+ ## [0.1.4] - 2023-03-05
9
+
10
+ - fix some bug
11
+ - refactor
12
+ - fill spec
13
+ - modify some setting
14
+
3
15
  ## [0.1.3] - 2023-03-01
4
16
 
5
17
  - fix:folder name && some bug is RoR
data/Gemfile CHANGED
@@ -10,3 +10,5 @@ gem "rake", "~> 13.0"
10
10
  gem "rspec", "~> 3.0"
11
11
 
12
12
  gem "rubocop", "~> 1.21"
13
+
14
+ gem 'i18n', '~> 1.8'
data/README.ja.md ADDED
@@ -0,0 +1,52 @@
1
+ # Umu (プロトタイプ))
2
+
3
+ Umu はRuby on Rails の`rails generator`コマンドを生成するためのライブラリです。
4
+
5
+
6
+
7
+ https://user-images.githubusercontent.com/78460152/222332886-50337710-4fc8-4437-b82a-f1a64edd95f3.mov
8
+
9
+ # インストール方法
10
+
11
+ gemをインストールし、アプリケーションのGemfileに追加するには、次のコマンドを実行します。
12
+
13
+ $ bundle add umu
14
+
15
+ or
16
+ ```ruby
17
+ group :development, :test do
18
+ gem 'umu'
19
+ end
20
+ ```
21
+
22
+ # 使用方法
23
+ 次のコマンドを実行してください。
24
+
25
+ bundle exec umu
26
+
27
+ ## Doc
28
+
29
+ #### 言語変更
30
+ ```
31
+ bundle exec umu --lang
32
+ # or
33
+ bundle exec umu -l
34
+ ```
35
+ #### オプションの確認
36
+ ```
37
+ bundle exec umu --help
38
+ # or
39
+ bundle exec umu -h
40
+ ```
41
+
42
+ # 貢献方法
43
+ バグ報告やプルリクエストは、https://github.com/chen-196-hub/umu で受け付けています。このプロジェクトは、協力のための安全で歓迎される空間であることを意図しており、貢献者は[行動規範](https://github.com/chen-196-hub/umu/blob/main/CODE_OF_CONDUCT.md)に従うことが期待されています。
44
+
45
+ # ライセンス
46
+ このgemは[MITライセンス](https://opensource.org/licenses/MIT)の下でオープンソースとして利用可能です。
47
+
48
+ # 行動規範
49
+ Umuプロジェクトのコードベース、問題トラッカー、チャットルーム、メーリングリストに参加するすべての人が、[行動規範](https://github.com/chen-196-hub/umu/blob/main/CODE_OF_CONDUCT.md)に従うことを期待しています。
50
+
51
+
52
+
data/README.md CHANGED
@@ -1,6 +1,16 @@
1
+ <div align="center">
2
+ English | <a href="https://github.com/chen-196-hub/umu/blob/main/README.jp.md">日本語</a> | <a href="https://github.com/chen-196-hub/umu/blob/main/README.zh.md">中文</a>
3
+ </div>
4
+
1
5
  # Umu (prototype)
2
6
 
3
7
  Umu is a framework that supports you to make & run command in Ruby on Rails
8
+
9
+
10
+
11
+ https://user-images.githubusercontent.com/78460152/222332886-50337710-4fc8-4437-b82a-f1a64edd95f3.mov
12
+
13
+
4
14
  ## Installation
5
15
 
6
16
  Install the gem and add to the application's Gemfile by executing:
@@ -16,11 +26,20 @@ end
16
26
  ## Usage
17
27
  bundle exec umu
18
28
 
19
- ## Development
29
+ ## Doc
20
30
 
21
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
22
-
23
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
31
+ #### Change language
32
+ ```
33
+ bundle exec umu --lang
34
+ # or
35
+ bundle exec umu -l
36
+ ```
37
+ #### Check Options
38
+ ```
39
+ bundle exec umu --help
40
+ # or
41
+ bundle exec umu -h
42
+ ```
24
43
 
25
44
  ## Contributing
26
45
 
@@ -32,4 +51,4 @@ The gem is available as open source under the terms of the [MIT License](https:/
32
51
 
33
52
  ## Code of Conduct
34
53
 
35
- Everyone interacting in the Umu project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/umu/blob/main/CODE_OF_CONDUCT.md).
54
+ Everyone interacting in the Umu project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/chen-196-hub/umu/blob/main/CODE_OF_CONDUCT.md).
data/README.zh.md ADDED
@@ -0,0 +1,51 @@
1
+
2
+
3
+ # Umu (prototype)
4
+
5
+ Umu 是一個支援在Ruby on Rails中製作和執行`rails generator`指令的框架
6
+
7
+
8
+
9
+ https://user-images.githubusercontent.com/78460152/222332886-50337710-4fc8-4437-b82a-f1a64edd95f3.mov
10
+
11
+
12
+
13
+ # 安裝
14
+ 透過執行以下命令安裝 gem,並將其加入應用程式的 Gemfile 中:
15
+
16
+ $ bundle add umu
17
+
18
+ or
19
+ ```ruby
20
+ group :development, :test do
21
+ gem 'umu'
22
+ end
23
+ ```
24
+
25
+ # 用法
26
+ bundle exec umu
27
+
28
+ ## Doc
29
+
30
+ #### 變更語言
31
+ ```
32
+ bundle exec umu --lang
33
+ # or
34
+ bundle exec umu -l
35
+ ```
36
+ #### 指令選項確認
37
+ ```
38
+ bundle exec umu --help
39
+ # or
40
+ bundle exec umu -h
41
+ ```
42
+
43
+
44
+ # 貢獻
45
+ 歡迎在 https://github.com/chen-196-hub/umu 上報告錯誤和拉取請求。本專案旨在成為一個安全、友好的協作空間,期望貢獻者遵守[行為準則](https://github.com/chen-196-hub/umu/blob/main/CODE_OF_CONDUCT.md)。
46
+
47
+ # 許可證
48
+ 該 gem 以 [MIT 許可證](https://opensource.org/licenses/MIT)的形式作為開放原始碼提供。
49
+
50
+ # 行為準則
51
+ 在 Umu 專案的程式碼庫、問題追蹤器、聊天室和郵件列表中,所有互動都應遵守[行為準則](https://github.com/chen-196-hub/umu/blob/main/CODE_OF_CONDUCT.md)。
data/exe/umu CHANGED
@@ -1,4 +1,25 @@
1
1
  #!/usr/bin/env ruby
2
2
  require 'umu'
3
+ require 'optparse'
3
4
 
4
- Umu.generator
5
+ options = {}
6
+
7
+ OptionParser.new do |opts|
8
+ opts.on("-l", "--lang") do
9
+ options[:lang] = true
10
+ end
11
+ opts.on("-h", "--help") do
12
+ options[:help] = true
13
+ end
14
+ end.parse!
15
+
16
+
17
+ if options[:lang]
18
+ Umu::LanguageSetting.change_language
19
+ elsif options[:help]
20
+ puts 'UMU '
21
+ puts 'bundle exec umu [options]'
22
+ puts ' -l, --lang: change language'
23
+ else
24
+ Umu.generator
25
+ end
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ # Color module is a module for colorizing string.
3
4
  module Color
4
5
  COLORS = {
5
6
  black: 30,
@@ -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,34 @@ module Template
13
13
  end
14
14
 
15
15
  def checker(boolean, str)
16
- boolean ? "(○) #{blue(str)}" : "( ) #{str}"
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
- module_function :pointer, :checker, :hover, :cover
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
+ def logo
35
+ print <<-'UMU'
36
+ _ _
37
+ | | | |_ __ ___ _ _
38
+ | | | | '_ ` _ \| | | |
39
+ | |_| | | | | | | |_| |
40
+ \___/|_| |_| |_|\__,_|
41
+
42
+ UMU
43
+ end
44
+
45
+ module_function :pointer, :checker, :hover, :cover, :show_command, :command
23
46
  end
@@ -2,8 +2,10 @@
2
2
 
3
3
  require_relative 'validation'
4
4
  require_relative '../beautifica/beautifica'
5
+ require 'i18n'
5
6
 
6
7
  module Umu
8
+ # Inputter is a module for inputting.
7
9
  class Inputter
8
10
  extend Template
9
11
  def self.input(content, has_vaild = false, check_target = [])
@@ -13,7 +15,7 @@ module Umu
13
15
  while is_empty
14
16
  cover(2)
15
17
  puts "\e[1A"
16
- puts "#{content} #{red('必須項目です')}"
18
+ puts "#{content} #{red(I18n.t('inputter.required'))}"
17
19
  input_val = gets
18
20
  is_empty = input_val.chomp == ''
19
21
  end
@@ -23,14 +25,14 @@ module Umu
23
25
  while is_overlap
24
26
  cover(2)
25
27
  puts "\e[1A"
26
- puts "#{content} #{red("#{input_val.chomp}は重複です")}"
28
+ puts "#{content} #{red("#{input_val.chomp} #{I18n.t('inputter.is_overlap')}")}"
27
29
  input_val = gets
28
30
 
29
31
  is_empty = input_val.chomp == ''
30
32
  while is_empty
31
33
  cover(2)
32
34
  puts "\e[1A"
33
- puts "#{content} #{red('必須項目です')}"
35
+ puts "#{content} #{red(I18n.t('inputter.required'))}"
34
36
  input_val = gets
35
37
  is_empty = input_val.chomp == ''
36
38
  end
@@ -0,0 +1,46 @@
1
+ require 'yaml'
2
+ require 'i18n'
3
+ require_relative 'selector'
4
+ require_relative '../beautifica/beautifica'
5
+
6
+ I18n.load_path = Dir[File.join(File.dirname(__FILE__), '..', 'locales', '*.yml')]
7
+
8
+ module Umu
9
+ # LanguageSetting is a module for setting language.
10
+ class LanguageSetting
11
+ extend Template
12
+ LANG = {
13
+ en: 'English',
14
+ zh: '中文',
15
+ ja: '日本語'
16
+ }.freeze
17
+ LANG_PATH = File.join(File.dirname(__FILE__), '../../..', '.umu_lang')
18
+
19
+ def self.setup_language
20
+ save_language_choice(prompt_language) unless File.exist?(LANG_PATH)
21
+ umu_lang = YAML.load_file(LANG_PATH)
22
+ lang = umu_lang['language']
23
+ I18n.locale = lang
24
+ end
25
+
26
+ def self.prompt_language
27
+ logo
28
+ content = 'Please select a language:'
29
+ item = Umu::Selector.radio(LANG.values, content)
30
+ cover(1)
31
+ puts "#{content} #{green(item)}"
32
+ LANG.key(item)
33
+ end
34
+
35
+ def self.save_language_choice(lang)
36
+ umu_lang = {}
37
+ umu_lang['language'] = lang
38
+ File.write(LANG_PATH, umu_lang.to_yaml)
39
+ end
40
+
41
+ def self.change_language
42
+ File.exist?(LANG_PATH) ? File.delete(LANG_PATH) : nil
43
+ setup_language
44
+ end
45
+ end
46
+ end
@@ -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
@@ -3,24 +3,26 @@
3
3
  require_relative '../core/inputter'
4
4
  require_relative '../core/selector'
5
5
  require_relative '../beautifica/beautifica'
6
+ require 'i18n'
6
7
 
8
+ # ApplicationRecordMaker is a module for generating application_record.
7
9
  module ApplicationRecordMaker
8
10
  class << self
9
11
  include Template
10
12
  def generator
11
- puts '#=> rails generate application_record'
12
- is_make_options = Umu::Selector.single_choice('オプションを追加しますか?')
13
+ show_command('application_record')
14
+ is_make_options = Umu::Selector.single_choice(I18n.t('common.make_options'))
13
15
  cover(1)
14
16
  options = ''
15
- options = Umu::Inputter.input('オプションを入力してください', true) if is_make_options
17
+ options = Umu::Inputter.input(I18n.t('common.add_option'), true) if is_make_options
16
18
  cover(1) if is_make_options
17
- command = "rails generate application_record #{options}"
19
+ command = command('application_record', options)
18
20
  cover(1)
19
21
  puts command
20
- confirm_content = '上記コマンド実行しますか?'
22
+ confirm_content = I18n.t('common.run_command')
21
23
  run_command = Umu::Selector.single_choice(confirm_content)
22
24
  cover(1)
23
- puts confirm_content + (run_command ? 'はい' : 'いいえ')
25
+ puts confirm_content + (run_command ? I18n.t('affirm') : I18n.t('deny'))
24
26
  system(command) if run_command
25
27
  true
26
28
  end
@@ -1,20 +1,23 @@
1
1
  require_relative '../core/inputter'
2
2
  require_relative '../core/selector'
3
3
  require_relative '../beautifica/beautifica'
4
+ require 'i18n'
4
5
 
6
+ # BenchmarkMaker is a module for generating benchmark.
5
7
  module BenchmarkMaker
6
8
  class << self
7
9
  include Template
8
10
  def generator
9
- benchmark_name = Umu::Inputter.input('ベンチマーク名を入力してください (例:CreditCard)')
11
+ benchmark_name = Umu::Inputter.input(I18n.t('benchmark.make_name'))
10
12
  cover(1)
11
- puts "#=> rails generate benchmark #{benchmark_name}"
12
- confirm_content = '上記コマンド実行しますか?'
13
+ show_command('benchmark', benchmark_name)
14
+ confirm_content = I18n.t('common.run_command')
13
15
  run_command = Umu::Selector.single_choice(confirm_content)
14
16
  cover(1)
15
- puts confirm_content + (run_command ? 'はい' : 'いいえ')
17
+ command = command('benchmark', benchmark_name)
18
+ puts confirm_content + (run_command ? I18n.t('affirm') : I18n.t('deny'))
16
19
  system(command) if run_command
17
20
  true
18
21
  end
19
22
  end
20
- end
23
+ 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
+ # ChannelMaker is a module for generating channel.
7
9
  module ChannelMaker
8
10
  class << self
9
11
  include Template
10
12
  def generator
11
- channel_name = Umu::Inputter.input('チャネル名を入力してください (例:ChatChannel)')
13
+ channel_name = Umu::Inputter.input(I18n.t('channel.make_name'))
12
14
  cover(1)
13
- puts "#=> rails generate channel #{channel_name}"
14
- make_action = Umu::Selector.single_choice('アクションを追加しますか?')
15
+ show_command('channel', channel_name)
16
+ make_action = Umu::Selector.single_choice(I18n.t('channel.make_actions'))
15
17
  cover(1)
16
18
  actions = []
17
19
  while make_action
18
- action_name = Umu::Inputter.input('アクション名を入力してください (例:subscribed)')
20
+ action_name = Umu::Inputter.input(I18n.t('channel.make_action_name'))
19
21
  cover(1)
20
22
  actions << action_name
21
23
  cover(1)
22
- puts "#=> rails generate channel #{channel_name} #{actions.join(' ')}"
23
- make_action = Umu::Selector.single_choice('追加続きますか?')
24
+ show_command('channel', channel_name, actions.join(' '))
25
+ make_action = Umu::Selector.single_choice(I18n.t('channel.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('オプションを入力してください', true) if is_make_options
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 = "rails generate channel #{channel_name} " + actions.join(' ').to_s + " #{options}"
34
+ command = command('channel', channel_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
@@ -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
+ # ControllerMaker is a module for generating controller.
7
9
  module ControllerMaker
8
10
  class << self
9
11
  include Template
@@ -17,42 +19,42 @@ module ControllerMaker
17
19
  other
18
20
  ].freeze
19
21
  def generator
20
- controller_name = Umu::Inputter.input('コントローラー名を入力してください (複数)')
22
+ controller_name = Umu::Inputter.input(I18n.t('controller.make_name'))
21
23
  cover(1)
22
- puts "#=> rails generate controller #{controller_name}"
23
- make_actions = Umu::Selector.single_choice('アクション生成しますか?')
24
+ show_command('controller', controller_name)
25
+ make_actions = Umu::Selector.single_choice(I18n.t('controller.make_actions'))
24
26
  cover(1)
25
27
  actions = []
26
28
  if make_actions
27
- actions = Umu::Selector.checkbox(ACTIONS, 'アクションを選択してください。')
29
+ actions = Umu::Selector.checkbox(ACTIONS, I18n.t('controller.select_actions'))
28
30
  cover(1)
29
31
  cover(1)
30
- puts "#=> rails generate controller #{controller_name} #{actions.join(' ')}"
32
+ show_command('controller', controller_name, actions.join(' '))
31
33
  if actions.include?('other')
32
34
  make_action = true
33
35
  actions.delete('other')
34
36
  while make_action
35
- original_action_name = Umu::Inputter.input('アクション名を入力してください', true, actions)
37
+ original_action_name = Umu::Inputter.input(I18n.t('controller.make_action_name'), true, actions)
36
38
  actions << original_action_name
37
39
  cover(2)
38
- puts "#=> rails generate controller #{controller_name} #{actions.join(' ')}"
39
- make_action = Umu::Selector.single_choice('作り続けますか?')
40
+ show_command('controller', controller_name, actions.join(' '))
41
+ make_action = Umu::Selector.single_choice(I18n.t('controller.make_action_continue'))
40
42
  cover(1)
41
43
  end
42
44
  end
43
45
  end
44
- is_make_options = Umu::Selector.single_choice('オプションを追加しますか?')
46
+ is_make_options = Umu::Selector.single_choice(I18n.t('common.make_options'))
45
47
  options = ''
46
48
  cover(1)
47
- options = Umu::Inputter.input('オプションを入力してください', true) if is_make_options
49
+ options = Umu::Inputter.input(I18n.t('common.add_option'), true) if is_make_options
48
50
  cover(1) if is_make_options
49
- command = "rails generate controller #{controller_name} #{actions.join(' ')} #{options}"
51
+ command = command('controller', controller_name, actions.join(' '), options)
50
52
  cover(1)
51
53
  puts command
52
- confirm_content = '上記コマンド実行しますか?'
54
+ confirm_content = I18n.t('common.run_command')
53
55
  run_command = Umu::Selector.single_choice(confirm_content)
54
56
  cover(1)
55
- puts confirm_content + (run_command ? 'はい' : 'いいえ')
57
+ puts confirm_content + (run_command ? I18n.t('affirm') : I18n.t('deny'))
56
58
  system(command) if run_command
57
59
  true
58
60
  end
@@ -3,26 +3,28 @@
3
3
  require_relative '../core/inputter'
4
4
  require_relative '../core/selector'
5
5
  require_relative '../beautifica/beautifica'
6
+ require 'i18n'
6
7
 
8
+ # HelperMaker is a module for generating helper.
7
9
  module HelperMaker
8
10
  class << self
9
11
  include Template
10
12
  def generator
11
- helper_name = Umu::Inputter.input('ヘルパー名を入力してください (例:CreditCard)')
13
+ helper_name = Umu::Inputter.input(I18n.t('helper.make_name'))
12
14
  cover(1)
13
- puts "#=> rails generate helper #{helper_name}"
14
- is_make_options = Umu::Selector.single_choice('オプションを追加しますか?')
15
+ show_command('helper', helper_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('オプションを入力してください', true) if is_make_options
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 = "rails generate helper #{helper_name} #{options}"
21
+ command = command('helper', helper_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
@@ -3,26 +3,28 @@
3
3
  require_relative '../core/inputter'
4
4
  require_relative '../core/selector'
5
5
  require_relative '../beautifica/beautifica'
6
+ require 'i18n'
6
7
 
8
+ # JobMaker is a module for generating job.
7
9
  module JobMaker
8
10
  class << self
9
11
  include Template
10
12
  def generator
11
- job_name = Umu::Inputter.input('ジョブ名を入力してください (例:CreditCard)')
13
+ job_name = Umu::Inputter.input(I18n.t('job.make_name'))
12
14
  cover(1)
13
- puts "#=> rails generate job #{job_name}"
14
- is_make_options = Umu::Selector.single_choice('オプションを追加しますか?')
15
+ show_command('job', job_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('オプションを入力してください', true) if is_make_options
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 = "rails generate job #{job_name} #{options}"
21
+ command = command('job', job_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