umu 0.1.4 → 0.1.6

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: b732fe56cc1c56176ef9053e8a5dfb30b4f814b5626b789dd083bec905b46043
4
- data.tar.gz: fe9a20417e6f41e321be0514d99b3d584de03d961cf277dcf1a4b95bb428d633
3
+ metadata.gz: bc6e9fc2007b253383dff37eb39027a6781d347b8eb99a38253e91039e411fce
4
+ data.tar.gz: 8aa9d4a578393b7303fe34c247c789877b8bf9ff36c64749265ae4f86deea47c
5
5
  SHA512:
6
- metadata.gz: cefd9243e9c650c721e77476aeb6e68fa2ca4c2c76eea6612880b6cccede1e6d04ee8e5b03465a7270302773054b5b14b98655c878ad045742b5a10867fcd42a
7
- data.tar.gz: de2eaa14281f6fc86dd38ba056eddbe34233ffa8ba0a120daee866f24cb78d8b18cb4d3fbb7444bff52b0d8eb2b8c2a3d46d84745402b181f4d98c6b14baf09d
6
+ metadata.gz: 58d8e74ac65ec0d747567943a5612f3698ce6757ba8531ede470785a7182feb0d1660484977d987080a0752af61b9aa8d705205da9765b3668756e16166012ce
7
+ data.tar.gz: f43e1898be75ff77a7378a5501d04f1862ed0cd408eb88ef8a76a1047ef555f5fc23e154b98e71ea083bad79c3d0d0b1484e3e754dd1bdfd21d56c2cd4b9571f
data/CHANGELOG.md CHANGED
@@ -1,6 +1,14 @@
1
1
  ## [Unreleased]
2
2
 
3
- - Language setting
3
+ ## [0.1.6]
4
+
5
+ - fix: some bug
6
+ - update README(ja, en, zh)
7
+
8
+ ## [0.1.5]
9
+
10
+ - multilingual localization (en,ja,zh)
11
+ - fix: some bug
4
12
 
5
13
  ## [0.1.4] - 2023-03-05
6
14
 
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,56 @@
1
+ # Umu (プロトタイプ))
2
+
3
+ Umu はRuby on Rails の`rails generator`コマンドを生成するためのライブラリです。
4
+
5
+
6
+
7
+ https://user-images.githubusercontent.com/78460152/223889166-b69a6a65-f655-4b86-aae4-900d5ddd5b48.mov
8
+
9
+
10
+
11
+
12
+ # インストール方法
13
+
14
+ アプリケーションのGemfileに追加する
15
+
16
+ ```ruby
17
+ group :development, :test do
18
+ gem 'umu'
19
+ end
20
+ ```
21
+ そして
22
+ ```
23
+ bundle install
24
+ ```
25
+
26
+ # 使用方法
27
+ 次のコマンドを実行してください。
28
+
29
+ bundle exec umu
30
+
31
+ ## Doc
32
+
33
+ #### 言語変更
34
+ ```
35
+ bundle exec umu --lang
36
+ # or
37
+ bundle exec umu -l
38
+ ```
39
+ #### オプションの確認
40
+ ```
41
+ bundle exec umu --help
42
+ # or
43
+ bundle exec umu -h
44
+ ```
45
+
46
+ # 貢献方法
47
+ バグ報告やプルリクエストは、https://github.com/chen-196-hub/umu で受け付けています。このプロジェクトは、協力のための安全で歓迎される空間であることを意図しており、貢献者は[行動規範](https://github.com/chen-196-hub/umu/blob/main/CODE_OF_CONDUCT.md)に従うことが期待されています。
48
+
49
+ # ライセンス
50
+ このgemは[MITライセンス](https://opensource.org/licenses/MIT)の下でオープンソースとして利用可能です。
51
+
52
+ # 行動規範
53
+ Umuプロジェクトのコードベース、問題トラッカー、チャットルーム、メーリングリストに参加するすべての人が、[行動規範](https://github.com/chen-196-hub/umu/blob/main/CODE_OF_CONDUCT.md)に従うことを期待しています。
54
+
55
+
56
+
data/README.md CHANGED
@@ -1,32 +1,49 @@
1
+ <div align="center">
2
+ English | <a href="https://github.com/chen-196-hub/umu/blob/main/README.ja.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
4
8
 
5
9
 
6
10
 
7
- https://user-images.githubusercontent.com/78460152/222332886-50337710-4fc8-4437-b82a-f1a64edd95f3.mov
8
11
 
9
12
 
10
- ## Installation
13
+ https://user-images.githubusercontent.com/78460152/223889166-b69a6a65-f655-4b86-aae4-900d5ddd5b48.mov
14
+
11
15
 
12
- Install the gem and add to the application's Gemfile by executing:
13
16
 
14
- $ bundle add umu
15
17
 
16
- or
18
+ ## Installation
19
+
20
+ Add to the application's Gemfile by executing:
17
21
  ```ruby
18
22
  group :development, :test do
19
23
  gem 'umu'
20
24
  end
21
25
  ```
26
+ then
27
+ ```
28
+ bundle install
29
+ ```
22
30
  ## Usage
23
31
  bundle exec umu
24
32
 
25
- ## Development
26
-
27
- 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.
33
+ ## Doc
28
34
 
29
- 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).
35
+ #### Change language
36
+ ```
37
+ bundle exec umu --lang
38
+ # or
39
+ bundle exec umu -l
40
+ ```
41
+ #### Check Options
42
+ ```
43
+ bundle exec umu --help
44
+ # or
45
+ bundle exec umu -h
46
+ ```
30
47
 
31
48
  ## Contributing
32
49
 
@@ -38,4 +55,4 @@ The gem is available as open source under the terms of the [MIT License](https:/
38
55
 
39
56
  ## Code of Conduct
40
57
 
41
- 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).
58
+ 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,57 @@
1
+
2
+
3
+ # Umu (prototype)
4
+
5
+ Umu 是一個支援在Ruby on Rails中製作和執行`rails generator`指令的框架
6
+
7
+
8
+
9
+ https://user-images.githubusercontent.com/78460152/223889166-b69a6a65-f655-4b86-aae4-900d5ddd5b48.mov
10
+
11
+
12
+
13
+ # 安裝
14
+ 透過執行以下命令安裝 gem
15
+
16
+ $ bundle add umu
17
+
18
+ 將其加入應用程式的 Gemfile 中:
19
+ ```ruby
20
+ group :development, :test do
21
+ gem 'umu'
22
+ end
23
+ ```
24
+ 然後執行
25
+ ```
26
+ bundle install
27
+ ```
28
+
29
+ # 用法
30
+ ```
31
+ bundle exec umu
32
+ ```
33
+
34
+ ## Doc
35
+
36
+ #### 變更語言
37
+ ```
38
+ bundle exec umu --lang
39
+ # or
40
+ bundle exec umu -l
41
+ ```
42
+ #### 指令選項確認
43
+ ```
44
+ bundle exec umu --help
45
+ # or
46
+ bundle exec umu -h
47
+ ```
48
+
49
+
50
+ # 貢獻
51
+ 歡迎在 https://github.com/chen-196-hub/umu 上報告錯誤和拉取請求。本專案旨在成為一個安全、友好的協作空間,期望貢獻者遵守[行為準則](https://github.com/chen-196-hub/umu/blob/main/CODE_OF_CONDUCT.md)。
52
+
53
+ # 許可證
54
+ 該 gem 以 [MIT 許可證](https://opensource.org/licenses/MIT)的形式作為開放原始碼提供。
55
+
56
+ # 行為準則
57
+ 在 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
@@ -31,5 +31,16 @@ module Template
31
31
  puts green('>') + " #{command(generator_name, target_name, sub_items, options)}"
32
32
  end
33
33
 
34
+ def logo
35
+ print <<-'UMU'
36
+ _ _
37
+ | | | |_ __ ___ _ _
38
+ | | | | '_ ` _ \| | | |
39
+ | |_| | | | | | | |_| |
40
+ \___/|_| |_| |_|\__,_|
41
+
42
+ UMU
43
+ end
44
+
34
45
  module_function :pointer, :checker, :hover, :cover, :show_command, :command
35
46
  end
@@ -2,6 +2,7 @@
2
2
 
3
3
  require_relative 'validation'
4
4
  require_relative '../beautifica/beautifica'
5
+ require 'i18n'
5
6
 
6
7
  module Umu
7
8
  # Inputter is a module for inputting.
@@ -14,7 +15,7 @@ module Umu
14
15
  while is_empty
15
16
  cover(2)
16
17
  puts "\e[1A"
17
- puts "#{content} #{red('必須項目です')}"
18
+ puts "#{content} #{red(I18n.t('inputter.required'))}"
18
19
  input_val = gets
19
20
  is_empty = input_val.chomp == ''
20
21
  end
@@ -24,14 +25,14 @@ module Umu
24
25
  while is_overlap
25
26
  cover(2)
26
27
  puts "\e[1A"
27
- puts "#{content} #{red("#{input_val.chomp}は重複です")}"
28
+ puts "#{content} #{red("#{input_val.chomp} #{I18n.t('inputter.is_overlap')}")}"
28
29
  input_val = gets
29
30
 
30
31
  is_empty = input_val.chomp == ''
31
32
  while is_empty
32
33
  cover(2)
33
34
  puts "\e[1A"
34
- puts "#{content} #{red('必須項目です')}"
35
+ puts "#{content} #{red(I18n.t('inputter.required'))}"
35
36
  input_val = gets
36
37
  is_empty = input_val.chomp == ''
37
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
@@ -3,6 +3,7 @@
3
3
  require_relative '../core/inputter'
4
4
  require_relative '../core/selector'
5
5
  require_relative '../beautifica/beautifica'
6
+ require 'i18n'
6
7
 
7
8
  # ApplicationRecordMaker is a module for generating application_record.
8
9
  module ApplicationRecordMaker
@@ -10,18 +11,18 @@ module ApplicationRecordMaker
10
11
  include Template
11
12
  def generator
12
13
  show_command('application_record')
13
- is_make_options = Umu::Selector.single_choice('オプションを追加しますか?')
14
+ is_make_options = Umu::Selector.single_choice(I18n.t('common.make_options'))
14
15
  cover(1)
15
16
  options = ''
16
- options = Umu::Inputter.input('オプションを入力してください', true) if is_make_options
17
+ options = Umu::Inputter.input(I18n.t('common.add_option'), true) if is_make_options
17
18
  cover(1) if is_make_options
18
19
  command = command('application_record', options)
19
20
  cover(1)
20
21
  puts command
21
- confirm_content = '上記コマンドを実行しますか?'
22
+ confirm_content = I18n.t('common.run_command')
22
23
  run_command = Umu::Selector.single_choice(confirm_content)
23
24
  cover(1)
24
- puts confirm_content + (run_command ? 'はい' : 'いいえ')
25
+ puts confirm_content + (run_command ? I18n.t('affirm') : I18n.t('deny'))
25
26
  system(command) if run_command
26
27
  true
27
28
  end
@@ -1,20 +1,21 @@
1
1
  require_relative '../core/inputter'
2
2
  require_relative '../core/selector'
3
3
  require_relative '../beautifica/beautifica'
4
+ require 'i18n'
4
5
 
5
6
  # BenchmarkMaker is a module for generating benchmark.
6
7
  module BenchmarkMaker
7
8
  class << self
8
9
  include Template
9
10
  def generator
10
- benchmark_name = Umu::Inputter.input('ベンチマーク名を入力してください (例:benchmark_name)')
11
+ benchmark_name = Umu::Inputter.input(I18n.t('benchmark.make_name'))
11
12
  cover(1)
12
13
  show_command('benchmark', benchmark_name)
13
- confirm_content = '上記コマンドを実行しますか?'
14
+ confirm_content = I18n.t('common.run_command')
14
15
  run_command = Umu::Selector.single_choice(confirm_content)
15
16
  cover(1)
16
17
  command = command('benchmark', benchmark_name)
17
- puts confirm_content + (run_command ? 'はい' : 'いいえ')
18
+ puts confirm_content + (run_command ? I18n.t('affirm') : I18n.t('deny'))
18
19
  system(command) if run_command
19
20
  true
20
21
  end
@@ -3,40 +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
 
7
8
  # ChannelMaker is a module for generating channel.
8
9
  module ChannelMaker
9
10
  class << self
10
11
  include Template
11
12
  def generator
12
- channel_name = Umu::Inputter.input('チャネル名を入力してください (例:channel_name)')
13
+ channel_name = Umu::Inputter.input(I18n.t('channel.make_name'))
13
14
  cover(1)
14
15
  show_command('channel', channel_name)
15
- make_action = Umu::Selector.single_choice('アクションを追加しますか?')
16
+ make_action = Umu::Selector.single_choice(I18n.t('channel.make_actions'))
16
17
  cover(1)
17
18
  actions = []
18
19
  while make_action
19
- action_name = Umu::Inputter.input('アクション名を入力してください (例:subscribed)')
20
+ action_name = Umu::Inputter.input(I18n.t('channel.make_action_name'))
20
21
  cover(1)
21
22
  actions << action_name
22
23
  cover(1)
23
24
  show_command('channel', channel_name, actions.join(' '))
24
- make_action = Umu::Selector.single_choice('追加続きますか?')
25
+ make_action = Umu::Selector.single_choice(I18n.t('channel.make_action_continue'))
25
26
  cover(1)
26
27
  end
27
28
 
28
- is_make_options = Umu::Selector.single_choice('オプションを追加しますか?')
29
+ is_make_options = Umu::Selector.single_choice(I18n.t('common.make_options'))
29
30
  cover(1)
30
31
  options = ''
31
- options = Umu::Inputter.input('オプションを入力してください', true) if is_make_options
32
+ options = Umu::Inputter.input(I18n.t('common.add_option'), true) if is_make_options
32
33
  cover(1) if is_make_options
33
34
  command = command('channel', channel_name, actions.join(' '), options)
34
35
  cover(1)
35
36
  puts command
36
- confirm_content = '上記コマンド実行しますか?'
37
+ confirm_content = I18n.t('common.run_command')
37
38
  run_command = Umu::Selector.single_choice(confirm_content)
38
39
  cover(1)
39
- puts confirm_content + (run_command ? 'はい' : 'いいえ')
40
+ puts confirm_content + (run_command ? I18n.t('affirm') : I18n.t('deny'))
40
41
  system(command) if run_command
41
42
  true
42
43
  end
@@ -3,6 +3,7 @@
3
3
  require_relative '../core/inputter'
4
4
  require_relative '../core/selector'
5
5
  require_relative '../beautifica/beautifica'
6
+ require 'i18n'
6
7
 
7
8
  # ControllerMaker is a module for generating controller.
8
9
  module ControllerMaker
@@ -18,43 +19,44 @@ module ControllerMaker
18
19
  other
19
20
  ].freeze
20
21
  def generator
21
- controller_name = Umu::Inputter.input('コントローラー名を入力してください (複数)')
22
+ controller_name = Umu::Inputter.input(I18n.t('controller.make_name'))
22
23
  cover(1)
23
- puts "#=> rails generate controller #{controller_name}"
24
24
  show_command('controller', controller_name)
25
- make_actions = Umu::Selector.single_choice('アクション生成しますか?')
25
+ make_actions = Umu::Selector.single_choice(I18n.t('controller.make_actions'))
26
26
  cover(1)
27
27
  actions = []
28
28
  if make_actions
29
- actions = Umu::Selector.checkbox(ACTIONS, 'アクションを選択してください。<スペースキーで選択できます>')
29
+ actions = Umu::Selector.checkbox(ACTIONS, I18n.t('controller.select_actions'))
30
30
  cover(1)
31
31
  cover(1)
32
- show_command('controller', controller_name, actions.join(' '))
32
+ show_actions = actions.dup
33
+ show_actions.delete('other')
34
+ show_command('controller', controller_name, show_actions.join(' '))
33
35
  if actions.include?('other')
34
36
  make_action = true
35
37
  actions.delete('other')
36
38
  while make_action
37
- original_action_name = Umu::Inputter.input('アクション名を入力してください', true, actions)
39
+ original_action_name = Umu::Inputter.input(I18n.t('controller.make_action_name'), true, actions)
38
40
  actions << original_action_name
39
41
  cover(2)
40
42
  show_command('controller', controller_name, actions.join(' '))
41
- make_action = Umu::Selector.single_choice('作り続けますか?')
43
+ make_action = Umu::Selector.single_choice(I18n.t('controller.make_action_continue'))
42
44
  cover(1)
43
45
  end
44
46
  end
45
47
  end
46
- is_make_options = Umu::Selector.single_choice('オプションを追加しますか?')
48
+ is_make_options = Umu::Selector.single_choice(I18n.t('common.make_options'))
47
49
  options = ''
48
50
  cover(1)
49
- options = Umu::Inputter.input('オプションを入力してください', true) if is_make_options
51
+ options = Umu::Inputter.input(I18n.t('common.add_option'), true) if is_make_options
50
52
  cover(1) if is_make_options
51
53
  command = command('controller', controller_name, actions.join(' '), options)
52
54
  cover(1)
53
55
  puts command
54
- confirm_content = '上記コマンド実行しますか?'
56
+ confirm_content = I18n.t('common.run_command')
55
57
  run_command = Umu::Selector.single_choice(confirm_content)
56
58
  cover(1)
57
- puts confirm_content + (run_command ? 'はい' : 'いいえ')
59
+ puts confirm_content + (run_command ? I18n.t('affirm') : I18n.t('deny'))
58
60
  system(command) if run_command
59
61
  true
60
62
  end
@@ -3,27 +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
 
7
8
  # HelperMaker is a module for generating helper.
8
9
  module HelperMaker
9
10
  class << self
10
11
  include Template
11
12
  def generator
12
- helper_name = Umu::Inputter.input('ヘルパー名を入力してください (例:helper_name)')
13
+ helper_name = Umu::Inputter.input(I18n.t('helper.make_name'))
13
14
  cover(1)
14
15
  show_command('helper', helper_name)
15
- is_make_options = Umu::Selector.single_choice('オプションを追加しますか?')
16
+ is_make_options = Umu::Selector.single_choice(I18n.t('common.make_options'))
16
17
  cover(1)
17
18
  options = ''
18
- options = Umu::Inputter.input('オプションを入力してください', true) if is_make_options
19
+ options = Umu::Inputter.input(I18n.t('common.add_option'), true) if is_make_options
19
20
  cover(1) if is_make_options
20
21
  command = command('helper', helper_name, options)
21
22
  cover(1)
22
23
  puts command
23
- confirm_content = '上記コマンド実行しますか?'
24
+ confirm_content = I18n.t('common.run_command')
24
25
  run_command = Umu::Selector.single_choice(confirm_content)
25
26
  cover(1)
26
- puts confirm_content + (run_command ? 'はい' : 'いいえ')
27
+ puts confirm_content + (run_command ? I18n.t('affirm') : I18n.t('deny'))
27
28
  system(command) if run_command
28
29
  true
29
30
  end
@@ -3,27 +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
 
7
8
  # JobMaker is a module for generating job.
8
9
  module JobMaker
9
10
  class << self
10
11
  include Template
11
12
  def generator
12
- job_name = Umu::Inputter.input('ジョブ名を入力してください (例:job_name)')
13
+ job_name = Umu::Inputter.input(I18n.t('job.make_name'))
13
14
  cover(1)
14
15
  show_command('job', job_name)
15
- is_make_options = Umu::Selector.single_choice('オプションを追加しますか?')
16
+ is_make_options = Umu::Selector.single_choice(I18n.t('common.make_options'))
16
17
  cover(1)
17
18
  options = ''
18
- options = Umu::Inputter.input('オプションを入力してください', true) if is_make_options
19
+ options = Umu::Inputter.input(I18n.t('common.add_option'), true) if is_make_options
19
20
  cover(1) if is_make_options
20
21
  command = command('job', job_name, options)
21
22
  cover(1)
22
23
  puts command
23
- confirm_content = '上記コマンド実行しますか?'
24
+ confirm_content = I18n.t('common.run_command')
24
25
  run_command = Umu::Selector.single_choice(confirm_content)
25
26
  cover(1)
26
- puts confirm_content + (run_command ? 'はい' : 'いいえ')
27
+ puts confirm_content + (run_command ? I18n.t('affirm') : I18n.t('deny'))
27
28
  system(command) if run_command
28
29
  true
29
30
  end
@@ -3,27 +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
 
7
8
  # MailboxMaker is a module for generating mailbox.
8
9
  module MailboxMaker
9
10
  class << self
10
11
  include Template
11
12
  def generator
12
- mailbox_name = Umu::Inputter.input('メールボックス名を入力してください (例:mailbox_name)')
13
+ mailbox_name = Umu::Inputter.input(I18n.t('mailbox.make_name'))
13
14
  cover(1)
14
15
  show_command('mailbox', mailbox_name)
15
- is_make_options = Umu::Selector.single_choice('オプションを追加しますか?')
16
+ is_make_options = Umu::Selector.single_choice(I18n.t('common.make_options'))
16
17
  cover(1)
17
18
  options = ''
18
- options = Umu::Inputter.input('オプションを入力してください', true) if is_make_options
19
+ options = Umu::Inputter.input(I18n.t('common.add_option'), true) if is_make_options
19
20
  cover(1) if is_make_options
20
21
  command = command('mailbox', mailbox_name, options)
21
22
  cover(1)
22
23
  puts command
23
- confirm_content = '上記コマンド実行しますか?'
24
+ confirm_content = I18n.t('common.run_command')
24
25
  run_command = Umu::Selector.single_choice(confirm_content)
25
26
  cover(1)
26
- puts confirm_content + (run_command ? 'はい' : 'いいえ')
27
+ puts confirm_content + (run_command ? I18n.t('affirm') : I18n.t('deny'))
27
28
  system(command) if run_command
28
29
  true
29
30
  end
@@ -3,39 +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
 
7
8
  # MailerMaker is a module for generating mailer.
8
9
  module MailerMaker
9
10
  class << self
10
11
  include Template
11
12
  def generator
12
- mailer_name = Umu::Inputter.input('メーラー名を入力してください (例:mailer_name)')
13
+ mailer_name = Umu::Inputter.input(I18n.t('mailer.make_name'))
13
14
  cover(1)
14
15
  show_command('mailer', mailer_name)
15
- make_action = Umu::Selector.single_choice('アクションを追加しますか?')
16
+ make_action = Umu::Selector.single_choice(I18n.t('mailer.make_actions'))
16
17
  cover(1)
17
18
  actions = []
18
19
  while make_action
19
- action_name = Umu::Inputter.input('アクション名を入力してください (例:subscribed)')
20
+ action_name = Umu::Inputter.input(I18n.t('mailer.make_action_name'))
20
21
  cover(1)
21
22
  actions << action_name
22
23
  cover(1)
23
24
  show_command('mailer', mailer_name, actions.join(' '))
24
- make_action = Umu::Selector.single_choice('追加続きますか?')
25
+ make_action = Umu::Selector.single_choice(I18n.t('mailer.make_action_continue'))
25
26
  cover(1)
26
27
  end
27
- is_make_options = Umu::Selector.single_choice('オプションを追加しますか?')
28
+ is_make_options = Umu::Selector.single_choice(I18n.t('common.make_options'))
28
29
  cover(1)
29
30
  options = ''
30
- options = Umu::Inputter.input('オプションを入力してください', true) if is_make_options
31
+ options = Umu::Inputter.input(I18n.t('common.add_option'), true) if is_make_options
31
32
  cover(1) if is_make_options
32
33
  command = command('mailer', mailer_name, actions.join(' '), options)
33
34
  cover(1)
34
35
  puts command
35
- confirm_content = '上記コマンド実行しますか?'
36
+ confirm_content = I18n.t('common.run_command')
36
37
  run_command = Umu::Selector.single_choice(confirm_content)
37
38
  cover(1)
38
- puts confirm_content + (run_command ? 'はい' : 'いいえ')
39
+ puts confirm_content + (run_command ? I18n.t('affirm') : I18n.t('deny'))
39
40
  system(command) if run_command
40
41
  true
41
42
  end
@@ -3,6 +3,7 @@
3
3
  require_relative '../core/inputter'
4
4
  require_relative '../core/selector'
5
5
  require_relative '../beautifica/beautifica'
6
+ require 'i18n'
6
7
 
7
8
  # MigrationMaker is a module for generating migration.
8
9
  module MigrationMaker
@@ -23,40 +24,40 @@ module MigrationMaker
23
24
  primary_key
24
25
  ].freeze
25
26
  def generator
26
- migration_name = Umu::Inputter.input('マイグレーション名を入力してください(例: AddNameToUsers・Users)')
27
+ migration_name = Umu::Inputter.input(I18n.t('migration.make_name'))
27
28
  cover(1)
28
29
  show_command('migration', migration_name)
29
- is_make_column = Umu::Selector.single_choice('カラム生成しますか?')
30
+ is_make_column = Umu::Selector.single_choice(I18n.t('migration.make_column'))
30
31
  cover(1)
31
32
  columns = []
32
33
  while is_make_column
33
34
  columns << make_column
34
35
  show_command('migration', migration_name, columns.join(' '))
35
- is_make_column = Umu::Selector.single_choice('作り続けますか?')
36
+ is_make_column = Umu::Selector.single_choice(I18n.t('migration.make_column_continue'))
36
37
  cover(1)
37
38
  end
38
39
  show_command('migration', migration_name, columns.join(' '))
39
40
  cover(1)
40
- is_make_options = Umu::Selector.single_choice('オプションを追加しますか?')
41
+ is_make_options = Umu::Selector.single_choice(I18n.t('common.make_options'))
41
42
  cover(1)
42
43
  options = ''
43
- options = Umu::Inputter.input('オプションを入力してください', true) if is_make_options
44
+ options = Umu::Inputter.input(I18n.t('common.add_option'), true) if is_make_options
44
45
  cover(1) if is_make_options
