alula 0.0.1 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +4 -0
- data/VERSION +1 -0
- data/alula.gemspec +13 -8
- data/bin/alula +6 -1
- data/lib/alula/cli.rb +28 -23
- data/lib/alula/compressors.rb +10 -1
- data/lib/alula/plugins/assets.rb +8 -1
- data/lib/alula/rake_tasks.rb +12 -0
- data/lib/alula/site.rb +31 -24
- data/lib/alula/version.rb +2 -2
- data/template/Gemfile.erb +5 -0
- metadata +79 -33
data/Rakefile
CHANGED
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.1.0
|
data/alula.gemspec
CHANGED
@@ -16,12 +16,17 @@ Gem::Specification.new do |gem|
|
|
16
16
|
gem.require_paths = ["lib"]
|
17
17
|
gem.version = Alula::VERSION
|
18
18
|
|
19
|
-
gem.add_dependency 'jekyll'
|
20
|
-
gem.add_dependency 'sprockets'
|
21
|
-
gem.add_dependency 'thor'
|
22
|
-
gem.add_dependency 'rmagick'
|
23
|
-
gem.add_dependency 'sass'
|
24
|
-
gem.add_dependency 'coffee-script'
|
25
|
-
gem.add_dependency 'uglifier'
|
26
|
-
gem.add_dependency '
|
19
|
+
gem.add_dependency 'jekyll', '~> 0.11.2'
|
20
|
+
gem.add_dependency 'sprockets', '~> 2.4.0'
|
21
|
+
gem.add_dependency 'thor', '~> 0.14.6'
|
22
|
+
gem.add_dependency 'rmagick', '~> 2.13.1'
|
23
|
+
gem.add_dependency 'sass', '~> 3.1.15'
|
24
|
+
gem.add_dependency 'coffee-script', '~> 2.2.0'
|
25
|
+
gem.add_dependency 'uglifier', '~> 1.2.4'
|
26
|
+
gem.add_dependency 'front-compiler', '~> 1.1.0'
|
27
|
+
gem.add_dependency 'activesupport', '~> 3.2.3'
|
28
|
+
gem.add_dependency 'ruby-progressbar', '~> 0.0.10'
|
29
|
+
|
30
|
+
gem.add_development_dependency 'version', '~> 1.0.0'
|
31
|
+
gem.add_development_dependency 'pry', '~> 0.9.8.4'
|
27
32
|
end
|
data/bin/alula
CHANGED
@@ -2,6 +2,11 @@
|
|
2
2
|
|
3
3
|
$:.unshift File.join(File.dirname(__FILE__), *%w[.. lib])
|
4
4
|
|
5
|
-
|
5
|
+
# Are we in Alula blog
|
6
|
+
if File.exists?("Rakefile") and File.read("Rakefile") =~ /alula/
|
7
|
+
require 'bundler/setup'
|
8
|
+
Bundler.require(:default)
|
9
|
+
end
|
6
10
|
|
11
|
+
require 'alula/cli'
|
7
12
|
Alula::CLI.start
|
data/lib/alula/cli.rb
CHANGED
@@ -15,35 +15,40 @@ module Alula
|
|
15
15
|
empty_directory File.join(path, dir)
|
16
16
|
end
|
17
17
|
|
18
|
-
#
|
19
|
-
|
20
|
-
|
21
|
-
source :rubygems
|
22
|
-
|
23
|
-
gem "alula"
|
24
|
-
gem "alula-plugins"
|
25
|
-
gem "alula-themes"
|
26
|
-
EOF
|
27
|
-
end
|
28
|
-
|
29
|
-
# Create Rakefile
|
30
|
-
create_file File.join(path, "Rakefile") do
|
31
|
-
<<EOF
|
32
|
-
require 'rubygems'
|
33
|
-
require "bundler/setup"
|
34
|
-
Bundler.require(:default)
|
35
|
-
|
36
|
-
require 'alula/tasks'
|
37
|
-
EOF
|
18
|
+
# Insert templates
|
19
|
+
%w{Gemfile config.yml}.each do |tpl|
|
20
|
+
template "#{tpl}.erb" File.join(path, tpl)
|
38
21
|
end
|
39
22
|
|
40
|
-
# Create config
|
41
|
-
template "config.yml.erb", File.join(path, "config.yml")
|
42
|
-
|
43
23
|
# Initialize system
|
44
24
|
inside File.join(path) do
|
45
25
|
run "bundle install"
|
46
26
|
end
|
47
27
|
end
|
28
|
+
|
29
|
+
desc "generate", "Generates blog"
|
30
|
+
method_option :development, :type => :boolean, :default => true,
|
31
|
+
:desc => "Generate site using development settings. Keeps all assets and HTML uncompressed."
|
32
|
+
method_option :production, :type => :boolean, :default => false,
|
33
|
+
:desc => "Generate site suing production settings. Compresses all assets and HTML."
|
34
|
+
def generate
|
35
|
+
site = Alula::Site.new("asset_compress" => (!options["development"] or options["production"]))
|
36
|
+
site.generate
|
37
|
+
end
|
38
|
+
|
39
|
+
desc "preview", "Preview blog"
|
40
|
+
method_option :development, :type => :boolean, :default => true,
|
41
|
+
:desc => "Preview site using development settings. Keeps all assets and HTML uncompressed."
|
42
|
+
method_option :production, :type => :boolean, :default => false,
|
43
|
+
:desc => "Preview site suing production settings. Compresses all assets and HTML."
|
44
|
+
def preview
|
45
|
+
site = Alula::Site.new("asset_compress" => (!options["development"] or options["production"]))
|
46
|
+
site.preview
|
47
|
+
end
|
48
|
+
|
49
|
+
desc "attach POST ASSET", "Attached given asset, photo or video to given post"
|
50
|
+
def attach(post, asset)
|
51
|
+
puts "Hii haa"
|
52
|
+
end
|
48
53
|
end
|
49
54
|
end
|
data/lib/alula/compressors.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'sass'
|
2
2
|
require 'uglifier'
|
3
|
+
require 'front-compiler'
|
3
4
|
|
4
5
|
module Alula
|
5
6
|
module Compressors
|
@@ -19,7 +20,15 @@ module Alula
|
|
19
20
|
|
20
21
|
class JSCompressor
|
21
22
|
def compress(content)
|
22
|
-
Uglifier.new
|
23
|
+
@@compressor ||= Uglifier.new
|
24
|
+
@@compressor.compress(content)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
module HTMLCompressor
|
29
|
+
def output_with_compression
|
30
|
+
@@compressor ||= FrontCompiler.new
|
31
|
+
@@compressor.compact_html(@output)
|
23
32
|
end
|
24
33
|
end
|
25
34
|
end
|
data/lib/alula/plugins/assets.rb
CHANGED
@@ -40,7 +40,14 @@ module Alula
|
|
40
40
|
default "scripts"
|
41
41
|
|
42
42
|
def content(asset)
|
43
|
-
|
43
|
+
if File.size(File.join("public", asset)) < 10
|
44
|
+
content = File.read(File.join("public", asset))
|
45
|
+
unless content == ";"
|
46
|
+
"<script type=\"text/javascript\">#{content}</script>"
|
47
|
+
end
|
48
|
+
else
|
49
|
+
"<script type=\"text/javascript\" src=\"#{asset}\"></script>"
|
50
|
+
end
|
44
51
|
end
|
45
52
|
end
|
46
53
|
|
data/lib/alula/rake_tasks.rb
CHANGED
@@ -25,6 +25,18 @@ module Alula
|
|
25
25
|
site = Alula::Site.new
|
26
26
|
site.preview
|
27
27
|
end
|
28
|
+
|
29
|
+
desc "Generate blog (deployment)"
|
30
|
+
task :publish do
|
31
|
+
site = Alula::Site.new("asset_compress" => true)
|
32
|
+
site.generate
|
33
|
+
end
|
34
|
+
|
35
|
+
desc "Starts preview server in deployment mode"
|
36
|
+
task :preview_publish do
|
37
|
+
site = Alula::Site.new("asset_compress" => true)
|
38
|
+
site.preview
|
39
|
+
end
|
28
40
|
end
|
29
41
|
end
|
30
42
|
end
|
data/lib/alula/site.rb
CHANGED
@@ -3,6 +3,7 @@ require 'jekyll'
|
|
3
3
|
require 'sprockets'
|
4
4
|
require 'RMagick'
|
5
5
|
require 'active_support/inflector/methods'
|
6
|
+
require 'progressbar'
|
6
7
|
|
7
8
|
require 'alula/theme'
|
8
9
|
require 'alula/plugin'
|
@@ -19,9 +20,9 @@ module Alula
|
|
19
20
|
|
20
21
|
attr_reader :config, :jekyll
|
21
22
|
|
22
|
-
def initialize
|
23
|
+
def initialize(override = {})
|
23
24
|
# Load configuration
|
24
|
-
@config = YAML.load_file('config.yml')
|
25
|
+
@config = YAML.load_file('config.yml').deep_merge(override)
|
25
26
|
|
26
27
|
# Register local theme path
|
27
28
|
Alula::Theme.register("themes")
|
@@ -57,6 +58,12 @@ module Alula
|
|
57
58
|
if @config['asset_compress']
|
58
59
|
@sprockets.css_compressor = Alula::Compressors::CSSCompressor.new
|
59
60
|
@sprockets.js_compressor = Alula::Compressors::JSCompressor.new
|
61
|
+
|
62
|
+
[Jekyll::Post, Jekyll::Page].each do |klass|
|
63
|
+
klass.send(:include, Alula::Compressors::HTMLCompressor)
|
64
|
+
klass.send(:alias_method, :output_without_compression, :output)
|
65
|
+
klass.send(:alias_method, :output, :output_with_compression)
|
66
|
+
end
|
60
67
|
end
|
61
68
|
|
62
69
|
# Add theme to asset paths
|
@@ -163,23 +170,22 @@ module Alula
|
|
163
170
|
originals_path = File.join("attachments", "_originals")
|
164
171
|
thumbnails_path = File.join("attachments", "_thumbnails")
|
165
172
|
|
166
|
-
Dir[File.join(originals_path, "**", "*")]
|
173
|
+
assets = Dir[File.join(originals_path, "**", "*")]
|
167
174
|
.select {|f| File.file?(f) }
|
168
175
|
.collect {|f| File.join(f.split("/")[2..-1])}
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
else
|
180
|
-
puts "exists."
|
181
|
-
end
|
176
|
+
pb = ProgressBar.new "Assets", assets.count
|
177
|
+
|
178
|
+
assets.each do |original|
|
179
|
+
unless File.exists?(File.join(thumbnails_path, original))
|
180
|
+
image = Magick::Image.read(File.join(originals_path, original)).first
|
181
|
+
image.crop_resized!(width, height, Magick::NorthGravity)
|
182
|
+
FileUtils.mkdir_p File.dirname(File.join(thumbnails_path, original))
|
183
|
+
image.write(File.join(thumbnails_path, original))
|
184
|
+
end
|
185
|
+
pb.inc
|
182
186
|
end
|
187
|
+
|
188
|
+
pb.finish
|
183
189
|
end
|
184
190
|
|
185
191
|
def compile
|
@@ -196,19 +202,15 @@ module Alula
|
|
196
202
|
|
197
203
|
# Package javascript
|
198
204
|
File.open(File.join("_tmp", "assets", "scripts.js"), "w") do |tf|
|
199
|
-
tf.puts "
|
200
|
-
tf.puts " *=require #{@config["theme"]}"
|
205
|
+
tf.puts "//=require #{@config["theme"]}"
|
201
206
|
# Plugins
|
202
|
-
@config["plugins"].each { |plugin, opts| tf.puts "
|
203
|
-
tf.puts " */"
|
207
|
+
@config["plugins"].each { |plugin, opts| tf.puts "//=require #{plugin}" }
|
204
208
|
end
|
205
209
|
|
206
210
|
File.open(File.join("_tmp", "assets", "scripts_body.js"), "w") do |tf|
|
207
|
-
tf.puts "
|
208
|
-
tf.puts " *=require #{@config["theme"]}_body"
|
211
|
+
tf.puts "//=require #{@config["theme"]}_body"
|
209
212
|
# Plugins
|
210
|
-
@config["plugins"].each { |plugin, opts| tf.puts "
|
211
|
-
tf.puts " */"
|
213
|
+
@config["plugins"].each { |plugin, opts| tf.puts "//=require #{plugin}_body" }
|
212
214
|
end
|
213
215
|
|
214
216
|
|
@@ -231,6 +233,11 @@ module Alula
|
|
231
233
|
|
232
234
|
# Inject our manifest to jekyll
|
233
235
|
@jekyll.config["manifest"] = @manifest
|
236
|
+
|
237
|
+
# Cleanup
|
238
|
+
%w{styles.css scripts.js scripts_body.js}.each do |f|
|
239
|
+
FileUtils.rm(File.join("_tmp", "assets", f))
|
240
|
+
end
|
234
241
|
end
|
235
242
|
|
236
243
|
def process
|
data/lib/alula/version.rb
CHANGED
@@ -1,3 +1,3 @@
|
|
1
1
|
module Alula
|
2
|
-
VERSION =
|
3
|
-
end
|
2
|
+
VERSION = File.read(File.join(File.dirname(__FILE__), %w{.. .. VERSION})).strip
|
3
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: alula
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,92 +13,136 @@ date: 2012-04-06 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: jekyll
|
16
|
-
requirement: &
|
16
|
+
requirement: &70325892298600 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
|
-
- -
|
19
|
+
- - ~>
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version:
|
21
|
+
version: 0.11.2
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70325892298600
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: sprockets
|
27
|
-
requirement: &
|
27
|
+
requirement: &70325892297560 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
|
-
- -
|
30
|
+
- - ~>
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version:
|
32
|
+
version: 2.4.0
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70325892297560
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: thor
|
38
|
-
requirement: &
|
38
|
+
requirement: &70325892349240 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
|
-
- -
|
41
|
+
- - ~>
|
42
42
|
- !ruby/object:Gem::Version
|
43
|
-
version:
|
43
|
+
version: 0.14.6
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70325892349240
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: rmagick
|
49
|
-
requirement: &
|
49
|
+
requirement: &70325892348540 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ~>
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
54
|
+
version: 2.13.1
|
55
55
|
type: :runtime
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70325892348540
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: sass
|
60
|
-
requirement: &
|
60
|
+
requirement: &70325892347940 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
|
-
- -
|
63
|
+
- - ~>
|
64
64
|
- !ruby/object:Gem::Version
|
65
|
-
version:
|
65
|
+
version: 3.1.15
|
66
66
|
type: :runtime
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *70325892347940
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: coffee-script
|
71
|
-
requirement: &
|
71
|
+
requirement: &70325892347340 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
|
-
- -
|
74
|
+
- - ~>
|
75
75
|
- !ruby/object:Gem::Version
|
76
|
-
version:
|
76
|
+
version: 2.2.0
|
77
77
|
type: :runtime
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *70325892347340
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
81
|
name: uglifier
|
82
|
-
requirement: &
|
82
|
+
requirement: &70325892346700 !ruby/object:Gem::Requirement
|
83
83
|
none: false
|
84
84
|
requirements:
|
85
|
-
- -
|
85
|
+
- - ~>
|
86
86
|
- !ruby/object:Gem::Version
|
87
|
-
version:
|
87
|
+
version: 1.2.4
|
88
88
|
type: :runtime
|
89
89
|
prerelease: false
|
90
|
-
version_requirements: *
|
90
|
+
version_requirements: *70325892346700
|
91
|
+
- !ruby/object:Gem::Dependency
|
92
|
+
name: front-compiler
|
93
|
+
requirement: &70325892346080 !ruby/object:Gem::Requirement
|
94
|
+
none: false
|
95
|
+
requirements:
|
96
|
+
- - ~>
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: 1.1.0
|
99
|
+
type: :runtime
|
100
|
+
prerelease: false
|
101
|
+
version_requirements: *70325892346080
|
91
102
|
- !ruby/object:Gem::Dependency
|
92
103
|
name: activesupport
|
93
|
-
requirement: &
|
104
|
+
requirement: &70325892345600 !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ~>
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: 3.2.3
|
110
|
+
type: :runtime
|
111
|
+
prerelease: false
|
112
|
+
version_requirements: *70325892345600
|
113
|
+
- !ruby/object:Gem::Dependency
|
114
|
+
name: ruby-progressbar
|
115
|
+
requirement: &70325892345100 !ruby/object:Gem::Requirement
|
94
116
|
none: false
|
95
117
|
requirements:
|
96
|
-
- -
|
118
|
+
- - ~>
|
97
119
|
- !ruby/object:Gem::Version
|
98
|
-
version:
|
120
|
+
version: 0.0.10
|
99
121
|
type: :runtime
|
100
122
|
prerelease: false
|
101
|
-
version_requirements: *
|
123
|
+
version_requirements: *70325892345100
|
124
|
+
- !ruby/object:Gem::Dependency
|
125
|
+
name: version
|
126
|
+
requirement: &70325892344620 !ruby/object:Gem::Requirement
|
127
|
+
none: false
|
128
|
+
requirements:
|
129
|
+
- - ~>
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: 1.0.0
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: *70325892344620
|
135
|
+
- !ruby/object:Gem::Dependency
|
136
|
+
name: pry
|
137
|
+
requirement: &70325892344100 !ruby/object:Gem::Requirement
|
138
|
+
none: false
|
139
|
+
requirements:
|
140
|
+
- - ~>
|
141
|
+
- !ruby/object:Gem::Version
|
142
|
+
version: 0.9.8.4
|
143
|
+
type: :development
|
144
|
+
prerelease: false
|
145
|
+
version_requirements: *70325892344100
|
102
146
|
description: Alula is a simple tool for creating fast, static blogs easily.
|
103
147
|
email:
|
104
148
|
- mikko@owlforestry.com
|
@@ -112,6 +156,7 @@ files:
|
|
112
156
|
- LICENSE
|
113
157
|
- README.md
|
114
158
|
- Rakefile
|
159
|
+
- VERSION
|
115
160
|
- alula.gemspec
|
116
161
|
- bin/alula
|
117
162
|
- lib/alula.rb
|
@@ -124,6 +169,7 @@ files:
|
|
124
169
|
- lib/alula/tasks.rb
|
125
170
|
- lib/alula/theme.rb
|
126
171
|
- lib/alula/version.rb
|
172
|
+
- template/Gemfile.erb
|
127
173
|
- template/config.yml.erb
|
128
174
|
- vendor/javascripts/jquery.js
|
129
175
|
homepage: http://owlforestry.github.com/alula
|