soxer 0.9.8 → 0.9.9

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGES CHANGED
@@ -1,3 +1,18 @@
1
+ = 0.9.9 / 2011-03-03
2
+
3
+ * Changed the names of Classes to match CamelCase convention in Ruby
4
+
5
+ * Added .eot font to the mime collection to Rack
6
+
7
+ * Cleaned up the superfuous blocks of documentation.
8
+
9
+ * Fixed interpretation of layout: 'false' statement, if used inside yaml
10
+ file.
11
+
12
+ * Added dependancy on 'hashie' gem. Now page keys can be accessed
13
+ as hash keys(strings or symbols) as well as methods.
14
+ The following will yield the same: page[:date], page['date'], page.date
15
+
1
16
  = 0.9.8 / 2010-11-28
2
17
 
3
18
  * Standardized and beautified code (no particular standard though.)
data/README.markdown CHANGED
@@ -19,7 +19,6 @@ What Soxer is not (yet)...
19
19
 
20
20
  - ... a complete CMS in classic sense.
21
21
  - ... a *turn-key-slap-the-logo-on-and-charge-for-it* solution.
22
- - ... mature product.
23
22
 
24
23
 
25
24
  Test drive the soxer
data/bin/soxer CHANGED
@@ -61,8 +61,8 @@ def help
61
61
 
62
62
  Examples:
63
63
 
64
- #{b '$ soxer create blog myblog'}
65
- This command would create a new project directory 'myblog' with a mockup blog
64
+ #{b '$ soxer create empty app'}
65
+ This command would create a new project directory 'app' with a mockup empty
66
66
  soxer/sinatra application in it. You can tweak the design and parameters to
67
67
  acheve the desired experience.
68
68
 
@@ -86,6 +86,7 @@ def create template, dir
86
86
  return err "The destination directory exists."
87
87
  else
88
88
  FileUtils.copy_entry( File.join(skel, template), dir)
89
+ FileUtils.rm Dir.glob('**/EMPTY')
89
90
  return notice "Successfuly created '#{dir}' application directory from '#{template}'."
90
91
  end
91
92
  end
data/lib/soxer/main.rb CHANGED
@@ -1,3 +1,6 @@
1
+ # encoding: utf-8
2
+
3
+ require 'hashie'
1
4
  require 'sinatra/base'
2
5
  require 'yaml'
3
6
  require 'haml'
@@ -22,17 +25,17 @@ module Sinatra
22
25
  # License: Distributed under the GPL licence. http://www.gnu.org/licenses/gpl.html
23
26
  module Soxer
24
27
 
25
- # === The Filereader class
28
+ # === The FileReader class
26
29
  #
27
- # Filereader is responsible for reading a YAML file, that contains the
30
+ # FileReader is responsible for reading a YAML file, that contains the
28
31
  # content and metadata for each web page.
29
32
  #
30
- # Filereader also assumes that each YAML file contains 2 top level fields:
33
+ # FileReader also assumes that each YAML file contains 2 top level fields:
31
34
  # uuid:: A Universally Unique Identifier field
32
35
  # date:: A standard date and time field
33
36
  # if the fields are not present, they are automatically generated and
34
37
  # saved in the file.
35
- class Filereader
38
+ class FileReader
36
39
  # The name of the YAML file
37
40
  attr_accessor :filename
38
41
 
@@ -79,13 +82,13 @@ module Sinatra
79
82
  end
80
83
  end
81
84
 
82
- # === The Urlreader class
85
+ # === The UrlReader class
83
86
  #
84
- # Urlreader simply checks if the URL recieved can be matched to a file.
87
+ # UrlReader simply checks if the URL recieved can be matched to a file.
85
88
  # Currelntly it either matches a file path (ending with .yaml) from origin
86
89
  # (the default is "content" directory within application root) or a
87
90
  # directory path with index.yaml
88
- class Urlreader
91
+ class UrlReader
89
92
 
90
93
  # Url, recieved from the request
91
94
  attr_accessor :url
@@ -97,7 +100,7 @@ module Sinatra
97
100
  @s = Sinatra::Application
98
101
  end
99
102
 
