Class: Gumdrop::CLI::Internal
- Inherits:
-
Thor
- Object
- Thor
- Gumdrop::CLI::Internal
- Includes:
- Thor::Actions
- Defined in:
- lib/gumdrop/cli/internal.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.source_root ⇒ Object
9 10 11 |
# File 'lib/gumdrop/cli/internal.rb', line 9 def self.source_root File.('../../..', __FILE__) end |
Instance Method Details
#build ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/gumdrop/cli/internal.rb', line 20 def build if [:quiet] Gumdrop.configure do |c| c.log_level= :warn end end if [:profile] require 'profile' end Gumdrop.run .merge(mode:'build') end |
#server ⇒ Object
36 37 38 39 40 41 42 43 44 |
# File 'lib/gumdrop/cli/internal.rb', line 36 def server Gumdrop.configure do |c| c.server_port= [:port] end Gumdrop.site. = .merge(mode:'server') Launchy.open "http://127.0.0.1:#{ [:port] }" if [:browser] Gumdrop.log.warn "Launching dev server at http://127.0.0.1:#{ [:port] }" Gumdrop::Server end |
#template(name) ⇒ Object
47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# 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 ⇒ Object
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
# 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 |