redacted 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 696543c83a20c2ec7c2e3e1be6062f94b220c5e6
4
- data.tar.gz: e6a6d8bfd03718e43f5aae7b492ddf583a392a3d
3
+ metadata.gz: 898b8576effd7e89eeb8eb860a759bac5d686697
4
+ data.tar.gz: f74e3c61e9c52b704fb43015f8823de025ce039c
5
5
  SHA512:
6
- metadata.gz: c90ebfe53f7445723c715c0871e7f6fd681ae41db835eae3ab773478945173a8e9c0ce54d1447bad0ec3227d764ec5f9cbb72b7130cb135a4c24ba231031fe4c
7
- data.tar.gz: 25720cd8c67d238dff781e163da67c690b7af1b411f10c2f103e30c3056252e1532c79be7047c569ad22b465842e2622d8e9c886bb7a14fe4e3819a226072d3b
6
+ metadata.gz: 9bec6a5dbd663398a030755781daf8d0a2e6635fb8b2ce1bbaa862bace4d1b829d98746a38c82cc3aa052c5a06192a0fb86ad67dc0721bab59891a74ecfb97ed
7
+ data.tar.gz: a4054c2c4a49a5320c495becce7f2f8defc9213926c1aafbeb1894145ea3e3f4e89bdfa580312d2071560c97617907a9483695678596390f2281e128460fa316
data/Gemfile CHANGED
@@ -1,8 +1,11 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- # Specify your gem's dependencies in redacted.gemspec
4
3
  gemspec
5
4
 
6
5
  group :development do
7
6
  gem 'pry', platforms: :ruby
8
7
  end
8
+
9
+ group :test do
10
+ gem "codeclimate-test-reporter", require: false
11
+ end
data/README.md CHANGED
@@ -1,51 +1,53 @@
1
1
  # Redacted
