diff options
Diffstat (limited to 'new/lib')
-rw-r--r-- | new/lib/crys.rb | 4 | ||||
-rw-r--r-- | new/lib/crys/code_processor.rb | 0 | ||||
-rw-r--r-- | new/lib/crys/default_data.rb | 4 | ||||
-rw-r--r-- | new/lib/crys/file_watcher.rb | 0 | ||||
-rw-r--r-- | new/lib/crys/image_processor.rb | 10 | ||||
-rw-r--r-- | new/lib/crys/listing.rb | 0 | ||||
-rw-r--r-- | new/lib/crys/new_file.rb | 0 | ||||
-rw-r--r-- | new/lib/crys/page_from_erb.rb | 0 | ||||
-rw-r--r-- | new/lib/crys/page_from_org.rb | 0 | ||||
-rw-r--r-- | new/lib/crys/renderer.rb | 32 | ||||
-rw-r--r-- | new/lib/crys/resource_from_css.rb | 0 | ||||
-rw-r--r-- | new/lib/crys/server.rb | 21 |
12 files changed, 71 insertions, 0 deletions
diff --git a/new/lib/crys.rb b/new/lib/crys.rb new file mode 100644 index 0000000..333fcfb --- /dev/null +++ b/new/lib/crys.rb @@ -0,0 +1,4 @@ +require_relative "crys/server.rb" + +module Crys +end diff --git a/new/lib/crys/code_processor.rb b/new/lib/crys/code_processor.rb new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/new/lib/crys/code_processor.rb diff --git a/new/lib/crys/default_data.rb b/new/lib/crys/default_data.rb new file mode 100644 index 0000000..8333669 --- /dev/null +++ b/new/lib/crys/default_data.rb @@ -0,0 +1,4 @@ +module Crys + module DefaultData + end +end diff --git a/new/lib/crys/file_watcher.rb b/new/lib/crys/file_watcher.rb new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/new/lib/crys/file_watcher.rb diff --git a/new/lib/crys/image_processor.rb b/new/lib/crys/image_processor.rb new file mode 100644 index 0000000..1a33d04 --- /dev/null +++ b/new/lib/crys/image_processor.rb @@ -0,0 +1,10 @@ +module Crys + class ImageProcessor + def initialize(path:, width:, height:, format:) + end + + def path + + end + end +end diff --git a/new/lib/crys/listing.rb b/new/lib/crys/listing.rb new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/new/lib/crys/listing.rb diff --git a/new/lib/crys/new_file.rb b/new/lib/crys/new_file.rb new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/new/lib/crys/new_file.rb diff --git a/new/lib/crys/page_from_erb.rb b/new/lib/crys/page_from_erb.rb new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/new/lib/crys/page_from_erb.rb diff --git a/new/lib/crys/page_from_org.rb b/new/lib/crys/page_from_org.rb new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/new/lib/crys/page_from_org.rb diff --git a/new/lib/crys/renderer.rb b/new/lib/crys/renderer.rb new file mode 100644 index 0000000..c490330 --- /dev/null +++ b/new/lib/crys/renderer.rb @@ -0,0 +1,32 @@ +require 'erb' +require 'pry' + +module Crys + module Splash + class Theme + PARENT_DIR = File.expand_path(".", Dir.pwd) + + def render + template = ERB.new(File.read(PARENT_DIR + "/theme/" + self.class::PAGE)) + template.result(local_binding) + end + + def body + self.class::BODY.result(local_binding) + end + + private + + attr_accessor :template, :data + + def local_binding + local_binding = binding.clone + self.class::DATA.each do |k, v| + local_binding.local_variable_set(k,v) + end + local_binding + + end + end + end +end diff --git a/new/lib/crys/resource_from_css.rb b/new/lib/crys/resource_from_css.rb new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/new/lib/crys/resource_from_css.rb diff --git a/new/lib/crys/server.rb b/new/lib/crys/server.rb new file mode 100644 index 0000000..aa0c19c --- /dev/null +++ b/new/lib/crys/server.rb @@ -0,0 +1,21 @@ +require 'webrick' +module Crys + class Server + def initialize(root:) + @root = root + end + + def start + server = WEBrick::HTTPServer.new :Port => 8000, :DocumentRoot => root + trap 'INT' do server.shutdown end + + server.start + end + + private + + attr_reader :root + + end +end + |