Skip to content

Commit c3dda4d

Browse files
committed
Update documentation
1 parent c120d3a commit c3dda4d

21 files changed

Lines changed: 124 additions & 122 deletions

CHANGELOG.md

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44

55
### Bug fixes
66

7-
* Add base64 gem as a dependency because from Ruby 3.4 this is not a standard gem.
7+
* Add the base64 gem as a dependency because, from Ruby 3.4, this is not a standard gem.
88

99

1010
## 1.4.0 (2025-01-07)
1111

1212
### Changes
1313

14-
* Upgrade sqlite3 to version 2.0.4
14+
* Upgrade the sqlite3 gem to version 2.0.4
1515
* Add Ruby 3.4 support.
1616
* Drop Ruby 2.7 support.
1717
* Update bundler and gems.
@@ -21,16 +21,16 @@
2121

2222
### Changes
2323

24-
* Update webrick to version 1.8.2 because of security issues.
25-
* Upgrade rackup to version 2.1.0
24+
* Update the webrick gem to version 1.8.2 because of security issues.
25+
* Upgrade the rackup gem to version 2.1.0
2626
* Update gems.
2727

2828

2929
## 1.3.6 (2024-03-05)
3030

3131
### Changes
3232

33-
* Update rack to version 3.0.9.1 because of security issues.
33+
* Update the rack gem to version 3.0.9.1 because of security issues.
3434
* Update gems.
3535

3636

@@ -40,7 +40,7 @@
4040

4141
* Add Ruby 3.3 support.
4242
* Update bundler and gems.
43-
* Replace apparition gem to cuprite gem.
43+
* Replace the apparition gem with the cuprite gem.
4444

4545

4646
## 1.3.4 (2023-05-19)
@@ -55,7 +55,7 @@
5555

5656
### Changes
5757

58-
* Update rack to version 3.0.7 because of security issues.
58+
* Update the rack gem to version 3.0.7 because of security issues.
5959
* Update gem description.
6060
* Update gems.
6161

@@ -64,15 +64,15 @@
6464

6565
### Changes
6666

67-
* Update rack to version 3.0.4.2 because of security issues.
67+
* Update the rack gem to version 3.0.4.2 because of security issues.
6868
* Update bundler and gems.
6969

7070

7171
## 1.3.1 (2023-01-25)
7272

7373
### Changes
7474

75-
* Update rack to version 3.0.4.1 because of security issues.
75+
* Update the rack gem to version 3.0.4.1 because of security issues.
7676
* Update bundler and gems.
7777

7878
### Bug fixes
@@ -85,22 +85,22 @@
8585
### Changes
8686

8787
* Replace rack to rackup gem as a dependency.
88-
In the rack 3.x gem it was extracted rackup command, Rack::Server, Rack::Handler, Rack::Lobster and related code into a separate gem.
88+
In the rack 3.x gem it was extracted rackup command, Rack::Server, Rack::Handler, Rack::Lobster, and related code into the rackup gem.
8989
* Update bundler and gems.
9090

9191
### Bug fixes
9292

9393
* Fix infinite scroll.
94-
In the new Chrome browser, the scrollTop is a float and not an integer. Because of that, the infinite scroll was stopped working.
94+
In the new Chrome browser, the scrollTop is a float and not an integer. Because of that, the infinite scroll stopped working.
9595
* Override webrick server for capybara in RSpec configuration.
96-
At this moment capybara does not support the new rack/rackup changes.
96+
At this moment, capybara does not support the new rack/rackup changes.
9797

9898

9999
## 1.2.1 (2022-05-27)
100100

101101
### Changes
102102

103-
* Update rack to version 2.2.3.1 because of security issues.
103+
* Update the rack gem to version 2.2.3.1 because of security issues.
104104

105105

106106
## 1.2.0 (2022-05-26)
@@ -123,23 +123,23 @@
123123

124124
### Bug fixes
125125

126-
* Update apparition gem from github to fix issues.
126+
* Update the apparition gem from GitHub to fix issues.
127127

128128

129129
## 1.0.0 (2021-04-02)
130130

131131
### Changes
132132

