class Gumdrop::CLI::Internal
Public Class Methods
source_root()
click to toggle source
# File lib/gumdrop/cli/internal.rb, line 9 def self.source_root File.expand_path('../../..', __FILE__) end
Public Instance Methods
build()
click to toggle source
# File lib/gumdrop/cli/internal.rb, line 20 def build if options[:quiet] Gumdrop.configure do |c| c.log_level= :warn end end if options[:profile] require 'profile' end Gumdrop.run options.merge(mode:'build') end
server()
click to toggle source
# File lib/gumdrop/cli/internal.rb, line 36 def server Gumdrop.configure do |c| c.server_port= options[:port] end Gumdrop.site.options = options.merge(mode:'server') Launchy.open "http://127.0.0.1:#{ options[:port] }" if options[:browser] Gumdrop.log.warn "Launching dev server at http://127.0.0.1:#{ options[:port] }" Gumdrop::Server end
template(name)
click to toggle source
# File lib/gumdrop/cli/internal.rb, line 47 def template(name) template= name template_path = home_template_path name if File.exists? template_path say "A template named '#{name}' already exists!" else say "Creating template: #{name}" say " ~/.gumdrop/templates/#{name}" site_root= Gumdrop.site.root FileUtils.mkdir_p File.dirname(template_path) FileUtils.cp_r (site_root / "."), template_path end end
uris()
click to toggle source
# File lib/gumdrop/cli/internal.rb, line 64 def uris Gumdrop.configure do |c| c.log_level= :error end Gumdrop.site.scan say "Gumdrop found:" say "" Gumdrop.site.contents.keys.sort.each do |uri| content= Gumdrop.site.contents[uri] blackout= Gumdrop.site.in_blacklist?(uri) ? 'X' : ' ' generated= content.generated? ? '*' : ' ' # binary= content.binary? ? '!' : ' ' # say " #{blackout + generated + binary} #{content.uri}" say " #{blackout + generated } #{content.uri}" end say "" say "Legend:" say " X = On the blacklist" say " * = Generated (not on fs)" # say " ! = Binary file" end
version()
click to toggle source
# File lib/gumdrop/cli/internal.rb, line 88 def version say "Gumdrop v#{ Gumdrop::VERSION }" end
Private Instance Methods
home_path(name="")
click to toggle source
# File lib/gumdrop/cli/internal.rb, line 94 def home_path(name="") File.expand_path "~" /".gumdrop" / name end
home_template_path(template)
click to toggle source
# File lib/gumdrop/cli/internal.rb, line 98 def home_template_path(template) home_path 'templates' / template end
local_path(name="")
click to toggle source
# File lib/gumdrop/cli/internal.rb, line 102 def local_path(name="") "." / name end