darkhelmet-darkext 0.7.3 → 0.8.0
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.
- data/History.txt +5 -0
- data/VERSION.yml +2 -2
- data/lib/darkext/beagle.rb +5 -4
- data/lib/darkext/sinatra.rb +63 -0
- metadata +3 -2
data/History.txt
CHANGED
data/VERSION.yml
CHANGED
data/lib/darkext/beagle.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'darkext/io'
|
2
2
|
require 'darkext/symbol'
|
3
|
+
require 'extensions/string'
|
3
4
|
|
4
5
|
module Beagle
|
5
6
|
class BeagleError < RuntimeError
|
@@ -18,7 +19,7 @@ module Beagle
|
|
18
19
|
|
19
20
|
def self.start
|
20
21
|
raise BeagleError, "Beagle.home (BEAGLE_HOME) not set!" if home.nil?
|
21
|
-
system('beagled')
|
22
|
+
system('beagled --backend Files')
|
22
23
|
end
|
23
24
|
|
24
25
|
def self.stop
|
@@ -62,12 +63,12 @@ private
|
|
62
63
|
section_lines = section.split("\n")
|
63
64
|
section_hash = Hash.new
|
64
65
|
section_lines.each do |line|
|
65
|
-
if line.include?('=')
|
66
|
+
if !line.include?('=') || line.starts_with?(' Snip')
|
67
|
+
k,v = line.split(':')
|
68
|
+
else
|
66
69
|
k,v = line.split('=')
|
67
70
|
k = k.split(':').last
|
68
71
|
v.gsub!("'",'')
|
69
|
-
else
|
70
|
-
k,v = line.split(':')
|
71
72
|
end
|
72
73
|
section_hash[k.strip] = v.strip
|
73
74
|
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
module Darkext
|
2
|
+
module Sinatra
|
3
|
+
module Helpers
|
4
|
+
def view(view, options = {})
|
5
|
+
html = haml(view,options)
|
6
|
+
flash.clear
|
7
|
+
html
|
8
|
+
end
|
9
|
+
|
10
|
+
def partial(page, options = {})
|
11
|
+
# Can't make this use view() because of the flash.clear
|
12
|
+
haml(page, options.merge!(:layout => false))
|
13
|
+
end
|
14
|
+
|
15
|
+
def css_link_tag(sheet, media = 'screen,projection')
|
16
|
+
@dsh_sheet = sheet
|
17
|
+
@dsh_media = media
|
18
|
+
partial('%link{ :type => "text/css", :href => "/stylesheets/#{@dsh_sheet}.css", :rel => "stylesheet", :media => "#{@dsh_media}" }')
|
19
|
+
end
|
20
|
+
|
21
|
+
def js_script_tag(script)
|
22
|
+
@dsh_script = script
|
23
|
+
partial('%script{ :type => "text/javascript", :src => "/javascripts/#{@dsh_script}.js" }')
|
24
|
+
end
|
25
|
+
|
26
|
+
def js_tag(script)
|
27
|
+
@dsh_script = script
|
28
|
+
temp = ["%script{ :type => 'text/javascript' }",
|
29
|
+
" //<![CDATA[",
|
30
|
+
" = @dsh_script",
|
31
|
+
" //]]>"].join("\n")
|
32
|
+
partial(temp)
|
33
|
+
end
|
34
|
+
|
35
|
+
def flash
|
36
|
+
session[:flash] = {} if session[:flash] && session[:flash].class != Hash
|
37
|
+
session[:flash] ||= {}
|
38
|
+
end
|
39
|
+
|
40
|
+
def host
|
41
|
+
port = request.env['SERVER_PORT']
|
42
|
+
port = port == 80 ? "" : ":#{port}"
|
43
|
+
"#{protocol}://#{server_name}#{port}"
|
44
|
+
end
|
45
|
+
|
46
|
+
def protocol
|
47
|
+
request.env['rack.url_scheme']
|
48
|
+
end
|
49
|
+
|
50
|
+
def server_name
|
51
|
+
request.env['SERVER_NAME']
|
52
|
+
end
|
53
|
+
|
54
|
+
def set_title(extra)
|
55
|
+
@title = "#{options.site_name} - #{extra}"
|
56
|
+
end
|
57
|
+
|
58
|
+
def base
|
59
|
+
"#{host}#{options.site_base}"
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: darkhelmet-darkext
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Huckstep
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-02-
|
12
|
+
date: 2009-02-20 00:00:00 -08:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -31,6 +31,7 @@ files:
|
|
31
31
|
- lib/darkext/io.rb
|
32
32
|
- lib/darkext/symbol.rb
|
33
33
|
- lib/darkext/statistics.rb
|
34
|
+
- lib/darkext/sinatra.rb
|
34
35
|
- lib/darkext/boolean.rb
|
35
36
|
- lib/darkext/hash.rb
|
36
37
|
- lib/darkext/net.rb
|