Module: SocialButterfly
- Defined in:
- lib/social_butterfly.rb,
lib/social_butterfly/hooks.rb,
lib/social_butterfly/rails.rb,
lib/social_butterfly/version.rb,
lib/social_butterfly/services.rb,
lib/social_butterfly/rails/engine.rb,
lib/social_butterfly/rails/railtie.rb,
lib/social_butterfly/rails/action_view_extension.rb
Defined Under Namespace
Modules: Rails, Services
Classes: AbstractService, Engine, Hooks
Constant Summary
collapse
- VERSION =
"0.0.4"
Class Method Summary
collapse
Class Method Details
.frameworks ⇒ Object
2
3
4
5
6
7
8
|
# File 'lib/social_butterfly.rb', line 2
def self.frameworks
frameworks = []
case
when rails? then frameworks << 'rails'
end
frameworks
end
|
.hook! ⇒ Object
39
40
41
42
43
44
45
46
47
48
49
50
|
# File 'lib/social_butterfly.rb', line 39
def self.hook!
load_framework!
load_social_butterfly!
require 'social_butterfly/hooks'
if rails?
require 'social_butterfly/rails/action_view_extension'
require 'social_butterfly/rails/railtie'
require 'social_butterfly/rails/engine'
else
SocialButterfly::Hooks.init!
end
end
|
.load! ⇒ Object
52
53
54
|
# File 'lib/social_butterfly.rb', line 52
def self.load!
hook!
end
|
.load_framework! ⇒ Object
10
11
12
13
14
15
16
17
18
19
|
# File 'lib/social_butterfly.rb', line 10
def self.load_framework!
show_warning if frameworks.empty?
frameworks.each do |framework|
begin
require framework
rescue NameError => e
raise "Failed to load framework #{framework.inspect}. Have you added it to Gemfile?"
end
end
end
|
.load_social_butterfly! ⇒ Object
33
34
35
36
37
|
# File 'lib/social_butterfly.rb', line 33
def self.load_social_butterfly!
require 'social_butterfly/version'
require 'social_butterfly/services'
require 'social_butterfly/helpers/social_butterfly_helper'
end
|
.show_warning ⇒ Object
21
22
23
24
25
26
27
28
29
30
31
|
# File 'lib/social_butterfly.rb', line 21
def self.show_warning
$stderr.puts <<-EOC
warning: no framework detected.
would you check out if your Gemfile appropriately configured?
---- e.g. ----
when Rails:
gem 'rails'
gem 'social_butterfly'
EOC
end
|