commonthread-rails 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -0
- data/VERSION +1 -1
- data/commonthread-rails.gemspec +4 -1
- data/lib/commonthread-rails.rb +10 -4
- data/lib/commonthread/date_formats.rb +4 -2
- data/lib/commonthread/monkey_patches.rb +19 -21
- metadata +11 -1
data/Rakefile
CHANGED
@@ -11,6 +11,7 @@ begin
|
|
11
11
|
gem.homepage = "http://github.com/commonthread/commonthread-rails"
|
12
12
|
gem.authors = ["CommonThread"]
|
13
13
|
gem.add_development_dependency "thoughtbot-shoulda", ">= 0"
|
14
|
+
gem.add_dependency "crypt", ">= 0"
|
14
15
|
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
15
16
|
end
|
16
17
|
Jeweler::GemcutterTasks.new
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.1
|
data/commonthread-rails.gemspec
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{commonthread-rails}
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["CommonThread"]
|
@@ -49,11 +49,14 @@ Gem::Specification.new do |s|
|
|
49
49
|
|
50
50
|
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
51
51
|
s.add_development_dependency(%q<thoughtbot-shoulda>, [">= 0"])
|
52
|
+
s.add_runtime_dependency(%q<crypt>, [">= 0"])
|
52
53
|
else
|
53
54
|
s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
|
55
|
+
s.add_dependency(%q<crypt>, [">= 0"])
|
54
56
|
end
|
55
57
|
else
|
56
58
|
s.add_dependency(%q<thoughtbot-shoulda>, [">= 0"])
|
59
|
+
s.add_dependency(%q<crypt>, [">= 0"])
|
57
60
|
end
|
58
61
|
end
|
59
62
|
|
data/lib/commonthread-rails.rb
CHANGED
@@ -1,9 +1,15 @@
|
|
1
1
|
require 'commonthread/date_formats'
|
2
2
|
require 'commonthread/monkey_patches'
|
3
|
+
|
4
|
+
gem 'crypt'
|
3
5
|
require 'commonthread/encrypter'
|
4
6
|
|
5
|
-
|
6
|
-
|
7
|
+
if defined?(ActionView)
|
8
|
+
require 'commonthread/lipsum'
|
9
|
+
ActionView::Base.send(:include, CommonThread::Lipsum::Helper)
|
10
|
+
end
|
7
11
|
|
8
|
-
|
9
|
-
|
12
|
+
if defined?(ActionController)
|
13
|
+
require 'commonthread/filters'
|
14
|
+
ActionController::Base.send(:include, CommonThread::Filters)
|
15
|
+
end
|
@@ -14,5 +14,7 @@ common_formats = {
|
|
14
14
|
:time_24 => '%H:%M' # 16:30
|
15
15
|
}
|
16
16
|
|
17
|
-
ActiveSupport
|
18
|
-
ActiveSupport::CoreExtensions::
|
17
|
+
if defined?(ActiveSupport)
|
18
|
+
ActiveSupport::CoreExtensions::Time::Conversions::DATE_FORMATS.merge!(common_formats)
|
19
|
+
ActiveSupport::CoreExtensions::Date::Conversions::DATE_FORMATS.merge!(common_formats)
|
20
|
+
end
|
@@ -36,10 +36,6 @@ class String
|
|
36
36
|
def to_pretty_url
|
37
37
|
self.strip.downcase.gsub(/\s+/, '_').gsub(/[^\w_-]/, '')
|
38
38
|
end
|
39
|
-
|
40
|
-
def to_html
|
41
|
-
BlueCloth.new(self).to_html rescue ''
|
42
|
-
end
|
43
39
|
end
|
44
40
|
|
45
41
|
|
@@ -104,21 +100,23 @@ class Object
|
|
104
100
|
end
|
105
101
|
|
106
102
|
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
103
|
+
if defined?(ActiveRecord)
|
104
|
+
class ActiveRecord::Base
|
105
|
+
def self.[](id)
|
106
|
+
self.find(id)
|
107
|
+
end
|
108
|
+
|
109
|
+
def to_param
|
110
|
+
if self.respond_to?(:name) and !self.name.blank?
|
111
|
+
"#{self.id}-#{self.name.to_pretty_url}"
|
112
|
+
else
|
113
|
+
self.id.to_s
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
def dom_id(prefix = nil)
|
118
|
+
prefix ||= 'new' if self.new_record?
|
119
|
+
[ prefix, self.class.name, self.id ].compact.join('_').downcase
|
120
|
+
end
|
121
|
+
end
|
124
122
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: commonthread-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- CommonThread
|
@@ -22,6 +22,16 @@ dependencies:
|
|
22
22
|
- !ruby/object:Gem::Version
|
23
23
|
version: "0"
|
24
24
|
version:
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: crypt
|
27
|
+
type: :runtime
|
28
|
+
version_requirement:
|
29
|
+
version_requirements: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: "0"
|
34
|
+
version:
|
25
35
|
description: commonthread-rails is a collection of things that make rails development better for us. It includes date formats, monkey patches to String, Array and NilClass to make things nicer. An Encrypter using blowfish. Also, some rails filters
|
26
36
|
email: hello@commonthread.com
|
27
37
|
executables: []
|