class Slate::Installer::Cli
Public Class Methods
source_paths()
click to toggle source
# File lib/slate/installer/cli.rb, line 14 def self.source_paths [Dir.tmpdir] end
Private Class Methods
exit_on_failure?()
click to toggle source
# File lib/slate/installer/cli.rb, line 50 def self.exit_on_failure? true end
Public Instance Methods
install()
click to toggle source
# File lib/slate/installer/cli.rb, line 21 def install if options[:logo] logo = determine_logo_path(options[:logo]) end Dir.mktmpdir("slate-src-") do |tmpdir| branch = if options[:dev] "dev" else "master" end output, _status = Open3.capture2e("git", "clone", "--depth", "1", "--branch", branch, "--progress", "https://github.com/lord/slate.git", tmpdir) puts output if logo slate_logo_path = File.join(tmpdir, "source", "images", "logo.png") logo_mode = File.stat(slate_logo_path).mode create_file slate_logo_path, File.binread(logo), {:force => true} chmod slate_logo_path, logo_mode, {} end directory Pathname.new(tmpdir).basename, "docs", \ mode: :preserve, recursive: true, exclude_pattern: /(?:\.git(?:hub)?\/)|(?:\.travis)/ end end
Private Instance Methods
determine_logo_path(logo)
click to toggle source
# File lib/slate/installer/cli.rb, line 54 def determine_logo_path(logo) logo = String(logo) if logo.empty? logo = ask("Enter the path to the logo file:", :path => true) end if logo.empty? raise ::Thor::MalformattedArgumentError, "A logo path must be provided when using the logo option" end unless File.file?(File.expand_path(logo)) raise ::Thor::MalformattedArgumentError, "The logo path provided is not a file" end logo end