letter_opener_web 1.1.3 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (28) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +2 -1
  3. data/CHANGELOG.md +7 -1
  4. data/Gemfile +2 -3
  5. data/Gemfile.lock +112 -121
  6. data/README.md +3 -20
  7. data/app/assets/javascripts/letter_opener_web/application.js +2 -3
  8. data/app/assets/stylesheets/letter_opener_web/application.css.erb +3 -5
  9. data/app/controllers/letter_opener_web/letters_controller.rb +6 -0
  10. data/app/models/letter_opener_web/letter.rb +5 -1
  11. data/app/views/letter_opener_web/letters/index.html.erb +15 -0
  12. data/config/routes.rb +4 -3
  13. data/demo/Gemfile +1 -3
  14. data/demo/Gemfile.lock +57 -60
  15. data/demo/index.html.erb +2 -2
  16. data/letter_opener_web.gemspec +2 -2
  17. data/lib/letter_opener_web/version.rb +1 -1
  18. data/spec/controllers/letter_opener_web/letters_controller_spec.rb +23 -15
  19. data/spec/internal/config/routes.rb +1 -0
  20. data/spec/models/letter_opener_web/letter_spec.rb +25 -12
  21. data/vendor/assets/images/{glyphicons-halflings-white.png → letter_opener_web/glyphicons-halflings-white.png} +0 -0
  22. data/vendor/assets/images/{glyphicons-halflings.png → letter_opener_web/glyphicons-halflings.png} +0 -0
  23. data/vendor/assets/javascripts/{bootstrap.min.js → letter_opener_web/bootstrap.min.js} +0 -0
  24. data/vendor/assets/javascripts/{jquery-1.8.3.min.js → letter_opener_web/jquery-1.8.3.min.js} +0 -0
  25. data/vendor/assets/javascripts/{jquery_ujs.js → letter_opener_web/jquery_ujs.js} +0 -0
  26. data/vendor/assets/stylesheets/{bootstrap.min.css → letter_opener_web/bootstrap.min.css} +0 -0
  27. metadata +28 -29
  28. data/demo/initializers.rb +0 -9
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 635c1ee37b5f5af26958ed5352c8c2f993836837
4
- data.tar.gz: 0f726ba70c2dc43486f1dd1aa08ee723f7ba4ed3
3
+ metadata.gz: fc14aca146ed087b4338ac541248a3d9f1959eac
4
+ data.tar.gz: 40c58615d7b5da34ebb616056a15d95890b29784
5
5
  SHA512:
6
- metadata.gz: bd1ef70c5276f5b97907d6e088d96303c9dd2b59bae2e33b680264046fd7b25c9bacf6474ef911e3c9966a659b7fe9e2398a39ce5c0487362231da92141e988e
7
- data.tar.gz: e56d00193cc694602d18749cb76e9dc111d6456b1cab5266762851fc0b7b40379db9aba93ae9628cea9139985e8bcfb25485dd2cc9692a927a0da4cca6e3db11
6
+ metadata.gz: 7767870d3426c8b5e412c5393c1915e9095dc8f2c889462d3f8dd3ae50c88099a465399e550aeb2267609124e54e610fb5b67c5b46db402ef4fdd0f49cfec516
7
+ data.tar.gz: 837fb0d561726c6284e1444df8244f74b2cf491b2174489a7e6a34bac5538e5767ac2776170db6687af7753b4ea73e6499927fb6bf0e39161fea64c63258d140
data/.travis.yml CHANGED
@@ -1,6 +1,7 @@
1
1
  language: ruby
2
- bundler_args: --without devonly
2
+ bundler_args: --without development
3
3
  rvm:
4
+ - 2.1.1
4
5
  - 2.1.0
5
6
  - 2.0.0
6
7
  - 1.9.3
