cms-lite 0.2.7
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/.gemspec +47 -0
- data/MIT-LICENSE +20 -0
- data/README.markdown +87 -0
- data/Rakefile +66 -0
- data/VERSION +1 -0
- data/app/controllers/cms_lite_controller.rb +30 -0
- data/cms-lite.gemspec +62 -0
- data/config/cms_lite_routes.rb +11 -0
- data/lib/cms_lite.rb +103 -0
- data/lib/cms_lite/exceptions.rb +5 -0
- data/lib/cms_lite/initialize_routes.rb +8 -0
- data/lib/cms_lite/languages.rb +49 -0
- data/lib/cms_lite/tasks.rb +40 -0
- data/pkg/cms-lite-0.2.7.gem +0 -0
- data/rails/init.rb +2 -0
- data/tasks/rails.rake +2 -0
- data/test/cms_lite_test.rb +8 -0
- data/test/test_helper.rb +3 -0
- data/uninstall.rb +0 -0
- metadata +72 -0
data/.gemspec
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = nil
|
5
|
+
s.version = "0.2.3"
|
6
|
+
|
7
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
|
+
s.date = %q{2009-05-07}
|
9
|
+
s.extra_rdoc_files = [
|
10
|
+
"README.markdown"
|
11
|
+
]
|
12
|
+
s.files = [
|
13
|
+
"MIT-LICENSE",
|
14
|
+
"README.markdown",
|
15
|
+
"Rakefile",
|
16
|
+
"VERSION",
|
17
|
+
"app/controllers/cms_lite_controller.rb",
|
18
|
+
"cms_lite.gemspec",
|
19
|
+
"config/cms_lite_routes.rb",
|
20
|
+
"lib/cms_lite.rb",
|
21
|
+
"pkg/cms_lite-0.1.1.gem",
|
22
|
+
"rails/init.rb",
|
23
|
+
"tasks/rails.rake",
|
24
|
+
"test/cms_lite_test.rb",
|
25
|
+
"test/test_helper.rb",
|
26
|
+
"uninstall.rb"
|
27
|
+
]
|
28
|
+
s.has_rdoc = true
|
29
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
30
|
+
s.require_paths = ["lib"]
|
31
|
+
s.rubygems_version = %q{1.3.1}
|
32
|
+
s.summary = nil
|
33
|
+
s.test_files = [
|
34
|
+
"test/cms_lite_test.rb",
|
35
|
+
"test/test_helper.rb"
|
36
|
+
]
|
37
|
+
|
38
|
+
if s.respond_to? :specification_version then
|
39
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
40
|
+
s.specification_version = 2
|
41
|
+
|
42
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
43
|
+
else
|
44
|
+
end
|
45
|
+
else
|
46
|
+
end
|
47
|
+
end
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2009 Justin Ball
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.markdown
ADDED
@@ -0,0 +1,87 @@
|
|
1
|
+
CMS Lite Engine
|
2
|
+
=================
|
3
|
+
CMS Lite makes it simple to add lots of content to your rails application without having to add a full CMS system. Frequently,
|
4
|
+
the parties involved in developing your website will have enough technical knowledge to be able to build html pages and add
|
5
|
+
content, but not be experienced enough to build out new controllers and deal with rendering the appropriate templates. CMS Lite
|
6
|
+
addresses this need by centralizing all content into a 'content' subdirectory. Tell
|
7
|
+
your content developers to put their code into /content/pages/en or /content/protected-page/en (for content that requires a login)
|
8
|
+
and you're ready to go.
|
9
|
+
|
10
|
+
Installation
|
11
|
+
=================
|
12
|
+
|
13
|
+
Install the gem:
|
14
|
+
------------------
|
15
|
+
sudo gem install cms-lite
|
16
|
+
|
17
|
+
|
18
|
+
Add the gem to environment.rb
|
19
|
+
------------------
|
20
|
+
config.gem 'cms-lite', :lib => 'cms_lite'
|
21
|
+
|
22
|
+
|
23
|
+
Handy Rake Tasks
|
24
|
+
------------------
|
25
|
+
CMS Lite comes with rake tasks that can help you manage your project. These include the ability to send all files from one language
|
26
|
+
to google for translation into 24 other languages. To gain access to these tasks simple add the following lines to Rakefile:
|
27
|
+
|
28
|
+
require 'cms_lite'
|
29
|
+
require 'cms_lite/tasks'
|
30
|
+
|
31
|
+
|
32
|
+
Run rake task:
|
33
|
+
------------------
|
34
|
+
rake cms_lite:setup
|
35
|
+
|
36
|
+
then visit:
|
37
|
+
http://localhost:3000/cmslite/hello-world
|
38
|
+
or
|
39
|
+
http://localhost:3000/cmslite-protected/hello-world
|
40
|
+
|
41
|
+
|
42
|
+
Translate your content with Google
|
43
|
+
------------------
|
44
|
+
rake cms_lite:translate
|
45
|
+
|
46
|
+
Will translate all files in the 'en' directory into the following languages (codes):
|
47
|
+
ar bg ca cs da de el en es fr hi id it ja pt-PT sk sr sv vi zh-CN
|
48
|
+
|
49
|
+
If you wish to translate from another language -ie your content files are in the es directory then you can do this:
|
50
|
+
rake cms_lite:translate -language=es
|
51
|
+
|
52
|
+
Notes:
|
53
|
+
------------------
|
54
|
+
1. CMS Lite Requires a login method called 'login_required' that will be called in the event the user is not logged in and attempts to load a protected page.
|
55
|
+
2. Don't mix directories it will mess up the routes. ie if you have a directory named cmslite in pages don't create a directory called cmslite under protected-pages.
|
56
|
+
If you do Rails won't know which directory to route to.
|
57
|
+
|
58
|
+
|
59
|
+
Routes:
|
60
|
+
------------------
|
61
|
+
CMS Lite will add a route for each subdirectory found under /content/pages/en and /content/protected-pages/en.
|
62
|
+
|
63
|
+
Example:
|
64
|
+
- - -
|
65
|
+
Thus, a page found at:
|
66
|
+
/content/pages/en/example/my-page.htm
|
67
|
+
becomes
|
68
|
+
http://localhost:3000/example/my-page
|
69
|
+
|
70
|
+
|
71
|
+
The Basics
|
72
|
+
=================
|
73
|
+
The cms lite plugin provides basic template rendering functionality.
|
74
|
+
Any templates added to /content/pages will be publicly visible.
|
75
|
+
Any pages added to /content/protected-pages will require a login.
|
76
|
+
CMS lite will use the layout specified in application_controller.rb
|
77
|
+
|
78
|
+
|
79
|
+
Advanced Stuff
|
80
|
+
=================
|
81
|
+
The CMS Lite engine can display localization content. To add spanish simply add an 'es' directory next to the 'en' directory
|
82
|
+
and then copy your content pages to that directory.
|
83
|
+
|
84
|
+
|
85
|
+
|
86
|
+
|
87
|
+
Copyright (c) 2009 Justin Ball, released under the MIT license
|
data/Rakefile
ADDED
@@ -0,0 +1,66 @@
|
|
1
|
+
require 'rake'
|
2
|
+
require 'rake/testtask'
|
3
|
+
require 'rake/rdoctask'
|
4
|
+
|
5
|
+
desc 'Default: run unit tests.'
|
6
|
+
task :default => :test
|
7
|
+
|
8
|
+
desc 'Test the cms_lite plugin.'
|
9
|
+
Rake::TestTask.new(:test) do |t|
|
10
|
+
t.libs << 'lib'
|
11
|
+
t.libs << 'test'
|
12
|
+
t.pattern = 'test/**/*_test.rb'
|
13
|
+
t.verbose = true
|
14
|
+
end
|
15
|
+
|
16
|
+
desc 'Generate documentation for the cms_lite plugin.'
|
17
|
+
Rake::RDocTask.new(:rdoc) do |rdoc|
|
18
|
+
rdoc.rdoc_dir = 'rdoc'
|
19
|
+
rdoc.title = 'CmsLite'
|
20
|
+
rdoc.options << '--line-numbers' << '--inline-source'
|
21
|
+
rdoc.rdoc_files.include('README')
|
22
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
23
|
+
end
|
24
|
+
|
25
|
+
begin
|
26
|
+
require 'jeweler'
|
27
|
+
Jeweler::Tasks.new do |gemspec|
|
28
|
+
gemspec.name = "cms-lite"
|
29
|
+
gemspec.summary = "Simple CMS system"
|
30
|
+
gemspec.email = "justinball@gmail.com"
|
31
|
+
gemspec.homepage = "http://github.com/jbasdf/cms_lite"
|
32
|
+
gemspec.description = "CMS gem that makes it simple to interact with your content developers by serving pages from '/content'."
|
33
|
+
gemspec.authors = ["Justin Ball"]
|
34
|
+
gemspec.files.include %w( tasks/rails.rake lib/cms_lite/*.rb )
|
35
|
+
gemspec.rubyforge_project = 'cms-lite'
|
36
|
+
end
|
37
|
+
rescue LoadError
|
38
|
+
puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
|
39
|
+
end
|
40
|
+
|
41
|
+
# rubyforge tasks
|
42
|
+
begin
|
43
|
+
require 'rake/contrib/sshpublisher'
|
44
|
+
namespace :rubyforge do
|
45
|
+
|
46
|
+
desc "Release gem and RDoc documentation to RubyForge"
|
47
|
+
task :release => ["rubyforge:release:gem", "rubyforge:release:docs"]
|
48
|
+
|
49
|
+
namespace :release do
|
50
|
+
desc "Publish RDoc to RubyForge."
|
51
|
+
task :docs => [:rdoc] do
|
52
|
+
config = YAML.load(
|
53
|
+
File.read(File.expand_path('~/.rubyforge/user-config.yml'))
|
54
|
+
)
|
55
|
+
|
56
|
+
host = "#{config['username']}@rubyforge.org"
|
57
|
+
remote_dir = "/var/www/gforge-projects/the-perfect-gem/"
|
58
|
+
local_dir = 'rdoc'
|
59
|
+
|
60
|
+
Rake::SshDirPublisher.new(host, remote_dir, local_dir).upload
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
rescue LoadError
|
65
|
+
puts "Rake SshDirPublisher is unavailable or your rubyforge environment is not configured."
|
66
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.2.7
|
@@ -0,0 +1,30 @@
|
|
1
|
+
class CmsLiteController < ApplicationController
|
2
|
+
|
3
|
+
before_filter :login_required, :only => [:show_protected_page]
|
4
|
+
|
5
|
+
def show_page
|
6
|
+
render_content_page(CmsLite::PAGES_PATH)
|
7
|
+
end
|
8
|
+
|
9
|
+
def show_protected_page
|
10
|
+
render_content_page(CmsLite::PROTECTED_PAGES_PATH)
|
11
|
+
end
|
12
|
+
|
13
|
+
def render_content_page(cms_lite_path, request_layout = '')
|
14
|
+
path = File.join(RAILS_ROOT, CmsLite::CONTENT_PATH, cms_lite_path, I18n.locale.to_s, params[:content_key], params[:content_page].join('/'))
|
15
|
+
format = params[:format] || 'htm'
|
16
|
+
content_page = Dir.glob("/#{path}.#{format}").first
|
17
|
+
content_page = Dir.glob("/#{path}").first if content_page.nil?
|
18
|
+
content_page = Dir.glob("/#{path}.*").first if content_page.nil?
|
19
|
+
raise CmsLite::Exceptions::MissingTemplateError, "Could not find template for: '#{path}'" if content_page.nil?
|
20
|
+
respond_to do |format|
|
21
|
+
format.html { render :file => content_page }
|
22
|
+
format.js { render :file => content_page, :layout => false }
|
23
|
+
format.xml { render :file => content_page, :layout => false }
|
24
|
+
end
|
25
|
+
rescue CmsLite::Exceptions::MissingTemplateError => ex
|
26
|
+
|
27
|
+
render :file => "#{RAILS_ROOT}/public/404.html", :status => 404
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
data/cms-lite.gemspec
ADDED
@@ -0,0 +1,62 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = %q{cms-lite}
|
5
|
+
s.version = "0.2.7"
|
6
|
+
|
7
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
|
+
s.authors = ["Justin Ball"]
|
9
|
+
s.date = %q{2009-05-08}
|
10
|
+
s.description = %q{CMS gem that makes it simple to interact with your content developers by serving pages from '/content'.}
|
11
|
+
s.email = %q{justinball@gmail.com}
|
12
|
+
s.extra_rdoc_files = [
|
13
|
+
"README.markdown"
|
14
|
+
]
|
15
|
+
s.files = [
|
16
|
+
".gemspec",
|
17
|
+
"MIT-LICENSE",
|
18
|
+
"README.markdown",
|
19
|
+
"Rakefile",
|
20
|
+
"VERSION",
|
21
|
+
"app/controllers/cms_lite_controller.rb",
|
22
|
+
"cms-lite.gemspec",
|
23
|
+
"config/cms_lite_routes.rb",
|
24
|
+
"lib/cms_lite.rb",
|
25
|
+
"lib/cms_lite/exceptions.rb",
|
26
|
+
"lib/cms_lite/exceptions.rb",
|
27
|
+
"lib/cms_lite/initialize_routes.rb",
|
28
|
+
"lib/cms_lite/initialize_routes.rb",
|
29
|
+
"lib/cms_lite/languages.rb",
|
30
|
+
"lib/cms_lite/languages.rb",
|
31
|
+
"lib/cms_lite/tasks.rb",
|
32
|
+
"lib/cms_lite/tasks.rb",
|
33
|
+
"pkg/cms-lite-0.2.7.gem",
|
34
|
+
"rails/init.rb",
|
35
|
+
"tasks/rails.rake",
|
36
|
+
"tasks/rails.rake",
|
37
|
+
"test/cms_lite_test.rb",
|
38
|
+
"test/test_helper.rb",
|
39
|
+
"uninstall.rb"
|
40
|
+
]
|
41
|
+
s.has_rdoc = true
|
42
|
+
s.homepage = %q{http://github.com/jbasdf/cms_lite}
|
43
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
44
|
+
s.require_paths = ["lib"]
|
45
|
+
s.rubyforge_project = %q{cms-lite}
|
46
|
+
s.rubygems_version = %q{1.3.1}
|
47
|
+
s.summary = %q{Simple CMS system}
|
48
|
+
s.test_files = [
|
49
|
+
"test/cms_lite_test.rb",
|
50
|
+
"test/test_helper.rb"
|
51
|
+
]
|
52
|
+
|
53
|
+
if s.respond_to? :specification_version then
|
54
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
55
|
+
s.specification_version = 2
|
56
|
+
|
57
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
58
|
+
else
|
59
|
+
end
|
60
|
+
else
|
61
|
+
end
|
62
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
ActionController::Routing::Routes.draw do |map|
|
2
|
+
|
3
|
+
CmsLite.cms_routes.each do |cms_route|
|
4
|
+
map.connect cms_route[:uri], :controller => 'cms_lite', :action => 'show_page', :content_key => cms_route[:content_key]
|
5
|
+
end
|
6
|
+
|
7
|
+
CmsLite.protected_cms_routes.each do |cms_route|
|
8
|
+
map.connect cms_route[:uri], :controller => 'cms_lite', :action => 'show_protected_page', :content_key => cms_route[:content_key]
|
9
|
+
end
|
10
|
+
|
11
|
+
end
|
data/lib/cms_lite.rb
ADDED
@@ -0,0 +1,103 @@
|
|
1
|
+
require 'cms_lite/exceptions'
|
2
|
+
require 'cms_lite/languages'
|
3
|
+
require 'fileutils'
|
4
|
+
|
5
|
+
class CmsLite
|
6
|
+
CONTENT_PATH = 'content'
|
7
|
+
PAGES_PATH = 'pages'
|
8
|
+
PROTECTED_PAGES_PATH = 'protected-pages'
|
9
|
+
|
10
|
+
class << self
|
11
|
+
|
12
|
+
def cms_routes
|
13
|
+
get_cms_routes(PAGES_PATH)
|
14
|
+
end
|
15
|
+
|
16
|
+
def protected_cms_routes
|
17
|
+
get_cms_routes(PROTECTED_PAGES_PATH)
|
18
|
+
end
|
19
|
+
|
20
|
+
def get_cms_routes(pages_path)
|
21
|
+
cms_routes = []
|
22
|
+
cms_lite_page_path = File.join(RAILS_ROOT, CONTENT_PATH, pages_path)
|
23
|
+
Dir.glob("#{cms_lite_page_path}/*").each do |localization_directory|
|
24
|
+
if File.directory?(localization_directory)
|
25
|
+
Dir.glob("#{localization_directory}/*").each do |content_item|
|
26
|
+
path = File.basename(content_item)
|
27
|
+
content_key = content_item.gsub(localization_directory, '')
|
28
|
+
cms_routes << { :uri => "/#{path}/*content_page",
|
29
|
+
:content_key => content_key }
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
cms_routes
|
34
|
+
end
|
35
|
+
|
36
|
+
def translate_pages(language = 'en')
|
37
|
+
translate_and_write_pages(File.join(RAILS_ROOT, CONTENT_PATH, PAGES_PATH, language), language)
|
38
|
+
translate_and_write_pages(File.join(RAILS_ROOT, CONTENT_PATH, PROTECTED_PAGES_PATH, language), language)
|
39
|
+
end
|
40
|
+
|
41
|
+
def translate_and_write_pages(path, language)
|
42
|
+
Dir.glob("#{path}/*").each do |next_file|
|
43
|
+
if File.directory?(next_file)
|
44
|
+
translate_and_write_pages(next_file, language)
|
45
|
+
else
|
46
|
+
GoogleTranslate::LANGUAGES.each do |to|
|
47
|
+
translate_and_write_page(next_file, to, language)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
def translate_and_write_page(page_path, to, from)
|
54
|
+
return if to == from
|
55
|
+
return unless File.exist?(page_path)
|
56
|
+
translated_filename = get_translated_file(page_path, to, from)
|
57
|
+
return if File.exist?(translated_filename) # don't overwrite existing files
|
58
|
+
text = IO.read(page_path)
|
59
|
+
translated_text = translate(text, to, from)
|
60
|
+
translated_directory = File.dirname(translated_filename)
|
61
|
+
FileUtils.mkdir_p(translated_directory)
|
62
|
+
File.open(translated_filename, 'w') { |f| f.write(translated_text) }
|
63
|
+
end
|
64
|
+
|
65
|
+
def get_translated_file(page, to, from)
|
66
|
+
segments = page.split('/')
|
67
|
+
index = segments.index(from)
|
68
|
+
segments[index] = to
|
69
|
+
segments.join('/')
|
70
|
+
end
|
71
|
+
|
72
|
+
# from: http://ruby.geraldbauer.ca/google-translation-api.html
|
73
|
+
def translate(text, to, from = 'en')
|
74
|
+
|
75
|
+
return if to == from
|
76
|
+
|
77
|
+
require 'cgi'
|
78
|
+
require 'json'
|
79
|
+
require 'net/http'
|
80
|
+
|
81
|
+
base = 'http://ajax.googleapis.com/ajax/services/language/translate'
|
82
|
+
# assemble query params
|
83
|
+
params = {
|
84
|
+
:langpair => "#{from}|#{to}",
|
85
|
+
:q => text,
|
86
|
+
:v => 1.0
|
87
|
+
}
|
88
|
+
query = params.map{ |k,v| "#{k}=#{CGI.escape(v.to_s)}" }.join('&')
|
89
|
+
# send get request
|
90
|
+
response = Net::HTTP.get_response( URI.parse( "#{base}?#{query}" ) )
|
91
|
+
json = JSON.parse( response.body )
|
92
|
+
if json['responseStatus'] == 200
|
93
|
+
json['responseData']['translatedText']
|
94
|
+
else
|
95
|
+
puts response
|
96
|
+
puts to
|
97
|
+
puts from
|
98
|
+
raise StandardError, response['responseDetails']
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
end
|
103
|
+
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
class ActionController::Routing::RouteSet
|
2
|
+
def load_routes_with_cms_lite!
|
3
|
+
cms_lite_routes = File.join(File.dirname(__FILE__), *%w[.. .. config cms_lite_routes.rb])
|
4
|
+
add_configuration_file(cms_lite_routes) unless configuration_files.include? cms_lite_routes
|
5
|
+
load_routes_without_cms_lite!
|
6
|
+
end
|
7
|
+
alias_method_chain :load_routes!, :cms_lite
|
8
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
module GoogleTranslate
|
2
|
+
|
3
|
+
ARABIC = "ar"
|
4
|
+
BULGARIAN = "bg"
|
5
|
+
CATALAN = "ca"
|
6
|
+
CHINESE = "zh"
|
7
|
+
CHINESE_SIMPLIFIED = "zh-CN"
|
8
|
+
CHINESE_TRADITIONAL = "zh-TW"
|
9
|
+
CROATIAN = "cr"
|
10
|
+
CZECH = "cs"
|
11
|
+
DANISH = "da"
|
12
|
+
DUTCH = "nl"
|
13
|
+
ENGLISH = "en"
|
14
|
+
FILIPINO = "tl"
|
15
|
+
FINNISH = "fi"
|
16
|
+
FRENCH = "fr"
|
17
|
+
GERMAN = "de"
|
18
|
+
GREEK = "el"
|
19
|
+
HEBREW = "iw"
|
20
|
+
HINDI = "hi"
|
21
|
+
INDONESIAN = "id"
|
22
|
+
ITALIAN = "it"
|
23
|
+
JAPANESE = "ja"
|
24
|
+
KOREAN = "ko"
|
25
|
+
LATVIAN = "lv"
|
26
|
+
LITHUANIAN = "lt"
|
27
|
+
NORWEGIAN = "no"
|
28
|
+
POLISH = "pl"
|
29
|
+
PORTUGESE = "pt"
|
30
|
+
ROMANIAN = "ro"
|
31
|
+
RUSSIAN = "ru"
|
32
|
+
SERBIAN = "sr"
|
33
|
+
SLOVAK = "sk"
|
34
|
+
SLOVENIAN = "sl"
|
35
|
+
SPANISH = "es"
|
36
|
+
SWEDISH = "sv"
|
37
|
+
UKRANIAN = "uk"
|
38
|
+
VIETNAMESE = "vi"
|
39
|
+
|
40
|
+
# LANGUAGES = [ARABIC, BULGARIAN, CATALAN, CHINESE, CHINESE_SIMPLIFIED,CHINESE_TRADITIONAL,
|
41
|
+
# CROATIAN, CZECH, DANISH, DUTCH, ENGLISH, FILIPINO, FRENCH, GERMAN, GREEK, HEBREW,
|
42
|
+
# ITALIAN, JAPANESE, KOREAN, LATVIAN, LITHUANIAN, NORWEGIAN, POLISH, PORTUGESE,
|
43
|
+
# ROMANIAN, RUSSIAN, SERBIAN, SLOVAK, SLOVENIAN, SPANISH, SWEDISH, UKRANIAN, VIETNAMESE]
|
44
|
+
|
45
|
+
LANGUAGES = [ARABIC, BULGARIAN, CATALAN, CHINESE, CHINESE_SIMPLIFIED,CHINESE_TRADITIONAL,
|
46
|
+
CZECH, DANISH, DUTCH, ENGLISH, FILIPINO, FRENCH, GERMAN, GREEK, HEBREW,
|
47
|
+
ITALIAN, JAPANESE, KOREAN, LATVIAN, LITHUANIAN, NORWEGIAN, POLISH, PORTUGESE,
|
48
|
+
ROMANIAN, RUSSIAN, SERBIAN, SLOVAK, SLOVENIAN, SPANISH, SWEDISH, UKRANIAN, VIETNAMESE]
|
49
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'rake'
|
2
|
+
require 'rake/tasklib'
|
3
|
+
require 'fileutils'
|
4
|
+
|
5
|
+
class CmsLite
|
6
|
+
class Tasks < ::Rake::TaskLib
|
7
|
+
def initialize
|
8
|
+
define
|
9
|
+
end
|
10
|
+
|
11
|
+
private
|
12
|
+
def define
|
13
|
+
namespace :cms_lite do
|
14
|
+
|
15
|
+
task :app_env do
|
16
|
+
Rake::Task[:environment].invoke if defined?(RAILS_ROOT)
|
17
|
+
end
|
18
|
+
|
19
|
+
desc 'Translate all pages in the given language directory to all other languages. Pass a language with language=en, language=ja, etc'
|
20
|
+
task :translate do
|
21
|
+
language = ENV['language'] || 'en'
|
22
|
+
CmsLite.translate_pages(language)
|
23
|
+
end
|
24
|
+
|
25
|
+
desc 'Create basic directory structure for cms lite'
|
26
|
+
task :setup => :app_env do
|
27
|
+
page_path = "#{RAILS_ROOT}/content/pages/en/cmslite"
|
28
|
+
protected_path = "#{RAILS_ROOT}/content/protected-pages/en/cmslite-protected"
|
29
|
+
FileUtils.mkdir_p(page_path) unless File.directory?(page_path)
|
30
|
+
FileUtils.mkdir_p(protected_path) unless File.directory?(protected_path)
|
31
|
+
File.open("#{page_path}/hello-world.htm", 'w') {|f| f.write("Hello World") }
|
32
|
+
File.open("#{protected_path}/hello-world.htm", 'w') {|f| f.write("Hello World") }
|
33
|
+
puts "finished setting up cmslite directories"
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
CmsLite::Tasks.new
|
Binary file
|
data/rails/init.rb
ADDED
data/tasks/rails.rake
ADDED
data/test/test_helper.rb
ADDED
data/uninstall.rb
ADDED
File without changes
|
metadata
ADDED
@@ -0,0 +1,72 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: cms-lite
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.2.7
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Justin Ball
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2009-05-08 00:00:00 -06:00
|
13
|
+
default_executable:
|
14
|
+
dependencies: []
|
15
|
+
|
16
|
+
description: CMS gem that makes it simple to interact with your content developers by serving pages from '/content'.
|
17
|
+
email: justinball@gmail.com
|
18
|
+
executables: []
|
19
|
+
|
20
|
+
extensions: []
|
21
|
+
|
22
|
+
extra_rdoc_files:
|
23
|
+
- README.markdown
|
24
|
+
files:
|
25
|
+
- .gemspec
|
26
|
+
- MIT-LICENSE
|
27
|
+
- README.markdown
|
28
|
+
- Rakefile
|
29
|
+
- VERSION
|
30
|
+
- app/controllers/cms_lite_controller.rb
|
31
|
+
- cms-lite.gemspec
|
32
|
+
- config/cms_lite_routes.rb
|
33
|
+
- lib/cms_lite.rb
|
34
|
+
- lib/cms_lite/exceptions.rb
|
35
|
+
- lib/cms_lite/initialize_routes.rb
|
36
|
+
- lib/cms_lite/languages.rb
|
37
|
+
- lib/cms_lite/tasks.rb
|
38
|
+
- pkg/cms-lite-0.2.7.gem
|
39
|
+
- rails/init.rb
|
40
|
+
- tasks/rails.rake
|
41
|
+
- test/cms_lite_test.rb
|
42
|
+
- test/test_helper.rb
|
43
|
+
- uninstall.rb
|
44
|
+
has_rdoc: true
|
45
|
+
homepage: http://github.com/jbasdf/cms_lite
|
46
|
+
post_install_message:
|
47
|
+
rdoc_options:
|
48
|
+
- --charset=UTF-8
|
49
|
+
require_paths:
|
50
|
+
- lib
|
51
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - ">="
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: "0"
|
56
|
+
version:
|
57
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: "0"
|
62
|
+
version:
|
63
|
+
requirements: []
|
64
|
+
|
65
|
+
rubyforge_project: cms-lite
|
66
|
+
rubygems_version: 1.3.1
|
67
|
+
signing_key:
|
68
|
+
specification_version: 2
|
69
|
+
summary: Simple CMS system
|
70
|
+
test_files:
|
71
|
+
- test/cms_lite_test.rb
|
72
|
+
- test/test_helper.rb
|