class Stratum::Generator
Public Instance Methods
install()
click to toggle source
# File lib/stratum/generator.rb, line 14 def install if install_path.exist? && !options[:force] puts "Stratum installation already exists. Use -f to force" else copy_files puts "Stratum installed to #{install_path}" end end
remove(replace = false)
click to toggle source
# File lib/stratum/generator.rb, line 29 def remove(replace = false) if stratum_exists? FileUtils.rm_rf("stratum") if replace copy_files puts "Stratum updated" else puts "Stratum has been removed" end else puts "Stratum installation is not found in current directory" end end
update()
click to toggle source
# File lib/stratum/generator.rb, line 24 def update remove(true) end
version()
click to toggle source
# File lib/stratum/generator.rb, line 44 def version say "Stratum #{Stratum::VERSION}" end
Private Instance Methods
assets_stylesheets()
click to toggle source
# File lib/stratum/generator.rb, line 67 def assets_stylesheets current_dir = File.dirname(File.dirname(__FILE__)) stylesheets = File.join(current_dir, "..", "assets", "stylesheets") Dir["#{stylesheets}/*"] end
copy_files()
click to toggle source
# File lib/stratum/generator.rb, line 62 def copy_files FileUtils.mkdir_p(install_path) FileUtils.cp_r(assets_stylesheets, install_path) end
install_path()
click to toggle source
# File lib/stratum/generator.rb, line 54 def install_path @install_path ||= if options[:path] Pathname.new(File.join(options[:path], 'stratum')) else Pathname.new('stratum') end end
stratum_exists?()
click to toggle source
# File lib/stratum/generator.rb, line 50 def stratum_exists? install_path.exist? end