133133
* Update documentation.
134-
* Change JavaScript to hide HTML tab if mail does not have HTML part.
134+
* Change JavaScript to hide the HTML tab if the mail does not have an HTML part.
135135
* Refactoring the JavaScript code.
136-
* Change the documentation uri in the gemspec file.
136+
* Change the documentation URI in the gemspec file.
137137
* Update .rubocop.yml.
138138
* Update gems.
139139

140140
### Bug fixes
141141

142-
* Fix 3x load message list when reload tab and infinite scroll was used.
142+
* Fix the 3x load message list when reloading the tab, and infinite scroll was used.
143143

144144

145145
## 1.0.0.rc1 (2021-03-20)

CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ do so.
99

1010
* Check that the issue has not already been reported.
1111
* Check that the issue has not already been fixed in the latest code.
12-
* Be clear, concise and precise in your description of the problem.
12+
* Be clear, concise, and precise in your description of the problem.
1313
* Open an issue with a descriptive title and summary.
14-
* Include any relevant code to the issue summary.
14+
* Include any relevant code in the issue summary.
1515

1616
## Pull requests
1717

README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99

1010
**MailGrabber** is yet another solution to inspect sent emails.
1111

12-
It has two part:
13-
- delivery method to grab emails and store into a database
12+
It has two parts:
13+
- delivery method to grab emails and store them in a database
1414
- simple rack web interface to check those emails
1515

1616
## Installation
@@ -29,7 +29,9 @@ Or install it yourself as:
2929

3030
$ gem install mail_grabber
3131

32-
## Usage
32+
## Documentation
33+
34+
### How Tos
3335

3436
- [How to use MailGrabber in a Ruby script or IRB console](https://github.com/MailToolbox/mail_grabber/blob/main/docs/usage_in_script_or_console.md)
3537
- [How to use MailGrabber in Ruby on Rails](https://github.com/MailToolbox/mail_grabber/blob/main/docs/usage_in_ruby_on_rails.md)
@@ -43,7 +45,7 @@ To install this gem onto your local machine, run `bundle exec rake install`.
4345
To release a new version:
4446

4547
- Update [CHANGELOG.md](https://github.com/MailToolbox/mail_grabber/blob/main/CHANGELOG.md)
46-
- Update the version number in `version.rb` manually or use `gem-release` gem and run `gem bump -v major|minor|patch|rc|beta`.
48+
- Update the version number in `version.rb` manually or use the `gem-release` gem and run `gem bump -v major|minor|patch|rc|beta`.
4749
- Build gem with `bundle exec rake build`.
4850
- Run `bundle install` to update gemfiles and commit the changes.
4951
- Run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).

docs/usage_in_ruby_on_rails.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
# How to use MailGrabber in Ruby on Rails
22

3-
Add `mail_grabber` gem to the `Gemfile` and run `bundle install`.
3+
Add the `mail_grabber` gem to the `Gemfile` and run `bundle install`.
44

55
Then change `config/environments/development.rb` file.
66

77
```ruby
88
config.action_mailer.delivery_method = :mail_grabber
99
```
1010

11-
Also add route that we can reach MailGrabber web interface. Let's change `config/routes.rb` file.
11+
Also, add a route that we can reach the MailGrabber web interface. Let's change the `config/routes.rb` file.
1212

1313
```ruby
1414
require 'mail_grabber/web'
@@ -18,7 +18,7 @@ Rails.application.routes.draw do
1818
end
1919
```
2020

21-
So now we should add a mailer method. Let's create `app/mailers/test_mailer.rb` file.
21+
So now we should add a mailer method. Let's create the `app/mailers/test_mailer.rb` file.
2222

2323
```ruby
2424
class TestMailer < ApplicationMailer
@@ -30,19 +30,19 @@ class TestMailer < ApplicationMailer
3030
end
3131
```
3232

33-
Then we should add views (the body) of this email, so create `app/views/test_mailer/send_test.html.erb`
33+
Then we should add views (the body) of this email, so create the `app/views/test_mailer/send_test.html.erb`
3434

3535
```erb
3636
<p>Test email body</p>
3737
```
3838

39-
and `app/views/test_mailer/send_test.text.erb`.
39+
and the `app/views/test_mailer/send_test.text.erb` files.
4040

4141
```erb
4242
Test email body
4343
```
4444

45-
In the `rails console` we can try it out.
45+
In the `rails console`, we can try it out.
4646

4747
```ruby
4848
TestMailer.send_test.deliver_now
@@ -97,4 +97,4 @@ TestMailer.send_test.deliver_now
9797
#=> #<Mail::Message:61160, Multipart: true, Headers: <Date: Sat, 20 Mar 2021 16:56:34 +0100>, <From: from@example.com>, <To: to@example.com>, <Message-ID: <60561b32d6d5a_12424ebdc947a5@local.mail>>, <Subject: Test email>, <Mime-Version: 1.0>, <Content-Type: multipart/alternative; boundary="--==_mimepart_60561b32d4370_12424ebdc946bb"; charset=UTF-8>, <Content-Transfer-Encoding: 7bit>>
9898
```
9999

100-
Then we can check grabbed emails on the web interface. If the Rails server is running, then open a browser and visit on the `http://localhost:3000/mail_grabber` page.
100+
Then we can check the grabbed emails on the web interface. If the Rails server is running, then open a browser and visit on the `http://localhost:3000/mail_grabber` page.

docs/usage_in_script_or_console.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ MailGrabber::DeliveryMethod.new.deliver!(message)
1212
# => true
1313
```
1414

15-
Or add `MailGrabber::DeliveryMethod` to `mail.delivery_method`.
15+
Or add the `MailGrabber::DeliveryMethod` to the `mail.delivery_method`.
1616

1717
```ruby
1818
mail = Mail.new(from: 'from@example.com', to: 'to@example.com', subject: 'Test email', body: 'Test email body')
@@ -30,7 +30,7 @@ mail.deliver!
3030
# => #<Mail::Message:2100, Multipart: false, Headers: <Date: Sat, 20 Mar 2021 16:13:05 +0100>, <From: from@example.com>, <To: to@example.com>, <Message-ID: <60561101cd2b5_113b37e4309b5@local.mail>>, <Subject: Test email>, <Mime-Version: 1.0>, <Content-Type: text/plain>, <Content-Transfer-Encoding: 7bit>>
3131
```
3232

33-
Then we can check grabbed emails on the web interface. To do that, we need a `config.ru` file with the following content.
33+
Then we can check the grabbed emails on the web interface. To do that, we need a `config.ru` file with the following content.
3434

3535
```ruby
3636
require 'mail_grabber/web'

lib/mail_grabber/database_helper.rb

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ module DatabaseHelper
1818
}
1919
}.freeze
2020

21-
# Create connection to the SQLite3 database. Use foreign_keys pragmas that
22-
# we can use DELETE CASCADE option. It accepts block to execute queries.
23-
# If something goes wrong, then it raises a database helper error.
24-
# Also ensure to close the database (important to close database if we don't
25-
# want to see database busy errors).
21+
# Create a connection to the SQLite3 database. Use foreign_keys pragmas so
22+
# that we can use the DELETE CASCADE option. It accepts a block to execute
23+
# queries. If something goes wrong, then it raises a database helper error.
24+
# Also, ensure to close the database (important to close the database if we
25+
# don't want to see database busy errors).
2626
def connection
2727
database = open_database
2828
database.foreign_keys = 'ON'
@@ -34,16 +34,16 @@ def connection
3434
database&.close
3535
end
3636

37-
# Create connection and execute a query.
37+
# Create a connection and execute a query.
3838
#
39-
# @param [String] query which query we would like to execute
40-
# @param [Array] args any arguments which we will use in the query
39+
# @param [String] query which query would we like to execute
40+
# @param [Array] args any arguments that we will use in the query
4141
def connection_execute(query, args = [])
4242
connection { |db| db.execute(query, args) }
4343
end
4444

45-
# Create connection and execute many queries in transaction. It accepts
46-
# block to execute queries. If something goes wrong, it rolls back the
45+
# Create a connection and execute many queries in a transaction. It accepts
46+
# a block to execute queries. If something goes wrong, it rolls back the
4747
# changes and raises a database helper error.
4848
def connection_execute_transaction
4949
connection do |db|
@@ -91,10 +91,10 @@ def select_message_parts_by(id)
9191
end
9292

