bcms_tools 0.0.8 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1,2 +1,2 @@
1
- 0.0.8
1
+ 0.0.9
2
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"
8
+ s.version = "0.0.9"
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-03-09}
12
+ s.date = %q{2010-03-11}
13
13
  s.description = %q{Tools for BrowserCms.}
14
14
  s.email = %q{contact@buzzware.com.au}
15
15
  s.extra_rdoc_files = [
@@ -14,9 +14,21 @@ module BcmsTools
14
14
  def self.thumbnail_name_from_attachment(aAttachment,aWidth,aHeight)
15
15
  extThumb = aAttachment.file_extension
16
16
  size = "#{aWidth.to_s}x#{aHeight.to_s}"
17
- return File.basename(aAttachment.file_location)+'-'+size+'.'+extThumb
17
+ result = File.basename(aAttachment.file_location)+'-'
18
+ result += if aWidth && aHeight
19
+ size+'.'+extThumb
20
+ else
21
+ '*'
22
+ end
23
+ result
18
24
  end
19
25
 
26
+ def self.remove_attachment_thumbnails(aAttachment)
27
+ nameThumb = thumbnail_name_from_attachment(aAttachment,nil,nil)
28
+ pathThumbWildcard = File.join(APP_CONFIG[:thumbs_cache],nameThumb)
29
+ FileUtils.rm(Dir.glob(pathThumbWildcard))
30
+ end
31
+
20
32
  def self.attachment_from_url(aUrl)
21
33
  if aUrl.begins_with?('/cms/attachments/')
22
34
  id,version = aUrl.scan(/\/cms\/attachments\/([0-9]+)\?version=([0-9]+)/).flatten.map {|i| i.to_i}
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.8
4
+ version: 0.0.9
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-03-09 00:00:00 +08:00
12
+ date: 2010-03-11 00:00:00 +08:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency