class Ghost::Manager::GhostFile
Attributes
content[RW]
path[RW]
Public Class Methods
create(dir)
click to toggle source
# File lib/ghost/manager/ghost_file.rb, line 11 def self.create dir content = { "ghost-installation" => dir } json = JSON.pretty_generate content File.write File.join(Dir.pwd, "ghostfile.json"), json self.new end
new()
click to toggle source
# File lib/ghost/manager/ghost_file.rb, line 20 def initialize self.path = "#{Dir.pwd}/ghostfile.json" load_content end
Public Instance Methods
exists?()
click to toggle source
# File lib/ghost/manager/ghost_file.rb, line 25 def exists? File.exists? path end
ghost_path()
click to toggle source
# File lib/ghost/manager/ghost_file.rb, line 39 def ghost_path content["ghost-installation"] end
ghost_theme()
click to toggle source
# File lib/ghost/manager/ghost_file.rb, line 43 def ghost_theme content["ghost-theme"] end
load_content()
click to toggle source
# File lib/ghost/manager/ghost_file.rb, line 33 def load_content unless !exists? self.content = JSON.parse File.read(path) end end
save()
click to toggle source
# File lib/ghost/manager/ghost_file.rb, line 54 def save unless content.nil? json = JSON.pretty_generate(content) File.write path, json end end
set_default_theme(theme)
click to toggle source
# File lib/ghost/manager/ghost_file.rb, line 47 def set_default_theme theme unless content.nil? content["ghost-theme"] = theme save end end
theme_installed?()
click to toggle source
# File lib/ghost/manager/ghost_file.rb, line 29 def theme_installed? !content["ghost-theme"].nil? end