ms_tools 0.4.0 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -17,7 +17,7 @@ module MsTools
17
17
  flash_to_display = flash[:error]
18
18
  end
19
19
  messages << content_tag(:div, flash_to_display, :id => "flash-error") unless flash_to_display.blank?
20
- raw(messages)
20
+ raw(messages.join("<br />"))
21
21
  end
22
22
 
23
23
  # Normalizes image file names
@@ -31,28 +31,27 @@ module MsTools
31
31
  # also match any file that is explictly specified.
32
32
  #
33
33
  def clean_imagefile_name(name='')
34
- root = Rails.public_path
34
+ #root = Rails.public_path
35
+ root = Rails.application.assets.paths.find{|f| f.include? "images" }
35
36
  filename = ""
36
37
  # Shortcut to handle the most common cases.
37
- if FileTest.exist?( File.join( root, "/images/#{name}.png" ) )
38
- filename = "/images/#{name}.png"
39
- elsif FileTest.exist?( File.join( root, "/images/icons/#{name}.png" ) )
40
- filename = "/images/icons/#{name}.png"
38
+ if FileTest.exist?( File.join( root, "#{name}.png" ) )
39
+ filename = "#{name}.png"
40
+ elsif FileTest.exist?( File.join( root, "/icons/#{name}.png" ) )
41
+ filename = "/icons/#{name}.png"
41
42
  else
42
43
  # If not, check all
43
44
  ["", ".png", ".gif", ".jpg"].each do |ext|
44
45
  # Check if full path has been specified
45
46
  if FileTest.exist?( File.join( root, name + ext ) )
46
47
  filename = name + ext
47
- elsif FileTest.exist?( File.join( root, "/images/", name + ext ) )
48
- filename = File.join( "/images/", name + ext )
49
- elsif FileTest.exist?( File.join( root, "/images/icons/", name + ext ) )
50
- filename = File.join( "/images/icons/", name + ext )
48
+ elsif FileTest.exist?( File.join( root, "/icons/", name + ext ) )
49
+ filename = File.join( "/icons/", name + ext )
51
50
  end
52
51
  end
53
52
  end
54
53
  if filename.blank?
55
- filename = "/images/broken.png"
54
+ filename = "broken.png"
56
55
  end
57
56
  filename
58
57
  end
metadata CHANGED
@@ -1,13 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ms_tools
3
3
  version: !ruby/object:Gem::Version
4
- hash: 15
5
- prerelease: false
6
- segments:
7
- - 0
8
- - 4
9
- - 0
10
- version: 0.4.0
4
+ prerelease:
5
+ version: 0.5.1
11
6
  platform: ruby
12
7
  authors:
13
8
  - Will Merrell
@@ -15,8 +10,7 @@ autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
12
 
18
- date: 2010-11-13 00:00:00 -05:00
19
- default_executable:
13
+ date: 2011-07-10 00:00:00 Z
20
14
  dependencies:
21
15
  - !ruby/object:Gem::Dependency
22
16
  name: nokogiri
@@ -24,14 +18,9 @@ dependencies:
24
18
  requirement: &id001 !ruby/object:Gem::Requirement
25
19
  none: false
26
20
  requirements:
27
- - - ~>
21
+ - - ">="
28
22
  - !ruby/object:Gem::Version
29
- hash: 1
30
- segments:
31
- - 1
32
- - 4
33
- - 3
34
- version: 1.4.3
23
+ version: "0"
35
24
  type: :runtime
36
25
  version_requirements: *id001
37
26
  - !ruby/object:Gem::Dependency
@@ -40,14 +29,9 @@ dependencies:
40
29
  requirement: &id002 !ruby/object:Gem::Requirement
41
30
  none: false
42
31
  requirements:
43
- - - ~>
32
+ - - ">="
44
33
  - !ruby/object:Gem::Version
45
- hash: 29
46
- segments:
47
- - 1
48
- - 2
49
- - 1
50
- version: 1.2.1
34
+ version: "0"
51
35
  type: :runtime
52
36
  version_requirements: *id002
53
37
  - !ruby/object:Gem::Dependency
@@ -58,13 +42,10 @@ dependencies:
58
42
  requirements:
59
43
  - - ">="
60
44
  - !ruby/object:Gem::Version
61
- hash: 3
62
- segments:
63
- - 0
64
45
  version: "0"
65
46
  type: :development
66
47
  version_requirements: *id003
67
- description: A collection of functions and tools I use in my projects. Longer description.
48
+ description: A collection of functions and tools I use in my projects. Includes helpers for javascript, stylesheets and flash messages.
68
49
  email: will@morelandsolutions.com
69
50
  executables: []
70
51
 
@@ -81,15 +62,12 @@ files:
81
62
  - lib/ms_tools/sanitize.rb
82
63
  - LICENSE
83
64
  - README.rdoc
84
- - test/test_ms_tools.rb
85
- - test/helper.rb
86
- has_rdoc: true
87
65
  homepage: http://github.com/wmerrell/ms_tools
88
66
  licenses: []
89
67
 
90
68
  post_install_message:
91
- rdoc_options:
92
- - --charset=UTF-8
69
+ rdoc_options: []
70
+
93
71
  require_paths:
94
72
  - lib
95
73
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -97,26 +75,19 @@ required_ruby_version: !ruby/object:Gem::Requirement
97
75
  requirements:
98
76
  - - ">="
99
77
  - !ruby/object:Gem::Version
100
- hash: 3
101
- segments:
102
- - 0
103
78
  version: "0"
104
79
  required_rubygems_version: !ruby/object:Gem::Requirement
105
80
  none: false
106
81
  requirements:
107
82
  - - ">="
108
83
  - !ruby/object:Gem::Version
109
- hash: 3
110
- segments:
111
- - 0
112
84
  version: "0"
113
85
  requirements: []
114
86
 
115
87
  rubyforge_project:
116
- rubygems_version: 1.3.7
88
+ rubygems_version: 1.8.5
117
89
  signing_key:
118
90
  specification_version: 3
119
91
  summary: A collection of functions and tools I use in my projects.
120
- test_files:
121
- - test/test_ms_tools.rb
122
- - test/helper.rb
92
+ test_files: []
93
+
@@ -1,10 +0,0 @@
1
- require 'rubygems'
2
- require 'test/unit'
3
- require 'shoulda'
4
-
5
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
6
- $LOAD_PATH.unshift(File.dirname(__FILE__))
7
- require 'ms_tools'
8
-
9
- class Test::Unit::TestCase
10
- end
@@ -1,7 +0,0 @@
1
- require 'helper'
2
-
3
- class TestMsTools < Test::Unit::TestCase
4
- should "probably rename this file and start testing for real" do
5
- flunk "hey buddy, you should probably rename this file and start testing for real"
6
- end
7
- end