moxify 0.1.3 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +4 -0
- data/Gemfile +4 -0
- data/Rakefile +2 -0
- data/lib/gemspec.rb +4 -2
- data/lib/moxify/url_tempfile.rb +1 -1
- data/lib/moxify/version.rb +3 -0
- data/moxify.gemspec +49 -0
- metadata +8 -22
- data/app/sweepers/page_sweeper.rb +0 -55
data/.gitignore
CHANGED
data/Gemfile
ADDED
data/Rakefile
ADDED
data/lib/gemspec.rb
CHANGED
@@ -25,16 +25,18 @@ end
|
|
25
25
|
|
26
26
|
gemspec = <<EOF
|
27
27
|
# DO NOT EDIT THIS FILE DIRECTLY! Instead, use lib/gemspec.rb to generate it.
|
28
|
+
$:.push File.expand_path("../lib", __FILE__)
|
29
|
+
require "moxify/version"
|
28
30
|
|
29
31
|
Gem::Specification.new do |s|
|
30
32
|
s.name = %q{#{gemname = 'moxify'}}
|
31
|
-
s.version =
|
33
|
+
s.version = Moxify::VERSION
|
32
34
|
s.description = 'A blanket full of toy cars for Refinery CMS'
|
33
35
|
s.date = %q{#{Time.now.strftime('%Y-%m-%d')}}
|
34
36
|
s.summary = 'My port of Refinery CMS'
|
35
37
|
s.email = %q{mail@bitflut.com}
|
36
38
|
s.homepage = %q{http://bitflut.com}
|
37
|
-
s.authors = ['Marian
|
39
|
+
s.authors = ['Marian Andre']
|
38
40
|
s.license = %q{MIT}
|
39
41
|
s.require_paths = %w(lib)
|
40
42
|
s.files = Dir['lib/**/*', 'config/**/*', 'app/**/*', 'public/**/*']
|
data/lib/moxify/url_tempfile.rb
CHANGED
data/moxify.gemspec
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
# DO NOT EDIT THIS FILE DIRECTLY! Instead, use lib/gemspec.rb to generate it.
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "moxify/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = %q{moxify}
|
7
|
+
s.version = Moxify::VERSION
|
8
|
+
s.description = 'A blanket full of toy cars for Refinery CMS'
|
9
|
+
s.date = %q{2011-04-20}
|
10
|
+
s.summary = 'My port of Refinery CMS'
|
11
|
+
s.email = %q{mail@bitflut.com}
|
12
|
+
s.homepage = %q{http://bitflut.com}
|
13
|
+
s.authors = ['Marian Andre']
|
14
|
+
s.license = %q{MIT}
|
15
|
+
s.require_paths = %w(lib)
|
16
|
+
s.files = Dir['lib/**/*', 'config/**/*', 'app/**/*', 'public/**/*']
|
17
|
+
|
18
|
+
s.add_dependency 'refinerycms', '~> 0.9.9.10'
|
19
|
+
|
20
|
+
s.files = [
|
21
|
+
'.gitignore',
|
22
|
+
'Gemfile',
|
23
|
+
'Gemfile',
|
24
|
+
'Rakefile',
|
25
|
+
'app',
|
26
|
+
'app/views',
|
27
|
+
'app/views/admin',
|
28
|
+
'app/views/admin/_head.html.erb',
|
29
|
+
'app/views/layouts',
|
30
|
+
'app/views/layouts/application.html.erb',
|
31
|
+
'app/views/shared',
|
32
|
+
'app/views/shared/_site_bar.html.erb',
|
33
|
+
'config',
|
34
|
+
'config/routes.rb',
|
35
|
+
'lib',
|
36
|
+
'lib/gemspec.rb',
|
37
|
+
'lib/moxify',
|
38
|
+
'lib/moxify/dragonfly_quality_hook.rb',
|
39
|
+
'lib/moxify/url_tempfile.rb',
|
40
|
+
'lib/moxify/version.rb',
|
41
|
+
'lib/moxify.rb',
|
42
|
+
'moxify.gemspec',
|
43
|
+
'public',
|
44
|
+
'public/stylesheets',
|
45
|
+
'public/stylesheets/refinery',
|
46
|
+
'public/stylesheets/refinery/moxify.css',
|
47
|
+
'public/stylesheets/refinery/site_bar.css'
|
48
|
+
]
|
49
|
+
end
|
metadata
CHANGED
@@ -1,21 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: moxify
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash: 29
|
5
4
|
prerelease:
|
6
|
-
|
7
|
-
- 0
|
8
|
-
- 1
|
9
|
-
- 3
|
10
|
-
version: 0.1.3
|
5
|
+
version: 0.1.5
|
11
6
|
platform: ruby
|
12
7
|
authors:
|
13
|
-
-
|
8
|
+
- Marian Andre
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
12
|
|
18
|
-
date: 2011-
|
13
|
+
date: 2011-04-20 00:00:00 +02:00
|
19
14
|
default_executable:
|
20
15
|
dependencies:
|
21
16
|
- !ruby/object:Gem::Dependency
|
@@ -26,12 +21,6 @@ dependencies:
|
|
26
21
|
requirements:
|
27
22
|
- - ~>
|
28
23
|
- !ruby/object:Gem::Version
|
29
|
-
hash: 55
|
30
|
-
segments:
|
31
|
-
- 0
|
32
|
-
- 9
|
33
|
-
- 9
|
34
|
-
- 10
|
35
24
|
version: 0.9.9.10
|
36
25
|
type: :runtime
|
37
26
|
version_requirements: *id001
|
@@ -45,7 +34,8 @@ extra_rdoc_files: []
|
|
45
34
|
|
46
35
|
files:
|
47
36
|
- .gitignore
|
48
|
-
-
|
37
|
+
- Gemfile
|
38
|
+
- Rakefile
|
49
39
|
- app/views/admin/_head.html.erb
|
50
40
|
- app/views/layouts/application.html.erb
|
51
41
|
- app/views/shared/_site_bar.html.erb
|
@@ -53,7 +43,9 @@ files:
|
|
53
43
|
- lib/gemspec.rb
|
54
44
|
- lib/moxify/dragonfly_quality_hook.rb
|
55
45
|
- lib/moxify/url_tempfile.rb
|
46
|
+
- lib/moxify/version.rb
|
56
47
|
- lib/moxify.rb
|
48
|
+
- moxify.gemspec
|
57
49
|
- public/stylesheets/refinery/moxify.css
|
58
50
|
- public/stylesheets/refinery/site_bar.css
|
59
51
|
has_rdoc: true
|
@@ -70,23 +62,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
70
62
|
requirements:
|
71
63
|
- - ">="
|
72
64
|
- !ruby/object:Gem::Version
|
73
|
-
hash: 3
|
74
|
-
segments:
|
75
|
-
- 0
|
76
65
|
version: "0"
|
77
66
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
78
67
|
none: false
|
79
68
|
requirements:
|
80
69
|
- - ">="
|
81
70
|
- !ruby/object:Gem::Version
|
82
|
-
hash: 3
|
83
|
-
segments:
|
84
|
-
- 0
|
85
71
|
version: "0"
|
86
72
|
requirements: []
|
87
73
|
|
88
74
|
rubyforge_project:
|
89
|
-
rubygems_version: 1.
|
75
|
+
rubygems_version: 1.5.2
|
90
76
|
signing_key:
|
91
77
|
specification_version: 3
|
92
78
|
summary: My port of Refinery CMS
|
@@ -1,55 +0,0 @@
|
|
1
|
-
class PageSweeper < ActionController::Caching::Sweeper
|
2
|
-
observe Page, Slug
|
3
|
-
|
4
|
-
def after_save model
|
5
|
-
expire_cache model
|
6
|
-
end
|
7
|
-
|
8
|
-
def after_destroy model
|
9
|
-
expire_cache model
|
10
|
-
end
|
11
|
-
|
12
|
-
private
|
13
|
-
|
14
|
-
def expire_cache model
|
15
|
-
case model.class.name.to_s
|
16
|
-
when "Page"
|
17
|
-
# only expire latest slug
|
18
|
-
# in case title changes, it will trigger the expire_slug function from the observer
|
19
|
-
expire_page "/#{model.slug.name}"
|
20
|
-
|
21
|
-
# expire all cache if we change root page
|
22
|
-
expire_dir nil if (model.parent_id.blank?)
|
23
|
-
when "Slug"
|
24
|
-
# expire from parent level down
|
25
|
-
expire_parent_and_descendants model.name
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
private
|
30
|
-
|
31
|
-
# expire the parent directory and page
|
32
|
-
def expire_parent_and_descendants slug
|
33
|
-
expire_page parent_slug(slug)
|
34
|
-
expire_dir parent_slug(slug)
|
35
|
-
end
|
36
|
-
|
37
|
-
# expire a whole cache directory
|
38
|
-
def expire_dir dir
|
39
|
-
cache_dir = ActionController::Base.page_cache_directory
|
40
|
-
FileUtils.rm_rf Dir.glob("#{cache_dir}#{dir}") rescue Errno::ENOENT
|
41
|
-
Rails.logger.info("Removed cache dir: #{cache_dir}#{dir}")
|
42
|
-
end
|
43
|
-
|
44
|
-
# why not split, pop and rejoin?
|
45
|
-
def parent_slug slug
|
46
|
-
if slug.sluggable_type == "Page"
|
47
|
-
if slug.sluggable.root?
|
48
|
-
slug
|
49
|
-
else
|
50
|
-
slug.sluggable.parent.slug.name
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
end
|