rails-static 1.1.0 → 1.2.0
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.
- checksums.yaml +4 -4
- data/lib/rails-static.rb +10 -0
- data/lib/tasks/static.rake +5 -9
- data/rails-static.gemspec +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ba79014208d1a8e1629703999efa4432f7eb7249
|
4
|
+
data.tar.gz: 9d4e466039ed62f5fd2766fb9bb44a95d310ad51
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 47eba128e94a5c2f4ce4724ba12a901a970a35f4198edf81f5c8aef62e1fd70c47eba7417259ddc9167d3fe0b0a540f54f0ac6a2a7da05727716bcd9e347f3c0
|
7
|
+
data.tar.gz: 10132bbe8f260f1801d22d8182c8f81f95b61a452a511eab494f9fe7628b9ceb7cdd5bd3c65bf327c01f57c0106aadd810729822db3f34136ff3afb718702749
|
data/lib/rails-static.rb
CHANGED
@@ -18,5 +18,15 @@ module RailsStatic
|
|
18
18
|
yield @config
|
19
19
|
end
|
20
20
|
|
21
|
+
def files
|
22
|
+
config.routes.map {|r| path_from_route r }
|
23
|
+
end
|
24
|
+
|
25
|
+
def path_from_route(route)
|
26
|
+
path = route.gsub %r{^/}, ''
|
27
|
+
path = path.gsub(%r{/$}, "/#{RailsStatic.config.index}") if route =~ %r{/$}
|
28
|
+
path += RailsStatic.config.extension
|
29
|
+
end
|
30
|
+
|
21
31
|
end
|
22
32
|
end
|
data/lib/tasks/static.rake
CHANGED
@@ -16,13 +16,15 @@ namespace :static do
|
|
16
16
|
|
17
17
|
RailsStatic.config.routes.each do |route|
|
18
18
|
|
19
|
-
path = path_from_route route
|
19
|
+
path = RailsStatic.path_from_route route
|
20
|
+
fullpath = full_path path
|
20
21
|
|
21
22
|
print "Generating #{path} "
|
22
23
|
|
24
|
+
File.delete fullpath if File.exists? fullpath
|
25
|
+
|
23
26
|
r = app.get(route)
|
24
27
|
|
25
|
-
fullpath = full_path path
|
26
28
|
dir = File.dirname(fullpath)
|
27
29
|
FileUtils.mkdir_p dir
|
28
30
|
File.open(fullpath, "w") do |f|
|
@@ -36,7 +38,7 @@ namespace :static do
|
|
36
38
|
desc "Delete static pages"
|
37
39
|
task :clean => :environment do
|
38
40
|
RailsStatic.config.routes.each do |route|
|
39
|
-
path = path_from_route route
|
41
|
+
path = RailsStatic.path_from_route route
|
40
42
|
fullpath = full_path path
|
41
43
|
|
42
44
|
next unless File.exists? fullpath
|
@@ -51,12 +53,6 @@ namespace :static do
|
|
51
53
|
|
52
54
|
private
|
53
55
|
|
54
|
-
def path_from_route(route)
|
55
|
-
path = route
|
56
|
-
path = path.gsub(%r{/$}, "/#{RailsStatic.config.index}") if route =~ %r{/$}
|
57
|
-
path += RailsStatic.config.extension
|
58
|
-
end
|
59
|
-
|
60
56
|
def full_path(path)
|
61
57
|
File.join(Rails.public_path, path)
|
62
58
|
end
|
data/rails-static.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails-static
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- DanX
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-08-
|
11
|
+
date: 2013-08-05 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: A rake task for generating static websites using Rails.
|
14
14
|
email:
|