45
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,6 +3,7 @@
3
3
  require_relative '../core/inputter'
4
4
  require_relative '../core/selector'
5
5
  require_relative '../beautifica/beautifica'
6
+ require 'i18n'
6
7
 
7
8
  # ModelMaker is a module for generating model.
8
9
  module ModelMaker
@@ -23,42 +24,42 @@ module ModelMaker
23
24
  primary_key
24
25
  ].freeze
25
26
  def generator
26
- model_name = Umu::Inputter.input('モデル名を入力してください (単数)')
27
+ model_name = Umu::Inputter.input(I18n.t('model.make_name'))
27
28
  cover(1)
28
29
  show_command('model', model_name)
29
- is_make_column = Umu::Selector.single_choice('カラム生成しますか?')
30
+ is_make_column = Umu::Selector.single_choice(I18n.t('model.make_column'))
30
31
  cover(1)
31
32
  columns = []
32
33
  while is_make_column
33
34
  columns << make_column
34
35
  show_command('model', model_name, columns.join(' '))
35
- is_make_column = Umu::Selector.single_choice('作り続けますか?')
36
+ is_make_column = Umu::Selector.single_choice(I18n.t('model.make_column_continue'))
36
37
  cover(1)
37
38
  end
38
39
 
39
40
  show_command('model', model_name, columns.join(' '))
40
41
  cover(1)
41
- is_make_options = Umu::Selector.single_choice('オプションを追加しますか?')
42
+ is_make_options = Umu::Selector.single_choice(I18n.t('common.make_options'))
42
43
  cover(1)
43
44
  options = ''
44
- options = Umu::Inputter.input('オプションを入力してください', true) if is_make_options
45
+ options = Umu::Inputter.input(I18n.t('common.add_option'), true) if is_make_options
45
46
  cover(1) if is_make_options
46
47
 
47
48
  command = command('model', model_name, columns.join(' '), options)
48
49
  cover(1)
49
50
  puts command
50
- confirm_content = '上記コマンド実行しますか?'
51
+ confirm_content = I18n.t('common.run_command')
51
52
  run_command = Umu::Selector.single_choice(confirm_content)
52
53
  cover(1)
53
- puts confirm_content + (run_command ? 'はい' : 'いいえ')
54
+ puts confirm_content + (run_command ?I18n.t('affirm') : I18n.t('deny'))
54
55
  system(command) if run_command
55
56
  true
56
57
  end
57
58
 
58
59
  def make_column
59
- colum_name = Umu::Inputter.input('カラム名を入力してください')
60
+ colum_name = Umu::Inputter.input(I18n.t('model.make_column_name'))
60
61
  cover(1)
61
- type = Umu::Selector.radio(COLUMN_TYPE, 'タイプを選んでください')
62
+ type = Umu::Selector.radio(COLUMN_TYPE, I18n.t('model.choose_column_type'))
62
63
  cover(2)
63
64
  "#{colum_name}:#{type}"
64
65
  end
@@ -1,6 +1,7 @@
1
1
  require_relative '../core/inputter'
2
2
  require_relative '../core/selector'
3
3
  require_relative '../beautifica/beautifica'
4
+ require 'i18n'
4
5
 
5
6
  # ResourceMaker is a module for generating resource.
6
7
  module ResourceMaker
@@ -21,41 +22,41 @@ 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
  show_command('resource', resource_name)
27
- is_make_column = Umu::Selector.single_choice('カラム生成しますか?')
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
  show_command('resource', resource_name, columns.join(' '))
33
- is_make_column = Umu::Selector.single_choice('作り続けますか?')
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('オプションを入力してください', true) if is_make_options
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 = command('resource', resource_name, columns.join(' '), options)
45
46
  cover(1)
46
47
  puts command
47
- confirm_content = '上記コマンド実行しますか?'
48
+ confirm_content = I18n.t('common.run_command')
48
49
  run_command = Umu::Selector.single_choice(confirm_content)
49
50
  cover(1)
