redis_snippets 0.0.11 → 1.0.0

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.
Files changed (56) hide show
  1. checksums.yaml +5 -5
  2. data/.gitignore +4 -2
  3. data/.rspec +2 -0
  4. data/.travis.yml +19 -0
  5. data/Gemfile +12 -0
  6. data/README.md +40 -17
  7. data/Rakefile +5 -0
  8. data/app/controllers/redis_snippets/snippets_controller.rb +6 -3
  9. data/app/helpers/redis_snippets/snippets_helper.rb +5 -23
  10. data/app/presenters/snippet_presenter.rb +54 -0
  11. data/app/{models/redis_snippets/snippets.rb → services/snippet_store_service.rb} +9 -1
  12. data/app/views/redis_snippets/snippets/show.html.erb +11 -15
  13. data/lib/redis_snippets/engine.rb +4 -0
  14. data/lib/redis_snippets/redis.rb +10 -5
  15. data/lib/redis_snippets/{help.rb → util.rb} +2 -2
  16. data/lib/redis_snippets/version.rb +1 -1
  17. data/lib/redis_snippets.rb +4 -2
  18. data/redis_snippets.gemspec +3 -3
  19. data/spec/app/helpers/redis_snippets/snippets_helper_spec.rb +38 -0
  20. data/spec/app/presenters/snippet_presenter_spec.rb +53 -0
  21. data/spec/app/services/snippet_store_service_spec.rb +44 -0
  22. data/spec/dummy/.ruby-version +1 -0
  23. data/spec/dummy/Rakefile +6 -0
  24. data/spec/dummy/app/assets/config/manifest.js +3 -0
  25. data/spec/dummy/app/assets/images/.keep +0 -0
  26. data/spec/dummy/app/assets/stylesheets/application.css +15 -0
  27. data/spec/dummy/app/controllers/application_controller.rb +2 -0
  28. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  29. data/spec/dummy/bin/rails +4 -0
  30. data/spec/dummy/bin/rake +4 -0
  31. data/spec/dummy/bin/setup +33 -0
  32. data/spec/dummy/config/application.rb +29 -0
  33. data/spec/dummy/config/boot.rb +5 -0
  34. data/spec/dummy/config/environment.rb +5 -0
  35. data/spec/dummy/config/environments/development.rb +62 -0
  36. data/spec/dummy/config/environments/test.rb +48 -0
  37. data/spec/dummy/config/initializers/application_controller_renderer.rb +8 -0
  38. data/spec/dummy/config/initializers/assets.rb +12 -0
  39. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  40. data/spec/dummy/config/initializers/content_security_policy.rb +28 -0
  41. data/spec/dummy/config/initializers/cookies_serializer.rb +5 -0
  42. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  43. data/spec/dummy/config/initializers/inflections.rb +16 -0
  44. data/spec/dummy/config/initializers/mime_types.rb +4 -0
  45. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  46. data/spec/dummy/config/puma.rb +38 -0
  47. data/spec/dummy/config/routes.rb +3 -0
  48. data/spec/dummy/config.ru +5 -0
  49. data/spec/dummy/lib/assets/.keep +0 -0
  50. data/spec/dummy/log/.keep +0 -0
  51. data/spec/dummy/tmp/.keep +0 -0
  52. data/spec/dummy/tmp/development_secret.txt +1 -0
  53. data/spec/rails_helper.rb +53 -0
  54. data/spec/spec_helper.rb +13 -0
  55. data/spec/support/simplecov_setup.rb +5 -0
  56. metadata +88 -10
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 201aaa3560f2c964fdb9751db79dc562d3417877
4
- data.tar.gz: cd61885b8d6eae29bec8e06a1a9330c61dd394d5
2
+ SHA256:
3
+ metadata.gz: a32461d6ee5259748fc6537e758b48225976155e8cdc44ebf9ec17f3d93b804f
4
+ data.tar.gz: 590fc3a6e3b3e0bdc3ffad2af93365acac6c52df011073f41df3f3fdb14ecc17
5
5
  SHA512:
6
- metadata.gz: cf1e09f3d02b341a8a66d7f2503c9592e0eea39e6ff0c3f343abfd3a669a8d53783965cfce198183a5c62fd25322007ad92aa749b05ffd36b7fcc3b73b0e7751
7
- data.tar.gz: d23eb03147736e87eccda9881354950e95e70f343cf682965a9ed4df55eb0e49467f5a5c9e09fa529cffb281867c66b238e1fb780b894418eeae533ded2bd46b
6
+ metadata.gz: b4819ebdecad814ba7af40a2ede613e6a7b828b967a59a8fada4e0ac372291822a4e7c3ec3b5d82ebbf4d2e2bbafc4f6e1b4495b834eb5848eb1644e3457d6d7
7
+ data.tar.gz: ad2259a91847730a1344ed181269543eb348fbd67fad5d19154f93274e0c8b20718991676f6127b64c20064c006ea68ed23cdccda21729165b093768d8e1bcd8
data/.gitignore CHANGED
@@ -1,3 +1,5 @@
1
- *.tmproj
2
- pkg
3
1
  .bundle
2
+ pkg
3
+ spec/dummy/log
4
+ Gemfile.lock
5
+ coverage
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --colour
2
+ --format documentation
data/.travis.yml ADDED
@@ -0,0 +1,19 @@
1
+ language: ruby
2
+ cache: bundler
3
+ sudo: false
4
+ env:
5
+ global:
6
+ - CC_TEST_REPORTER_ID=aa59e066b7cd7b5477aecc5c17004d78d35012420e791d23b17c0ea705ef9cd7
7
+ before_script:
8
+ - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
9
+ - chmod +x ./cc-test-reporter
10
+ - ./cc-test-reporter before-build
11
+ before_install:
12
+ - gem update --system
13
+ - gem install bundler --version 2.0.2
14
+ rvm:
15
+ - 2.6.5
16
+ script:
17
+ - bundle exec rake
18
+ after_script:
19
+ - ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
data/Gemfile ADDED
@@ -0,0 +1,12 @@
1
+ source "https://rubygems.org"
2
+ gemspec
3
+
4
+ group :test, :development do
5
+ gem "rails", ">= 6.0"
6
+ gem "rspec-rails", ">= 3.9.0"
7
+ end
8
+
9
+ group :test do
10
+ gem "mock_redis"
11
+ gem "simplecov"
12
+ end
data/README.md CHANGED
@@ -1,20 +1,48 @@
1
1
  # Redis Snippets
