Sha256: 2e621f28cecfb79717d4c944ff9e8da329c1cc7d8f669c56f09059424a19b794
Contents?: true
Size: 1.24 KB
Versions: 2
Compression:
Stored size: 1.24 KB
Contents
require "thor" module Hajimeru module Generator class GroongaPlugin < Thor::Group include Thor::Actions argument :name def self.source_root File.join(File.dirname(__FILE__), "templates", "groonga_plugin") end def create_files git_user_name = `git config user.name`.chomp git_user_email = `git config user.email`.chomp config = { plugin_name: name, author: (git_user_name || "TODO: YOUR NAME"), email: (git_user_email || "TODO: YOUR EMAIL"), } [ "Makefile.am.tt", "autogen.sh", "configure.ac.tt", "plugin_name/Makefile.am.tt", "plugin_name/plugin_name.c.tt", "plugin_name/sources.am.tt", "test/Makefile.am", "test/run-test.sh", "test/suite/register.expected.tt", "test/suite/register.test.tt", ].each do |path| output_path = path.gsub(/plugin_name/, config[:plugin_name]) output_path = output_path.gsub(/\.tt\z/, "") template(path, "#{name}/#{output_path}", config) if /\.sh\z/ =~ output_path File.chmod(0755, "#{name}/#{output_path}") end end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
hajimeru-0.1.2 | lib/hajimeru/generator/groonga_plugin.rb |
hajimeru-0.1.1 | lib/hajimeru/generator/groonga_plugin.rb |