50
- puts confirm_content + (run_command ? 'はい' : 'いいえ')
51
+ puts confirm_content + (run_command ? I18n.t('affirm') : I18n.t('deny'))
51
52
  system(command) if run_command
52
53
  true
53
54
  end
54
55
 
55
56
  def make_colum
56
- colum_name = Umu::Inputter.input('カラム名を入力してください')
57
+ colum_name = Umu::Inputter.input(I18n.t('resource.make_column_name'))
57
58
  cover(1)
58
- type = Umu::Selector.radio(COLUMN_TYPE, 'タイプを選んでください')
59
+ type = Umu::Selector.radio(COLUMN_TYPE, I18n.t('resource.choose_column_type'))
59
60
  cover(2)
60
61
  "#{colum_name}:#{type}"
61
62
  end
@@ -3,40 +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
 
7
8
  # TaskMaker is a module for generating task.
8
9
  module TaskMaker
9
10
  class << self
10
11
  include Template
11
12
  def generator
12
- task_name = Umu::Inputter.input('タスク名を入力してください (例:task_name)')
13
+ task_name = Umu::Inputter.input(I18n.t('task.make_name'))
13
14
  cover(1)
14
15
  show_command('task', task_name)
15
- make_action = Umu::Selector.single_choice('アクションを追加しますか?')
16
+ make_action = Umu::Selector.single_choice(I18n.t('task.make_actions'))
16
17
  cover(1)
17
18
  actions = []
18
19
  while make_action
19
- action_name = Umu::Inputter.input('アクション名を入力してください (例:action_name)', true, actions)
20
+ action_name = Umu::Inputter.input(I18n.t('task.make_action_name'), true, actions)
20
21
  cover(1)
21
22
  actions << action_name
22
23
  cover(1)
23
24
  show_command('task', task_name, actions.join(' '))
24
- make_action = Umu::Selector.single_choice('追加続きますか?')
25
+ make_action = Umu::Selector.single_choice(I18n.t('task.make_action_continue'))
25
26
  cover(1)
26
27
  end
27
28
 
28
- is_make_options = Umu::Selector.single_choice('オプションを追加しますか?')
29
+ is_make_options = Umu::Selector.single_choice(I18n.t('common.make_options'))
29
30
  cover(1)
30
31
  options = ''
31
- options = Umu::Inputter.input('オプションを入力してください', true) if is_make_options
32
+ options = Umu::Inputter.input(I18n.t('common.add_option'), true) if is_make_options
32
33
  cover(1) if is_make_options
33
34
  command = command('task', task_name, actions.join(' '), options)
34
35
  cover(1)
35
36
  puts command
36
- confirm_content = '上記コマンド実行しますか?'
37
+ confirm_content = I18n.t('common.run_command')
37
38
  run_command = Umu::Selector.single_choice(confirm_content)
38
39
  cover(1)
39
- puts confirm_content + (run_command ? 'はい' : 'いいえ')
40
+ puts confirm_content + (run_command ? I18n.t('affirm') : I18n.t('deny'))
40
41
  system(command) if run_command
41
42
  true
42
43
  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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Umu
4
- VERSION = "0.1.4"
4
+ VERSION = "0.1.6"
5
5
  end
data/lib/umu.rb CHANGED
@@ -1,10 +1,12 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative 'umu/core/selector'
4
- require_relative 'umu/core/inputter'
5
- require_relative 'umu/generators'
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
8
  require_relative 'umu/version'
9
+ require 'i18n'
8
10
 
9
11
  ##
10
12
  # UmuはRailsのコードを自動生成するためのツールです。
@@ -13,9 +15,10 @@ module Umu
13
15
  include Umu::Generators
14
16
  extend Color
15
17
  def self.generator
18
+ Umu::LanguageSetting.setup_language
16
19
  items = %w[model controller migration application_record helper channel job task mailer mailbox benchmark
17
20
  resource].freeze
