milk 0.0.3 → 0.0.4
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/Milk.tmproj +65 -0
- data/Rakefile +1 -1
- data/lib/milk.rb +1 -0
- data/lib/milk/application.rb +0 -2
- data/lib/milk/component.rb +16 -5
- data/lib/milk/fields/component_view.haml +1 -1
- data/lib/milk/fields/page_chooser.rb +2 -2
- data/lib/milk/page.rb +15 -3
- data/lib/milk/tasks.rb +1 -1
- data/pkg/milk-0.0.3.gem +0 -0
- metadata +27 -24
data/Milk.tmproj
ADDED
@@ -0,0 +1,65 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
3
|
+
<plist version="1.0">
|
4
|
+
<dict>
|
5
|
+
<key>currentDocument</key>
|
6
|
+
<string>lib/milk/page.rb</string>
|
7
|
+
<key>documents</key>
|
8
|
+
<array>
|
9
|
+
<dict>
|
10
|
+
<key>expanded</key>
|
11
|
+
<true/>
|
12
|
+
<key>name</key>
|
13
|
+
<string>Milk</string>
|
14
|
+
<key>regexFolderFilter</key>
|
15
|
+
<string>!.*/(\.[^/]*|CVS|_darcs|_MTN|\{arch\}|blib|.*~\.nib|.*\.(framework|app|pbproj|pbxproj|xcode(proj)?|bundle))$</string>
|
16
|
+
<key>selected</key>
|
17
|
+
<true/>
|
18
|
+
<key>sourceDirectory</key>
|
19
|
+
<string></string>
|
20
|
+
</dict>
|
21
|
+
</array>
|
22
|
+
<key>fileHierarchyDrawerWidth</key>
|
23
|
+
<integer>200</integer>
|
24
|
+
<key>metaData</key>
|
25
|
+
<dict>
|
26
|
+
<key>lib/milk.rb</key>
|
27
|
+
<dict>
|
28
|
+
<key>caret</key>
|
29
|
+
<dict>
|
30
|
+
<key>column</key>
|
31
|
+
<integer>12</integer>
|
32
|
+
<key>line</key>
|
33
|
+
<integer>19</integer>
|
34
|
+
</dict>
|
35
|
+
<key>firstVisibleColumn</key>
|
36
|
+
<integer>0</integer>
|
37
|
+
<key>firstVisibleLine</key>
|
38
|
+
<integer>10</integer>
|
39
|
+
</dict>
|
40
|
+
<key>lib/milk/page.rb</key>
|
41
|
+
<dict>
|
42
|
+
<key>caret</key>
|
43
|
+
<dict>
|
44
|
+
<key>column</key>
|
45
|
+
<integer>2</integer>
|
46
|
+
<key>line</key>
|
47
|
+
<integer>6</integer>
|
48
|
+
</dict>
|
49
|
+
<key>firstVisibleColumn</key>
|
50
|
+
<integer>0</integer>
|
51
|
+
<key>firstVisibleLine</key>
|
52
|
+
<integer>0</integer>
|
53
|
+
</dict>
|
54
|
+
</dict>
|
55
|
+
<key>openDocuments</key>
|
56
|
+
<array>
|
57
|
+
<string>lib/milk.rb</string>
|
58
|
+
<string>lib/milk/page.rb</string>
|
59
|
+
</array>
|
60
|
+
<key>showFileHierarchyDrawer</key>
|
61
|
+
<true/>
|
62
|
+
<key>windowFrame</key>
|
63
|
+
<string>{{281, 240}, {840, 469}}</string>
|
64
|
+
</dict>
|
65
|
+
</plist>
|
data/Rakefile
CHANGED
@@ -5,7 +5,7 @@ spec = Gem::Specification.new do |s|
|
|
5
5
|
s.summary = "Milk is a rack based content management system built for ease of use and simplicity. Milk tastes great with and without cookies."
|
6
6
|
s.description= File.read(File.join(File.dirname(__FILE__), 'README'))
|
7
7
|
s.requirements << 'none'
|
8
|
-
s.version = "0.0.
|
8
|
+
s.version = "0.0.4"
|
9
9
|
s.author = "Tim Caswell"
|
10
10
|
s.email = "tim@creationix.com"
|
11
11
|
s.homepage = "http://milk.rubyforge.org"
|
data/lib/milk.rb
CHANGED
data/lib/milk/application.rb
CHANGED
data/lib/milk/component.rb
CHANGED
@@ -5,11 +5,20 @@ module Milk
|
|
5
5
|
|
6
6
|
def to_yaml_properties
|
7
7
|
if respond_to? :global_properties
|
8
|
-
instance_variables.select { |name| !global_properties.member?
|
8
|
+
instance_variables.select { |name| name == :page || !global_properties.member?(name) }
|
9
9
|
else
|
10
10
|
instance_variables
|
11
11
|
end
|
12
12
|
end
|
13
|
+
|
14
|
+
def page
|
15
|
+
if @parent.class == Milk::Page
|
16
|
+
@parent
|
17
|
+
else
|
18
|
+
@parent.page
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
13
22
|
|
14
23
|
def self.local_properties(*props)
|
15
24
|
end
|
@@ -72,10 +81,12 @@ module Milk
|
|
72
81
|
return unless @system_name.nil?
|
73
82
|
|
74
83
|
@system_name = self.class.to_s.gsub(/([a-z])([A-Z])/) { "#{$1}_#{$2}" }.downcase
|
75
|
-
|
76
|
-
if File.file?
|
77
|
-
YAML.load_file(
|
78
|
-
|
84
|
+
yaml_file = Milk::CONFIG_DIR + "/#{@system_name}.yaml"
|
85
|
+
if File.file? yaml_file
|
86
|
+
obj = YAML.load_file(yaml_file)
|
87
|
+
obj.instance_variable_set(:@parent, @parent)
|
88
|
+
obj.instance_variables.each do |key|
|
89
|
+
self.instance_variable_set(key, obj.instance_variable_get(key))
|
79
90
|
end
|
80
91
|
end
|
81
92
|
end
|
@@ -1,2 +1,2 @@
|
|
1
|
-
%div{:class=>"component com_#{index}"
|
1
|
+
%div{:class=>"component com_#{index}"}
|
2
2
|
= yield
|
@@ -1,8 +1,8 @@
|
|
1
1
|
module Milk::Fields
|
2
2
|
class PageChooser < Milk::Field
|
3
3
|
@@pages = []
|
4
|
-
Dir.glob(Milk::PAGES_DIR + "/*.
|
5
|
-
pagename = File.basename(page, '.
|
4
|
+
Dir.glob(Milk::PAGES_DIR + "/*.yaml").each do |page|
|
5
|
+
pagename = File.basename(page, '.yaml').rpartition('/').last.gsub('.','/')
|
6
6
|
@@pages << {
|
7
7
|
file: page,
|
8
8
|
name: pagename,
|
data/lib/milk/page.rb
CHANGED
@@ -6,7 +6,7 @@ module Milk
|
|
6
6
|
attr_reader :pagename
|
7
7
|
|
8
8
|
def self.find(pagename)
|
9
|
-
yaml_file = Milk::PAGES_DIR + "/" + pagename + ".
|
9
|
+
yaml_file = Milk::PAGES_DIR + "/" + pagename + ".yaml"
|
10
10
|
raise PageNotFoundError unless File.readable? yaml_file
|
11
11
|
page = YAML.load_file(yaml_file)
|
12
12
|
page.instance_variable_set('@pagename', pagename)
|
@@ -38,7 +38,7 @@ module Milk
|
|
38
38
|
|
39
39
|
def save
|
40
40
|
save_settings
|
41
|
-
yaml_file = Milk::PAGES_DIR + "/" + @pagename + ".
|
41
|
+
yaml_file = Milk::PAGES_DIR + "/" + @pagename + ".yaml"
|
42
42
|
data = YAML.dump(self)
|
43
43
|
File.open(yaml_file, "w") do |file|
|
44
44
|
file.write(data)
|
@@ -92,7 +92,19 @@ module Milk
|
|
92
92
|
preview
|
93
93
|
end
|
94
94
|
end
|
95
|
-
|
95
|
+
|
96
|
+
def link_to
|
97
|
+
if @pagename == "Home"
|
98
|
+
"/"
|
99
|
+
else
|
100
|
+
"/#{@pagename}"
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
def link_to?(url)
|
105
|
+
(@pagename == "Home" && url == '/') || url == "/#{@pagename}"
|
106
|
+
end
|
107
|
+
|
96
108
|
def save_to_cache(html=nil)
|
97
109
|
html ||= view
|
98
110
|
folder = Milk::PUBLIC_DIR + "/cache/" + @pagename
|
data/lib/milk/tasks.rb
CHANGED
@@ -53,7 +53,7 @@ task :compile_sass => :environment do
|
|
53
53
|
Dir.glob(Milk::COMPONENTS_DIR + "/*.sass").each do |c|
|
54
54
|
puts "Adding #{c}"
|
55
55
|
open(c, "r") do |file|
|
56
|
-
style.write Sass::Engine.new(file.read, :filename=>c, :style=>:
|
56
|
+
style.write Sass::Engine.new(file.read, :filename=>c, :style=>:compact, :load_paths => [Milk::COMPONENTS_DIR]).render.strip
|
57
57
|
end
|
58
58
|
end
|
59
59
|
end
|
data/pkg/milk-0.0.3.gem
ADDED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: milk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tim Caswell
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-06-
|
12
|
+
date: 2009-06-11 00:00:00 -05:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -51,42 +51,45 @@ extensions: []
|
|
51
51
|
extra_rdoc_files: []
|
52
52
|
|
53
53
|
files:
|
54
|
-
- bin
|
55
|
-
- bin/milk
|
56
|
-
- INSTALL
|
57
54
|
- lib
|
58
55
|
- lib/milk
|
59
|
-
- lib/milk/
|
60
|
-
- lib/milk/
|
56
|
+
- lib/milk/page.rb
|
57
|
+
- lib/milk/haxe.rb
|
58
|
+
- lib/milk/tasks.rb
|
61
59
|
- lib/milk/field.rb
|
62
60
|
- lib/milk/fields
|
63
|
-
- lib/milk/fields/component.haml
|
64
|
-
- lib/milk/fields/component_array.haml
|
65
|
-
- lib/milk/fields/component_array.rb
|
66
|
-
- lib/milk/fields/component_view.haml
|
67
|
-
- lib/milk/fields/image_chooser.haml
|
68
|
-
- lib/milk/fields/image_chooser.rb
|
69
61
|
- lib/milk/fields/markdown_field.haml
|
70
|
-
- lib/milk/fields/markdown_field.rb
|
71
62
|
- lib/milk/fields/page_chooser.haml
|
72
|
-
- lib/milk/fields/page_chooser.rb
|
73
|
-
- lib/milk/fields/sprite_chooser.haml
|
74
|
-
- lib/milk/fields/sprite_chooser.rb
|
75
|
-
- lib/milk/fields/text_field.haml
|
76
63
|
- lib/milk/fields/text_field.rb
|
64
|
+
- lib/milk/fields/image_chooser.haml
|
65
|
+
- lib/milk/fields/text_field.haml
|
66
|
+
- lib/milk/fields/sprite_chooser.rb
|
77
67
|
- lib/milk/fields/xhtml.haml
|
78
|
-
- lib/milk/
|
79
|
-
- lib/milk/
|
80
|
-
- lib/milk/
|
68
|
+
- lib/milk/fields/component_array.rb
|
69
|
+
- lib/milk/fields/page_chooser.rb
|
70
|
+
- lib/milk/fields/image_chooser.rb
|
71
|
+
- lib/milk/fields/sprite_chooser.haml
|
72
|
+
- lib/milk/fields/markdown_field.rb
|
73
|
+
- lib/milk/fields/component_array.haml
|
74
|
+
- lib/milk/fields/component_view.haml
|
75
|
+
- lib/milk/fields/component.haml
|
76
|
+
- lib/milk/component.rb
|
77
|
+
- lib/milk/application.rb
|
81
78
|
- lib/milk/templates
|
82
|
-
- lib/milk/templates/bzrignore
|
83
|
-
- lib/milk/templates/rackup
|
84
79
|
- lib/milk/templates/rakefile
|
85
80
|
- lib/milk/templates/restart
|
81
|
+
- lib/milk/templates/bzrignore
|
82
|
+
- lib/milk/templates/rackup
|
86
83
|
- lib/milk.rb
|
87
84
|
- LICENSE
|
88
|
-
- Rakefile
|
89
85
|
- README
|
86
|
+
- pkg
|
87
|
+
- pkg/milk-0.0.3.gem
|
88
|
+
- Rakefile
|
89
|
+
- Milk.tmproj
|
90
|
+
- INSTALL
|
91
|
+
- bin
|
92
|
+
- bin/milk
|
90
93
|
has_rdoc: false
|
91
94
|
homepage: http://milk.rubyforge.org
|
92
95
|
post_install_message:
|