dekiru 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/lib/dekiru/helper.rb +23 -0
  2. data/lib/dekiru/version.rb +1 -1
  3. metadata +48 -39
@@ -38,5 +38,28 @@ EOF
38
38
  EOF
39
39
  html.html_safe
40
40
  end
41
+
42
+ def google_analytics(code, options = {})
43
+ if code.present? && ::Rails.env == "production"
44
+ multi_subdomain = if options[:domain]
45
+ "_gaq.push(['_setDomainName', '#{options[:domain]}']);"
46
+ end
47
+
48
+ html = <<-EOF
49
+ <script type="text/javascript">
50
+ var _gaq = _gaq || [];
51
+ _gaq.push(['_setAccount', '#{code}']);
52
+ #{multi_subdomain}
53
+ _gaq.push(['_tracktextPageview']);
54
+ (function() {
55
+ var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
56
+ ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
57
+ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
58
+ })();
59
+ </script>
60
+ EOF
61
+ html.html_safe
62
+ end
63
+ end
41
64
  end
42
65
  end
@@ -1,3 +1,3 @@
1
1
  module Dekiru
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
metadata CHANGED
@@ -1,39 +1,45 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: dekiru
3
- version: !ruby/object:Gem::Version
4
- version: 0.0.3
5
- prerelease:
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 0
8
+ - 4
9
+ version: 0.0.4
6
10
  platform: ruby
7
- authors:
11
+ authors:
8
12
  - Akihiro Matsumura
9
13
  autorequire:
10
14
  bindir: bin
11
15
  cert_chain: []
12
- date: 2012-07-20 00:00:00.000000000 Z
13
- dependencies:
14
- - !ruby/object:Gem::Dependency
16
+
17
+ date: 2012-07-27 00:00:00 +09:00
18
+ default_executable:
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
15
21
  name: rake
16
- requirement: !ruby/object:Gem::Requirement
17
- none: false
18
- requirements:
19
- - - ! '>='
20
- - !ruby/object:Gem::Version
21
- version: '0'
22
- type: :development
23
22
  prerelease: false
24
- version_requirements: !ruby/object:Gem::Requirement
23
+ requirement: &id001 !ruby/object:Gem::Requirement
25
24
  none: false
26
- requirements:
27
- - - ! '>='
28
- - !ruby/object:Gem::Version
29
- version: '0'
25
+ requirements:
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ segments:
29
+ - 0
30
+ version: "0"
31
+ type: :development
32
+ version_requirements: *id001
30
33
  description: Usefull helper methods for Ruby on Rails
31
- email:
34
+ email:
32
35
  - matsumura.aki@gmail.com
33
36
  executables: []
37
+
34
38
  extensions: []
39
+
35
40
  extra_rdoc_files: []
36
- files:
41
+
42
+ files:
37
43
  - .gitignore
38
44
  - Gemfile
39
45
  - LICENSE
@@ -44,34 +50,37 @@ files:
44
50
  - lib/dekiru/helper.rb
45
51
  - lib/dekiru/railtie.rb
46
52
  - lib/dekiru/version.rb
47
- homepage: ''
53
+ has_rdoc: true
54
+ homepage: ""
48
55
  licenses: []
56
+
49
57
  post_install_message:
50
58
  rdoc_options: []
51
- require_paths:
59
+
60
+ require_paths:
52
61
  - lib
53
- required_ruby_version: !ruby/object:Gem::Requirement
62
+ required_ruby_version: !ruby/object:Gem::Requirement
54
63
  none: false
55
- requirements:
56
- - - ! '>='
57
- - !ruby/object:Gem::Version
58
- version: '0'
59
- segments:
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ segments:
60
68
  - 0
61
- hash: 142686872410909050
62
- required_rubygems_version: !ruby/object:Gem::Requirement
69
+ version: "0"
70
+ required_rubygems_version: !ruby/object:Gem::Requirement
63
71
  none: false
64
- requirements:
65
- - - ! '>='
66
- - !ruby/object:Gem::Version
67
- version: '0'
68
- segments:
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ segments:
69
76
  - 0
70
- hash: 142686872410909050
77
+ version: "0"
71
78
  requirements: []
79
+
72
80
  rubyforge_project:
73
- rubygems_version: 1.8.24
81
+ rubygems_version: 1.3.7
74
82
  signing_key:
75
83
  specification_version: 3
76
84
  summary: Usefull helper methods for Ruby on Rails
77
85
  test_files: []
86
+