feedbacker 0.1.5 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile ADDED
@@ -0,0 +1,2 @@
1
+ source 'https://rubygems.org'
2
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,26 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ feedbacker (0.1.6)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ activesupport (3.2.2)
10
+ i18n (~> 0.6)
11
+ multi_json (~> 1.0)
12
+ i18n (0.6.1)
13
+ json (1.6.5)
14
+ multi_json (1.3.6)
15
+ rake (0.9.2.2)
16
+ rdoc (3.12)
17
+ json (~> 1.4)
18
+
19
+ PLATFORMS
20
+ ruby
21
+
22
+ DEPENDENCIES
23
+ activesupport
24
+ feedbacker!
25
+ rake (>= 0.9.2)
26
+ rdoc (>= 3.12)
data/MIT-LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2009 Worldwide IDEA, Inc http://www.wwidea.org
1
+ Copyright 2009-2013 Worldwide IDEA, Inc http://www.wwidea.org
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -1,3 +1,6 @@
1
+ [![Gem Version](https://badge.fury.io/rb/feedbacker.png)](http://badge.fury.io/rb/feedbacker)
2
+ [![Code Climate](https://codeclimate.com/github/wwidea/feedbacker.png)](https://codeclimate.com/github/wwidea/feedbacker)
3
+
1
4
  Feedbacker
2
5
  ==========
3
6
 
@@ -11,47 +14,52 @@ Feedbacker assumes that you're using...
11
14
  * At least Rails 3.1.3
12
15
  * The Rails Asset Pipeline
13
16
  * Jquery
17
+ * That you have a User class with email and name methods (name can be configured to something else)
14
18
  * and probably some other things that we've failed to mention.
15
19
 
16
20
  Installation
17
21
  ------------
18
22
  1. Add the following to your Gemfile.
19
23
 
20
- gem :feedbacker
24
+ gem :feedbacker
21
25
 
22
26
  2. Run `bundle install`
23
27
 
24
28
  3. Add the following line to your application layout.
25
29
 
26
- <%= javascript_include_tag :feedbacker %>
30
+ <%= javascript_include_tag :feedbacker %>
27
31
 
28
32
  4. Add the following line to your application layout before you call application.css. Override default settings in application.css.
29
33
 
30
- <%= stylesheet_link_tag :feedbacker %>
34
+ <%= stylesheet_link_tag :feedbacker %>
31
35
 
32
36
  5. Add the following line at at appropriate position in your application layout.
33
37
 
34
- <%= render(:partial => 'feedbacker/tab') unless current_user.is_guest? %>
38
+ <%= render(:partial => 'feedbacker/tab') unless current_user.is_guest? %>
35
39
 
36
40
  6. Add the folllowing line to config/application.rb.
37
41
 
38
- config.paths['db/migrate'] = Feedbacker::Engine.paths['db/migrate'].existent
39
-
42
+ config.paths['db/migrate'] += Feedbacker::Engine.paths['db/migrate'].existent
43
+
40
44
  7. Run `rake db:migrate` to add remarks table.
41
45
 
42
46
  8. Create feedbacker.rb in config/initializers and add the following line.
43
47
 
44
- Feedbacker::EMAIL_TO = 'support@yourdomain.com'
45
-
46
- 9. (Optional) You may also add either or both of the following lines and edit to taste. Defaults are shown.
48
+ Feedbacker::SETTINGS.email_to = 'support@yourdomain.com'
49
+
50
+ OR
51
+
52
+ Feedbacker::SETTINGS.update do |settings|
53
+ settings.email_to = 'support@yourdomain.com'
54
+ settings.user_name_method = :name # default value
55
+ settings.email_prefix = '[FEEDBACKER]' # default value
56
+ end
47
57
 
48
- Feedbacker::RemarkMethods::USER_NAME_METHOD = :first_last
49
- Feedbacker::EMAIL_PREFIX = '[FEEDBACKER]'
50
-
51
- Copyright (c) 2009 WWIDEA, Inc. released under the MIT license
52
58
 
53
59
 
54
60
  Contributions
55
61
  -------------
56
62
 
57
63
  If have improvements to contribute to this gem, please feel free to fork, commit with tests (if applicable), and then send a pull request. Thank You!
64
+
65
+ Copyright (c) 2009-2013 WWIDEA, Inc. released under the MIT license
data/Rakefile CHANGED
@@ -1,6 +1,6 @@
1
1
  require 'rake'
2
2
  require 'rake/testtask'
3
- require 'rake/rdoctask'
3
+ require 'rdoc/task'
4
4
 
5
5
  desc 'Default: run unit tests.'
6
6
  task :default => :test
@@ -1,6 +1,11 @@
1
1
  class FeedbackMailer < ActionMailer::Base
2
2
  def feedback(remark)
3
3
  @remark = remark
4
- mail(:to => Feedbacker::EMAIL_TO, :from => Feedbacker::EMAIL_TO, :reply_to => remark.user.email, :subject => "#{(defined? Feedbacker::EMAIL_PREFIX) ? Feedbacker::EMAIL_PREFIX : '[FEEDBACKER]'} Feedback Notification")
4
+ mail(
5
+ to: Feedbacker::SETTINGS.email_to,
6
+ from: Feedbacker::SETTINGS.email_to,
7
+ reply_to: remark.user.email,
8
+ subject: "#{Feedbacker::SETTINGS.email_prefix} Feedback Notification"
9
+ )
5
10
  end
6
11
  end
data/feedbacker.gemspec CHANGED
@@ -1,15 +1,21 @@
1
1
  require File.expand_path('../lib/feedbacker/version', __FILE__)
2
2
 
3
3
  Gem::Specification.new do |s|
4
- s.name = "feedbacker"
5
- s.version = Feedbacker::VERSION
6
- s.platform = Gem::Platform::RUBY
7
- s.authors = ["Jonathan S. Garvin", 'Aaron Baldwin', 'WWIDEA, Inc']
8
- s.email = ["developers@wwidea.org"]
9
- s.homepage = "https://github.com/wwidea/feedbacker"
10
- s.summary = %q{Sitewide Feedback form pinned to sidewall as verticle tab.}
11
- s.description = %q{Feedbacker provides a pull out tab on the side of every page on a site for users to send feedback to the site.}
4
+ s.name = "feedbacker"
5
+ s.version = Feedbacker::VERSION
6
+ s.platform = Gem::Platform::RUBY
7
+ s.authors = ["Jonathan S. Garvin", 'Aaron Baldwin', 'WWIDEA, Inc']
8
+ s.email = ["developers@wwidea.org"]
9
+ s.homepage = "https://github.com/wwidea/feedbacker"
10
+ s.summary = %q{Sitewide Feedback form pinned to sidewall as verticle tab.}
11
+ s.description = %q{Feedbacker provides a pull out tab on the side of every page on a site for users to send feedback to the site.}
12
+ s.license = 'MIT'
13
+
14
+ s.add_development_dependency('rake','>= 0.9.2')
15
+ s.add_development_dependency('rdoc','>= 3.12')
16
+ s.add_development_dependency('activesupport')
17
+
12
18
  s.files = `git ls-files`.split("\n")
13
19
  s.test_files = `git ls-files -- test/*`.split("\n")
14
20
  s.require_paths = ["lib"]
15
- end
21
+ end
@@ -1,28 +1,13 @@
1
1
  module Feedbacker #:nodoc:
2
2
  module RemarkMethods
3
3
  def self.included(base)
4
- base.extend ClassMethods
5
4
  base.class_eval do
6
- include InstanceMethods
7
-
8
5
  belongs_to :user
9
6
  end
10
7
  end
11
8
 
12
- module ClassMethods
13
-
14
- end
15
-
16
- module InstanceMethods
17
-
18
- def user_name
19
- if defined? Feedbacker::RemarkMethods::USER_NAME_METHOD
20
- return user.send(Feedbacker::RemarkMethods::USER_NAME_METHOD)
21
- else
22
- user.name
23
- end
24
- end
25
-
9
+ def user_name
10
+ return user.send(Feedbacker::SETTINGS.user_name_method)
26
11
  end
27
12
  end
28
- end
13
+ end
@@ -0,0 +1,17 @@
1
+ module Feedbacker
2
+ class Settings
3
+ attr_accessor :email_to, :email_prefix, :user_name_method
4
+
5
+ def initialize
6
+ self.email_to = ''
7
+ self.email_prefix = '[FEEDBACKER]'
8
+ self.user_name_method = :name
9
+ end
10
+
11
+ def update
12
+ yield self
13
+ end
14
+ end
15
+
16
+ SETTINGS = Settings.new
17
+ end
@@ -1,3 +1,3 @@
1
1
  module Feedbacker
2
- VERSION = '0.1.5'
2
+ VERSION = '0.1.6'
3
3
  end
data/test/jenkins.bash ADDED
@@ -0,0 +1,3 @@
1
+ #!/bin/bash
2
+ bundle install
3
+ bundle exec rake test
@@ -0,0 +1,36 @@
1
+ require 'test_helper'
2
+ require File.expand_path('../../lib/feedbacker/remark_methods', __FILE__)
3
+
4
+ class RemarkMethodsTest < ActiveSupport::TestCase
5
+
6
+ test "should send user_name_method to user" do
7
+ instance = remark_methods_class.new(return_send_class.new)
8
+
9
+ assert_equal 'name method', instance.user_name
10
+ end
11
+
12
+ private
13
+
14
+ def remark_methods_class
15
+ @remark_methods_class ||= Class.new do
16
+ attr_accessor :user
17
+
18
+ def self.belongs_to(*args)
19
+ end
20
+
21
+ def initialize(user)
22
+ self.user = user
23
+ end
24
+
25
+ include Feedbacker::RemarkMethods
26
+ end
27
+ end
28
+
29
+ def return_send_class
30
+ Class.new do
31
+ def name
32
+ "name method"
33
+ end
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,33 @@
1
+ require 'test_helper'
2
+ require File.expand_path('../../lib/feedbacker/settings', __FILE__)
3
+
4
+ class SettingsTest < ActiveSupport::TestCase
5
+
6
+ test "should return default values" do
7
+ settings = Feedbacker::Settings.new
8
+
9
+ assert_equal '', settings.email_to
10
+ assert_equal '[FEEDBACKER]', settings.email_prefix
11
+ assert_equal :name, settings.user_name_method
12
+ end
13
+
14
+ test "should assign new value to setting" do
15
+ settings = Feedbacker::Settings.new
16
+ settings.email_to = 'testing@mail.com'
17
+
18
+ assert_equal 'testing@mail.com', settings.email_to
19
+ end
20
+
21
+ test 'should update setting' do
22
+ settings = Feedbacker::Settings.new
23
+ settings.update do |settings|
24
+ settings.email_to = 'me@mail.com'
25
+ end
26
+
27
+ assert_equal 'me@mail.com', settings.email_to
28
+ end
29
+
30
+ test 'should return default value from SETTINGS constant' do
31
+ assert_equal '[FEEDBACKER]', Feedbacker::SETTINGS.email_prefix
32
+ end
33
+ end
data/test/test_helper.rb CHANGED
@@ -1,3 +1,5 @@
1
1
  require 'rubygems'
2
2
  require 'active_support'
3
- require 'active_support/test_case'
3
+ require 'active_support/test_case'
4
+ require 'test/unit'
5
+
metadata CHANGED
@@ -1,32 +1,77 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: feedbacker
3
- version: !ruby/object:Gem::Version
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.6
4
5
  prerelease:
5
- version: 0.1.5
6
6
  platform: ruby
7
- authors:
7
+ authors:
8
8
  - Jonathan S. Garvin
9
9
  - Aaron Baldwin
10
10
  - WWIDEA, Inc
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
-
15
- date: 2012-01-16 00:00:00 -07:00
16
- default_executable:
17
- dependencies: []
18
-
19
- description: Feedbacker provides a pull out tab on the side of every page on a site for users to send feedback to the site.
20
- email:
14
+ date: 2013-07-16 00:00:00.000000000 Z
15
+ dependencies:
16
+ - !ruby/object:Gem::Dependency
17
+ name: rake
18
+ requirement: !ruby/object:Gem::Requirement
19
+ none: false
20
+ requirements:
21
+ - - ! '>='
22
+ - !ruby/object:Gem::Version
23
+ version: 0.9.2
24
+ type: :development
25
+ prerelease: false
26
+ version_requirements: !ruby/object:Gem::Requirement
27
+ none: false
28
+ requirements:
29
+ - - ! '>='
30
+ - !ruby/object:Gem::Version
31
+ version: 0.9.2
32
+ - !ruby/object:Gem::Dependency
33
+ name: rdoc
34
+ requirement: !ruby/object:Gem::Requirement
35
+ none: false
36
+ requirements:
37
+ - - ! '>='
38
+ - !ruby/object:Gem::Version
39
+ version: '3.12'
40
+ type: :development
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ none: false
44
+ requirements:
45
+ - - ! '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '3.12'
48
+ - !ruby/object:Gem::Dependency
49
+ name: activesupport
50
+ requirement: !ruby/object:Gem::Requirement
51
+ none: false
52
+ requirements:
53
+ - - ! '>='
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
56
+ type: :development
57
+ prerelease: false
58
+ version_requirements: !ruby/object:Gem::Requirement
59
+ none: false
60
+ requirements:
61
+ - - ! '>='
62
+ - !ruby/object:Gem::Version
63
+ version: '0'
64
+ description: Feedbacker provides a pull out tab on the side of every page on a site
65
+ for users to send feedback to the site.
66
+ email:
21
67
  - developers@wwidea.org
22
68
  executables: []
23
-
24
69
  extensions: []
25
-
26
70
  extra_rdoc_files: []
27
-
28
- files:
71
+ files:
29
72
  - .gitignore
73
+ - Gemfile
74
+ - Gemfile.lock
30
75
  - MIT-LICENSE
31
76
  - README.md
32
77
  - Rakefile
@@ -40,12 +85,9 @@ files:
40
85
  - app/views/remarks/_form.html.erb
41
86
  - app/views/remarks/_greeting.html.erb
42
87
  - app/views/remarks/create.js.erb
43
- - config/initializers/feedbacker.rb
44
88
  - config/routes.rb
45
89
  - db/migrate/20101230191157_create_remarks_table.rb
46
90
  - feedbacker.gemspec
47
- - init.rb
48
- - install.rb
49
91
  - lib/assets/images/feedback_tab.png
50
92
  - lib/assets/images/feedback_tab_bottom.png
51
93
  - lib/assets/javascripts/feedbacker.js
@@ -53,39 +95,41 @@ files:
53
95
  - lib/feedbacker.rb
54
96
  - lib/feedbacker/remark_methods.rb
55
97
  - lib/feedbacker/remarks_controller_methods.rb
98
+ - lib/feedbacker/settings.rb
56
99
  - lib/feedbacker/version.rb
57
100
  - lib/tasks/feedbacker_tasks.rake
58
- - test/feedbacker_test.rb
101
+ - test/jenkins.bash
102
+ - test/remark_methods_test.rb
103
+ - test/settings_test.rb
59
104
  - test/test_helper.rb
60
- - uninstall.rb
61
- has_rdoc: true
62
105
  homepage: https://github.com/wwidea/feedbacker
63
- licenses: []
64
-
106
+ licenses:
107
+ - MIT
65
108
  post_install_message:
66
109
  rdoc_options: []
67
-
68
- require_paths:
110
+ require_paths:
69
111
  - lib
70
- required_ruby_version: !ruby/object:Gem::Requirement
112
+ required_ruby_version: !ruby/object:Gem::Requirement
71
113
  none: false
72
- requirements:
73
- - - ">="
74
- - !ruby/object:Gem::Version
75
- version: "0"
76
- required_rubygems_version: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ! '>='
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ required_rubygems_version: !ruby/object:Gem::Requirement
77
119
  none: false
78
- requirements:
79
- - - ">="
80
- - !ruby/object:Gem::Version
81
- version: "0"
120
+ requirements:
121
+ - - ! '>='
122
+ - !ruby/object:Gem::Version
123
+ version: '0'
82
124
  requirements: []
83
-
84
125
  rubyforge_project:
85
- rubygems_version: 1.5.2
126
+ rubygems_version: 1.8.24
86
127
  signing_key:
87
128
  specification_version: 3
88
129
  summary: Sitewide Feedback form pinned to sidewall as verticle tab.
89
- test_files:
90
- - test/feedbacker_test.rb
130
+ test_files:
131
+ - test/jenkins.bash
132
+ - test/remark_methods_test.rb
133
+ - test/settings_test.rb
91
134
  - test/test_helper.rb
135
+ has_rdoc:
@@ -1,3 +0,0 @@
1
- Feedbacker::RemarkMethods::USER_NAME_METHOD = :first_last
2
- Feedbacker::EMAIL_PREFIX = '[FEEDBACKER]'
3
- Feedbacker::EMAIL_TO = ''
data/init.rb DELETED
@@ -1 +0,0 @@
1
- # Include hook code here
data/install.rb DELETED
@@ -1 +0,0 @@
1
- # Install hook code here
@@ -1,8 +0,0 @@
1
- require 'test_helper'
2
-
3
- class FeedbackerTest < ActiveSupport::TestCase
4
- # Replace this with your real tests.
5
- test "the truth" do
6
- assert true
7
- end
8
- end
data/uninstall.rb DELETED
@@ -1 +0,0 @@
1
- # Uninstall hook code here