microengine 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. data/LICENSE +674 -0
  2. data/README +102 -0
  3. data/Rakefile +67 -0
  4. data/access.log +1 -0
  5. data/bin/microengine +0 -0
  6. data/content/403/en.body +2 -0
  7. data/content/403/en.header +1 -0
  8. data/content/403/layout +1 -0
  9. data/content/403/ru.body +2 -0
  10. data/content/403/ru.header +1 -0
  11. data/content/404/en.body +5 -0
  12. data/content/404/en.header +1 -0
  13. data/content/404/layout +1 -0
  14. data/content/404/ru.body +5 -0
  15. data/content/404/ru.header +1 -0
  16. data/content/WARNING +2 -0
  17. data/content/en.body +2 -0
  18. data/content/en.header +1 -0
  19. data/content/layout +1 -0
  20. data/content/ru.body +2 -0
  21. data/content/ru.header +1 -0
  22. data/layouts/WARNING +2 -0
  23. data/layouts/default/en.yaml +7 -0
  24. data/layouts/default/layout.rhtml +18 -0
  25. data/layouts/default/ru.yaml +7 -0
  26. data/lib/microengine/admin.rb +268 -0
  27. data/lib/microengine/admin_exception.rb +31 -0
  28. data/lib/microengine/admin_page.rb +199 -0
  29. data/lib/microengine/assambler.rb +192 -0
  30. data/lib/microengine/dispatcher.rb +125 -0
  31. data/lib/microengine/file_cache.rb +62 -0
  32. data/lib/microengine/html/deleter.rhtml +11 -0
  33. data/lib/microengine/html/editor.rhtml +34 -0
  34. data/lib/microengine/html/en.yaml +33 -0
  35. data/lib/microengine/html/error.rhtml +6 -0
  36. data/lib/microengine/html/refresher.rhtml +7 -0
  37. data/lib/microengine/html/ru.yaml +33 -0
  38. data/lib/microengine/html/untranslater.rhtml +11 -0
  39. data/lib/microengine/http.rb +213 -0
  40. data/lib/microengine/initializer.rb +93 -0
  41. data/lib/microengine/memory_cache.rb +53 -0
  42. data/password +20 -0
  43. data/public/microengine.fcgi +5 -0
  44. data/public/styles/handheld.css +0 -0
  45. data/public/styles/print.css +3 -0
  46. data/public/styles/screen.css +18 -0
  47. metadata +106 -0
