| 1 |
|
| 2 |
イン自動生成 |
| 3 |
|
| 4 |
require "fileutils" |
| 5 |
|
| 6 |
slug = ARGV[1] |
| 7 |
|
| 8 |
unless slug |
| 9 |
puts "plugin_slug not specified." |
| 10 |
puts "usage: mikutter.rb #{ARGV[0]} plugin_slug" |
| 11 |
exit |
| 12 |
end |
| 13 |
|
| 14 |
plugin_path = File.expand_path(File.join(CHIConfig::CONFROOT, "plugin", slug)) |
| 15 |
FileUtils.mkdir_p(plugin_path) |
| 16 |
puts "directory generated: #{plugin_path}" |
| 17 |
File.open("#{plugin_path}/#{slug}.rb", "w"){ |io| |
| 18 |
io.write <<"EOM"; |
| 19 |
# frozen_string_literal: true |
| 20 |
|
| 21 |
Plugin.create(:#{slug}) do |
| 22 |
|
| 23 |
end |
| 24 |
EOM |
| 25 |
} |
| 26 |
puts "file generated: #{plugin_path}/#{slug}.rb" |