18
- content = "#{green('?')} 何を生成しますか?"
21
+ content = "#{green('?')} #{I18n.t(:umu)}"
19
22
  target = Umu::Selector.radio(items, content)
20
23
  puts "\e[2A"
21
24
  puts "#{content} #{green(target)}"
data/umu.gemspec CHANGED
@@ -35,6 +35,7 @@ Gem::Specification.new do |spec|
35
35
 
36
36
  # Uncomment to register a new dependency of your gem
37
37
  spec.add_dependency "activesupport", ">= 3.0.0"
38
+ spec.add_dependency "i18n", ">= 1.8"
38
39
 
39
40
  # For more information and examples about making a new gem, check out our
40
41
  # guide at: https://bundler.io/guides/creating_gem.html
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
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kuan-Hung Chen
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-03-05 00:00:00.000000000 Z
11
+ date: 2023-03-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: 3.0.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: i18n
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '1.8'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '1.8'
27
41
  description: " Umu is a framework that supports you to make command in Ruby on
28
42
  Rails.\n"
29
43
  email:
@@ -38,9 +52,10 @@ files:
38
52
  - CHANGELOG.md
39
53
  - CODE_OF_CONDUCT.md
40
54
  - Gemfile
41
- - Gemfile.lock
42
55
  - LICENSE.txt
56
+ - README.ja.md
43
57
  - README.md
58
+ - README.zh.md
44
59
  - Rakefile
45
60
  - exe/umu
46
61
  - lib/umu.rb
@@ -48,6 +63,7 @@ files:
48
63
  - lib/umu/beautifica/assets/template.rb
49
64
  - lib/umu/beautifica/beautifica.rb
50
65
  - lib/umu/core/inputter.rb
66
+ - lib/umu/core/language_setting.rb
51
67
  - lib/umu/core/selector.rb
52
68
  - lib/umu/core/validation.rb
53
69
  - lib/umu/generators.rb
@@ -63,6 +79,9 @@ files:
63
79
  - lib/umu/generators/model_maker.rb
64
80
  - lib/umu/generators/resource_maker.rb
65
81
  - lib/umu/generators/task_maker.rb
82
+ - lib/umu/locales/en.yml
83
+ - lib/umu/locales/ja.yml
84
+ - lib/umu/locales/zh.yml
66
85
  - lib/umu/version.rb
67
86
  - sig/umu.rbs
68
87
  - umu.gemspec
data/Gemfile.lock DELETED
@@ -1,70 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- umu (0.1.3)
5
- activesupport (>= 3.0.0)
6
-
7
- GEM
8
- remote: https://rubygems.org/
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)
15
- ast (2.4.2)
16
- concurrent-ruby (1.2.2)
17
- diff-lcs (1.5.0)
18
- i18n (1.12.0)
19
- concurrent-ruby (~> 1.0)
20
- json (2.6.3)
21
- minitest (5.17.0)
22
- parallel (1.22.1)
23
- parser (3.2.1.0)
24
- ast (~> 2.4.1)
25
- rainbow (3.1.1)
26
- rake (13.0.6)
27
- regexp_parser (2.7.0)
28
- rexml (3.2.5)
29
- rspec (3.12.0)
30
- rspec-core (~> 3.12.0)
31
- rspec-expectations (~> 3.12.0)
32
- rspec-mocks (~> 3.12.0)
33
- rspec-core (3.12.1)
34
- rspec-support (~> 3.12.0)
35
- rspec-expectations (3.12.2)
36
- diff-lcs (>= 1.2.0, < 2.0)
37
- rspec-support (~> 3.12.0)
38
- rspec-mocks (3.12.3)
39
- diff-lcs (>= 1.2.0, < 2.0)
40
- rspec-support (~> 3.12.0)
41
- rspec-support (3.12.0)
42
- rubocop (1.46.0)
43
- json (~> 2.3)
44
- parallel (~> 1.10)
45
- parser (>= 3.2.0.0)
46
- rainbow (>= 2.2.2, < 4.0)
47
- regexp_parser (>= 1.8, < 3.0)
48
- rexml (>= 3.2.5, < 4.0)
49
- rubocop-ast (>= 1.26.0, < 2.0)
50
- ruby-progressbar (~> 1.7)
51
- unicode-display_width (>= 2.4.0, < 3.0)
52
- rubocop-ast (1.26.0)
53
- parser (>= 3.2.1.0)
54
- ruby-progressbar (1.11.0)
55
- tzinfo (2.0.6)
56
- concurrent-ruby (~> 1.0)
57
- unicode-display_width (2.4.2)
58
-
59
- PLATFORMS
60
- x86_64-darwin-19
61
- x86_64-darwin-21
62
-
63
- DEPENDENCIES
64
- rake (~> 13.0)
65
- rspec (~> 3.0)
66
- rubocop (~> 1.21)
67
- umu!
68
-
69
- BUNDLED WITH
70
- 2.3.18