octopress-ink 1.0.0.rc.38 → 1.0.0.rc.39
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/lib/octopress-ink.rb +3 -3
- data/lib/octopress-ink/assets.rb +1 -0
- data/lib/octopress-ink/assets/asset.rb +3 -2
- data/lib/octopress-ink/assets/config.rb +2 -2
- data/lib/octopress-ink/assets/lang_config.rb +15 -0
- data/lib/octopress-ink/assets/page.rb +3 -2
- data/lib/octopress-ink/jekyll/page.rb +2 -0
- data/lib/octopress-ink/plugin.rb +88 -27
- data/lib/octopress-ink/plugins.rb +16 -14
- data/lib/octopress-ink/utils.rb +21 -0
- data/lib/octopress-ink/version.rb +1 -1
- metadata +18 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2fefc72653c604f6032907e28920a720c14dac6d
|
4
|
+
data.tar.gz: 6948d4deaf142cbf2da3cf6d2aa3b9dce5cc01da
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2dd6f7519fefc7dbde61d38c1278676d573a8b687da792b9055fd0b0e0d18473529e8b2c26e31ca35ed461cf1463621af3c82380545883d51aaada8e02421ab6
|
7
|
+
data.tar.gz: c0c6f57fc24b1d99b4f33cc9696df24f8852b3259371f4859f93eb8453577d078ecf91a34ea4271c65ac9c5e3679c9d0058cddbc090c94c55c38fd55176ede64
|
data/CHANGELOG.md
CHANGED
data/lib/octopress-ink.rb
CHANGED
@@ -16,6 +16,7 @@ require 'octopress-ink/cache'
|
|
16
16
|
module Octopress
|
17
17
|
module Ink
|
18
18
|
|
19
|
+
autoload :Utils, 'octopress-ink/utils'
|
19
20
|
autoload :Assets, 'octopress-ink/assets'
|
20
21
|
autoload :Convertible, 'octopress-ink/jekyll/convertible'
|
21
22
|
autoload :Page, 'octopress-ink/jekyll/page'
|
@@ -42,8 +43,8 @@ module Octopress
|
|
42
43
|
version << "Octopress Ink v#{Octopress::Ink::VERSION}"
|
43
44
|
end
|
44
45
|
|
45
|
-
def self.payload
|
46
|
-
config = Plugins.config
|
46
|
+
def self.payload(lang=nil)
|
47
|
+
config = Plugins.config(lang)
|
47
48
|
ink_payload = {
|
48
49
|
'plugins' => config['plugins'],
|
49
50
|
'theme' => config['theme'],
|
@@ -145,7 +146,6 @@ module Octopress
|
|
145
146
|
|
146
147
|
path = copy_path(name, options)
|
147
148
|
|
148
|
-
|
149
149
|
if p = plugin(name)
|
150
150
|
copied = p.copy_asset_files(path, options)
|
151
151
|
if !copied.empty?
|
data/lib/octopress-ink/assets.rb
CHANGED
@@ -3,6 +3,7 @@ module Octopress
|
|
3
3
|
module Assets
|
4
4
|
autoload :Asset, 'octopress-ink/assets/asset'
|
5
5
|
autoload :Config, 'octopress-ink/assets/config'
|
6
|
+
autoload :LangConfig, 'octopress-ink/assets/lang_config'
|
6
7
|
autoload :FileAsset, 'octopress-ink/assets/file'
|
7
8
|
autoload :PageAsset, 'octopress-ink/assets/page'
|
8
9
|
autoload :Javascript, 'octopress-ink/assets/javascript'
|
@@ -20,11 +20,11 @@ module Octopress
|
|
20
20
|
def info
|
21
21
|
message = filename.ljust(35)
|
22
22
|
if disabled?
|
23
|
-
message += "disabled"
|
23
|
+
message += "-disabled-"
|
24
24
|
elsif self.respond_to?(:url_info)
|
25
25
|
message += url_info
|
26
26
|
elsif path.to_s != plugin_path
|
27
|
-
shortpath = File.join(Plugins.custom_dir, dir)
|
27
|
+
shortpath = File.join(Plugins.custom_dir.sub(Dir.pwd,''), dir).sub('/','')
|
28
28
|
message += "from: #{shortpath}/#{filename}"
|
29
29
|
end
|
30
30
|
" - #{message}"
|
@@ -81,6 +81,7 @@ module Octopress
|
|
81
81
|
else
|
82
82
|
target_dir = user_dir
|
83
83
|
end
|
84
|
+
|
84
85
|
FileUtils.mkdir_p File.join(target_dir, File.dirname(file))
|
85
86
|
FileUtils.cp plugin_path, File.join(target_dir, file)
|
86
87
|
target_dir.sub!(Dir.pwd+'/', '')
|
@@ -15,9 +15,9 @@ module Octopress
|
|
15
15
|
# If config plugin config file exists, return contents for list command
|
16
16
|
def info
|
17
17
|
if exists?(config = plugin_path)
|
18
|
-
|
18
|
+
Ink::Utils.pretty_print_yaml(read)
|
19
19
|
else
|
20
|
-
"
|
20
|
+
" none"
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
@@ -59,8 +59,9 @@ module Octopress
|
|
59
59
|
|
60
60
|
def info
|
61
61
|
message = super
|
62
|
-
|
63
|
-
message.ljust(
|
62
|
+
name = permalink_name << page.ext
|
63
|
+
message.sub!(/#{filename}/, name.ljust(filename.size))
|
64
|
+
message.ljust(25) << (permalink || page.permalink || '')
|
64
65
|
end
|
65
66
|
|
66
67
|
def permalink
|
@@ -2,6 +2,7 @@ module Octopress
|
|
2
2
|
module Ink
|
3
3
|
class Page < Jekyll::Page
|
4
4
|
include Ink::Convertible
|
5
|
+
attr_reader :asset, :plugin
|
5
6
|
|
6
7
|
# Purpose: Configs can override a page's permalink
|
7
8
|
#
|
@@ -12,6 +13,7 @@ module Octopress
|
|
12
13
|
#
|
13
14
|
def initialize(site, base, dir, name, asset)
|
14
15
|
@asset = asset
|
16
|
+
@plugin = asset.plugin
|
15
17
|
super(site, base, dir, name)
|
16
18
|
end
|
17
19
|
|
data/lib/octopress-ink/plugin.rb
CHANGED
@@ -26,7 +26,7 @@ module Octopress
|
|
26
26
|
@includes_dir = 'includes'
|
27
27
|
@javascripts_dir = 'javascripts'
|
28
28
|
@stylesheets_dir = 'stylesheets'
|
29
|
-
@
|
29
|
+
@lang_configs = []
|
30
30
|
@layouts = []
|
31
31
|
@includes = []
|
32
32
|
@css = []
|
@@ -43,7 +43,6 @@ module Octopress
|
|
43
43
|
end
|
44
44
|
|
45
45
|
def register
|
46
|
-
|
47
46
|
unless @assets_path.nil?
|
48
47
|
disable_assets
|
49
48
|
add_assets
|
@@ -118,12 +117,68 @@ module Octopress
|
|
118
117
|
@no_compress_js.reject(&:disabled?).compact
|
119
118
|
end
|
120
119
|
|
120
|
+
def user_plugin_dir
|
121
|
+
File.join(Plugins.custom_dir, slug)
|
122
|
+
end
|
123
|
+
|
121
124
|
# Plugin configuration
|
122
125
|
#
|
123
126
|
# returns: Hash of merged user and default config.yml files
|
124
127
|
#
|
125
|
-
def config
|
126
|
-
@
|
128
|
+
def config(lang=nil)
|
129
|
+
@config ||= configs.first.read
|
130
|
+
lang_config_hash[lang] || @config
|
131
|
+
end
|
132
|
+
|
133
|
+
# Language configurations
|
134
|
+
#
|
135
|
+
# returns: Hash of configs for files matching: conifg_[lang].yml
|
136
|
+
#
|
137
|
+
# Example:
|
138
|
+
# {
|
139
|
+
# 'de' => { configs },
|
140
|
+
# 'fr' => { configs }
|
141
|
+
# }
|
142
|
+
#
|
143
|
+
def lang_config_hash
|
144
|
+
@lang_config_hash ||= begin
|
145
|
+
configs = {}
|
146
|
+
|
147
|
+
user_lang_configs.each do |lang, file|
|
148
|
+
configs[lang] = SafeYAML.load_file(file)
|
149
|
+
end
|
150
|
+
|
151
|
+
plugin_lang_configs.each do |lang, file|
|
152
|
+
# Add to lang
|
153
|
+
@lang_configs << Assets::LangConfig.new(self, File.basename(file), lang)
|
154
|
+
configs[lang] = @lang_configs.last.read
|
155
|
+
end
|
156
|
+
|
157
|
+
configs
|
158
|
+
end
|
159
|
+
end
|
160
|
+
|
161
|
+
def plugin_lang_configs
|
162
|
+
lang_config_files(@assets_path)
|
163
|
+
end
|
164
|
+
|
165
|
+
def user_lang_configs
|
166
|
+
files = lang_config_files(user_plugin_dir)
|
167
|
+
plugin_lang_configs.keys.each {|k| files.delete(k)}
|
168
|
+
files
|
169
|
+
end
|
170
|
+
|
171
|
+
def lang_config_files(dir)
|
172
|
+
configs = {}
|
173
|
+
if defined?(Octopress::Multilingual) && Octopress.site.config['lang']
|
174
|
+
files = Dir[File.join(dir, 'config_*.yml')]
|
175
|
+
files.each do |file|
|
176
|
+
# Determine the language from the filename pattern: conifg_[lang].yml
|
177
|
+
lang = File.basename(file, '.*').split('_').last
|
178
|
+
configs[lang] = file
|
179
|
+
end
|
180
|
+
end
|
181
|
+
configs
|
127
182
|
end
|
128
183
|
|
129
184
|
# Remove files from Jekyll since they'll be proccessed by Ink instead
|
@@ -158,11 +213,6 @@ module Octopress
|
|
158
213
|
config['disable'] = disabled
|
159
214
|
end
|
160
215
|
|
161
|
-
def config_defaults
|
162
|
-
@config ||= Assets::Config.new(self, @config_file)
|
163
|
-
end
|
164
|
-
|
165
|
-
|
166
216
|
def can_disable
|
167
217
|
[
|
168
218
|
'pages',
|
@@ -180,18 +230,19 @@ module Octopress
|
|
180
230
|
|
181
231
|
def assets
|
182
232
|
{
|
183
|
-
'layouts'
|
184
|
-
'includes'
|
185
|
-
'pages'
|
186
|
-
'sass'
|
187
|
-
'css'
|
188
|
-
'js'
|
189
|
-
'minjs'
|
190
|
-
'coffee'
|
191
|
-
'images'
|
192
|
-
'fonts'
|
193
|
-
'files'
|
194
|
-
'config-file'
|
233
|
+
'layouts' => @layouts,
|
234
|
+
'includes' => @includes,
|
235
|
+
'pages' => @pages,
|
236
|
+
'sass' => @sass,
|
237
|
+
'css' => @css,
|
238
|
+
'js' => @js,
|
239
|
+
'minjs' => @no_compress_js,
|
240
|
+
'coffee' => @coffee,
|
241
|
+
'images' => @images,
|
242
|
+
'fonts' => @fonts,
|
243
|
+
'files' => @files,
|
244
|
+
'config-file' => @configs,
|
245
|
+
'lang-configs' => @lang_configs
|
195
246
|
}
|
196
247
|
end
|
197
248
|
|
@@ -206,14 +257,20 @@ module Octopress
|
|
206
257
|
case name
|
207
258
|
when 'pages'
|
208
259
|
header = "pages:".ljust(36) + "urls"
|
209
|
-
message
|
260
|
+
message << asset_list(assets, header)
|
210
261
|
when 'config-file'
|
211
|
-
message
|
262
|
+
message << asset_list(assets, 'config')
|
263
|
+
when 'lang-configs'
|
264
|
+
lang_config_hash.keys.each do |lang|
|
265
|
+
message << " config_#{lang}:\n"
|
266
|
+
message << Ink::Utils.pretty_print_yaml(config(lang))
|
267
|
+
message << "\n"
|
268
|
+
end
|
212
269
|
else
|
213
|
-
message
|
270
|
+
message << asset_list(assets, name)
|
214
271
|
end
|
215
272
|
|
216
|
-
message
|
273
|
+
message << "\n"
|
217
274
|
end
|
218
275
|
|
219
276
|
message
|
@@ -222,7 +279,7 @@ module Octopress
|
|
222
279
|
def asset_list(assets, heading)
|
223
280
|
list = " #{heading}:\n"
|
224
281
|
assets.each do |asset|
|
225
|
-
list
|
282
|
+
list << "#{asset.info.rstrip}\n"
|
226
283
|
end
|
227
284
|
|
228
285
|
list
|
@@ -233,7 +290,7 @@ module Octopress
|
|
233
290
|
message += " (#{slug})"
|
234
291
|
message += " - v#{@version}" if @version
|
235
292
|
if @description && !@description.empty?
|
236
|
-
message = "#{message.ljust(30)}
|
293
|
+
message = "#{message.ljust(30)}\n#{@description}"
|
237
294
|
end
|
238
295
|
message += "\n"
|
239
296
|
end
|
@@ -322,6 +379,10 @@ module Octopress
|
|
322
379
|
end
|
323
380
|
end
|
324
381
|
|
382
|
+
def configs
|
383
|
+
@configs ||= [Assets::Config.new(self, 'config.yml')]
|
384
|
+
end
|
385
|
+
|
325
386
|
def add_stylesheets
|
326
387
|
find_assets(@stylesheets_dir).each do |asset|
|
327
388
|
if File.extname(asset) =~ /s[ca]ss/
|
@@ -83,22 +83,24 @@ module Octopress
|
|
83
83
|
end
|
84
84
|
end
|
85
85
|
|
86
|
-
def self.config
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
plugins.each do |p|
|
95
|
-
unless p == @theme
|
96
|
-
@config['plugins'][p.slug] = p.config
|
97
|
-
end
|
98
|
-
end
|
86
|
+
def self.config(lang=nil)
|
87
|
+
@configs ||= {}
|
88
|
+
@configs[lang || 'default'] ||= get_config(lang)
|
89
|
+
end
|
90
|
+
|
91
|
+
def self.get_config(lang=nil)
|
92
|
+
config = {}
|
93
|
+
config['plugins'] = {}
|
99
94
|
|
100
|
-
|
95
|
+
plugins.each do |p|
|
96
|
+
if p == theme
|
97
|
+
config['theme'] = p.config(lang)
|
98
|
+
else
|
99
|
+
config['plugins'][p.slug] = p.config(lang)
|
100
|
+
end
|
101
101
|
end
|
102
|
+
|
103
|
+
config
|
102
104
|
end
|
103
105
|
|
104
106
|
# Inclue partials from plugins
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'json'
|
2
|
+
|
3
|
+
module Octopress
|
4
|
+
module Ink
|
5
|
+
module Utils
|
6
|
+
extend self
|
7
|
+
|
8
|
+
def pretty_print_yaml(yaml)
|
9
|
+
# Use json pretty_print, but make it look like yaml
|
10
|
+
#
|
11
|
+
JSON.pretty_generate(yaml)
|
12
|
+
.sub(/\A{\n/,'') # remove leading {
|
13
|
+
.sub(/}\z/,'') # remove trailing }
|
14
|
+
.gsub(/^/,' ') # indent
|
15
|
+
.gsub(/"(.+?)":/,'\1:') # remove quotes around keys
|
16
|
+
.gsub(/,$/,'') # remove commas from end of lines
|
17
|
+
.gsub(/\w+: {\s+}\n/,'') # remove keys with empty hashes
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: octopress-ink
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0.rc.
|
4
|
+
version: 1.0.0.rc.39
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brandon Mathis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-02-
|
11
|
+
date: 2015-02-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|
@@ -122,6 +122,20 @@ dependencies:
|
|
122
122
|
- - ">="
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: octopress-multilingual
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
125
139
|
- !ruby/object:Gem::Dependency
|
126
140
|
name: bundler
|
127
141
|
requirement: !ruby/object:Gem::Requirement
|
@@ -173,6 +187,7 @@ files:
|
|
173
187
|
- lib/octopress-ink/assets/config.rb
|
174
188
|
- lib/octopress-ink/assets/file.rb
|
175
189
|
- lib/octopress-ink/assets/javascript.rb
|
190
|
+
- lib/octopress-ink/assets/lang_config.rb
|
176
191
|
- lib/octopress-ink/assets/layout.rb
|
177
192
|
- lib/octopress-ink/assets/page.rb
|
178
193
|
- lib/octopress-ink/assets/sass.rb
|
@@ -198,6 +213,7 @@ files:
|
|
198
213
|
- lib/octopress-ink/tags/javascript.rb
|
199
214
|
- lib/octopress-ink/tags/set_lang.rb
|
200
215
|
- lib/octopress-ink/tags/stylesheet.rb
|
216
|
+
- lib/octopress-ink/utils.rb
|
201
217
|
- lib/octopress-ink/version.rb
|
202
218
|
homepage: https://github.com/octopress/ink
|
203
219
|
licenses:
|