Sha256: d6084b960d31b027ea9493194303ce287bc02111a8573b7a80eb6faaa309bc02
Contents?: true
Size: 1.44 KB
Versions: 2
Compression:
Stored size: 1.44 KB
Contents
require 'crossbar/version' require 'fileutils' require 'pathname' require 'thor' module Crossbar class Generator < Thor map ['-v', '--version'] => :version desc 'install', 'Install Crossbar into your project' method_options path: :string def install # crossbar_files_already_installed? if crossbar_files_already_installed? puts "Crossbar files already installed, doing nothing." else install_files puts "Crossbar files installed to #{install_path}" end end desc 'version', 'Show Crossbar version' def version say "Crossbar #{Crossbar::VERSION}" end private def crossbar_files_already_installed? crossbar_folders.all? do |f| return File.directory?(File.join(install_path, f)) end end def crossbar_folders return ["base", "layout", "modules", "states"] end def install_path @install_path ||= if options[:path] Pathname.new(File.join(options[:path], '')) else Pathname.new '.' end end def install_files FileUtils.mkdir_p(install_path) FileUtils.cp_r(all_stylesheets, install_path) end def all_stylesheets Dir["#{stylesheets_directory}/*"] end def stylesheets_directory File.join(top_level_directory, "app", "assets", "stylesheets") end def top_level_directory File.dirname(File.dirname(File.dirname(__FILE__))) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
crossbar-0.0.5 | lib/crossbar/generator.rb |
crossbar-0.0.4 | lib/crossbar/generator.rb |