2
2
 
3
+ [![Version](https://img.shields.io/gem/v/redis_snippets.svg?style=flat-square)](https://rubygems.org/gems/redis_snippets)
4
+ [![Build](https://img.shields.io/travis/wulffeld/redis_snippets.svg?style=flat-square)](https://travis-ci.org/wulffeld/redis_snippets)
5
+ [![Maintainability](https://img.shields.io/codeclimate/maintainability/wulffeld/redis_snippets?style=flat-square)](https://codeclimate.com/github/wulffeld/redis_snippets)
6
+ [![Coverage](https://img.shields.io/codeclimate/coverage/wulffeld/redis_snippets?style=flat-square)](https://codeclimate.com/github/wulffeld/redis_snippets)
7
+
3
8
  ## Background
4
9
 
5
- Easily store snippets of content in Redis.
10
+ Easily store snippets of content in Redis. Inspired by plugin for Wordpress
11
+ named Snippets.
12
+
13
+ With redis_snippets you could for instance store AdSense code snippets or
14
+ other HTML/JS content.
6
15
 
7
- ## How
16
+ ## Requirements
8
17
 
9
- It's a Rails engine so add redis-snippets to your Gemfile and put this in an initializer:
18
+ Gems:
19
+
20
+ * rails 5.x or higher
21
+ * redis
22
+ * redis-namespace
23
+
24
+ ## Installation
25
+
26
+ Add to your Rails projects Gemfile and bundle install:
27
+
28
+ ```
29
+ gem "redis_snippets"
30
+ ```
31
+
32
+ ## Usage
33
+
34
+ It's a Rails engine so add redis-snippets to your Gemfile and put this in an
35
+ initializer:
10
36
 
11
37
  ``` ruby
12
- App::Application.config.redis_snippets = {
13
- :connection => ::Redis::Namespace.new("my_namespace", :redis => ::Redis.new),
14
- :keys => [:key1, :key2]
38
+ Rails.application.config.redis_snippets = {
39
+ connection: ::Redis::Namespace.new("my_namespace", redis: ::Redis.new),
40
+ keys: [:key1, :key2]
15
41
  }
16
42
  ```
17
43
 
44
+ The names of the keys are entirely up to you.
45
+
18
46
  You should then be able to access /admin/snippets/.
19
47
 
20
48
  In your views use helper snippet().
@@ -31,17 +59,18 @@ One snippet area can include multiple snippets if you separate them with a
31
59
  [section]
32
60
  ```
33
61
 
34
- The snippet helper will randomly select the snippet. This is convenient for ad delivery for example.
62
+ The snippet helper will randomly select the snippet. This is convenient for ad
63
+ delivery or perhaps A/B testing 🤷‍♂.
35
64
 
36
65
  ## Multi Site
37
66
 
38
67
  If you're using one app to serve multiple sites a little more configuration is necessary.
39
68
 
40
69
  ``` ruby
41
- App::Application.config.redis_snippets = {
42
- :connection => ::Redis::Namespace.new("my_namespace", :redis => ::Redis.new),
43
- :multi_site => true,
44
- :keys => [:key1, :key2]
70
+ Rails.application.config.redis_snippets = {
71
+ connection: ::Redis::Namespace.new("my_namespace", redis: ::Redis.new),
72
+ multi_site: true,
73
+ keys: [:key1, :key2]
45
74
  }
46
75
  ```
47
76
 
@@ -53,9 +82,3 @@ def redis_snippet_site_key
53
82
  request.host
54
83
  end
55
84
  ```
56
-
57
- ## Requirements
58
-
59
- * rails 5.x or higher
60
- * redis
61
- * redis-namespace
data/Rakefile CHANGED
@@ -1 +1,6 @@
1
1
  require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task default: :spec
@@ -1,5 +1,9 @@
1
1
  class RedisSnippets::SnippetsController < ApplicationController
2
- include RedisSnippets::Help
2
+ include RedisSnippets::Util
3
+
4
+ # Temporary fix for Rails 6.0 support. Rendering views doesn't have access
5
+ # to the apps routes unless we include them.
6
+ include Rails.application.routes.url_helpers
3
7
 
4
8
  before_action :redis_snippets_authenticate_admin_user!
5
9
 
@@ -10,8 +14,7 @@ class RedisSnippets::SnippetsController < ApplicationController
10
14
 
11
15
  def update
12
16
  params[:snippets].each do |key, content|
13
- raise "#{key} not in the specified keys." unless RedisSnippets::Engine.config.redis_snippets[:keys].include?(key.to_sym)
14
- RedisSnippets::Snippets.update(snippet_key(key), params[:snippets][key])
17
+ SnippetStoreService.update(snippet_key(key), params[:snippets][key])
15
18
  end
16
19
 
17
20
  flash[:notice] = 'Snippets updated.'
@@ -1,32 +1,14 @@
1
1
  module RedisSnippets
2
2
  module SnippetsHelper
3
- include RedisSnippets::Help
4
-
5
- def snippet_content(snippet_name)
6
- RedisSnippets::Snippets.send(snippet_key(snippet_name))
7
- end
3
+ include RedisSnippets::Util
8
4
 
9
5
  # Return true if snippet has content.
10
- def snippet_has_content?(snippet_name)
11
- !snippet_content(snippet_name).blank?
12
- end
13
-
14
- def snippet(snippet_name, classes=nil)
15
- return '' if controller.status == 404
16
- snippet = snippet_content(snippet_name)
17
- return '' if snippet.blank?
18
- snippets = snippet.split("[section]")
19
- build_snippet(snippets[rand(snippets.length)], snippet_class_list(snippet_name, classes))
20
- end
21
-
22
- def snippet_class_list(snippet_name, classes)
23
- ['snippet', classes || snippet_name.to_s].compact.join(' ').html_safe
6
+ def snippet_has_content?(key)
7
+ !SnippetStoreService.send(snippet_key(key)).blank?
24
8
  end
25
9
 
26
- def build_snippet(content, classes)
27
- content_tag(:div,
28
- content.html_safe,
29
- :class => classes)
10
+ def snippet(key, classes = nil)
11
+ SnippetPresenter.new(view: self, key: key, classes: classes).call
30
12
  end
31
13
  end
32
14
  end
@@ -0,0 +1,54 @@
1
+
2
+ class SnippetPresenter
3
+ include RedisSnippets::Util
4
+
5
+ SECTION_DELIMITER = "[section]"
6
+
7
+ delegate :random_snippet, to: "self.class"
8
+
9
+ def initialize(view:, key:, classes: nil)
10
+ @view = view
11
+ @key = key
12
+ @classes = classes
13
+ end
14
+
15
+ def call
16
+ prepare_snippet
17
+ render
18
+ end
19
+
20
+ protected
21
+
22
+ def prepare_snippet
23
+ @snippet = ""
24
+
25
+ if content = SnippetStoreService.send(snippet_key(@key))
26
+ snippets = content.split("#{SECTION_DELIMITER}")
27
+ @snippet = random_snippet(content)
28
+ end
29
+ end
30
+
31
+ def snippet_class_list
32
+ [
33
+ "snippet",
34
+ @key.to_s,
35
+ *@classes
36
+ ].reject(&:blank?).join(" ").html_safe
37
+ end
38
+
39
+ def render
40
+ # If snippet is empty we avoid wrapping it in the div.
41
+ if @snippet.blank?
42
+ ""
43
+ else
44
+ @view.content_tag(:div, @snippet.html_safe, class: snippet_class_list)
45
+ end
46
+ end
47
+
48
+ class << self
49
+ def random_snippet(content)
50
+ snippets = content.split("#{SECTION_DELIMITER}").map { |section| section.gsub(/^\n/, "") }
51
+ snippets[rand(snippets.length)]
52
+ end
53
+ end
54
+ end
@@ -1,10 +1,12 @@
1
- class RedisSnippets::Snippets
1
+ class SnippetStoreService
2
2
  class << self
3
3
  def update(key, content)
4
+ ensure_key_is_defined!(key)
4
5
  RedisSnippets::Redis.set("snippets:#{key}", content)
5
6
  end
6
7
 
7
8
  def del(key)
9
+ ensure_key_is_defined!(key)
8
10
  RedisSnippets::Redis.del("snippets:#{key}")
9
11
  end
10
12
 
@@ -12,5 +14,11 @@ class RedisSnippets::Snippets
12
14
  def method_missing(method, *args)
13
15
  RedisSnippets::Redis.get("snippets:#{method}")
14
16
  end
17
+
18
+ protected
19
+
20
+ def ensure_key_is_defined!(key)
21
+ raise UndefinedSnippetsKey.new("#{key} not in the specified keys.") unless RedisSnippets::Engine.config.redis_snippets[:keys].include?(key.to_sym)
22
+ end
15
23
  end
16
24
  end
@@ -1,23 +1,19 @@
1
- <div class="redis_snippets">
2
- <h1>Snippets</h1>
1
+ <div class="redis-snippets">
2
+ <h1 class="h1">Snippets</h1>
3
3
 
4
- <%= form_tag '', method: :put, class: "form-redis_snippets" do |f| %>
5
- <fieldset class="form-redis_snippets-inputs">
6
- <ol>
4
+ <%= form_tag "", method: :put, class: "redis-snippets__form" do |f| %>
5
+ <fieldset class="redis-snippets__fieldset">
6
+ <ol class="redis-snippets__list">
7
7
  <% RedisSnippets::Engine.config.redis_snippets[:keys].each do |key| %>
8
- <li class="form-redis_snippets-inputs-text form-redis_snippets-inputs-input form-redis_snippets-inputs-optional">
9
- <%= label_tag key.to_s, key.to_s, class: "form-redis_snippets-label" %>
10
- <%= text_area_tag "snippets[#{key}]", RedisSnippets::Snippets.send(snippet_key(key)), cols: 120, rows: 10 %>
8
+ <li class="redis-snippets__snippet">
9
+ <%= label_tag key.to_s, key.to_s, class: "redis-snippets__snippet-label" %>
10
+ <%= text_area_tag "snippets[#{key}]", SnippetStoreService.send(snippet_key(key)), cols: 120, rows: 10 %>
11
11
  </li>
12
12
  <% end -%>
13
13
  </ol>
14
14
  </fieldset>
15
- <fieldset class="form-redis_snippets-inputs-actions">
16
- <ol>
17
- <li class="form-redis_snippets-inputs-action form-redis_snippets-inputs-button_action">
18
- <%= button_tag 'Submit' %>
19
- </li>
20
- </ol>
21
- </field>
15
+ <fieldset class="redis-snippets__actions">
16
+ <%= button_tag "Submit", class: "redis-snippets__submit" %>
17
+ </fieldset>
22
18
  <% end -%>
23
19
  </div>
@@ -1,5 +1,9 @@
1
1
  module RedisSnippets
2
2
  class Engine < ::Rails::Engine
3
3
  isolate_namespace RedisSnippets
4
+
5
+ config.generators do |g|
6
+ g.test_framework :rspec
7
+ end
4
8
  end
5
9
  end
@@ -1,17 +1,22 @@
1
1
  module RedisSnippets
2
2
  class Redis
3
3
  class << self
4
- # Can't do method_missing on get/set as they're defined somewhere by Ruby.
5
4
  def get(key)
6
- RedisSnippets::Engine.config.redis_snippets[:connection].get(key)
5
+ connection.get(key)
7
6
  end
8
7
 
9
8
  def set(key, value)
10
- RedisSnippets::Engine.config.redis_snippets[:connection].set(key, value)
9
+ connection.set(key, value)
11
10
  end
12
11
 
13
- def method_missing(method, *args)
14
- RedisSnippets::Engine.config.redis_snippets[:connection].send(method, *args)
12
+ def del(key)
13
+ connection.del(key)
14
+ end
15
+
16
+ protected
17
+
18
+ def connection
19
+ RedisSnippets::Engine.config.redis_snippets[:connection]
15
20
  end
16
21
  end
17
22
  end
@@ -1,6 +1,6 @@
1
1
  module RedisSnippets
2
- module Help
3
- # If multi_site => true the symbol returned will have the key returned with a prefix.
2
+ module Util
3
+ # If multi_site is true the symbol returned will have the key returned with a prefix.
4
4
  # This prefix is defined in your application using the redis_snippet_site_key method.
5
5
  # redis_snippet_site_key should simply return a unique string per site. For instance
6
6
  # it could be the domain of the site.
@@ -1,3 +1,3 @@
1
1
  module RedisSnippets
2
- VERSION = '0.0.11'
2
+ VERSION = '1.0.0'
3
3
  end
@@ -1,7 +1,9 @@
1
+ require 'rails'
1
2
  require 'redis'
2
3
  require 'redis/namespace'
3
4
 
4
5
  require 'redis_snippets/engine'
5
-
6
6
  require 'redis_snippets/redis'
7
- require 'redis_snippets/help'
7
+ require 'redis_snippets/util'
8
+
9
+ class UndefinedSnippetsKey < Exception; end
@@ -7,9 +7,9 @@ Gem::Specification.new do |spec|
7
7
  spec.version = RedisSnippets::VERSION
8
8
  spec.authors = ["Martin Moen Wulffeld"]
9
9
  spec.email = ["martin@wulffeld.org"]
10
- spec.description = %q{Storing snippets of whatever in Redis.}
11
- spec.summary = %q{Storing snippets of whatever in Redis.}
12
- spec.homepage = "http://www.wulffeld.org/"
10
+ spec.summary = %q{Storing snippets of HTML, text, etc. in Redis for use in views.}
11
+ spec.description = %q{A Ruby on Rails gem that facilitates fast retrieval of snippets of code or information for views.}
12
+ spec.homepage = "https://github.com/wulffeld/redis_snippets"
13
13
  spec.license = "MIT"
14
14
 
15
15
  spec.files = `git ls-files`.split($/)
@@ -0,0 +1,38 @@
1
+ require 'rails_helper'
2
+
3
+ describe RedisSnippets::SnippetsHelper, type: :helper do
4
+ let(:code) { "<p>Buy this from Amazon.</p>" }
5
+ let(:view) { ActionController::Base.new.view_context }
6
+
7
+ describe "#snippet_has_content?" do
8
+ before do
9
+ SnippetStoreService.update(snippet_key(:advert_header), code)
10
+ end
11
+
12
+ it "returns true if there's content in the snippet" do
13
+ expect(snippet_has_content?(:advert_header)).to be true
14
+ end
15
+
16
+ it "returns false if there's no content in the snippet" do
17
+ expect(snippet_has_content?(:advert_footer)).to be false
18
+ end
19
+ end
20
+
21
+ describe "#snippet" do
22
+ before do
23
+ SnippetStoreService.update(snippet_key(:advert_header), code)
24
+ end
25
+
26
+ it "adds the snippet key as the class" do
27
+ expect(snippet(:advert_header)).to eq("<div class=\"snippet advert_header\"><p>Buy this from Amazon.</p></div>")
28
+ end
29
+
30
+ it "adds more classes from a string" do
31
+ expect(snippet(:advert_header, "advert-responsive")).to eq("<div class=\"snippet advert_header advert-responsive\"><p>Buy this from Amazon.</p></div>")
32
+ end
33
+
34
+ it "adds more classes from an array" do
35
+ expect(snippet(:advert_header, ["advert-responsive", "p-4"])).to eq("<div class=\"snippet advert_header advert-responsive p-4\"><p>Buy this from Amazon.</p></div>")
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,53 @@
1
+ require 'rails_helper'
2
+
3
+ describe SnippetPresenter do
4
+ let(:code) { "<p>Buy this from Amazon.</p>" }
5
+ let(:multiple_adverts) { <<-HEREDOC
6
+ <p>Buy this from Amazon.</p>
7
+ [section]
8
+ <p>Buy this from Apple.</p>
9
+ HEREDOC
10
+ }
11
+ let(:view) { ActionController::Base.new.view_context }
12
+
13
+ subject(:presenter) { described_class.new(view: view, key: :advert_header) }
14
+ subject(:presenter_with_string_class) { described_class.new(view: view, key: :advert_header, classes: "advert-responsive") }
15
+ subject(:presenter_with_array_classes) { described_class.new(view: view, key: :advert_header, classes: ["advert-responsive", "p-4"]) }
16
+
17
+ describe "#call" do
18
+ before do
19
+ SnippetStoreService.update(snippet_key(:advert_header), code)
20
+ end
21
+
22
+ it "renders the content" do
23
+ expect(presenter.call).to eq("<div class=\"snippet advert_header\">#{code}</div>")
24
+ end
25
+
26
+ describe "classes argument" do
27
+ it "adds the snippet key as the class" do
28
+ expect(presenter.call).to eq("<div class=\"snippet advert_header\"><p>Buy this from Amazon.</p></div>")
29
+ end
30
+
31
+ it "adds more classes from a string" do
32
+ expect(presenter_with_string_class.call).to eq("<div class=\"snippet advert_header advert-responsive\"><p>Buy this from Amazon.</p></div>")
33
+ end
34
+
35
+ it "adds more classes from an array" do
36
+ expect(presenter_with_array_classes.call).to eq("<div class=\"snippet advert_header advert-responsive p-4\"><p>Buy this from Amazon.</p></div>")
37
+ end
38
+ end
39
+ end
40
+
41
+ describe ".random_snippet" do
42
+ before do
43
+ SnippetStoreService.update(snippet_key(:advert_header), multiple_adverts)
44
+ end
45
+
46
+ it "returns one of the sections" do
47
+ allow(SnippetPresenter).to receive(:rand).and_return(0)
48
+ expect(described_class.random_snippet(multiple_adverts)).to eq("<p>Buy this from Amazon.</p>\n")
49
+ allow(SnippetPresenter).to receive(:rand).and_return(1)
50
+ expect(described_class.random_snippet(multiple_adverts)).to eq("<p>Buy this from Apple.</p>\n")
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,44 @@
1
+ require 'rails_helper'
2
+
3
+ describe SnippetStoreService do
4
+ let(:defined_key) { SnippetStoreService.advert_header }
5
+
6
+ let(:code) { "<p>Hello world.</p>" }
7
+
8
+ describe "#update" do
9
+ it "updates the content of a snippet" do
10
+ SnippetStoreService.update(snippet_key(:advert_header), code)
11
+
12
+ expect(SnippetStoreService.advert_header).to eq(code)
13
+ end
14
+
15
+ it "doesn't allowed undefined keys" do
16
+ expect { SnippetStoreService.update(:advert_sidebar, code) }.to raise_error(UndefinedSnippetsKey)
17
+ end
18
+ end
19
+
20
+ describe "#del" do
21
+ it "removes the content of a snippet" do
22
+ SnippetStoreService.update(snippet_key(:advert_header), code)
23
+ SnippetStoreService.del(snippet_key(:advert_header))
24
+
25
+ expect(SnippetStoreService.advert_header).to eq(nil)
26
+ end
27
+ end
28
+
29
+ describe "#method_missing" do
30
+ it "delegates missing methods to the store" do
31
+ SnippetStoreService.update(snippet_key(:advert_header), code)
32
+
33
+ expect(SnippetStoreService.advert_header).to eq(code)
34
+ end
35
+
36
+ it "returns nil for defined keys that has not been set" do
37
+ expect(defined_key).to eq(nil)
38
+ end
39
+
40
+ it "returns nil for undefined keys" do
41
+ expect(SnippetStoreService.advert_sidebar).to eq(nil)
42
+ end
43
+ end
44
+ end
@@ -0,0 +1 @@
1
+ 2.6.5
@@ -0,0 +1,6 @@
1
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
2
+ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
+
4
+ require_relative 'config/application'
5
+
6
+ Rails.application.load_tasks
@@ -0,0 +1,3 @@
1
+ //= link_tree ../images
2
+ //= link_directory ../stylesheets .css
3
+ //= link manifest.js
File without changes
@@ -0,0 +1,15 @@
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
+ * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the bottom of the
9
+ * compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
10
+ * files in this directory. Styles in this file should be added after the last require_* statement.
11
+ * It is generally better to create a new file per style scope.
12
+ *
13
+ *= require_tree .
14
+ *= require_self
15
+ */
@@ -0,0 +1,2 @@
1
+ class ApplicationController < ActionController::Base
2
+ end
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Dummy</title>
5
+ <%= csrf_meta_tags %>
6
+ <%= csp_meta_tag %>
7
+
8
+ <%= stylesheet_link_tag 'application', media: 'all' %>
9
+ </head>
10
+
11
+ <body>
12
+ <%= yield %>
13
+ </body>
14
+ </html>
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ APP_PATH = File.expand_path('../config/application', __dir__)
3
+ require_relative '../config/boot'
4
+ require 'rails/commands'
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ require_relative '../config/boot'
3
+ require 'rake'
4
+ Rake.application.run
@@ -0,0 +1,33 @@
1
+ #!/usr/bin/env ruby
2
+ require 'fileutils'
3
+
4
+ # path to your application root.
5
+ APP_ROOT = File.expand_path('..', __dir__)
6
+
7
+ def system!(*args)
8
+ system(*args) || abort("\n== Command #{args} failed ==")
9
+ end
10
+
11
+ FileUtils.chdir APP_ROOT do
12
+ # This script is a way to setup or update your development environment automatically.
13
+ # This script is idempotent, so that you can run it at anytime and get an expectable outcome.
14
+ # Add necessary setup steps to this file.
15
+
16
+ puts '== Installing dependencies =='
17
+ system! 'gem install bundler --conservative'
18
+ system('bundle check') || system!('bundle install')
19
+
20
+ # puts "\n== Copying sample files =="
21
+ # unless File.exist?('config/database.yml')
22
+ # FileUtils.cp 'config/database.yml.sample', 'config/database.yml'
23
+ # end
24
+
25
+ puts "\n== Preparing database =="
26
+ system! 'bin/rails db:prepare'
27
+
28
+ puts "\n== Removing old logs and tempfiles =="
29
+ system! 'bin/rails log:clear tmp:clear'
30
+
31
+ puts "\n== Restarting application server =="
32
+ system! 'bin/rails restart'
33
+ end
@@ -0,0 +1,29 @@
1
+ require_relative 'boot'
2
+
3
+ require "rails"
4
+ # Pick the frameworks you want:
5
+ require "active_model/railtie"
6
+ # require "active_job/railtie"
7
+ # require "active_record/railtie"
8
+ # require "active_storage/engine"
9
+ require "action_controller/railtie"
10
+ # require "action_mailer/railtie"
11
+ require "action_view/railtie"
12
+ require "action_cable/engine"
13
+ require "sprockets/railtie"
14
+ # require "rails/test_unit/railtie"
15
+
16
+ Bundler.require(*Rails.groups)
17
+ require "redis_snippets"
18
+
19
+ module Dummy
20
+ class Application < Rails::Application
21
+ # Initialize configuration defaults for originally generated Rails version.
22
+ config.load_defaults 6.0
23
+
24
+ # Settings in config/environments/* take precedence over those specified here.
25
+ # Application configuration can go into files in config/initializers
26
+ # -- all .rb files in that directory are automatically loaded after loading
27
+ # the framework and any gems in your application.
28
+ end
29
+ end
@@ -0,0 +1,5 @@
1
+ # Set up gems listed in the Gemfile.
2
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../../Gemfile', __dir__)
3
+
4
+ require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
5
+ $LOAD_PATH.unshift File.expand_path('../../../lib', __dir__)
@@ -0,0 +1,5 @@
1
+ # Load the Rails application.
2
+ require_relative 'application'
3
+
4
+ # Initialize the Rails application.
5
+ Rails.application.initialize!
@@ -0,0 +1,62 @@
1
+ Rails.application.configure do
2
+ # Settings specified here will take precedence over those in config/application.rb.
3
+
4
+ # In the development environment your application's code is reloaded on
5
+ # every request. This slows down response time but is perfect for development
6
+ # since you don't have to restart the web server when you make code changes.
7
+ config.cache_classes = false
8
+
9
+ # Do not eager load code on boot.
10
+ config.eager_load = false
11
+
12
+ # Show full error reports.
13
+ config.consider_all_requests_local = true
14
+
15
+ # Enable/disable caching. By default caching is disabled.
16
+ # Run rails dev:cache to toggle caching.
17
+ if Rails.root.join('tmp', 'caching-dev.txt').exist?
18
+ config.action_controller.perform_caching = true
19
+ config.action_controller.enable_fragment_cache_logging = true
20
+
21
+ config.cache_store = :memory_store
22
+ config.public_file_server.headers = {
23
+ 'Cache-Control' => "public, max-age=#{2.days.to_i}"
24
+ }
25
+ else
26
+ config.action_controller.perform_caching = false
27
+
28
+ config.cache_store = :null_store
29
+ end
30
+
31
+ # Store uploaded files on the local file system (see config/storage.yml for options).
32
+ config.active_storage.service = :local
33
+
34
+ # Don't care if the mailer can't send.
35
+ config.action_mailer.raise_delivery_errors = false
36
+
37
+ config.action_mailer.perform_caching = false
38
+
39
+ # Print deprecation notices to the Rails logger.
40
+ config.active_support.deprecation = :log
41
+
42
+ # Raise an error on page load if there are pending migrations.
43
+ config.active_record.migration_error = :page_load
44
+
45
+ # Highlight code that triggered database queries in logs.
46
+ config.active_record.verbose_query_logs = true
47
+
48
+ # Debug mode disables concatenation and preprocessing of assets.
49
+ # This option may cause significant delays in view rendering with a large
50
+ # number of complex assets.
51
+ config.assets.debug = true
52
+
53
+ # Suppress logger output for asset requests.
54
+ config.assets.quiet = true
55
+
56
+ # Raises error for missing translations.
57
+ # config.action_view.raise_on_missing_translations = true
58
+
59
+ # Use an evented file watcher to asynchronously detect changes in source code,
60
+ # routes, locales, etc. This feature depends on the listen gem.
61
+ # config.file_watcher = ActiveSupport::EventedFileUpdateChecker
62
+ end
@@ -0,0 +1,48 @@
1
+ # The test environment is used exclusively to run your application's
2
+ # test suite. You never need to work with it otherwise. Remember that
3
+ # your test database is "scratch space" for the test suite and is wiped
4
+ # and recreated between test runs. Don't rely on the data there!
5
+
6
+ Rails.application.configure do
7
+ # Settings specified here will take precedence over those in config/application.rb.
8
+
9
+ config.cache_classes = false
10
+
11
+ # Do not eager load code on boot. This avoids loading your whole application
12
+ # just for the purpose of running a single test. If you are using a tool that
13
+ # preloads Rails for running tests, you may have to set it to true.
14
+ config.eager_load = false
15
+
16
+ # Configure public file server for tests with Cache-Control for performance.
17
+ config.public_file_server.enabled = true
18
+ config.public_file_server.headers = {
19
+ 'Cache-Control' => "public, max-age=#{1.hour.to_i}"
20
+ }
21
+
22
+ # Show full error reports and disable caching.
23
+ config.consider_all_requests_local = true
24
+ config.action_controller.perform_caching = false
25
+ config.cache_store = :null_store
26
+
27
+ # Raise exceptions instead of rendering exception templates.
28
+ config.action_dispatch.show_exceptions = false
29
+
30
+ # Disable request forgery protection in test environment.
31
+ config.action_controller.allow_forgery_protection = false
32
+
33
+ # Store uploaded files on the local file system in a temporary directory.
34
+ # config.active_storage.service = :test
35
+
36
+ # config.action_mailer.perform_caching = false
37
+
38
+ # Tell Action Mailer not to deliver emails to the real world.
39
+ # The :test delivery method accumulates sent emails in the
40
+ # ActionMailer::Base.deliveries array.
41
+ # config.action_mailer.delivery_method = :test
42
+
43
+ # Print deprecation notices to the stderr.
44
+ config.active_support.deprecation = :stderr
45
+
46
+ # Raises error for missing translations.
47
+ # config.action_view.raise_on_missing_translations = true
48
+ end
@@ -0,0 +1,8 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # ActiveSupport::Reloader.to_prepare do
4
+ # ApplicationController.renderer.defaults.merge!(
5
+ # http_host: 'example.org',
6
+ # https: false
7
+ # )
8
+ # end
@@ -0,0 +1,12 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Version of your assets, change this if you want to expire all your assets.
4
+ Rails.application.config.assets.version = '1.0'
5
+
6
+ # Add additional assets to the asset load path.
7
+ # Rails.application.config.assets.paths << Emoji.images_path
8
+
9
+ # Precompile additional assets.
10
+ # application.js, application.css, and all non-JS/CSS in the app/assets
11
+ # folder are already added.
12
+ # Rails.application.config.assets.precompile += %w( admin.js admin.css )
@@ -0,0 +1,7 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
4
+ # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
5
+
6
+ # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
7
+ # Rails.backtrace_cleaner.remove_silencers!
@@ -0,0 +1,28 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Define an application-wide content security policy
4
+ # For further information see the following documentation
5
+ # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy
6
+
7
+ # Rails.application.config.content_security_policy do |policy|
8
+ # policy.default_src :self, :https
9
+ # policy.font_src :self, :https, :data
10
+ # policy.img_src :self, :https, :data
11
+ # policy.object_src :none
12
+ # policy.script_src :self, :https
13
+ # policy.style_src :self, :https
14
+
15
+ # # Specify URI for violation reports
16
+ # # policy.report_uri "/csp-violation-report-endpoint"
17
+ # end
18
+
19
+ # If you are using UJS then enable automatic nonce generation
20
+ # Rails.application.config.content_security_policy_nonce_generator = -> request { SecureRandom.base64(16) }
21
+
22
+ # Set the nonce only to specific directives
23
+ # Rails.application.config.content_security_policy_nonce_directives = %w(script-src)
24
+
25
+ # Report CSP violations to a specified URI
26
+ # For further information see the following documentation:
27
+ # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only
28
+ # Rails.application.config.content_security_policy_report_only = true
@@ -0,0 +1,5 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Specify a serializer for the signed and encrypted cookie jars.
4
+ # Valid options are :json, :marshal, and :hybrid.
5
+ Rails.application.config.action_dispatch.cookies_serializer = :json
@@ -0,0 +1,4 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Configure sensitive parameters which will be filtered from the log file.
4
+ Rails.application.config.filter_parameters += [:password]
@@ -0,0 +1,16 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Add new inflection rules using the following format. Inflections
4
+ # are locale specific, and you may define rules for as many different
5
+ # locales as you wish. All of these examples are active by default:
6
+ # ActiveSupport::Inflector.inflections(:en) do |inflect|
7
+ # inflect.plural /^(ox)$/i, '\1en'
8
+ # inflect.singular /^(ox)en/i, '\1'
9
+ # inflect.irregular 'person', 'people'
10
+ # inflect.uncountable %w( fish sheep )
11
+ # end
12
+
13
+ # These inflection rules are supported but not enabled by default:
14
+ # ActiveSupport::Inflector.inflections(:en) do |inflect|
15
+ # inflect.acronym 'RESTful'
16
+ # end
@@ -0,0 +1,4 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Add new mime types for use in respond_to blocks:
4
+ # Mime::Type.register "text/richtext", :rtf
@@ -0,0 +1,14 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # This file contains settings for ActionController::ParamsWrapper which
4
+ # is enabled by default.
5
+
6
+ # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
7
+ ActiveSupport.on_load(:action_controller) do
8
+ wrap_parameters format: [:json]
9
+ end
10
+
11
+ # To enable root element in JSON for ActiveRecord objects.
12
+ # ActiveSupport.on_load(:active_record) do
13
+ # self.include_root_in_json = true
14
+ # end
@@ -0,0 +1,38 @@
1
+ # Puma can serve each request in a thread from an internal thread pool.
2
+ # The `threads` method setting takes two numbers: a minimum and maximum.
3
+ # Any libraries that use thread pools should be configured to match
4
+ # the maximum value specified for Puma. Default is set to 5 threads for minimum
5
+ # and maximum; this matches the default thread size of Active Record.
6
+ #
7
+ max_threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }
8
+ min_threads_count = ENV.fetch("RAILS_MIN_THREADS") { max_threads_count }
9
+ threads min_threads_count, max_threads_count
10
+
11
+ # Specifies the `port` that Puma will listen on to receive requests; default is 3000.
12
+ #
13
+ port ENV.fetch("PORT") { 3000 }
14
+
15
+ # Specifies the `environment` that Puma will run in.
16
+ #
17
+ environment ENV.fetch("RAILS_ENV") { "development" }
18
+
19
+ # Specifies the `pidfile` that Puma will use.
20
+ pidfile ENV.fetch("PIDFILE") { "tmp/pids/server.pid" }
21
+
22
+ # Specifies the number of `workers` to boot in clustered mode.
23
+ # Workers are forked web server processes. If using threads and workers together
24
+ # the concurrency of the application would be max `threads` * `workers`.
25
+ # Workers do not work on JRuby or Windows (both of which do not support
26
+ # processes).
27
+ #
28
+ # workers ENV.fetch("WEB_CONCURRENCY") { 2 }
29
+
30
+ # Use the `preload_app!` method when specifying a `workers` number.
31
+ # This directive tells Puma to first boot the application and load code
32
+ # before forking the application. This takes advantage of Copy On Write
33
+ # process behavior so workers use less memory.
34
+ #
35
+ # preload_app!
36
+
37
+ # Allow puma to be restarted by `rails restart` command.
38
+ plugin :tmp_restart
@@ -0,0 +1,3 @@
1
+ Rails.application.routes.draw do
2
+ mount RedisSnippets::Engine, at: "admin", as: "redis_snippets"
3
+ end
@@ -0,0 +1,5 @@
1
+ # This file is used by Rack-based servers to start the application.
2
+
3
+ require_relative 'config/environment'
4
+
5
+ run Rails.application
File without changes
File without changes
File without changes
@@ -0,0 +1 @@
1
+ 25c7ba3ff5498aead660dbc8bf38be3833df9479ffc2fc76fd8306308d7d365a455654be62905c9594caa61d0c85e7349056c1cd49d027995ac34dae86cd3dd7
@@ -0,0 +1,53 @@
1
+ ENV['RAILS_ENV'] ||= 'test'
2
+
3
+ require 'support/simplecov_setup'
4
+
5
+ require File.expand_path('dummy/config/environment', __dir__)
6
+ require 'rspec/rails'
7
+ require 'redis_snippets'
8
+
9
+ include RedisSnippets::SnippetsHelper
10
+
11
+ Rails.application.config.redis_snippets = {
12
+ connection: MockRedis.new,
13
+ keys: [
14
+ :advert_header,
15
+ :advert_footer
16
+ ]
17
+ }
18
+
19
+ RSpec.configure do |config|
20
+ # RSpec Rails can automatically mix in different behaviours to your tests
21
+ # based on their file location, for example enabling you to call `get` and
22
+ # `post` in specs under `spec/controllers`.
23
+ #
24
+ # You can disable this behaviour by removing the line below, and instead
25
+ # explicitly tag your specs with their type, e.g.:
26
+ #
27
+ # RSpec.describe UsersController, :type => :controller do
28
+ # # ...
29
+ # end
30
+ #
31
+ # The different available types are documented in the features, such as in
32
+ # https://relishapp.com/rspec/rspec-rails/docs
33
+ config.infer_spec_type_from_file_location!
34
+
35
+ # Filter lines from Rails gems in backtraces.
36
+ config.filter_rails_from_backtrace!
37
+ # arbitrary gems may also be filtered via:
38
+ # config.filter_gems_from_backtrace("gem name")
39
+
40
+ def clean_keys!
41
+ RedisSnippets::Engine.config.redis_snippets[:keys].each do |key|
42
+ SnippetStoreService.del(key)
43
+ end
44
+ end
45
+
46
+ config.before(:each) do
47
+ clean_keys!
48
+ end
49
+
50
+ config.after(:each) do
51
+ clean_keys!
52
+ end
53
+ end
@@ -0,0 +1,13 @@
1
+ ENV['RAILS_ENV'] ||= 'test'
2
+
3
+ require 'support/simplecov_setup'
4
+
5
+ RSpec.configure do |config|
6
+ config.expect_with :rspec do |expectations|
7
+ expectations.syntax = :expect
8
+ end
9
+
10
+ config.mock_with :rspec do |mocks|
11
+ mocks.syntax = :expect
12
+ end
13
+ end
@@ -0,0 +1,5 @@
1
+ require 'simplecov'
2
+
3
+ SimpleCov.start do
4
+ add_filter %r{^/spec/}
5
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: redis_snippets
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.11
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martin Moen Wulffeld
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-10-02 00:00:00.000000000 Z
11
+ date: 2019-10-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -80,7 +80,8 @@ dependencies:
80
80
  - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: 1.2.1
83
- description: Storing snippets of whatever in Redis.
83
+ description: A Ruby on Rails gem that facilitates fast retrieval of snippets of code
84
+ or information for views.
84
85
  email:
85
86
  - martin@wulffeld.org
86
87
  executables: []
@@ -88,20 +89,61 @@ extensions: []
88
89
  extra_rdoc_files: []
89
90
  files:
90
91
  - ".gitignore"
92
+ - ".rspec"
93
+ - ".travis.yml"
94
+ - Gemfile
91
95
  - README.md
92
96
  - Rakefile
93
97
  - app/controllers/redis_snippets/snippets_controller.rb
94
98
  - app/helpers/redis_snippets/snippets_helper.rb
95
- - app/models/redis_snippets/snippets.rb
99
+ - app/presenters/snippet_presenter.rb
100
+ - app/services/snippet_store_service.rb
96
101
  - app/views/redis_snippets/snippets/show.html.erb
97
102
  - config/routes.rb
98
103
  - lib/redis_snippets.rb
99
104
  - lib/redis_snippets/engine.rb
100
- - lib/redis_snippets/help.rb
101
105
  - lib/redis_snippets/redis.rb
106
+ - lib/redis_snippets/util.rb
102
107
  - lib/redis_snippets/version.rb
103
108
  - redis_snippets.gemspec
104
- homepage: http://www.wulffeld.org/
109
+ - spec/app/helpers/redis_snippets/snippets_helper_spec.rb
110
+ - spec/app/presenters/snippet_presenter_spec.rb
111
+ - spec/app/services/snippet_store_service_spec.rb
112
+ - spec/dummy/.ruby-version
113
+ - spec/dummy/Rakefile
114
+ - spec/dummy/app/assets/config/manifest.js
115
+ - spec/dummy/app/assets/images/.keep
116
+ - spec/dummy/app/assets/stylesheets/application.css
117
+ - spec/dummy/app/controllers/application_controller.rb
118
+ - spec/dummy/app/views/layouts/application.html.erb
119
+ - spec/dummy/bin/rails
120
+ - spec/dummy/bin/rake
121
+ - spec/dummy/bin/setup
122
+ - spec/dummy/config.ru
123
+ - spec/dummy/config/application.rb
124
+ - spec/dummy/config/boot.rb
125
+ - spec/dummy/config/environment.rb
126
+ - spec/dummy/config/environments/development.rb
127
+ - spec/dummy/config/environments/test.rb
128
+ - spec/dummy/config/initializers/application_controller_renderer.rb
129
+ - spec/dummy/config/initializers/assets.rb
130
+ - spec/dummy/config/initializers/backtrace_silencers.rb
131
+ - spec/dummy/config/initializers/content_security_policy.rb
132
+ - spec/dummy/config/initializers/cookies_serializer.rb
133
+ - spec/dummy/config/initializers/filter_parameter_logging.rb
134
+ - spec/dummy/config/initializers/inflections.rb
135
+ - spec/dummy/config/initializers/mime_types.rb
136
+ - spec/dummy/config/initializers/wrap_parameters.rb
137
+ - spec/dummy/config/puma.rb
138
+ - spec/dummy/config/routes.rb
139
+ - spec/dummy/lib/assets/.keep
140
+ - spec/dummy/log/.keep
141
+ - spec/dummy/tmp/.keep
142
+ - spec/dummy/tmp/development_secret.txt
143
+ - spec/rails_helper.rb
144
+ - spec/spec_helper.rb
145
+ - spec/support/simplecov_setup.rb
146
+ homepage: https://github.com/wulffeld/redis_snippets
105
147
  licenses:
106
148
  - MIT
107
149
  metadata: {}
@@ -120,9 +162,45 @@ required_rubygems_version: !ruby/object:Gem::Requirement
120
162
  - !ruby/object:Gem::Version
121
163
  version: '0'
122
164
  requirements: []
123
- rubyforge_project:
124
- rubygems_version: 2.6.8
165
+ rubygems_version: 3.0.6
125
166
  signing_key:
126
167
  specification_version: 4
127
- summary: Storing snippets of whatever in Redis.
128
- test_files: []
168
+ summary: Storing snippets of HTML, text, etc. in Redis for use in views.
169
+ test_files:
170
+ - spec/app/helpers/redis_snippets/snippets_helper_spec.rb
171
+ - spec/app/presenters/snippet_presenter_spec.rb
172
+ - spec/app/services/snippet_store_service_spec.rb
173
+ - spec/dummy/.ruby-version
174
+ - spec/dummy/Rakefile
175
+ - spec/dummy/app/assets/config/manifest.js
176
+ - spec/dummy/app/assets/images/.keep
177
+ - spec/dummy/app/assets/stylesheets/application.css
178
+ - spec/dummy/app/controllers/application_controller.rb
179
+ - spec/dummy/app/views/layouts/application.html.erb
180
+ - spec/dummy/bin/rails
181
+ - spec/dummy/bin/rake
182
+ - spec/dummy/bin/setup
183
+ - spec/dummy/config.ru
184
+ - spec/dummy/config/application.rb
185
+ - spec/dummy/config/boot.rb
186
+ - spec/dummy/config/environment.rb
187
+ - spec/dummy/config/environments/development.rb
188
+ - spec/dummy/config/environments/test.rb
189
+ - spec/dummy/config/initializers/application_controller_renderer.rb
190
+ - spec/dummy/config/initializers/assets.rb
191
+ - spec/dummy/config/initializers/backtrace_silencers.rb
192
+ - spec/dummy/config/initializers/content_security_policy.rb
193
+ - spec/dummy/config/initializers/cookies_serializer.rb
194
+ - spec/dummy/config/initializers/filter_parameter_logging.rb
195
+ - spec/dummy/config/initializers/inflections.rb
196
+ - spec/dummy/config/initializers/mime_types.rb
197
+ - spec/dummy/config/initializers/wrap_parameters.rb
198
+ - spec/dummy/config/puma.rb
199
+ - spec/dummy/config/routes.rb
200
+ - spec/dummy/lib/assets/.keep
201
+ - spec/dummy/log/.keep
202
+ - spec/dummy/tmp/.keep
203
+ - spec/dummy/tmp/development_secret.txt
204
+ - spec/rails_helper.rb
205
+ - spec/spec_helper.rb
206
+ - spec/support/simplecov_setup.rb