9393
# Helper method to get a specific number of messages. We can specify which
94-
# part of the table we need and how many messages want to see.
94+
# part of the table we need and how many messages we want to see.
9595
#
9696
# @param [String/Integer] page which part of the table want to see
97-
# @param [String/Integer] per_page how many messages gives back
97+
# @param [String/Integer] per_page how many messages give back
9898
def select_messages_by(page, per_page)
9999
page = page.to_i
100100
per_page = per_page.to_i
@@ -130,8 +130,8 @@ def attachment(object)
130130
object.attachment? ? 1 : 0
131131
end
132132

133-
# Convert the given message or body to utf8 string. Needs this that we can
134-
# send it as JSON.
133+
# Convert the given message or body to utf8 string. Needs this so that we
134+
# can send it as JSON.
135135
#
136136
# @param [Mail::Message/Mail::Body] object
137137
#
@@ -151,7 +151,7 @@ def encode_if_attachment(object, string)
151151
object.attachment? ? Base64.encode64(string) : string
152152
end
153153

154-
# Extract cid value from the Mail::Part.
154+
# Extract the cid value from the Mail::Part.
155155
#
156156
# @param [Mail::Part] object
157157
#
@@ -170,12 +170,12 @@ def extract_mail_parts(message)
170170
message.multipart? ? message.all_parts : [message]
171171
end
172172

173-
# Extract MIME type of the Mail::Part object. If it is nil, then it returns
174-
# with text/plain value.
173+
# Extract the MIME type of the Mail::Part object. If it is nil, then it
174+
# returns with a text/plain value.
175175
#
176176
# @param [Mail::Part] object
177177
#
178-
# @return [String] with MIME type of the part
178+
# @return [String] with the MIME type of the part
179179
def extract_mime_type(object)
180180
object.mime_type || 'text/plain'
181181
end
@@ -234,8 +234,8 @@ def insert_into_mail_part(db, message)
234234
end
235235
end
236236

237-
# Open a database connection with the database. Also, it checks that the
238-
# database is existing or not. If it does not exist, then it creates a new
237+
# Open a database connection with the database. Also, it checks whether the
238+
# database exists or not. If it does not exist, then it creates a new
239239
# one.
240240
#
241241
# @return [SQLite3::Database] a database object

lib/mail_grabber/database_queries.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
module MailGrabber
44
module DatabaseQueries
5-
# Create mail table if it is not exist.
5+
# Create a mail table if it does not exist.
66
#
7-
# @param [SQLite3::Database] db to execute create table query
7+
# @param [SQLite3::Database] db to execute the create table query
88
def create_mail_table(db)
99
db.execute(<<-SQL)
1010
CREATE TABLE IF NOT EXISTS mail (
@@ -20,9 +20,9 @@ def create_mail_table(db)
2020
SQL
2121
end
2222

23-
# Create mail part table if it is not exist.
23+
# Create a mail part table if it does not exist.
2424
#
25-
# @param [SQLite3::Database] db to execute create table query
25+
# @param [SQLite3::Database] db to execute the create table query
2626
def create_mail_part_table(db)
2727
db.execute(<<-SQL)
2828
CREATE TABLE IF NOT EXISTS mail_part (
@@ -81,7 +81,7 @@ def insert_into_mail_part_query
8181
SQL
8282
end
8383

84-
# Select messages with pagination query.
84+
# Select messages with a pagination query.
8585
#
8686
# @return [Srting] with the select messages query
8787
def select_messages_with_pagination_query

lib/mail_grabber/delivery_method.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ class DeliveryMethod
77
# Initialize MailGrabber delivery method (Rails needs it).
88
def initialize(options = {}); end
99

10-
# Catch and save messages into the database that we can check those messages
11-
# in MailGrabber web application.
10+
# Catch and save messages into the database so that we can check those
11+
# messages in the MailGrabber web application.
1212
#
1313
# @param [Mail::Message] message what we would like to send
1414
def deliver!(message)
@@ -20,7 +20,7 @@ def deliver!(message)
2020
store_mail(message)
2121
end
2222

23-
# Delivery method settings (needed when run mail.deliver! method).
23+
# Delivery method settings (needed when running the mail.deliver! method).
2424
def settings
2525
{}
2626
end

0 commit comments

Comments
 (0)