100
- # Creates a filereader instance, maps the url to either yaml file or
103
+ # Creates a FileReader instance, maps the url to either yaml file or
101
104
  # index.yaml within a directory represented by url.
102
105
  def get_content
103
106
  self.settings
@@ -106,12 +109,36 @@ module Sinatra
106
109
  when File.exist?( f = File.join( @s.origin, @url+'/index.yaml' ) ) then f
107
110
  else throw :halt, [404, "Document not found"]
108
111
  end
109
- out = Filereader.new
112
+ out = FileReader.new
110
113
  out.filename = fn
111
114
  out.get_content
112
115
  end
113
116
  end
114
117
 
118
+ # === The DocumentStore class
119
+ #
120
+ # DocumentStore class extends the hash to enable document attribute access
121
+ # in one of three ways:
122
+ # hash key: page['key'] => value
123
+ # method call: page.key => value
124
+ # symbol: page[:key] => value
125
+ class Document < Hash
126
+ def initialize(attrs)
127
+ attrs.each do |k, v|
128
+ self[k] = v
129
+ end
130
+ end
131
+
132
+ def []=(k, v)
133
+ unless respond_to?(k)
134
+ self.class.send :define_method, k do
135
+ self[k]
136
+ end
137
+ end
138
+ super
139
+ end
140
+ end
141
+
115
142
  # === Helper module
116
143
  #
117
144
  # This module introduces several helper methods to Soxer application.
@@ -127,9 +154,9 @@ module Sinatra
127
154
  # [=> Hash]
128
155
  # A hash representation of yaml file.
129
156
  def get_page url=params[:splat][0]
130
- out = Urlreader.new
157
+ out = UrlReader.new
131
158
  out.url = url
132
- out.get_content
159
+ Hashie::Mash.new out.get_content
133
160
  end
134
161
 
135
162
  # === Document list generator method
@@ -146,7 +173,7 @@ module Sinatra
146
173
  fileset= Dir.glob File.join( settings.origin, "**", "*.yaml" )
147
174
  fileset.delete_if {|d| (d=~/\/index.yaml$/ and fileset.include? d[0..-12]+'.yaml') }
148
175
  output = fileset.map! do |f|
149
- file = Filereader.new
176
+ file = FileReader.new
150
177
  file.filename = f
151
178
  if block_given?
152
179
  f = block.call file.get_content
@@ -283,18 +310,6 @@ module Sinatra
283
310
  haml ('_'+snippet.to_s).to_sym, options.merge!(:layout => false)
284
311
  end
285
312
 
286
- #=== "link_to" rails like link_to generator
287
- #
288
- # This funnction accepts a 1 or 2 strings.
289
- #
290
- #==== text
291
- # A string that becomes the link text. If there is no second parameter,
292
- # link_to converts the string into a local url by replacing all spaces with
293
- # an underscore and downcasing the string.
294
- #
295
- #==== url
296
- # This string is used for 'href' in a link
297
-
298
313
  # === Link tag generator method
299
314
  # Generates Html <a href="#"></a> tag accordng to RoR convention.
300
315
  #
@@ -312,16 +327,6 @@ module Sinatra
312
327
  "<a href=\"#{url}\"> #{text}</a>"
313
328
  end
314
329
 
315
- # A simple string obuscator.
316
- # Useful for hiding emails and such
317
- #=== "obfuscate" simple string obuscator.
318
- #
319
- # This funnction accepts a 1 or 2 strings.
320
- #
321
- #==== str=nil
322
- # Obfuscates a string replacing characters with html entities.
323
- # Useful for hiding emails and such
324
-
325
330
  # === String obfuscator method
326
331
  # Converts strings into a stream of html character codes.
327
332
  #
@@ -351,6 +356,7 @@ module Sinatra
351
356
 
352
357
  mime_type :otf, 'application/x-font-TrueType'
353
358
  mime_type :ttf, 'application/x-font-TrueType'
359
+ mime_type :eot, 'application/vnd.ms-fontobject'
354
360
 
355
361
  app.get("/sitemap.xml") { sitemap }
356
362
 
@@ -392,7 +398,8 @@ module Sinatra
392
398
  content_type "text/html", :charset => "utf-8"
393
399
  page = get_page
394
400
  page['layout'] ||= 'layout'