data/CHANGELOG.md CHANGED
@@ -1,4 +1,10 @@
1
- ## [1.1.3](https://github.com/fgrehm/letter_opener_web/compare/v1.1.2...master) (Feb 21, 2014)
1
+ ## [1.2.0](https://github.com/fgrehm/letter_opener_web/compare/v1.1.3...v1.2.0) (Apr 07, 2014)
2
+
3
+ - Add support for removing a single email [#23](https://github.com/fgrehm/letter_opener_web/pull/23)
4
+ - Move vendored assets into the `letter_opener_web` folder [#24](https://github.com/fgrehm/letter_opener_web/issues/24)
5
+ - Avoid matching `<address>` when changing email links to open on new tabs [#22](https://github.com/fgrehm/letter_opener_web/pull/22)
6
+
7
+ ## [1.1.3](https://github.com/fgrehm/letter_opener_web/compare/v1.1.2...v1.1.3) (Feb 21, 2014)
2
8
 
3
9
  - Include assets into `precompile` list [#21](https://github.com/fgrehm/letter_opener_web/pull/21)
4
10
 
data/Gemfile CHANGED
@@ -5,9 +5,8 @@ source "http://rubygems.org"
5
5
  # development dependencies will be added by default to the :development group.
6
6
  gemspec
7
7
 
8
- group :devonly do
9
- gem 'debugger'
10
- gem 'rb-inotify', '~> 0.8.8'
8
+ group :development do
9
+ gem 'rb-inotify'
11
10
  gem 'guard'
12
11
  gem 'guard-rspec'
13
12
  end
data/Gemfile.lock CHANGED
@@ -1,162 +1,153 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- letter_opener_web (1.1.3)
4
+ letter_opener_web (1.2.0)
5
5
  letter_opener (~> 1.0)
6
6
  rails (>= 3.2)
7
7
 
8
8
  GEM
9
9
  remote: http://rubygems.org/
10
10
  specs:
11
- actionmailer (3.2.12)
12
- actionpack (= 3.2.12)
13
- mail (~> 2.4.4)
14
- actionpack (3.2.12)
15
- activemodel (= 3.2.12)
16
- activesupport (= 3.2.12)
17
- builder (~> 3.0.0)
11
+ actionmailer (4.0.4)
12
+ actionpack (= 4.0.4)
13
+ mail (~> 2.5.4)
14
+ actionpack (4.0.4)
15
+ activesupport (= 4.0.4)
16
+ builder (~> 3.1.0)
18
17
  erubis (~> 2.7.0)
19
- journey (~> 1.0.4)
20
- rack (~> 1.4.5)
21
- rack-cache (~> 1.2)
22
- rack-test (~> 0.6.1)
23
- sprockets (~> 2.2.1)
24
- activemodel (3.2.12)
25
- activesupport (= 3.2.12)
26
- builder (~> 3.0.0)
27
- activerecord (3.2.12)
28
- activemodel (= 3.2.12)
29
- activesupport (= 3.2.12)
30
- arel (~> 3.0.2)
31
- tzinfo (~> 0.3.29)
32
- activeresource (3.2.12)
33
- activemodel (= 3.2.12)
34
- activesupport (= 3.2.12)
35
- activesupport (3.2.12)
36
- i18n (~> 0.6)
37
- multi_json (~> 1.0)
38
- addressable (2.3.5)
39
- arel (3.0.2)
40
- bourne (1.4.0)
41
- mocha (~> 0.13.2)
42
- builder (3.0.4)
43
- coderay (1.0.8)
44
- columnize (0.3.6)
45
- combustion (0.3.3)
46
- rails (>= 3.0.0)
18
+ rack (~> 1.5.2)
19
+ rack-test (~> 0.6.2)
20
+ activemodel (4.0.4)
21
+ activesupport (= 4.0.4)
22
+ builder (~> 3.1.0)
23
+ activerecord (4.0.4)
24
+ activemodel (= 4.0.4)
25
+ activerecord-deprecated_finders (~> 1.0.2)
26
+ activesupport (= 4.0.4)
27
+ arel (~> 4.0.0)
28
+ activerecord-deprecated_finders (1.0.3)
29
+ activesupport (4.0.4)
30
+ i18n (~> 0.6, >= 0.6.9)
31
+ minitest (~> 4.2)
32
+ multi_json (~> 1.3)
33
+ thread_safe (~> 0.1)
34
+ tzinfo (~> 0.3.37)
35
+ addressable (2.3.6)
36
+ arel (4.0.2)
37
+ builder (3.1.4)
38
+ celluloid (0.15.2)
39
+ timers (~> 1.1.0)
40
+ celluloid-io (0.15.0)
41
+ celluloid (>= 0.15.0)
42
+ nio4r (>= 0.5.0)
43
+ coderay (1.1.0)
44
+ combustion (0.5.1)
45
+ activesupport (>= 3.0.0)
46
+ railties (>= 3.0.0)
47
47
  thor (>= 0.14.6)
48
- debugger (1.3.1)
49
- columnize (>= 0.3.1)
50
- debugger-linecache (~> 1.1.1)
51
- debugger-ruby_core_source (~> 1.1.8)
52
- debugger-linecache (1.1.2)
53
- debugger-ruby_core_source (>= 1.1.1)
54
- debugger-ruby_core_source (1.1.8)
55
- diff-lcs (1.1.3)
48
+ diff-lcs (1.2.5)
56
49
  erubis (2.7.0)
57
- ffi (1.4.0)
58
- guard (1.6.2)
59
- listen (>= 0.6.0)
60
- lumberjack (>= 1.0.2)
61
- pry (>= 0.9.10)
62
- terminal-table (>= 1.4.3)
63
- thor (>= 0.14.6)
64
- guard-rspec (2.4.0)
65
- guard (>= 1.1)
66
- rspec (~> 2.11)
67
- hike (1.2.1)
68
- i18n (0.6.1)
69
- journey (1.0.4)
70
- json (1.7.7)
71
- launchy (2.3.0)
50
+ ffi (1.9.3)
51
+ formatador (0.2.4)
52
+ guard (2.6.0)
53
+ formatador (>= 0.2.4)
54
+ listen (~> 2.7)
55
+ lumberjack (~> 1.0)
56
+ pry (>= 0.9.12)
57
+ thor (>= 0.18.1)
58
+ guard-rspec (4.2.8)
59
+ guard (~> 2.1)
60
+ rspec (>= 2.14, < 4.0)
61
+ hike (1.2.3)
62
+ i18n (0.6.9)
63
+ launchy (2.4.2)
72
64
  addressable (~> 2.3)
73
- letter_opener (1.1.2)
65
+ letter_opener (1.2.0)
74
66
  launchy (~> 2.2)
75
- listen (0.7.2)
76
- lumberjack (1.0.2)
77
- mail (2.4.4)
78
- i18n (>= 0.4.0)
67
+ listen (2.7.1)
68
+ celluloid (>= 0.15.2)
69
+ celluloid-io (>= 0.15.0)
70
+ rb-fsevent (>= 0.9.3)
71
+ rb-inotify (>= 0.9)
72
+ lumberjack (1.0.5)
73
+ mail (2.5.4)
79
74
  mime-types (~> 1.16)
80
75
  treetop (~> 1.4.8)
81
- metaclass (0.0.1)
82
- method_source (0.8.1)
83
- mime-types (1.21)
84
- mocha (0.13.3)
85
- metaclass (~> 0.0.1)
86
- multi_json (1.6.1)
87
- polyglot (0.3.3)
88
- pry (0.9.12)
89
- coderay (~> 1.0.5)
76
+ method_source (0.8.2)
77
+ mime-types (1.25.1)
78
+ minitest (4.7.5)
79
+ multi_json (1.9.2)
80
+ nio4r (1.0.0)
81
+ polyglot (0.3.4)
82
+ pry (0.9.12.6)
83
+ coderay (~> 1.0)
90
84
  method_source (~> 0.8)
91
85
  slop (~> 3.4)
92
- rack (1.4.5)
93
- rack-cache (1.2)
94
- rack (>= 0.4)
95
- rack-ssl (1.3.3)
96
- rack
86
+ rack (1.5.2)
97
87
  rack-test (0.6.2)
98
88
  rack (>= 1.0)
99
- rails (3.2.12)
100
- actionmailer (= 3.2.12)
101
- actionpack (= 3.2.12)
102
- activerecord (= 3.2.12)
103
- activeresource (= 3.2.12)
104
- activesupport (= 3.2.12)
105
- bundler (~> 1.0)
106
- railties (= 3.2.12)
107
- railties (3.2.12)
108
- actionpack (= 3.2.12)
109
- activesupport (= 3.2.12)
110
- rack-ssl (~> 1.3.2)
89
+ rails (4.0.4)
90
+ actionmailer (= 4.0.4)
91
+ actionpack (= 4.0.4)
92
+ activerecord (= 4.0.4)
93
+ activesupport (= 4.0.4)
94
+ bundler (>= 1.3.0, < 2.0)
95
+ railties (= 4.0.4)
96
+ sprockets-rails (~> 2.0.0)
97
+ railties (4.0.4)
98
+ actionpack (= 4.0.4)
99
+ activesupport (= 4.0.4)
111
100
  rake (>= 0.8.7)
112
- rdoc (~> 3.4)
113
- thor (>= 0.14.6, < 2.0)
114
- rake (10.0.3)
115
- rb-inotify (0.8.8)
101
+ thor (>= 0.18.1, < 2.0)
102
+ rake (10.2.2)
103
+ rb-fsevent (0.9.4)
104
+ rb-inotify (0.9.3)
116
105
  ffi (>= 0.5.0)
117
- rdoc (3.12.1)
118
- json (~> 1.4)
119
- rspec (2.12.0)
120
- rspec-core (~> 2.12.0)
121
- rspec-expectations (~> 2.12.0)
122
- rspec-mocks (~> 2.12.0)
123
- rspec-core (2.12.2)
124
- rspec-expectations (2.12.1)
125
- diff-lcs (~> 1.1.3)
126
- rspec-mocks (2.12.2)
127
- rspec-rails (2.12.2)
106
+ rspec (2.14.1)
107
+ rspec-core (~> 2.14.0)
108
+ rspec-expectations (~> 2.14.0)
109
+ rspec-mocks (~> 2.14.0)
110
+ rspec-core (2.14.8)
111
+ rspec-expectations (2.14.5)
112
+ diff-lcs (>= 1.1.3, < 2.0)
113
+ rspec-mocks (2.14.6)
114
+ rspec-rails (2.14.2)
128
115
  actionpack (>= 3.0)
116
+ activemodel (>= 3.0)
129
117
  activesupport (>= 3.0)
130
118
  railties (>= 3.0)
131
- rspec-core (~> 2.12.0)
132
- rspec-expectations (~> 2.12.0)
133
- rspec-mocks (~> 2.12.0)
134
- shoulda-matchers (1.5.6)
119
+ rspec-core (~> 2.14.0)
120
+ rspec-expectations (~> 2.14.0)
121
+ rspec-mocks (~> 2.14.0)
122
+ shoulda-matchers (2.5.0)
135
123
  activesupport (>= 3.0.0)
136
- bourne (~> 1.3)
137
- slop (3.4.3)
138
- sprockets (2.2.2)
124
+ slop (3.5.0)
125
+ sprockets (2.12.0)
139
126
  hike (~> 1.2)
140
127
  multi_json (~> 1.0)
141
128
  rack (~> 1.0)
142
129
  tilt (~> 1.1, != 1.3.0)
143
- terminal-table (1.4.5)
144
- thor (0.17.0)
145
- tilt (1.3.3)
146
- treetop (1.4.12)
130
+ sprockets-rails (2.0.1)
131
+ actionpack (>= 3.0)
132
+ activesupport (>= 3.0)
133
+ sprockets (~> 2.8)
134
+ thor (0.19.1)
135
+ thread_safe (0.3.2)
136
+ tilt (1.4.1)
137
+ timers (1.1.0)
138
+ treetop (1.4.15)
147
139
  polyglot
148
140
  polyglot (>= 0.3.1)
149
- tzinfo (0.3.35)
141
+ tzinfo (0.3.39)
150
142
 
151
143
  PLATFORMS
152
144
  ruby
153
145
 
154
146
  DEPENDENCIES
155
- combustion (~> 0.3.1)
156
- debugger
147
+ combustion (~> 0.5)
157
148
  guard
158
149
  guard-rspec
159
150
  letter_opener_web!
160
- rb-inotify (~> 0.8.8)
151
+ rb-inotify
161
152
  rspec-rails (~> 2.0)
162
- shoulda-matchers (= 1.5.6)
153
+ shoulda-matchers (~> 2.5)
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # letter_opener_web
2
2
 
3
- [![Build Status](https://travis-ci.org/fgrehm/letter_opener_web.png?branch=master)](https://travis-ci.org/fgrehm/letter_opener_web)
3
+ [![Build Status](https://travis-ci.org/fgrehm/letter_opener_web.png?branch=master)](https://travis-ci.org/fgrehm/letter_opener_web) [![Gem Version](https://badge.fury.io/rb/letter_opener_web.png)](http://badge.fury.io/rb/letter_opener_web) [![Code Climate](https://codeclimate.com/github/fgrehm/letter_opener_web.png)](https://codeclimate.com/github/fgrehm/letter_opener_web) [![Gittip](http://img.shields.io/gittip/fgrehm.svg)](https://www.gittip.com/fgrehm/)
4
4
 
5
5
  Gives [letter_opener](https://github.com/ryanb/letter_opener) an interface for
6
6
  browsing sent emails.
@@ -44,23 +44,6 @@ can set `:letter_opener_web` as your delivery method on your
44
44
  config.action_mailer.delivery_method = ENV['USER'] == 'vagrant' ? :letter_opener_web : :letter_opener
45
45
  ```
46
46
 
47
- ## Usage with [rails-footnotes](https://github.com/josevalim/rails-footnotes)
48
-
49
- To prevent `rails-footnotes` from outputing debug information to your mails add
50
- the following to your `config/initializers/footnotes.rb`:
51
-
52
- ```ruby
53
- notes = Footnotes::Filter.notes
54
- Footnotes.setup do |config|
55
- config.before do |controller, filter|
56
- if controller.class.name =~ /LetterOpenerWeb/
57
- filter.notes = []
58
- else
59
- filter.notes = notes
60
- end
61
- end
62
- end
63
- ```
64
47
 
65
48
  ## Try it out
66
49
 
@@ -75,11 +58,13 @@ bundle
75
58
  unicorn
76
59
  ```
77
60
 
61
+
78
62
  ## Acknowledgements
79
63
 
80
64
  Special thanks to [@alexrothenberg](https://github.com/alexrothenberg) for some
81
65
  ideas on [this pull request](https://github.com/ryanb/letter_opener/pull/12).
82
66
 
67
+
83
68
  ## Contributing
84
69
 
85
70
  1. Fork it
@@ -87,5 +72,3 @@ ideas on [this pull request](https://github.com/ryanb/letter_opener/pull/12).
87
72
  3. Commit your changes (`git commit -am 'Add some feature'`)
88
73
  4. Push to the branch (`git push origin my-new-feature`)
89
74
  5. Create new Pull Request
90
-
91
- [![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/fgrehm/letter_opener_web/trend.png)](https://bitdeli.com/free "Bitdeli Badge")
@@ -1,6 +1,5 @@
1
- //= require jquery-1.8.3.min
2
- //= require jquery_ujs
3
- //= require_tree .
1
+ //= require letter_opener_web/jquery-1.8.3.min
2
+ //= require letter_opener_web/jquery_ujs
4
3
 
5
4
  jQuery(function($) {
6
5
  $('.letter-opener').on('click', 'tr', function() {
@@ -1,7 +1,5 @@
1
1
  /*
2
- *= require bootstrap.min
3
- *= require_self
4
- *= require_tree .
2
+ *= require letter_opener_web/bootstrap.min
5
3
  */
6
4
 
7
5
  body {
@@ -48,9 +46,9 @@ h1 {
48
46
  }
49
47
 
50
48
  [class^="icon-"], [class*=" icon-"] {
51
- background-image: url(<%=asset_path "glyphicons-halflings.png"%>);
49
+ background-image: url(<%=asset_path "letter_opener_web/glyphicons-halflings.png"%>);
52
50
  }
53
51
 
54
52
  .icon-white {
55
- background-image: url(<%=asset_path "glyphicons-halflings-white.png"%>);
53
+ background-image: url(<%=asset_path "letter_opener_web/glyphicons-halflings-white.png"%>);
56
54
  }
@@ -29,5 +29,11 @@ module LetterOpenerWeb
29
29
  Letter.destroy_all
30
30
  redirect_to letters_path
31
31
  end
32
+
33
+ def destroy
34
+ letter = Letter.find(params[:id])
35
+ letter.delete
36
+ redirect_to letters_path
37
+ end
32
38
  end
33
39
  end
@@ -50,6 +50,10 @@ module LetterOpenerWeb
50
50
  end
51
51
  end
52
52
 
53
+ def delete
54
+ FileUtils.rm_rf("#{letters_location}/#{self.id}")
55
+ end
56
+
53
57
  private
54
58
 
55
59
  def base_dir
@@ -69,7 +73,7 @@ module LetterOpenerWeb
69
73
  # "complete" (as in they have the whole <html> structure) and letter_opener
70
74
  # prepends some information about the mail being sent, making REXML
71
75
  # complain about it
72
- contents.scan(/<a[^>]+>(?:.|\s)*?<\/a>/).each do |link|
76
+ contents.scan(/<a\s[^>]+>(?:.|\s)*?<\/a>/).each do |link|
73
77
  fixed_link = fix_link_html(link)
74
78
  xml = REXML::Document.new(fixed_link).root
75
79
  unless xml.attributes['href'] =~ /(plain|rich).html/
@@ -17,6 +17,7 @@
17
17
  <tr>
18
18
  <th>ID</th>
19
19
  <th>Sent at</th>
20
+ <th>Action</th>
20
21
  </tr>
21
22
  </thead>
22
23
  <tbody>
@@ -26,6 +27,13 @@
26
27
  <%= link_to(first_letter.id, letter_path(first_letter, style: first_letter.default_style), target: 'mail') %>
27
28
  </td>
28
29
  <td><%= first_letter.sent_at %></td>
30
+ <td>
31
+ <%= link_to delete_letter_path(first_letter), method: 'delete', data: { confirm: 'Are you sure you want to delete this email?' } do %>
32
+ <span class="pull-right">
33
+ <i class="icon-remove-circle" title="Delete"></i>
34
+ </span>
35
+ <% end %>
36
+ </td>
29
37
  </tr>
30
38
  <% end %>
31
39
  <% @letters.each do |letter| %>
@@ -34,6 +42,13 @@
34
42
  <%= link_to(letter.id, letter_path(letter, style: letter.default_style), target: 'mail') %>
35
43
  </td>
36
44
  <td><%= letter.sent_at %></td>
45
+ <td>
46
+ <%= link_to delete_letter_path(letter), :method => 'delete', data: { confirm: 'Are you sure you want to delete this email?' } do %>
47
+ <span class="pull-right">
48
+ <i class="icon-remove-circle"></i>
49
+ </span>
50
+ <% end %>
51
+ </td>
37
52
  </tr>
38
53
  <% end %>
39
54
  </tbody>
data/config/routes.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  LetterOpenerWeb::Engine.routes.draw do
2
- delete 'clear' => 'letters#clear', :as => :clear_letters
3
- get '/' => 'letters#index', :as => :letters
4
- get ':id(/:style)' => 'letters#show', :as => :letter
2
+ delete 'clear' => 'letters#clear', :as => :clear_letters
3
+ delete ':id/delete' => 'letters#destroy', :as => :delete_letter
4
+ get '/' => 'letters#index', :as => :letters
5
+ get ':id(/:style)' => 'letters#show', :as => :letter
5
6
  get ':id/attachments/:file' => 'letters#attachment'
6
7
  end
data/demo/Gemfile CHANGED
@@ -1,4 +1,4 @@
1
- source :rubygems
1
+ source "http://rubygems.org"
2
2
 
3
3
  # Required by active_support
4
4
  gem "tzinfo"
@@ -11,6 +11,4 @@ gem "railties", "~> 3.2"
11
11
  gem "letter_opener_web", path: '../'
12
12
  gem "actionmailer_inline_css"
13
13
 
14
- gem "rails-footnotes"
15
-
16
14
  gem "unicorn"
data/demo/Gemfile.lock CHANGED
@@ -1,114 +1,112 @@
1
1
  PATH
2
2
  remote: ../
3
3
  specs:
4
- letter_opener_web (1.1.3.dev)
4
+ letter_opener_web (1.2.0)
5
5
  letter_opener (~> 1.0)
6
6
  rails (>= 3.2)
7
7
 
8
8
  GEM
9
9
  remote: http://rubygems.org/
10
10
  specs:
11
- actionmailer (3.2.11)
12
- actionpack (= 3.2.11)
13
- mail (~> 2.4.4)
14
- actionmailer_inline_css (1.5.2)
11
+ actionmailer (3.2.17)
12
+ actionpack (= 3.2.17)
13
+ mail (~> 2.5.4)
14
+ actionmailer_inline_css (1.5.3)
15
15
  actionmailer (>= 3.0.0)
16
16
  nokogiri (>= 1.4.4)
17
17
  premailer (>= 1.7.1)
18
- actionpack (3.2.11)
19
- activemodel (= 3.2.11)
20
- activesupport (= 3.2.11)
18
+ actionpack (3.2.17)
19
+ activemodel (= 3.2.17)
20
+ activesupport (= 3.2.17)
21
21
  builder (~> 3.0.0)
22
22
  erubis (~> 2.7.0)
23
23
  journey (~> 1.0.4)
24
- rack (~> 1.4.0)
24
+ rack (~> 1.4.5)
25
25
  rack-cache (~> 1.2)
26
26
  rack-test (~> 0.6.1)
27
27
  sprockets (~> 2.2.1)
28
- activemodel (3.2.11)
29
- activesupport (= 3.2.11)
28
+ activemodel (3.2.17)
29
+ activesupport (= 3.2.17)
30
30
  builder (~> 3.0.0)
31
- activerecord (3.2.11)
32
- activemodel (= 3.2.11)
33
- activesupport (= 3.2.11)
31
+ activerecord (3.2.17)
32
+ activemodel (= 3.2.17)
33
+ activesupport (= 3.2.17)
34
34
  arel (~> 3.0.2)
35
35
  tzinfo (~> 0.3.29)
36
- activeresource (3.2.11)
37
- activemodel (= 3.2.11)
38
- activesupport (= 3.2.11)
39
- activesupport (3.2.11)
40
- i18n (~> 0.6)
36
+ activeresource (3.2.17)
37
+ activemodel (= 3.2.17)
38
+ activesupport (= 3.2.17)
39
+ activesupport (3.2.17)
40
+ i18n (~> 0.6, >= 0.6.4)
41
41
  multi_json (~> 1.0)
42
- addressable (2.3.2)
43
- arel (3.0.2)
42
+ addressable (2.3.6)
43
+ arel (3.0.3)
44
44
  builder (3.0.4)
45
- css_parser (1.2.6)
45
+ css_parser (1.3.5)
46
46
  addressable
47
- rdoc
48
47
  erubis (2.7.0)
49
- hike (1.2.1)
48
+ hike (1.2.3)
50
49
  htmlentities (4.3.1)
51
- i18n (0.6.1)
50
+ i18n (0.6.9)
52
51
  journey (1.0.4)
53
- json (1.7.6)
54
- kgio (2.7.4)
55
- launchy (2.3.0)
52
+ json (1.8.1)
53
+ kgio (2.9.2)
54
+ launchy (2.4.2)
56
55
  addressable (~> 2.3)
57
- letter_opener (1.1.2)
56
+ letter_opener (1.2.0)
58
57
  launchy (~> 2.2)
59
- mail (2.4.4)
60
- i18n (>= 0.4.0)
58
+ mail (2.5.4)
61
59
  mime-types (~> 1.16)
62
60
  treetop (~> 1.4.8)
63
- mime-types (1.19)
64
- multi_json (1.5.0)
65
- nokogiri (1.5.6)
66
- polyglot (0.3.3)
67
- premailer (1.7.3)
68
- css_parser (>= 1.1.9)
61
+ mime-types (1.25.1)
62
+ mini_portile (0.5.3)
63
+ multi_json (1.9.2)
64
+ nokogiri (1.6.1)
65
+ mini_portile (~> 0.5.0)
66
+ polyglot (0.3.4)
67
+ premailer (1.8.2)
68
+ css_parser (>= 1.3.5)
69
69
  htmlentities (>= 4.0.0)
70
- rack (1.4.4)
70
+ rack (1.4.5)
71
71
  rack-cache (1.2)
72
72
  rack (>= 0.4)
73
- rack-ssl (1.3.2)
73
+ rack-ssl (1.3.4)
74
74
  rack
75
75
  rack-test (0.6.2)
76
76
  rack (>= 1.0)
77
- rails (3.2.11)
78
- actionmailer (= 3.2.11)
79
- actionpack (= 3.2.11)
80
- activerecord (= 3.2.11)
81
- activeresource (= 3.2.11)
82
- activesupport (= 3.2.11)
77
+ rails (3.2.17)
78
+ actionmailer (= 3.2.17)
79
+ actionpack (= 3.2.17)
80
+ activerecord (= 3.2.17)
81
+ activeresource (= 3.2.17)
82
+ activesupport (= 3.2.17)
83
83
  bundler (~> 1.0)
84
- railties (= 3.2.11)
85
- rails-footnotes (3.7.9)
86
- rails (>= 3.0.0)
87
- railties (3.2.11)
88
- actionpack (= 3.2.11)
89
- activesupport (= 3.2.11)
84
+ railties (= 3.2.17)
85
+ railties (3.2.17)
86
+ actionpack (= 3.2.17)
87
+ activesupport (= 3.2.17)
90
88
  rack-ssl (~> 1.3.2)
91
89
  rake (>= 0.8.7)
92
90
  rdoc (~> 3.4)
93
91
  thor (>= 0.14.6, < 2.0)
94
- raindrops (0.10.0)
95
- rake (10.0.3)
96
- rdoc (3.12)
92
+ raindrops (0.13.0)
93
+ rake (10.2.2)
94
+ rdoc (3.12.2)
97
95
  json (~> 1.4)
98
96
  sprockets (2.2.2)
99
97
  hike (~> 1.2)
100
98
  multi_json (~> 1.0)
101
99
  rack (~> 1.0)
102
100
  tilt (~> 1.1, != 1.3.0)
103
- thor (0.16.0)
104
- tilt (1.3.3)
101
+ thor (0.19.1)
102
+ tilt (1.4.1)
105
103
  tiny-rails (0.1.1)
106
104
  thor (>= 0.14.6, < 2.0)
107
- treetop (1.4.12)
105
+ treetop (1.4.15)
108
106
  polyglot
109
107
  polyglot (>= 0.3.1)
110
- tzinfo (0.3.35)
111
- unicorn (4.5.0)
108
+ tzinfo (0.3.39)
109
+ unicorn (4.8.2)
112
110
  kgio (~> 2.6)
113
111
  rack
114
112
  raindrops (~> 0.7)
@@ -121,7 +119,6 @@ DEPENDENCIES
121
119
  actionmailer_inline_css
122
120
  actionpack (~> 3.2)
123
121
  letter_opener_web!
124
- rails-footnotes
125
122
  railties (~> 3.2)
126
123
  tiny-rails
127
124
  tzinfo
data/demo/index.html.erb CHANGED
@@ -2,7 +2,7 @@
2
2
  <html>
3
3
  <head>
4
4
  <title>LetterOpenerWeb Test APP</title>
5
- <%= stylesheet_link_tag "bootstrap.min" %>
5
+ <%= stylesheet_link_tag "letter_opener_web/bootstrap.min" %>
6
6
  <style>
7
7
  body {
8
8
  padding-top: 20px;
@@ -17,7 +17,7 @@
17
17
  }
18
18
 
19
19
  .icon-white {
20
- background-image: url(<%=asset_path "glyphicons-halflings-white.png"%>);
20
+ background-image: url(<%=asset_path "letter_opener_web/glyphicons-halflings-white.png"%>);
21
21
  }
22
22
  </style>
23
23
  </head>
@@ -22,6 +22,6 @@ Gem::Specification.new do |gem|
22
22
  gem.add_dependency 'letter_opener', '~> 1.0'
23
23
 
24
24
  gem.add_development_dependency 'rspec-rails', '~> 2.0'
25
- gem.add_development_dependency 'shoulda-matchers', '1.5.6'
26
- gem.add_development_dependency 'combustion', '~> 0.3.1'
25
+ gem.add_development_dependency 'shoulda-matchers', '~> 2.5'
26
+ gem.add_development_dependency 'combustion', '~> 0.5'
27
27
  end
@@ -1,3 +1,3 @@
1
1
  module LetterOpenerWeb
2
- VERSION = "1.1.3"
2
+ VERSION = "1.2.0"
3
3
  end
@@ -7,7 +7,7 @@ describe LetterOpenerWeb::LettersController do
7
7
  get :index
8
8
  end
9
9
  it 'should assign all letters to @letters' do
10
- assigns[:letters].should == :all_letters
10
+ expect(assigns[:letters]).to eq(:all_letters)
11
11
  end
12
12
  end
13
13
 
@@ -16,7 +16,7 @@ describe LetterOpenerWeb::LettersController do
16
16
  # TODO: Move these to fixture files
17
17
  let(:rich_text) { "rich text href=\"plain.html\"" }
18
18
  let(:plain_text) { "plain text href=\"rich.html\"" }
19
- let(:letter) { mock(:letter, :rich_text => rich_text, :plain_text => plain_text, :id => id) }
19
+ let(:letter) { double(:letter, :rich_text => rich_text, :plain_text => plain_text, :id => id) }
20
20
 
21
21
  before do
22
22
  LetterOpenerWeb::Letter.stub(:find => letter)
@@ -26,12 +26,12 @@ describe LetterOpenerWeb::LettersController do
26
26
  before { get :show, :id => id, :style => 'rich' }
27
27
 
28
28
  it "returns letter's rich text contents" do
29
- response.body.should =~ /^rich text/
29
+ expect(response.body).to match(/^rich text/)
30
30
  end
31
31
 
32
32
  it 'fixes plain text link' do
33
- response.body.should_not =~ /href="plain.html"/
34
- response.body.should =~ /href="#{Regexp.escape letter_path(:id => letter.id, :style => 'plain')}"/
33
+ expect(response.body).not_to match(/href="plain.html"/)
34
+ expect(response.body).to match(/href="#{Regexp.escape letter_path(:id => letter.id, :style => 'plain')}"/)
35
35
  end
36
36
  end
37
37
 
@@ -39,12 +39,12 @@ describe LetterOpenerWeb::LettersController do
39
39
  before { get :show, :id => id, :style => 'plain' }
40
40
 
41
41
  it "returns letter's plain text contents" do
42
- response.body.should =~ /^plain text/
42
+ expect(response.body).to match(/^plain text/)
43
43
  end
44
44
 
45
45
  it 'fixes rich text link' do
46
- response.body.should_not =~ /href="rich.html"/
47
- response.body.should =~ /href="#{Regexp.escape letter_path(:id => letter.id, :style => 'rich')}"/
46
+ expect(response.body).not_to match(/href="rich.html"/)
47
+ expect(response.body).to match(/href="#{Regexp.escape letter_path(:id => letter.id, :style => 'rich')}"/)
48
48
  end
49
49
  end
50
50
  end
@@ -53,34 +53,42 @@ describe LetterOpenerWeb::LettersController do
53
53
  let(:id) { 'an-id' }
54
54
  let(:attachment_path) { "path/to/attachment" }
55
55
  let(:file_name) { 'image.jpg' }
56
- let(:letter) { mock(:letter, :attachments => { file_name => attachment_path}, :id => id) }
56
+ let(:letter) { double(:letter, :attachments => { file_name => attachment_path}, :id => id) }
57
57
 
58
58
  before do
59
59
  LetterOpenerWeb::Letter.stub(:find => letter)
60
- controller.stub(:send_file) { controller.render :nothing => true }
60
+ allow(controller).to receive(:send_file) { controller.render :nothing => true }
61
61
  end
62
62
 
63
63
  it 'sends the file as an inline attachment' do
64
- controller.should_receive(:send_file).with(attachment_path, :filename => file_name, :disposition => 'inline')
64
+ expect(controller).to receive(:send_file).with(attachment_path, :filename => file_name, :disposition => 'inline')
65
65
  get :attachment, :id => id, :file => file_name.gsub(/\.\w+/, ''), :format => File.extname(file_name)[1..-1]
66
- response.status.should == 200
66
+ expect(response.status).to eq(200)
67
67
  end
68
68
 
69
69
  it "throws a 404 if attachment file can't be found" do
70
70
  get :attachment, :id => id, :file => 'unknown', :format => 'woot'
71
- response.status.should == 404
71
+ expect(response.status).to eq(404)
72
72
  end
73
73
  end
74
74
 
75
75
  describe 'DELETE clear' do
76
76
  it 'removes all letters' do
77
- LetterOpenerWeb::Letter.should_receive(:destroy_all)
77
+ expect(LetterOpenerWeb::Letter).to receive(:destroy_all)
78
78
  delete :clear
79
79
  end
80
80
 
81
81
  it 'redirects back to index' do
82
82
  delete :clear
83
- response.should redirect_to(letters_path)
83
+ expect(response).to redirect_to(letters_path)
84
+ end
85
+ end
86
+
87
+ describe 'DELETE destroy' do
88
+ let(:id) { 'an-id' }
89
+ it 'removes the selected letter' do
90
+ expect_any_instance_of(LetterOpenerWeb::Letter).to receive(:delete)
91
+ delete :destroy, :id => id, :use_route => :letter_opener_web
84
92
  end
85
93
  end
86
94
  end
@@ -1,5 +1,6 @@
1
1
  Rails.application.routes.draw do
2
2
  delete 'clear' => 'letter_opener_web/letters#clear'
3
+ delete ':id/delete' => 'letters#destroy', :as => :delete_letter
3
4
  get '/' => 'letter_opener_web/letters#index', :as => :letters
4
5
  get ':id(/:style)' => 'letter_opener_web/letters#show', :as => :letter
5
6
  get ':id/attachments/:file' => 'letter_opener_web/letters#attachment'
@@ -13,12 +13,13 @@ Rich text for #{mail_id}
13
13
  </a>
14
14
  <a href='fooo.html'>Bar</a>
15
15
  <a href="example.html" class="blank"></a>
16
+ <address><a href="inside-address.html">inside address</a></address>
16
17
  MAIL
17
18
  end
18
19
 
19
20
  before :each do
20
- described_class.stub(:letters_location).and_return(location)
21
- described_class.any_instance.stub(:letters_location).and_return(location)
21
+ allow(described_class).to receive(:letters_location).and_return(location)
22
+ allow_any_instance_of(described_class).to receive(:letters_location).and_return(location)
22
23
 
23
24
  ['1111_1111', '2222_2222'].each do |folder|
24
25
  FileUtils.mkdir_p("#{location}/#{folder}")
@@ -40,11 +41,11 @@ MAIL
40
41
  it { should =~ /Rich text for 1111_1111/ }
41
42
 
42
43
  it 'changes links to show up on a new window' do
43
- subject.should include("<a href='a-link.html' target='_blank'>\n <img src='an-image.jpg'/>\n Link text\n</a>")
44
+ expect(subject).to include("<a href='a-link.html' target='_blank'>\n <img src='an-image.jpg'/>\n Link text\n</a>")
44
45
  end
45
46
 
46
47
  it 'always rewrites links with a closing tag rather than making them selfclosing' do
47
- subject.should include("<a class='blank' href='example.html' target='_blank'></a>")
48
+ expect(subject).to include("<a class='blank' href='example.html' target='_blank'></a>")
48
49
  end
49
50
  end
50
51
 
@@ -60,12 +61,12 @@ MAIL
60
61
  subject { described_class.new(:id => id) }
61
62
 
62
63
  it 'returns rich if rich text version is present' do
63
- subject.default_style.should == 'rich'
64
+ expect(subject.default_style).to eq('rich')
64
65
  end
65
66
 
66
67
  it 'returns plain if rich text version is not present' do
67
68
  File.stub(:exists? => false)
68
- subject.default_style.should == 'plain'
69
+ expect(subject.default_style).to eq('plain')
69
70
  end
70
71
  end
71
72
 
@@ -82,7 +83,7 @@ MAIL
82
83
  end
83
84
 
84
85
  it 'builds a hash with file name as key and full path as value' do
85
- subject.attachments.should == { file => "#{attachments_dir}/#{file}" }
86
+ expect(subject.attachments).to eq({ file => "#{attachments_dir}/#{file}" })
86
87
  end
87
88
  end
88
89
 
@@ -92,12 +93,12 @@ MAIL
92
93
  let(:last_letter) { search_results.last }
93
94
 
94
95
  before do
95
- File.stub(:mtime).with("#{location}/1111_1111").and_return(Date.today - 1.day)
96
- File.stub(:mtime).with("#{location}/2222_2222").and_return(Date.today)
96
+ allow(File).to receive(:mtime).with("#{location}/1111_1111").and_return(Date.today - 1.day)
97
+ allow(File).to receive(:mtime).with("#{location}/2222_2222").and_return(Date.today)
97
98
  end
98
99
 
99
100
  it 'returns a list of ordered letters' do
100
- first_letter.sent_at.should > last_letter.sent_at
101
+ expect(first_letter.sent_at).to be > last_letter.sent_at
101
102
  end
102
103
  end
103
104
 
@@ -106,14 +107,26 @@ MAIL
106
107
  let(:letter) { described_class.find(id) }
107
108
 
108
109
  it 'returns a letter with id set' do
109
- letter.id.should == id
110
+ expect(letter.id).to eq(id)
110
111
  end
111
112
  end
112
113
 
113
114
  describe '.destroy_all' do
114
115
  it 'removes all letters' do
115
116
  described_class.destroy_all
116
- Dir["#{location}/**/*"].should be_empty
117
+ expect(Dir["#{location}/**/*"]).to be_empty
118
+ end
119
+ end
120
+
121
+ describe '#delete' do
122
+ let(:id) { '1111_1111' }
123
+ subject { described_class.new(:id => id).delete }
124
+
125
+ it'removes the letter with given id' do
126
+ subject
127
+ directories = Dir["#{location}/*"]
128
+ expect(directories.count).to eql(1)
129
+ expect(directories.first).not_to match(id)
117
130
  end
118
131
  end
119
132
  end
metadata CHANGED
@@ -1,85 +1,85 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: letter_opener_web
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.3
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fabio Rehm
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-02-21 00:00:00.000000000 Z
11
+ date: 2014-04-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '3.2'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '3.2'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: letter_opener
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
33
  version: '1.0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ~>
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '1.0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec-rails
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ~>
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
47
  version: '2.0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ~>
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '2.0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: shoulda-matchers
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - '='
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 1.5.6
61
+ version: '2.5'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - '='
66
+ - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: 1.5.6
68
+ version: '2.5'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: combustion
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ~>
73
+ - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: 0.3.1
75
+ version: '0.5'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ~>
80
+ - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: 0.3.1
82
+ version: '0.5'
83
83
  description: Gives letter_opener an interface for browsing sent emails
84
84
  email:
85
85
  - fgrehm@gmail.com
@@ -87,9 +87,9 @@ executables: []
87
87
  extensions: []
88
88
  extra_rdoc_files: []
89
89
  files:
90
- - .gitignore
91
- - .rspec
92
- - .travis.yml
90
+ - ".gitignore"
91
+ - ".rspec"
92
+ - ".travis.yml"
93
93
  - CHANGELOG.md
94
94
  - Gemfile
95
95
  - Gemfile.lock
@@ -112,7 +112,6 @@ files:
112
112
  - demo/boot.rb
113
113
  - demo/config.ru
114
114
  - demo/index.html.erb
115
- - demo/initializers.rb
116
115
  - demo/new_message.html.erb
117
116
  - letter_opener_web.gemspec
118
117
  - lib/letter_opener_web.rb
@@ -129,12 +128,12 @@ files:
129
128
  - spec/internal/public/favicon.ico
130
129
  - spec/models/letter_opener_web/letter_spec.rb
131
130
  - spec/spec_helper.rb
132
- - vendor/assets/images/glyphicons-halflings-white.png
133
- - vendor/assets/images/glyphicons-halflings.png
134
- - vendor/assets/javascripts/bootstrap.min.js
135
- - vendor/assets/javascripts/jquery-1.8.3.min.js
136
- - vendor/assets/javascripts/jquery_ujs.js
137
- - vendor/assets/stylesheets/bootstrap.min.css
131
+ - vendor/assets/images/letter_opener_web/glyphicons-halflings-white.png
132
+ - vendor/assets/images/letter_opener_web/glyphicons-halflings.png
133
+ - vendor/assets/javascripts/letter_opener_web/bootstrap.min.js
134
+ - vendor/assets/javascripts/letter_opener_web/jquery-1.8.3.min.js
135
+ - vendor/assets/javascripts/letter_opener_web/jquery_ujs.js
136
+ - vendor/assets/stylesheets/letter_opener_web/bootstrap.min.css
138
137
  homepage: https://github.com/fgrehm/letter_opener_web
139
138
  licenses:
140
139
  - MIT
@@ -145,17 +144,17 @@ require_paths:
145
144
  - lib
146
145
  required_ruby_version: !ruby/object:Gem::Requirement
147
146
  requirements:
148
- - - '>='
147
+ - - ">="
149
148
  - !ruby/object:Gem::Version
150
149
  version: '0'
151
150
  required_rubygems_version: !ruby/object:Gem::Requirement
152
151
  requirements:
153
- - - '>='
152
+ - - ">="
154
153
  - !ruby/object:Gem::Version
155
154
  version: '0'
156
155
  requirements: []
157
156
  rubyforge_project:
158
- rubygems_version: 2.1.5
157
+ rubygems_version: 2.2.2
159
158
  signing_key:
160
159
  specification_version: 4
161
160
  summary: Gives letter_opener an interface for browsing sent emails
data/demo/initializers.rb DELETED
@@ -1,9 +0,0 @@
1
- Footnotes.setup do |config|
2
- config.before do |controller, filter|
3
- controller.class.name =~ /LetterOpenerWeb/ ?
4
- filter.notes.clear :
5
- filter.notes
6
- end
7
- end
8
-
9
- Footnotes.run!