static_pages 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/MIT-LICENSE +20 -0
- data/README +24 -0
- data/Rakefile +33 -0
- data/lib/generators/USAGE +8 -0
- data/lib/generators/page_generator.rb +7 -0
- data/lib/static_pages.rb +8 -0
- data/static_pages.gemspec +22 -0
- data/test/static_pages_test.rb +8 -0
- data/test/test_helper.rb +3 -0
- metadata +75 -0
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2010 [name of plugin creator]
|
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
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
Static Pages
|
2
|
+
=====
|
3
|
+
|
4
|
+
Static Pages is a rails engine to serve static content from app/views/pages.
|
5
|
+
|
6
|
+
Files are displayed following this (named) route:
|
7
|
+
|
8
|
+
map.page "/pages/:id", :controller => :pages, :action => :show
|
9
|
+
|
10
|
+
where :id is the name of the file (think template names).
|
11
|
+
|
12
|
+
Example
|
13
|
+
=======
|
14
|
+
|
15
|
+
rails g page imprint
|
16
|
+
|
17
|
+
Creates imprint.html.erb in app/views/pages with this content:
|
18
|
+
|
19
|
+
This page can be found in app/views/pages/imprint.html.erb.
|
20
|
+
|
21
|
+
The page can be retrieved by pointing the browser to:
|
22
|
+
localhost:3000/pages/imprint
|
23
|
+
|
24
|
+
Copyright (c) 2010 [name of plugin creator], released under the MIT license
|
data/Rakefile
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
require 'rake/gempackagetask'
|
4
|
+
require 'rake/testtask'
|
5
|
+
require 'rake/rdoctask'
|
6
|
+
|
7
|
+
desc 'Default: run unit tests.'
|
8
|
+
task :default => :test
|
9
|
+
|
10
|
+
desc 'Test the pages plugin.'
|
11
|
+
Rake::TestTask.new(:test) do |t|
|
12
|
+
t.libs << 'lib'
|
13
|
+
t.libs << 'test'
|
14
|
+
t.pattern = 'test/**/*_test.rb'
|
15
|
+
t.verbose = true
|
16
|
+
end
|
17
|
+
|
18
|
+
desc 'Generate documentation for the pages plugin.'
|
19
|
+
Rake::RDocTask.new(:rdoc) do |rdoc|
|
20
|
+
rdoc.rdoc_dir = 'rdoc'
|
21
|
+
rdoc.title = 'Pages'
|
22
|
+
rdoc.options << '--line-numbers' << '--inline-source'
|
23
|
+
rdoc.rdoc_files.include('README')
|
24
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
25
|
+
end
|
26
|
+
|
27
|
+
spec = nil
|
28
|
+
File.open('static_pages.gemspec', 'r'){|f| spec = eval(f.read)}
|
29
|
+
|
30
|
+
Rake::GemPackageTask.new(spec) do |pkg|
|
31
|
+
pkg.need_zip = false
|
32
|
+
pkg.need_tar = false
|
33
|
+
end
|
@@ -0,0 +1,7 @@
|
|
1
|
+
class PageGenerator < Rails::Generators::Base
|
2
|
+
argument :page_name, :type => :string
|
3
|
+
|
4
|
+
def create_page
|
5
|
+
create_file "app/views/#{StaticPages::PATH}/#{page_name}.html.erb", "This page can be found in app/views/#{StaticPages::PATH}/#{page_name}.html.erb."
|
6
|
+
end
|
7
|
+
end
|
data/lib/static_pages.rb
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
PKG_FILES = FileList[
|
2
|
+
'[a-zA-Z]*',
|
3
|
+
'generators/**/*',
|
4
|
+
'lib/**/*',
|
5
|
+
'rails/**/*',
|
6
|
+
'tasks/**/*',
|
7
|
+
'test/**/*'
|
8
|
+
]
|
9
|
+
|
10
|
+
spec = Gem::Specification.new do |s|
|
11
|
+
s.name = "static_pages"
|
12
|
+
s.version = "0.0.2"
|
13
|
+
s.author = "Christian Weis"
|
14
|
+
s.email = "christian.weis@gmail.com"
|
15
|
+
s.homepage = "http://christian-weis.de/"
|
16
|
+
s.platform = Gem::Platform::RUBY
|
17
|
+
s.summary = "plugin for sharing static content in a configurable folder"
|
18
|
+
s.files = PKG_FILES.to_a
|
19
|
+
s.require_path = "lib"
|
20
|
+
s.has_rdoc = false
|
21
|
+
s.extra_rdoc_files = ["README"]
|
22
|
+
end
|
data/test/test_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,75 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: static_pages
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 27
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 2
|
10
|
+
version: 0.0.2
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Christian Weis
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2010-09-04 00:00:00 +02:00
|
19
|
+
default_executable:
|
20
|
+
dependencies: []
|
21
|
+
|
22
|
+
description:
|
23
|
+
email: christian.weis@gmail.com
|
24
|
+
executables: []
|
25
|
+
|
26
|
+
extensions: []
|
27
|
+
|
28
|
+
extra_rdoc_files:
|
29
|
+
- README
|
30
|
+
files:
|
31
|
+
- MIT-LICENSE
|
32
|
+
- Rakefile
|
33
|
+
- README
|
34
|
+
- static_pages.gemspec
|
35
|
+
- lib/generators/page_generator.rb
|
36
|
+
- lib/generators/USAGE
|
37
|
+
- lib/static_pages.rb
|
38
|
+
- test/static_pages_test.rb
|
39
|
+
- test/test_helper.rb
|
40
|
+
has_rdoc: true
|
41
|
+
homepage: http://christian-weis.de/
|
42
|
+
licenses: []
|
43
|
+
|
44
|
+
post_install_message:
|
45
|
+
rdoc_options: []
|
46
|
+
|
47
|
+
require_paths:
|
48
|
+
- lib
|
49
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
hash: 3
|
55
|
+
segments:
|
56
|
+
- 0
|
57
|
+
version: "0"
|
58
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
59
|
+
none: false
|
60
|
+
requirements:
|
61
|
+
- - ">="
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
hash: 3
|
64
|
+
segments:
|
65
|
+
- 0
|
66
|
+
version: "0"
|
67
|
+
requirements: []
|
68
|
+
|
69
|
+
rubyforge_project:
|
70
|
+
rubygems_version: 1.3.7
|
71
|
+
signing_key:
|
72
|
+
specification_version: 3
|
73
|
+
summary: plugin for sharing static content in a configurable folder
|
74
|
+
test_files: []
|
75
|
+
|