bcms_tools 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/bcms_tools.gemspec +3 -2
- data/lib/bcms_tools/bcms_thumbnails.rb +10 -4
- data/lib/bcms_tools/view_helpers.rb +20 -0
- metadata +3 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.2
|
data/bcms_tools.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{bcms_tools}
|
8
|
-
s.version = "0.0.
|
8
|
+
s.version = "0.0.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["buzzware"]
|
12
|
-
s.date = %q{2010-01-
|
12
|
+
s.date = %q{2010-01-14}
|
13
13
|
s.description = %q{Tools for BrowserCms.}
|
14
14
|
s.email = %q{contact@buzzware.com.au}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -27,6 +27,7 @@ Gem::Specification.new do |s|
|
|
27
27
|
"lib/bcms_tools.rb",
|
28
28
|
"lib/bcms_tools/bcms_thumbnails.rb",
|
29
29
|
"lib/bcms_tools/bcms_thumbnails.rb",
|
30
|
+
"lib/bcms_tools/view_helpers.rb",
|
30
31
|
"lib/bcms_tools_dev.rb",
|
31
32
|
"rails/init.rb",
|
32
33
|
"test/bcms_tools_test.rb",
|
@@ -91,8 +91,10 @@ module BcmsTools
|
|
91
91
|
# generate thumbnail at size to fit container
|
92
92
|
throw RuntimeError.new("Failed reading image #{pathImage}") unless objThumb = Paperclip::Thumbnail.new(File.new(pathImage), "#{aDestWidth}x#{aDestHeight}")
|
93
93
|
throw RuntimeError.new("Failed making thumbnail #{pathImage}") unless foThumb = objThumb.make
|
94
|
-
FileUtils.
|
95
|
-
|
94
|
+
FileUtils.cp(foThumb.path,pathThumb,:preserve => true)
|
95
|
+
FileUtils.chmod(0644,pathThumb)
|
96
|
+
FileUtils.rm(foThumb.path)
|
97
|
+
#POpen4::shell_out("sudo -u tca chgrp www-data #{pathThumb}; sudo -u tca chmod 644 #{pathThumb}")
|
96
98
|
end
|
97
99
|
|
98
100
|
img = XmlUtils.quick_set_att(img,'src',File.join(APP_CONFIG[:thumbs_url],nameThumb))
|
@@ -114,7 +116,9 @@ module BcmsTools
|
|
114
116
|
# generate thumbnail at size to fit container
|
115
117
|
throw RuntimeError.new("Failed reading image #{pathImage}") unless objThumb = Paperclip::Thumbnail.new(File.new(pathImage), "#{aWidth}x#{aHeight}#")
|
116
118
|
throw RuntimeError.new("Failed making thumbnail #{pathImage}") unless foThumb = objThumb.make
|
117
|
-
FileUtils.
|
119
|
+
FileUtils.cp(foThumb.path,pathThumb)
|
120
|
+
FileUtils.chmod(0644,pathThumb)
|
121
|
+
FileUtils.rm(foThumb.path)
|
118
122
|
end
|
119
123
|
return File.join(APP_CONFIG[:thumbs_url],nameThumb)
|
120
124
|
rescue Exception => e
|
@@ -140,7 +144,9 @@ module BcmsTools
|
|
140
144
|
if !File.exists?(pathThumb)
|
141
145
|
throw RuntimeError.new("Failed reading image #{pathImage}") unless objThumb = Paperclip::Thumbnail.new(File.new(pathImage), "#{aDestWidth}x#{aDestHeight}")
|
142
146
|
throw RuntimeError.new("Failed making thumbnail #{pathImage}") unless foThumb = objThumb.make
|
143
|
-
FileUtils.
|
147
|
+
FileUtils.cp(foThumb.path,pathThumb)
|
148
|
+
FileUtils.chmod(0644,pathThumb)
|
149
|
+
FileUtils.rm(foThumb.path)
|
144
150
|
end
|
145
151
|
|
146
152
|
img = "<img src=\"#{File.join(APP_CONFIG[:thumbs_url],nameThumb)}\" width=\"#{aDestWidth}\" height=\"#{aDestHeight}\" />"
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module ActionView
|
2
|
+
module Helpers
|
3
|
+
|
4
|
+
def default_content_for(name, &block)
|
5
|
+
name = name.kind_of?(Symbol) ? ":#{name}" : name
|
6
|
+
out = eval("yield #{name}", block.binding)
|
7
|
+
concat(out || capture(&block), block.binding)
|
8
|
+
end
|
9
|
+
|
10
|
+
module CaptureHelper
|
11
|
+
def set_content_for(name, content = nil, &block)
|
12
|
+
ivar = "@content_for_#{name}"
|
13
|
+
instance_variable_set(ivar, nil)
|
14
|
+
content_for(name, content, &block)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bcms_tools
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- buzzware
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-01-
|
12
|
+
date: 2010-01-14 00:00:00 +08:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -61,6 +61,7 @@ files:
|
|
61
61
|
- bcms_tools.gemspec
|
62
62
|
- lib/bcms_tools.rb
|
63
63
|
- lib/bcms_tools/bcms_thumbnails.rb
|
64
|
+
- lib/bcms_tools/view_helpers.rb
|
64
65
|
- lib/bcms_tools_dev.rb
|
65
66
|
- rails/init.rb
|
66
67
|
- test/bcms_tools_test.rb
|