Class: TinyPress::Site

Inherits:
Object
  • Object
show all
Defined in:
lib/tinypress/site.rb

Class Method Summary collapse

Class Method Details

.abort_unless_site_existsObject



22
23
24
25
26
27
28
29
# File 'lib/tinypress/site.rb', line 22

def self.abort_unless_site_exists
    unless site_exists?
        message = ""
        message += "Cannot find a TinyPress install at this location.\n".red
        message += "You can try setting up a new site with 'tinypress establish' to resolve this.\n".red
        raise message
    end
end

.generateObject



3
4
5
6
7
8
9
10
# File 'lib/tinypress/site.rb', line 3

def self.generate
    if self.site_exists?
        raise "Whoops! Looks like there's TinyPress site at this location already.".red
    else
        %x( touch .tinypressrc )
    end
    puts "Established a new TinyPress site.".green
end

.publishObject



12
13
14
15
16
# File 'lib/tinypress/site.rb', line 12

def self.publish
    self.abort_unless_site_exists

    puts "Published whole site.".green
end

.site_exists?Boolean



18
19
20
# File 'lib/tinypress/site.rb', line 18

def self.site_exists?
    File.exists?('.tinypressrc')
end