striker 0.0.8.pre
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +179 -0
- data/Rakefile +1 -0
- data/bin/striker +58 -0
- data/lib/new_site/config.yml +17 -0
- data/lib/new_site/css/style.css +1 -0
- data/lib/new_site/js/script.js +1 -0
- data/lib/new_site/templates/archive/index.html +1 -0
- data/lib/new_site/templates/default.html +10 -0
- data/lib/new_site/templates/page.html +10 -0
- data/lib/new_site/templates/tags/index.html +1 -0
- data/lib/new_site/templates/tags/tag.html +2 -0
- data/lib/striker.rb +28 -0
- data/lib/striker/archive.rb +72 -0
- data/lib/striker/command/build.rb +34 -0
- data/lib/striker/command/new.rb +42 -0
- data/lib/striker/command/page.rb +67 -0
- data/lib/striker/command/strike.rb +18 -0
- data/lib/striker/command/templates/page.md +8 -0
- data/lib/striker/media/image.rb +78 -0
- data/lib/striker/page.rb +86 -0
- data/lib/striker/settings.rb +22 -0
- data/lib/striker/site.rb +27 -0
- data/lib/striker/tag.rb +77 -0
- data/lib/striker/tags/soundcloud.rb +26 -0
- data/lib/striker/tags/thumbnail.rb +38 -0
- data/lib/striker/tags/tweet.rb +25 -0
- data/lib/striker/tags/vimeo.rb +26 -0
- data/lib/striker/tags/youtube.rb +26 -0
- data/lib/striker/template.rb +33 -0
- data/lib/striker/version.rb +3 -0
- data/striker.gemspec +32 -0
- metadata +219 -0
@@ -0,0 +1,26 @@
|
|
1
|
+
module Striker
|
2
|
+
module Tags
|
3
|
+
class SoundCloud < Liquid::Tag
|
4
|
+
|
5
|
+
def initialize(tag, markup, tokens)
|
6
|
+
super
|
7
|
+
if m = markup.match(/^(\w+)\s?(\d+%?)w\s?(\d+%?)h/i)
|
8
|
+
@sound_id = m[1]
|
9
|
+
@width = m[2]
|
10
|
+
@height = m[3]
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def render(context)
|
15
|
+
if @sound_id
|
16
|
+
<<-IFRAME
|
17
|
+
<iframe width="#{@width}" height="#{@height}" scrolling="no" frameborder="no" src="https://w.soundcloud.com/player/?url=https%3A//api.soundcloud.com/tracks/#{@sound_id}"></iframe>
|
18
|
+
IFRAME
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
Liquid::Template.register_tag('soundcloud', Striker::Tags::SoundCloud)
|
@@ -0,0 +1,38 @@
|
|
1
|
+
module Striker
|
2
|
+
module Tags
|
3
|
+
class Thumbnail < Liquid::Tag
|
4
|
+
|
5
|
+
def initialize(tag, markup, tokens)
|
6
|
+
super
|
7
|
+
@markup = markup
|
8
|
+
@tokens = tokens
|
9
|
+
if m = markup.match(/(\d+)w\s(\d+)h\s?#?\[?([\w|\d|\-|\s]+)*\]?\s?\.?\[?([\w|\d|\-|\s]+)*\]?/)
|
10
|
+
@width = m[1] || ""
|
11
|
+
@height = m[2] || ""
|
12
|
+
@id = m[3] || ""
|
13
|
+
@class = m[4] || ""
|
14
|
+
elsif m = markup.match(/(\d{1,3}\.{1}[\d]+)s{1}\s?#?\[?([\w|-|\s]+)*\]?\s?\.?\[?([\w|-|\s]+)*\]?/)
|
15
|
+
@scale = m[1] || ""
|
16
|
+
@id = m[2] || ""
|
17
|
+
@class = m[3] || ""
|
18
|
+
else
|
19
|
+
if m = markup.match(/#?\[?([\w|-|\s]+)*\]?\s?\.?\[?([\w|\s|-]+)*\]?/)
|
20
|
+
@id = m[1] || ""
|
21
|
+
@class = m[2] || ""
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def render(context)
|
27
|
+
image = Media::Image.new(nil, image_options = { :width => @width, :height => @height, :scale => @scale, :context => context['page'] })
|
28
|
+
image.thumbnailize
|
29
|
+
%Q{
|
30
|
+
<img src="/#{Settings::CONFIG['assets']}/images/#{context['page']['thumbnail']['src']}" alt="#{context['page']['title']}" id="#{@id}" class="#{@class}">
|
31
|
+
}
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
Liquid::Template.register_tag('thumbnail', Striker::Tags::Thumbnail)
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Striker
|
2
|
+
module Tags
|
3
|
+
class Tweet < Liquid::Tag
|
4
|
+
|
5
|
+
def initialize(tag, markup, tokens)
|
6
|
+
super
|
7
|
+
hashtags = markup.match /\s?#\[([\w\-~$^*!?.:;+=\s]+)\]/
|
8
|
+
mentions = markup.match /\s?@\[([\w\-~$^*!?.:;+=\s]+)\]/
|
9
|
+
@hashtags = hashtags[1].gsub(" ", ",") unless hashtags.nil?
|
10
|
+
@mentions = mentions[1].gsub(" ", ",") unless mentions.nil?
|
11
|
+
end
|
12
|
+
|
13
|
+
def render(context)
|
14
|
+
<<-TWEET
|
15
|
+
<a href="https://twitter.com/share" class="twitter-share-button" data-via="smswaroop" data-hashtags="#{@hashtags}" data-related="#{@mentions}">Tweet</a>
|
16
|
+
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script>
|
17
|
+
TWEET
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
Liquid::Template.register_tag('tweet', Striker::Tags::Tweet)
|
25
|
+
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module Striker
|
2
|
+
module Tags
|
3
|
+
class Vimeo < Liquid::Tag
|
4
|
+
|
5
|
+
def initialize(tag, markup, tokens)
|
6
|
+
super
|
7
|
+
if m = markup.match(/^(\w+)\s?(\d+%?)w\s?(\d+%?)h/i)
|
8
|
+
@video_id = m[1]
|
9
|
+
@width = m[2]
|
10
|
+
@height = m[3]
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def render(context)
|
15
|
+
if @video_id
|
16
|
+
<<-IFRAME
|
17
|
+
<iframe src="http://player.vimeo.com/video/#{@video_id}" width="#{@width}" height="#{@height}" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>
|
18
|
+
IFRAME
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
Liquid::Template.register_tag('vimeo', Striker::Tags::Vimeo)
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module Striker
|
2
|
+
module Tags
|
3
|
+
class Youtube < Liquid::Tag
|
4
|
+
|
5
|
+
def initialize(tag, markup, tokens)
|
6
|
+
super
|
7
|
+
if m = markup.match(/^(\w+)\s?(\d+%?)w\s?(\d+%?)h/i)
|
8
|
+
@video_id = m[1]
|
9
|
+
@width = m[2]
|
10
|
+
@height = m[3]
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def render(context)
|
15
|
+
if @video_id
|
16
|
+
<<-IFRAME
|
17
|
+
<iframe width="#{@width}" height="#{@height}" src="http://www.youtube.com/embed/#{@video_id}"></iframe>
|
18
|
+
IFRAME
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
Liquid::Template.register_tag('youtube', Striker::Tags::Youtube)
|
@@ -0,0 +1,33 @@
|
|
1
|
+
module Striker
|
2
|
+
|
3
|
+
class Template
|
4
|
+
|
5
|
+
attr_reader :page
|
6
|
+
|
7
|
+
def initialize(page, meta)
|
8
|
+
@page = page
|
9
|
+
@site_meta = meta
|
10
|
+
end
|
11
|
+
|
12
|
+
def process
|
13
|
+
template = File.open(File.join(Settings::TEMPLATES_DIR, "#{@page.template}.html"), 'r').read
|
14
|
+
markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML, :autolink => true)
|
15
|
+
File.open(File.join(Settings::PUBLIC_DIR, "#{@page.permalink}"), 'w') do |f|
|
16
|
+
f.write Liquid::Template.parse(template).render(
|
17
|
+
'content' => parsed_content(markdown),
|
18
|
+
'page' => @page.page_data,
|
19
|
+
'site' => @site_meta
|
20
|
+
)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
def parsed_content(markdown)
|
26
|
+
Liquid::Template.parse(markdown.render(@page.content)).render(
|
27
|
+
'site' => @site_meta,
|
28
|
+
'page' => @page.page_data
|
29
|
+
)
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
end
|
data/striker.gemspec
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'striker/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "striker"
|
8
|
+
spec.version = Striker::VERSION
|
9
|
+
spec.authors = ["Swaroop SM"]
|
10
|
+
spec.email = ["swaroop.striker@gmail.com"]
|
11
|
+
spec.description = %q{Simple & Fast Static Site Generator}
|
12
|
+
spec.summary = %q{A super simple static site generator with quick creation of pages.}
|
13
|
+
spec.homepage = ""
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
22
|
+
spec.add_development_dependency "rake"
|
23
|
+
|
24
|
+
spec.add_runtime_dependency "commander", "~> 4.1.5"
|
25
|
+
spec.add_runtime_dependency "safe_yaml", "~> 0.9.7"
|
26
|
+
spec.add_runtime_dependency "liquid", "~> 2.5.3"
|
27
|
+
spec.add_runtime_dependency "redcarpet", "~> 3.0.0"
|
28
|
+
spec.add_runtime_dependency "webrick", "~> 1.3.1"
|
29
|
+
spec.add_runtime_dependency "stringex", "~> 2.1.0"
|
30
|
+
spec.add_runtime_dependency "mime-types", "~> 1.25"
|
31
|
+
spec.add_runtime_dependency "rmagick", "~> 2.13.2"
|
32
|
+
end
|
metadata
ADDED
@@ -0,0 +1,219 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: striker
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.8.pre
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Swaroop SM
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-11-01 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.3'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.3'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: commander
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ~>
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 4.1.5
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 4.1.5
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: safe_yaml
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 0.9.7
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ~>
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 0.9.7
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: liquid
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ~>
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 2.5.3
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ~>
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 2.5.3
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: redcarpet
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ~>
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 3.0.0
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ~>
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 3.0.0
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: webrick
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ~>
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: 1.3.1
|
104
|
+
type: :runtime
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ~>
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: 1.3.1
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: stringex
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ~>
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: 2.1.0
|
118
|
+
type: :runtime
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ~>
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: 2.1.0
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: mime-types
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ~>
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '1.25'
|
132
|
+
type: :runtime
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ~>
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '1.25'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: rmagick
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - ~>
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: 2.13.2
|
146
|
+
type: :runtime
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - ~>
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: 2.13.2
|
153
|
+
description: Simple & Fast Static Site Generator
|
154
|
+
email:
|
155
|
+
- swaroop.striker@gmail.com
|
156
|
+
executables:
|
157
|
+
- striker
|
158
|
+
extensions: []
|
159
|
+
extra_rdoc_files: []
|
160
|
+
files:
|
161
|
+
- .gitignore
|
162
|
+
- Gemfile
|
163
|
+
- LICENSE.txt
|
164
|
+
- README.md
|
165
|
+
- Rakefile
|
166
|
+
- bin/striker
|
167
|
+
- lib/new_site/config.yml
|
168
|
+
- lib/new_site/css/style.css
|
169
|
+
- lib/new_site/js/script.js
|
170
|
+
- lib/new_site/templates/archive/index.html
|
171
|
+
- lib/new_site/templates/default.html
|
172
|
+
- lib/new_site/templates/page.html
|
173
|
+
- lib/new_site/templates/tags/index.html
|
174
|
+
- lib/new_site/templates/tags/tag.html
|
175
|
+
- lib/striker.rb
|
176
|
+
- lib/striker/archive.rb
|
177
|
+
- lib/striker/command/build.rb
|
178
|
+
- lib/striker/command/new.rb
|
179
|
+
- lib/striker/command/page.rb
|
180
|
+
- lib/striker/command/strike.rb
|
181
|
+
- lib/striker/command/templates/page.md
|
182
|
+
- lib/striker/media/image.rb
|
183
|
+
- lib/striker/page.rb
|
184
|
+
- lib/striker/settings.rb
|
185
|
+
- lib/striker/site.rb
|
186
|
+
- lib/striker/tag.rb
|
187
|
+
- lib/striker/tags/soundcloud.rb
|
188
|
+
- lib/striker/tags/thumbnail.rb
|
189
|
+
- lib/striker/tags/tweet.rb
|
190
|
+
- lib/striker/tags/vimeo.rb
|
191
|
+
- lib/striker/tags/youtube.rb
|
192
|
+
- lib/striker/template.rb
|
193
|
+
- lib/striker/version.rb
|
194
|
+
- striker.gemspec
|
195
|
+
homepage: ''
|
196
|
+
licenses:
|
197
|
+
- MIT
|
198
|
+
metadata: {}
|
199
|
+
post_install_message:
|
200
|
+
rdoc_options: []
|
201
|
+
require_paths:
|
202
|
+
- lib
|
203
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
204
|
+
requirements:
|
205
|
+
- - '>='
|
206
|
+
- !ruby/object:Gem::Version
|
207
|
+
version: '0'
|
208
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
209
|
+
requirements:
|
210
|
+
- - '>'
|
211
|
+
- !ruby/object:Gem::Version
|
212
|
+
version: 1.3.1
|
213
|
+
requirements: []
|
214
|
+
rubyforge_project:
|
215
|
+
rubygems_version: 2.0.7
|
216
|
+
signing_key:
|
217
|
+
specification_version: 4
|
218
|
+
summary: A super simple static site generator with quick creation of pages.
|
219
|
+
test_files: []
|