File: generate.rb

package info (click to toggle)
mikutter 5.1.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 9,780 kB
  • sloc: ruby: 22,912; sh: 186; makefile: 21
file content (26 lines) | stat: -rw-r--r-- 544 bytes parent folder | download | duplicates (3)
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"