Sha256: c1e7838517da7cf6172a6a71a04bd013c74f34301a3365b1bdabda1a8b97a3d0
Contents?: true
Size: 1.29 KB
Versions: 3
Compression:
Stored size: 1.29 KB
Contents
class Storys::Storys def initialize(root_path) raise "root_path must be an instance of Pathname" unless root_path.is_a?(Pathname) @root_path = root_path @storys_path = root_path + ".storys/" end def update update_app Storys::Update.new(self) end def install storys_path.mkdir unless File.exists?(storys_path) update_app end def update_app dev = ENV["STORYS_ENV"] == "development" app_children_paths.each do |file| storys_file = storys_path + file.basename FileUtils.rm_rf(storys_file, :verbose => dev) end if dev app_children_paths.each do |file| storys_file = storys_path + file.basename FileUtils.ln_sf(file, storys_file, :verbose => dev) end else FileUtils.cp_r(Storys::Storys.gem_path + "app/.", storys_path, :verbose => dev) end FileUtils.chmod_R(0755, storys_path, :verbose => dev) end def self.load_json(path) if File.exists?(path) JSON.parse(File.read(path)) else nil end end def self.save_json(path, data) File.open(path, "w") { |f| f << data.to_json } end private def app_children_paths app_path = Storys::Storys.gem_path + "app/" app_path.children.reject { |f| f.basename.to_s == "img"} #TODO: Deal with this directory properly end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
storys-0.0.3 | lib/storys/storys_package.rb |
storys-0.0.2 | lib/storys/storys_package.rb |
storys-0.0.1 | lib/storys/storys_package.rb |