@@ -0,0 +1,53 @@
1
+ =begin
2
+ Load pages to memory and return it on requests.
3
+ Copyright (C) 2008 Andrey "A.I." Sitnik <andrey@sitnik.ru>
4
+
5
+ This program is free software: you can redistribute it and/or modify
6
+ it under the terms of the GNU General Public License as published by
7
+ the Free Software Foundation, either version 3 of the License, or
8
+ (at your option) any later version.
9
+
10
+ This program is distributed in the hope that it will be useful,
11
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ GNU General Public License for more details.
14
+
15
+ You should have received a copy of the GNU General Public License
16
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
17
+ =end
18
+
19
+ require "file_cache"
20
+
21
+ module Microengine
22
+ # Load pages to memory and return it on requests
23
+ class MemoryCache < FileCache
24
+ def initialize
25
+ @cache = {}
26
+ super
27
+ end
28
+
29
+ # Refresh cache
30
+ def refresh
31
+ @cache = {}
32
+ super
33
+ end
34
+
35
+ # Return XHTML page content
36
+ def get(path, lang)
37
+ @cache[path][lang]
38
+ end
39
+
40
+ protected
41
+
42
+ # Cache directory languages
43
+ def cache_content(dir, langs)
44
+ super dir, langs
45
+
46
+ @cache[dir] = {}
47
+ prefix = MICROENGINE_ROOT + '/cache' + dir + 'content.'
48
+ langs.each do |lang|
49
+ @cache[dir][lang] = IO.read prefix + lang + '.html'
50
+ end
51
+ end
52
+ end
53
+ end
data/password ADDED
@@ -0,0 +1,20 @@
1
+ #!/usr/bin/ruby
2
+
3
+ require "sha1"
4
+ require "yaml"
5
+
6
+ # Show help if necessary
7
+ if nil == ARGV[0]
8
+ puts 'Create new admin password for microengine.'
9
+ puts 'USAGE: password [PASSWORD]'
10
+ Process.exit
11
+ end
12
+
13
+ begin
14
+ shadow = File.new(File.dirname(__FILE__) + '/../config/shadow.yaml', 'w')
15
+ salt = SHA1::sha1(Time.now.to_s).to_s
16
+ hash = SHA1::sha1(ARGV[0] + salt).to_s
17
+ YAML::dump({'salt' => salt, 'hash' => hash}, shadow)
18
+ rescue
19
+ puts "Can't open password file. Please ensure that config/shadow exists anf you has permissions to write it."
20
+ end
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/ruby
2
+
3
+ # Load microengine and start FastCGI dispatcher
4
+
5
+ require File.dirname(__FILE__) + '/../lib/boot.rb'
File without changes
@@ -0,0 +1,3 @@
1
+ #languages {
2
+ display: none;
3
+ }
@@ -0,0 +1,18 @@
1
+ * {
2
+ margin: 0;
3
+ padding: 0;
4
+ }
5
+ body {
6
+ padding: 5px;
7
+ }
8
+ #languages {
9
+ float: right;
10
+ }
11
+ #languages li {
12
+ list-style: none;
13
+ display: inline;
14
+ padding-left: 0.5em;
15
+ }
16
+ #languages .selected {
17
+ font-weight: bold;
18
+ }
metadata ADDED
@@ -0,0 +1,106 @@
1
+ --- !ruby/object:Gem::Specification
2
+ rubygems_version: 0.9.4
3
+ specification_version: 1
4
+ name: microengine
5
+ version: !ruby/object:Gem::Version
6
+ version: 0.0.1
7
+ date: 2008-01-29 00:00:00 +03:00
8
+ summary: MicroEngine is a fast, simple and minimalistic site engine.
9
+ require_paths:
10
+ - lib
11
+ email: andrey@sitnik.ru
12
+ homepage: http://microengine.rubyforge.org
13
+ rubyforge_project: microengine
14
+ description: MicroEngine is a fast, simple and minimalistic site engine. It contain good i18n support and web interface to edit, create and delete pages. It be created for simple sites, which only share information (maybe in some languages) like homepages.
15
+ autorequire:
16
+ default_executable: microengine
17
+ bindir: bin
18
+ has_rdoc: false
19
+ required_ruby_version: !ruby/object:Gem::Version::Requirement
20
+ requirements:
21
+ - - ">"
22
+ - !ruby/object:Gem::Version
23
+ version: 0.0.0
24
+ version:
25
+ platform: ruby
26
+ signing_key:
27
+ cert_chain:
28
+ post_install_message:
29
+ authors:
30
+ - Andrey "A.I." Sitnik
31
+ files:
32
+ - bin/microengine
33
+ - content/403
34
+ - content/403/ru.body
35
+ - content/403/ru.header
36
+ - content/403/en.header
37
+ - content/403/en.body
38
+ - content/403/layout
39
+ - content/ru.body
40
+ - content/404
41
+ - content/404/ru.body
42
+ - content/404/ru.header
43
+ - content/404/en.header
44
+ - content/404/en.body
45
+ - content/404/layout
46
+ - content/ru.header
47
+ - content/WARNING
48
+ - content/en.header
49
+ - content/en.body
50
+ - content/layout
51
+ - layouts/WARNING
52
+ - layouts/default
53
+ - layouts/default/ru.yaml
54
+ - layouts/default/layout.rhtml
55
+ - layouts/default/en.yaml
56
+ - lib/microengine/file_cache.rb
57
+ - lib/microengine/http.rb
58
+ - lib/microengine/initializer.rb
59
+ - lib/microengine/memory_cache.rb
60
+ - lib/microengine/dispatcher.rb
61
+ - lib/microengine/assambler.rb
62
+ - lib/microengine/admin_exception.rb
63
+ - lib/microengine/admin_page.rb
64
+ - lib/microengine/html
65
+ - lib/microengine/html/ru.yaml
66
+ - lib/microengine/html/untranslater.rhtml
67
+ - lib/microengine/html/editor.rhtml
68
+ - lib/microengine/html/refresher.rhtml
69
+ - lib/microengine/html/error.rhtml
70
+ - lib/microengine/html/en.yaml
71
+ - lib/microengine/html/deleter.rhtml
72
+ - lib/microengine/admin.rb
73
+ - public/javascripts
74
+ - public/images
75
+ - public/styles
76
+ - public/styles/handheld.css
77
+ - public/styles/print.css
78
+ - public/styles/screen.css
79
+ - public/microengine.fcgi
80
+ - access.log
81
+ - LICENSE
82
+ - password
83
+ - Rakefile
84
+ - README
85
+ test_files: []
86
+
87
+ rdoc_options: []
88
+
89
+ extra_rdoc_files: []
90
+
91
+ executables:
92
+ - microengine
93
+ extensions: []
94
+
95
+ requirements: []
96
+
97
+ dependencies:
98
+ - !ruby/object:Gem::Dependency
99
+ name: fastcgi
100
+ version_requirement:
101
+ version_requirements: !ruby/object:Gem::Version::Requirement
102
+ requirements:
103
+ - - ">"
104
+ - !ruby/object:Gem::Version
105
+ version: 0.0.0
106
+ version: