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