cortex-reaver 0.2.4 → 0.2.5
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/cortex_reaver +11 -0
- data/lib/cortex_reaver.rb +17 -5
- data/lib/cortex_reaver/config.rb +12 -2
- data/lib/cortex_reaver/controller/main.rb +2 -7
- data/lib/cortex_reaver/version.rb +2 -2
- metadata +2 -2
data/bin/cortex_reaver
CHANGED
@@ -223,6 +223,17 @@ module CortexReaver
|
|
223
223
|
require 'irb'
|
224
224
|
require 'irb/completion'
|
225
225
|
|
226
|
+
# IRB monkeypatch to let us load a custom context object
|
227
|
+
class IRB::Irb
|
228
|
+
alias initialize_orig initialize
|
229
|
+
def initialize(workspace = nil, *args)
|
230
|
+
default = IRB.conf[:DEFAULT_OBJECT]
|
231
|
+
workspace ||= IRB::WorkSpace.new default if default
|
232
|
+
initialize_orig(workspace, *args)
|
233
|
+
end
|
234
|
+
end
|
235
|
+
|
236
|
+
IRB.conf[:DEFAULT_OBJECT] = CortexReaver
|
226
237
|
IRB.start
|
227
238
|
|
228
239
|
when :restart
|
data/lib/cortex_reaver.rb
CHANGED
@@ -41,9 +41,9 @@ module CortexReaver
|
|
41
41
|
files = Dir.entries(stock_dir) | Dir.entries(custom_dir)
|
42
42
|
|
43
43
|
# Reorder files if necessary.
|
44
|
-
|
45
|
-
|
46
|
-
|
44
|
+
first = (opts[:first] || []) & files
|
45
|
+
last = (opts[:last] || []) & files
|
46
|
+
files = first + (files - first - last) + last
|
47
47
|
|
48
48
|
# Read files
|
49
49
|
files.each do |file|
|
@@ -69,7 +69,13 @@ module CortexReaver
|
|
69
69
|
|
70
70
|
# Get CSS files
|
71
71
|
FileUtils.mkdir_p(custom_dir)
|
72
|
-
css = collect_files(
|
72
|
+
css = collect_files(
|
73
|
+
stock_dir,
|
74
|
+
custom_dir,
|
75
|
+
/^((?!style).)*\.css$/,
|
76
|
+
:first => config.css.first,
|
77
|
+
:last => config.css.last
|
78
|
+
)
|
73
79
|
|
74
80
|
# Write minified CSS
|
75
81
|
File.open(File.join(custom_dir, 'style.css'), 'w') do |file|
|
@@ -85,7 +91,13 @@ module CortexReaver
|
|
85
91
|
|
86
92
|
# Get JS files
|
87
93
|
FileUtils.mkdir_p(custom_dir)
|
88
|
-
js = collect_files(
|
94
|
+
js = collect_files(
|
95
|
+
stock_dir,
|
96
|
+
custom_dir,
|
97
|
+
/^((?!site).)*\.js$/,
|
98
|
+
:first => config.js.first,
|
99
|
+
:last => config.js.last
|
100
|
+
)
|
89
101
|
|
90
102
|
# Write minified JS
|
91
103
|
File.open(File.join(custom_dir, 'site.js'), 'w') do |file|
|
data/lib/cortex_reaver/config.rb
CHANGED
@@ -155,10 +155,16 @@ You can also just provide a regex for the path, in which case it is matched dire
|
|
155
155
|
['/', 'photographs']
|
156
156
|
]
|
157
157
|
|
158
|
-
define :css,
|
158
|
+
define :css, :default => Construct.new
|
159
|
+
css.define :first,
|
159
160
|
:desc => "An array of CSS files to load first, in order.",
|
160
161
|
:default => []
|
161
|
-
define :
|
162
|
+
css.define :last,
|
163
|
+
:desc => "An array of CSS files to load last, in order.",
|
164
|
+
:default => ['custom.css']
|
165
|
+
|
166
|
+
define :js, :default => Construct.new
|
167
|
+
js.define :first,
|
162
168
|
:desc => "An array of Javascript files to load first, in order.",
|
163
169
|
:default => [
|
164
170
|
'jquery.js',
|
@@ -167,6 +173,10 @@ You can also just provide a regex for the path, in which case it is matched dire
|
|
167
173
|
'jquery.hotkeys-0.7.9.js',
|
168
174
|
'cookie.js'
|
169
175
|
]
|
176
|
+
js.define :last,
|
177
|
+
:desc => "An Array of Javascript files to load last, in order.",
|
178
|
+
:default => []
|
179
|
+
|
170
180
|
|
171
181
|
define :photographs,
|
172
182
|
:desc => "Photograph configuration options.",
|
@@ -3,7 +3,7 @@ require 'libxml'
|
|
3
3
|
module CortexReaver
|
4
4
|
class MainController < Controller
|
5
5
|
map '/'
|
6
|
-
|
6
|
+
|
7
7
|
layout(:text) do |name, wish|
|
8
8
|
if request.xhr? or name == 'atom' or name == 'sitemap'
|
9
9
|
false
|
@@ -14,7 +14,6 @@ module CortexReaver
|
|
14
14
|
|
15
15
|
# We provide an XML sitemap.
|
16
16
|
provide(:xml, :type => 'text/xml') do |action, value|
|
17
|
-
Ramaze::Log.info action
|
18
17
|
if action.method == 'sitemap'
|
19
18
|
value
|
20
19
|
else
|
@@ -29,16 +28,12 @@ module CortexReaver
|
|
29
28
|
:pages
|
30
29
|
|
31
30
|
cache_action(:method => :index, :ttl => 120) do
|
32
|
-
user.id.to_i.to_s + flash.inspect
|
31
|
+
user.id.to_i.to_s + flash.inspect + request.path_info
|
33
32
|
end
|
34
33
|
cache_action(:method => :sitemap, :ttl => 300) do
|
35
34
|
request.path_info
|
36
35
|
end
|
37
36
|
|
38
|
-
def cache
|
39
|
-
respond Ramaze::Cache.action.stats
|
40
|
-
end
|
41
|
-
|
42
37
|
# the index action is called automatically when no other action is specified
|
43
38
|
def index(*ids)
|
44
39
|
if not ids.empty? and @page = Page.get(ids)
|
@@ -1,8 +1,8 @@
|
|
1
1
|
module CortexReaver
|
2
2
|
APP_NAME = 'Cortex Reaver'
|
3
|
-
APP_VERSION = '0.2.
|
3
|
+
APP_VERSION = '0.2.5'
|
4
4
|
APP_AUTHOR = 'Kyle Kingsbury'
|
5
5
|
APP_EMAIL = 'aphyr@aphyr.com'
|
6
6
|
APP_URL = 'http://aphyr.com'
|
7
|
-
APP_COPYRIGHT = 'Copyright (c) 2009 Kyle Kingsbury <aphyr@aphyr.com>. All rights reserved.'
|
7
|
+
APP_COPYRIGHT = 'Copyright (c) 2009--2010 Kyle Kingsbury <aphyr@aphyr.com>. All rights reserved.'
|
8
8
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cortex-reaver
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kyle Kingsbury
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date:
|
12
|
+
date: 2010-01-01 00:00:00 -08:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|