395
- haml page['content'], :layout => page['layout'].to_sym, :locals => { :page => page }
401
+ page['layout'] == 'false' ? layout = false : layout = page['layout'].to_sym
402
+ haml page['content'], :layout => layout, :locals => { :page => page }
396
403
  end
397
404
 
398
405
  end
File without changes
File without changes
File without changes
data/soxer.gemspec CHANGED
@@ -4,8 +4,8 @@ Gem::Specification.new do |s|
4
4
  s.rubygems_version = '1.3.7'
5
5
 
6
6
  s.name = 'soxer'
7
- s.version = '0.9.8'
8
- s.date = '2010-11-28'
7
+ s.version = '0.9.9'
8
+ s.date = '2011-03-03'
9
9
  s.rubyforge_project = 'soxer'
10
10
 
11
11
  s.summary = "Dynamic web site generator engine"
@@ -23,6 +23,7 @@ Gem::Specification.new do |s|
23
23
  s.add_dependency('sinatra', "~> 1")
24
24
  s.add_dependency('haml', "~> 3")
25
25
  s.add_dependency('uuid', "~> 2")
26
+ s.add_dependency('hashie', "~> 1.0.0")
26
27
  s.add_dependency('sinatra-reloader', "~> 0.5")
27
28
 
28
29
  # = MANIFEST =
@@ -34,7 +35,7 @@ Gem::Specification.new do |s|
34
35
  bin/soxer
35
36
  lib/soxer.rb
36
37
  lib/soxer/main.rb
37
- ] + Dir.glob("{lib/soxer/views,lib/soxer/skel}/**/*")
38
+ ] + Dir.glob("{lib/soxer/views,lib/soxer/skel/**}/**")
38
39
  # = MANIFEST =
39
40
 
40
41
  s.executables = ['soxer']
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: soxer
3
3
  version: !ruby/object:Gem::Version
4
- hash: 43
4
+ hash: 41
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 9
9
- - 8
10
- version: 0.9.8
9
+ - 9
10
+ version: 0.9.9
11
11
  platform: ruby
12
12
  authors:
13
13
  - Toni Anzlovar
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-11-28 00:00:00 +01:00
18
+ date: 2011-03-03 00:00:00 +01:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -61,9 +61,25 @@ dependencies:
61
61
  type: :runtime
62
62
  version_requirements: *id003
63
63
  - !ruby/object:Gem::Dependency
64
- name: sinatra-reloader
64
+ name: hashie
65
65
  prerelease: false
66
66
  requirement: &id004 !ruby/object:Gem::Requirement
67
+ none: false
68
+ requirements:
69
+ - - ~>
70
+ - !ruby/object:Gem::Version
71
+ hash: 23
72
+ segments:
73
+ - 1
74
+ - 0
75
+ - 0
76
+ version: 1.0.0
77
+ type: :runtime
78
+ version_requirements: *id004
79
+ - !ruby/object:Gem::Dependency
80
+ name: sinatra-reloader
81
+ prerelease: false
82
+ requirement: &id005 !ruby/object:Gem::Requirement
67
83
  none: false
68
84
  requirements:
69
85
  - - ~>
@@ -74,7 +90,7 @@ dependencies:
74
90
  - 5
75
91
  version: "0.5"
76
92
  type: :runtime
77
- version_requirements: *id004
93
+ version_requirements: *id005
78
94
  description: Soxer is a file based dynamic web site creation tool for Sinatra.
79
95
  email: toni@formalibre.si
80
96
  executables:
@@ -98,7 +114,10 @@ files:
98
114
  - lib/soxer/views/google_analytics.haml
99
115
  - lib/soxer/views/google_ads.haml
100
116
  - lib/soxer/views/breadcrumb.haml
117
+ - lib/soxer/skel/empty/bin/EMPTY
101
118
  - lib/soxer/skel/empty/content/index.yaml
119
+ - lib/soxer/skel/empty/log/EMPTY
120
+ - lib/soxer/skel/empty/public/EMPTY
102
121
  - lib/soxer/skel/empty/config.yml
103
122
  - lib/soxer/skel/empty/config.ru
104
123
  - lib/soxer/skel/empty/views/layout.haml