story 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1285b7a2976c422296af617c5e2c0e5b69b0f25f
4
- data.tar.gz: abaa1d736158b1e33fe1625f366dfd1f51fffed0
3
+ metadata.gz: e20e544e8cae129c302c11ab9029113f6e38d61c
4
+ data.tar.gz: e770f5be0f8a24de0aae5f6fcb058a3085be5e07
5
5
  SHA512:
6
- metadata.gz: 8748d9ea721b1ef781dac85f4d921375c60eabbe9e86268f5048c5469933062451009f1572ac472337daa202bd4d28ddcd0f27745af3dff692d96ea410f7a3eb
7
- data.tar.gz: 57ef13e4ae9abcff35aaf3cce388e213dd40950f7c6ac84237ae6509c591f8185976d3867ed6a38d79fda8f3b884d817a14dfdc4bdc695d1e1931e1804ea5246
6
+ metadata.gz: 7fa887631c3496ec20bb87258d458dcb1aaabdbdd7649fa4094ef7b4bd0ed649a1ea7ece06afb8e6705f2ea7eef7d3037b41f527a5831ee4a49d0de8fa01832b
7
+ data.tar.gz: d3c9a3247ff6de5febd7ed5ba222a05f6090b05f93b0f6e0c0a5d57068fbc6b2cbdd9ab150cd81d2b7fd850c53fec99c09858bfbbb82c6dcfd80b6f552b3d5a1
data/Gemfile CHANGED
@@ -2,3 +2,5 @@ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in story.gemspec
4
4
  gemspec
5
+ gem 'sinatra'
6
+ gem 'slim'
data/README.md CHANGED
@@ -1,29 +1,2 @@
1
1
  # Story
