class Skele::Runner
Public Class Methods
new(skeleton, destination, root=SKELETON_ROOT)
click to toggle source
# File lib/skele.rb, line 103 def initialize(skeleton, destination, root=SKELETON_ROOT) @skeleton = Skeleton.new(skeleton, destination, root) end
Public Instance Methods
blue(text)
click to toggle source
# File lib/skele.rb, line 169 def blue(text) colorize text, 34 end
bundle_install()
click to toggle source
# File lib/skele.rb, line 116 def bundle_install STDOUT.puts "\nRunning bundle install\n\n" bundle = @skeleton.bundle_install unless bundle.nil? STDOUT.puts indent bundle end end
colorize(text, color_code)
click to toggle source
# File lib/skele.rb, line 157 def colorize(text, color_code) "\e[#{color_code}m#{text}\e[0m" end
copy_files()
click to toggle source
# File lib/skele.rb, line 126 def copy_files STDOUT.puts "\nCopying files\n\n" file_result = @skeleton.copy_files if file_result.nil? STDOUT.puts indent(red("Error:") + "Skeleton '#{@skeleton.skeleton}' does not exist or is not a directory") else file_result.each do |result| case result[:action] when "mkdir" STDOUT.puts indent(" " + green(result[:action]) + " " + result[:file]) when "create" STDOUT.puts indent(green(result[:action]) + " " + result[:file]) when "exists" STDOUT.puts indent(red(result[:action]) + " " + result[:file]) end end end end
green(text)
click to toggle source
# File lib/skele.rb, line 165 def green(text) colorize text, 32 end
indent(string)
click to toggle source
# File lib/skele.rb, line 147 def indent(string) indented = "" string.split("\n").each do |line| indented += INDENTATION + line + "\n" end return indented end
red(text)
click to toggle source
# File lib/skele.rb, line 161 def red(text) colorize text, 31 end
summon()
click to toggle source
# File lib/skele.rb, line 107 def summon STDOUT.puts "\nSummoning skeleton '#{@skeleton.skeleton}' from '#{@skeleton.destination}'" copy_files bundle_install STDOUT.puts "\nSkeleton complete. Enjoy!\n\n" end