Sha256: cb92350967b754a93bb4f530bad40878fe233b264ca6f20e9b84127794570bec
Contents?: true
Size: 1.36 KB
Versions: 4
Compression:
Stored size: 1.36 KB
Contents
require 'fileutils' require 'active_support' require 'active_support/core_ext/string' require 'thor' require 'bundler' class Lono::CLI::New class Sequence < Thor::Group include Concerns include Lono::Utils::Logging include Thor::Actions private def self.set_template_source(folder) path = File.expand_path("../../../templates/#{folder}", __dir__) source_root path end def set_template_source(*paths) paths = paths.flatten.map do |path| File.expand_path("../../../templates/#{path}", __dir__) end set_template_paths(paths) end def set_template_paths(*paths) paths.flatten! # https://github.com/erikhuda/thor/blob/34df888d721ecaa8cf0cea97d51dc6c388002742/lib/thor/actions.rb#L128 instance_variable_set(:@source_paths, nil) # unset instance variable cache # Using string with instance_eval because block doesnt have access to path at runtime. instance_eval %{ def self.source_paths #{paths.flatten.inspect} end } end def git_installed? system("type git > /dev/null 2>&1") end def run_git? options[:git] && git_installed? end def run_git_init return unless run_git? puts "=> Initialize git repo" run("git init") end def env Lono.env # allows for seed/vars/%env%.rb.tt end end end
Version data entries
4 entries across 4 versions & 1 rubygems