2
-
3
- TODO: Write a gem description
4
-
5
- ## Installation
6
-
7
- Add this line to your application's Gemfile:
8
-
9
- gem 'story'
10
-
11
- And then execute:
12
-
13
- $ bundle
14
-
15
- Or install it yourself as:
16
-
17
- $ gem install story
18
-
19
- ## Usage
20
-
21
- TODO: Write usage instructions here
22
-
23
- ## Contributing
24
-
25
- 1. Fork it
26
- 2. Create your feature branch (`git checkout -b my-new-feature`)
27
- 3. Commit your changes (`git commit -am 'Add some feature'`)
28
- 4. Push to the branch (`git push origin my-new-feature`)
29
- 5. Create new Pull Request
2
+ Gem for creating awesome personal blog.
data/Rakefile CHANGED
@@ -1 +1 @@
1
- require "bundler/gem_tasks"
1
+ require "bundler/gem_tasks"
data/lib/story/meta.rb ADDED
@@ -0,0 +1,8 @@
1
+ module Story
2
+ module Meta
3
+ NAME = 'story'
4
+ VERSION = '0.0.2'
5
+ CHARSET = 'utf-8'
6
+ DEFAULT_BLOG_TITLE = 'Personal Blog'
7
+ end
8
+ end
@@ -0,0 +1,41 @@
1
+ module Story
2
+ class Base < Sinatra::Base
3
+ include Utils
4
+
5
+ configure do
6
+ set :views, settings.views.to_s.gsub(/views$/, '/templates/story')
7
+ set :blog_title, Meta::DEFAULT_BLOG_TITLE
8
+ set :charset, Meta::CHARSET
9
+ set :static_ext, false
10
+ end
11
+
12
+ before do
13
+ @additional_styles ||= load_additional_styles
14
+ end
15
+
16
+ get %r{(.*\..*)} do |url|
17
+ if data = url.match(/(.*)\.(css|js|json|zip|mp3|mp4|ogg|mpeg|pdf|rtf|txt|doc|slim|xml|png|gif|jpg|jpeg|svg|tiff|#{settings.static_ext})/)
18
+ raise not_found if not File.exists? ".#{data[1]}.#{data[2]}"
19
+ content_type case data[2]
20
+ when "css", "xml" then "text/#{data[2]}"
21
+ when "js" then "text/javascript"
22
+ when "mp3", "mp4", "ogg", "mpeg" then "audio/#{data[2]}"
23
+ when "json", "pdf", "zip" then "application/#{data[2]}"
24
+ when "png", "gif", "jpg", "jpeg", "svg", "tiff" then "image/#{data[2]}"
25
+ else "text/plain"
26
+ end
27
+ File.read ".#{data[1]}.#{data[2]}"
28
+ else
29
+ raise not_found
30
+ end
31
+ end
32
+
33
+ get '/' do
34
+ slim :index
35
+ end
36
+
37
+ not_found do
38
+ 'Page not found'
39
+ end
40
+ end
41
+ end
@@ -0,0 +1 @@
1
+ div Story
@@ -0,0 +1,9 @@
1
+ doctype html
2
+ html
3
+ head
4
+ title = settings.blog_title
5
+ == slim :meta
6
+ == slim :styles
7
+ == slim :scripts
8
+ body
9
+ == yield
@@ -0,0 +1 @@
1
+ meta charset="#{Story::Meta::CHARSET}"
File without changes
@@ -0,0 +1,5 @@
1
+ / link rel='stylesheet' href=''
2
+ - if @additional_styles
3
+ - settings.additional_stylesheets.each do |stylesheet|
4
+ - if File.exists? stylesheet
5
+ link rel='stylesheet' href='#{stylesheet}'
@@ -0,0 +1,16 @@
1
+ module Story
2
+ module Utils
3
+ def load_additional_styles
4
+ begin
5
+ settings.additional_stylesheets
6
+ rescue NoMethodError
7
+ end
8
+ end
9
+
10
+ def self.lib_dir
11
+ ["#{File.dirname(File.expand_path($0))}/../lib/#{Meta::NAME}", "#{Gem.dir}/gems/#{Meta::NAME}-#{Meta::VERSION}/lib/#{Meta::NAME}"]
12
+ .each {|lib| return i if File.readable? lib }
13
+ raise LoadError
14
+ end
15
+ end
16
+ end
data/lib/story.rb CHANGED
@@ -1,5 +1,5 @@
1
- require "story/version"
2
-
3
- module Story
4
- # Your code goes here...
5
- end
1
+ # encoding: utf-8
2
+ require 'sinatra'
3
+ require 'story/meta'
4
+ require 'story/utils'
5
+ require 'story/router'
data/story.gemspec CHANGED
@@ -1,23 +1,23 @@
1
1
  # coding: utf-8
2
2
  lib = File.expand_path('../lib', __FILE__)
3
3
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'story/version'
4
+ require 'story/meta'
5
5
 
6
6
  Gem::Specification.new do |spec|
7
- spec.name = "story"
8
- spec.version = Story::VERSION
9
- spec.authors = ["Rozzy"]
10
- spec.email = ["berozzy@gmail.com"]
7
+ spec.name = 'story'
8
+ spec.version = Story::Meta::VERSION
9
+ spec.authors = ['Rozzy']
10
+ spec.email = ['berozzy@gmail.com']
11
11
  spec.description = %q{Ruby blog engine}
12
12
  spec.summary = %q{Simple blog engine}
13
- spec.homepage = "https://github.com/rozzy/story"
14
- spec.license = "MIT"
13
+ spec.homepage = 'https://github.com/rozzy/story'
14
+ spec.license = 'MIT'
15
15
 
16
16
  spec.files = `git ls-files`.split($/)
17
17
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
- spec.require_paths = ["lib"]
19
+ spec.require_paths = ['lib']
20
20
 
21
- spec.add_development_dependency "bundler", "~> 1.3"
22
- spec.add_development_dependency "rake"
21
+ spec.add_development_dependency 'bundler', '~> 1.3'
22
+ spec.add_development_dependency 'rake'
23
23
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: story
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rozzy
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-11-03 00:00:00.000000000 Z
11
+ date: 2013-12-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -51,7 +51,14 @@ files:
51
51
  - README.md
52
52
  - Rakefile
53
53
  - lib/story.rb
54
- - lib/story/version.rb
54
+ - lib/story/meta.rb
55
+ - lib/story/router.rb
56
+ - lib/story/templates/story/index.slim
57
+ - lib/story/templates/story/layout.slim
58
+ - lib/story/templates/story/meta.slim
59
+ - lib/story/templates/story/scripts.slim
60
+ - lib/story/templates/story/styles.slim
61
+ - lib/story/utils.rb
55
62
  - story.gemspec
56
63
  homepage: https://github.com/rozzy/story
57
64
  licenses:
@@ -78,3 +85,4 @@ signing_key:
78
85
  specification_version: 4
79
86
  summary: Simple blog engine
80
87
  test_files: []
88
+ has_rdoc:
data/lib/story/version.rb DELETED
@@ -1,3 +0,0 @@
1
- module Story
2
- VERSION = "0.0.1"
3
- end