story 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile +2 -0
- data/README.md +1 -28
- data/Rakefile +1 -1
- data/lib/story/meta.rb +8 -0
- data/lib/story/router.rb +41 -0
- data/lib/story/templates/story/index.slim +1 -0
- data/lib/story/templates/story/layout.slim +9 -0
- data/lib/story/templates/story/meta.slim +1 -0
- data/lib/story/templates/story/scripts.slim +0 -0
- data/lib/story/templates/story/styles.slim +5 -0
- data/lib/story/utils.rb +16 -0
- data/lib/story.rb +5 -5
- data/story.gemspec +10 -10
- metadata +11 -3
- data/lib/story/version.rb +0 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e20e544e8cae129c302c11ab9029113f6e38d61c
|
4
|
+
data.tar.gz: e770f5be0f8a24de0aae5f6fcb058a3085be5e07
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7fa887631c3496ec20bb87258d458dcb1aaabdbdd7649fa4094ef7b4bd0ed649a1ea7ece06afb8e6705f2ea7eef7d3037b41f527a5831ee4a49d0de8fa01832b
|
7
|
+
data.tar.gz: d3c9a3247ff6de5febd7ed5ba222a05f6090b05f93b0f6e0c0a5d57068fbc6b2cbdd9ab150cd81d2b7fd850c53fec99c09858bfbbb82c6dcfd80b6f552b3d5a1
|
data/Gemfile
CHANGED
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
data/lib/story/router.rb
ADDED
@@ -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 @@
|
|
1
|
+
meta charset="#{Story::Meta::CHARSET}"
|
File without changes
|
data/lib/story/utils.rb
ADDED
@@ -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
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
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/
|
4
|
+
require 'story/meta'
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
|
-
spec.name =
|
8
|
-
spec.version = Story::VERSION
|
9
|
-
spec.authors = [
|
10
|
-
spec.email = [
|
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 =
|
14
|
-
spec.license =
|
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 = [
|
19
|
+
spec.require_paths = ['lib']
|
20
20
|
|
21
|
-
spec.add_development_dependency
|
22
|
-
spec.add_development_dependency
|
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.
|
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
|
+
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/
|
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