Sha256: 5e397c64f0a516ea287bd6e88f79ddf1a54705de46eef1d5563b78345739c91f
Contents?: true
Size: 1.23 KB
Versions: 1
Compression:
Stored size: 1.23 KB
Contents
# frozen_string_literal: true module Upgrow module Generators module Helper module ClassMethods def base_root __dir__ end end def self.included(base) base.extend(ClassMethods) end def move_file(origin, destination) origin = File.expand_path(origin, destination_root) destination = File.expand_path(destination, destination_root) say_status( :move, "#{relative_to_original_destination_root(origin)} -> " + relative_to_original_destination_root(destination) ) FileUtils.mkdir_p(File.dirname(destination)) FileUtils.mv(origin, destination) end def class_name file_name.camelize end def module_namespacing(&block) super do content = capture(&block) concat(namespace_content(class_path, content)) end end def namespace_content(namespaces, content) namespace = namespaces.shift content = namespace_content(namespaces, content) if namespaces.any? if namespace "module #{namespace.camelize}\n#{indent(content).chomp}\nend\n" else content end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
upgrow-0.0.5 | lib/generators/upgrow.rb |