2
+ [![Circle CI](https://circleci.com/gh/kurtfunai/redacted/tree/master.png?style=badge)](https://circleci.com/gh/kurtfunai/redacted/tree/master) [![Code Climate](https://codeclimate.com/github/kurtfunai/redacted/badges/gpa.svg)](https://codeclimate.com/github/kurtfunai/redacted) [![Test Coverage](https://codeclimate.com/github/kurtfunai/redacted/badges/coverage.svg)](https://codeclimate.com/github/kurtfunai/redacted)
2
3
 
3
- The goal of Redacted is to take a block of text, turn it into Lorem ipsum of the same size, and then apply styles with CSS to make the text appear redacted! Just like top secret documents.
4
+ The goal of Redacted is to take text like `My maple syrup was stolen by a moose!` and black it out, just like on a top secret document!
4
5
 
5
- Basically it takes a string like `My maple syrup was stolen by a moose!` and turns it into a blacked-out block of text that is roughly the same size.
6
+ To keep the redacted information private, it turns the text into [Lorem ipsum](http://www.lipsum.com/). It tries its best to maintain the same size & shape of the text that is being redacted.
7
+
8
+ Redacted works with both plain text and HTML.
6
9
 
7
10
  ## Installation
8
11
 
9
12
  Add this line to your application's Gemfile:
10
-
11
- gem 'redacted'
13
+ ```ruby
14
+ gem 'redacted'
15
+ ```
12
16
 
13
17
  And then execute:
14
-
15
- $ bundle
18
+ ```bash
19
+ $ bundle
20
+ ```
16
21
 
17
22
  In your application.css, include the css file:
18
- ```
23
+ ```css
19
24
  /*
20
25
  *= require redacted
21
26
  */
22
27
  ```
23
- ## Usage
24
28
 
25
- Redacted will convert both plaintext and HTML into redacted text.
29
+ ## Usage
26
30
 
27
31
  After installing the gem, you will have access to a couple new methods in your Rails Views.
28
32
 
29
- **Plain text (inline):**
33
+ **redact(str)**
30
34
  ```ruby
31
- <%= redact('All of the maple syrup was stolen by aliens.')=>
32
- #=> Iusto eos eligendi non iure rerum quia accus
35
+ # Plain text (inline):
36
+ <%= redact("You know nothing Jon Snow") %>
37
+ #=> Iusto eos eligendi non iu
33
38
 
34
- All of the maple syrup was stolen by <%= redact('aliens')=>.
39
+ All of the maple syrup was stolen by <%= redact("aliens") %>.
35
40
  #=> All of the maple syrup was stolen by ducimu
36
- ```
37
- The plain text method can create inline redacted text, or write out paragraphs to maintain the size/shape of paragraphs.
38
41
 
39
- **Plain text (paragraphs):**
40
- ```ruby
41
- <%= redact('Roses are red.\nViolets are blue.\n\nAll our base\r\n are belong to you.')=>
42
- #=> <p>Roses are red.</p><p>Violets are blue.</p><p>All our base</p><p>are belong to you.</p>
42
+ # Plain text (paragraphs):
43
+ <%= redact("Roses are red.\nViolets are blue.\n\nAll our base\r\n are belong to you.") %>
44
+ #=> <p>consequatur et</p><p>excepturi sed dol</p><p>maxime id su</p><p>at non quia nonotas</p>
43
45
  ```
44
- The `#redact` method will try to guess if the text should be inline or not, but you can also explictly call `redact_text` or `redact_paragraphs` if you want specific functionality.
46
+ The `#redact` method will try to guess if the text should be inline or not, but you can also explictly call `redact_text(str)` for inline rendering, or `redact_paragraphs(str)` for paragraphs wrapped in `<p>` tags.
45
47
 
46
- **HTML**
48
+ **redact_html(html_str)**
47
49
  ```ruby
48
- redact_html('<p>A mind needs books as a sword needs a whetstone<br>if it is to keep its edge.</p><div>- George R.R. Martin, A Game of Thrones</div>')
50
+ redact_html("<p>A mind needs books as a sword needs a whetstone<br>if it is to keep its edge.</p><div>- George R.R. Martin, A Game of Thrones</div>")
49
51
  #=> <p>adipisci labore quae perferendis impedit autem <br>odit impedit dolorem rerum</p><div>et quibusdam qui quis accusantium ullam</div>
50
52
  ```
51
53
  Redacted parses the HTML string and replaces the text with lorem ipsum while maintaining the original HTML structure.
@@ -55,7 +57,7 @@ Redacted takes text like `Winter is coming.` and replaces it with lorem ipsum of
55
57
 
56
58
  It then returns the redacted text surrounded by `<span></span>` tags that have the class `.redacted-text`.
57
59
  ```ruby
58
- redact('Winter is coming.')
60
+ redact("Winter is coming.")
59
61
  ```
60
62
  Becomes:
61
63
  ```html
data/Rakefile CHANGED
@@ -28,7 +28,6 @@ Rake::TestTask.new(:test) do |t|
28
28
  t.verbose = false
29
29
  end
30
30
 
31
-
32
31
  task default: :test
33
32
 
34
33
 
@@ -0,0 +1,3 @@
1
+ machine:
2
+ ruby:
3
+ version: 2.1.6
@@ -2,7 +2,7 @@ require 'redacted/version'
2
2
  require 'redacted/action_view/helpers.rb'
3
3
  require 'redacted/engine.rb' if defined?(Rails)
4
4
  require 'redacted/railtie.rb' if defined?(Rails)
5
- require 'faker'
5
+ require 'ffaker'
6
6
  require 'nokogiri'
7
7
 
8
8
  module Redacted
@@ -1,3 +1,3 @@
1
1
  module Redacted
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ["lib"]
20
20
 
21
- spec.add_dependency "faker", "~> 1.4"
21
+ spec.add_dependency "ffaker", "~> 1.24.0"
22
22
  spec.add_dependency "nokogiri", "~> 1.6.3"
23
23
  spec.add_dependency "railties", ">= 3.2", "< 5.0"
24
24
 
@@ -1,3 +1,6 @@
1
+ require "codeclimate-test-reporter"
2
+ CodeClimate::TestReporter.start
3
+
1
4
  # Configure Rails Environment
2
5
  ENV["RAILS_ENV"] = "test"
3
6
 
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: redacted
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kurt Funai
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-29 00:00:00.000000000 Z
11
+ date: 2016-05-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: faker
14
+ name: ffaker
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.4'
19
+ version: 1.24.0
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
- version: '1.4'
26
+ version: 1.24.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: nokogiri
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -114,6 +114,7 @@ files:
114
114
  - README.md
115
115
  - Rakefile
116
116
  - app/assets/stylesheets/redacted.css
117
+ - circle.yml
117
118
  - lib/redacted.rb
118
119
  - lib/redacted/action_view/helpers.rb
119
120
  - lib/redacted/engine.rb
@@ -184,7 +185,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
184
185
  version: '0'
185
186
  requirements: []
186
187
  rubyforge_project:
187
- rubygems_version: 2.4.2
188
+ rubygems_version: 2.4.8
188
189
  signing_key:
189
190
  specification_version: 4
190
191
  summary: Convert strings into redacted text.
@@ -233,3 +234,4 @@ test_files:
233
234
  - test/redacted_helper_test.rb
234
235
  - test/redacted_test.rb
235
236
  - test/test_helper.rb
237
+ has_rdoc: