Sha256: fa6f50e2038d62b1adbcd3242d23d2b6299f2a7ed54dd73469c0e235740ff1d9
Contents?: true
Size: 1.27 KB
Versions: 1
Compression:
Stored size: 1.27 KB
Contents
begin require 'thor/group' rescue LoadError puts "Thor is not available" exit end module Zync module Generators class Error < Thor::Error end class Base < Thor::Group include Thor::Actions include Zync::Generators::Actions # Returns the base root for a common set of generators. def self.base_root File.dirname(__FILE__) end # Returns the source root for this generator def self.source_root(path=nil) @_source_root = path if path @_source_root ||= default_source_root end # Returns the default source root for a given generator. def self.default_source_root return unless generator_name path = File.expand_path(File.join(generator_name, 'templates'), base_root) path if File.exists?(path) end protected # Removes the namespaces and get the generator name. For example, # Zync::Generators::ModelGenerator will return "model" as generator name. # def self.generator_name @generator_name ||= begin if generator = name.to_s.split('::').last generator.sub!(/Generator$/, '') generator.underscore end end end end end # Generators end #Zync
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
zync-gen-0.1.0 | lib/zync-gen/generators/base.rb |