avataree 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -19,6 +19,8 @@
19
19
  # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
20
  # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
21
 
22
+ # encoding: utf-8
23
+
22
24
  require 'digest/md5'
23
25
 
24
26
  module Helper
@@ -19,6 +19,8 @@
19
19
  # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
20
  # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
21
 
22
+ # encoding: utf-8
23
+
22
24
  module Avataree
23
25
 
24
26
  module Image
@@ -19,6 +19,8 @@
19
19
  # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
20
  # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
21
 
22
+ # encoding: utf-8
23
+
22
24
  require 'json'
23
25
  require 'open-uri'
24
26
 
@@ -26,7 +28,7 @@ module Avataree
26
28
 
27
29
  module Profile
28
30
 
29
- #image path for gravatar if not defined?
31
+ #image path for gravatar if not defined?
30
32
  PROFILE_PATH = "http://www.gravatar.com/" unless const_defined?("PROFILE_PATH")
31
33
 
32
34
  #this method returns hash full of information provided by Gravatar.
@@ -0,0 +1,15 @@
1
+ # encoding: utf-8
2
+
3
+ require 'avataree'
4
+ require 'avataree/helper'
5
+ require 'avataree/image'
6
+ require 'avataree/profile'
7
+ require 'avataree/switch'
8
+
9
+ module Avataree
10
+ class Railtie < Rails::Railtie
11
+ initializer 'avataree.initialize', :after => :after_initialize do
12
+ Avataree.enable!
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,23 @@
1
+ module Avataree
2
+
3
+ class << self
4
+
5
+ def enable!
6
+ enable_for_controller!
7
+ enable_for_views!
8
+ end
9
+
10
+ def enable_for_controller!
11
+ #hook for ActionController
12
+ ActionController::Base.send(:include, Avataree::Image)
13
+ ActionController::Base.send(:include, Avataree::Profile)
14
+ end
15
+
16
+ def enable_for_views!
17
+ #hook for ActionView
18
+ ActionView::Base.send(:include, Avataree::Image)
19
+ end
20
+
21
+ end
22
+
23
+ end
data/lib/avataree.rb CHANGED
@@ -19,12 +19,9 @@
19
19
  # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
20
  # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
21
 
22
- require 'avataree/helper'
23
- require 'avataree/image'
24
- require 'avataree/profile'
22
+ # encoding: utf-8
25
23
 
26
- #hook for ActionController
27
- ActionController::Base.send(:include, Avataree::Image)
28
- ActionController::Base.send(:include, Avataree::Profile)
29
- #hook for ActionView
30
- ActionView::Base.send(:include, Avataree::Image)
24
+ require File.join(File.dirname(__FILE__), *%w[avataree railtie]) if defined?(::Rails::Railtie)
25
+
26
+ module Avataree
27
+ end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: avataree
3
3
  version: !ruby/object:Gem::Version
4
- hash: 19
4
+ hash: 15
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
- - 3
8
+ - 4
9
9
  - 0
10
- version: 0.3.0
10
+ version: 0.4.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Bagwan Pankaj (a.k.a modulo9)
@@ -122,6 +122,8 @@ files:
122
122
  - lib/avataree/helper.rb
123
123
  - lib/avataree/image.rb
124
124
  - lib/avataree/profile.rb
125
+ - lib/avataree/railtie.rb
126
+ - lib/avataree/switch.rb
125
127
  - LICENSE.txt
126
128
  - README.textile
127
129
  - test/avataree_test.rb