jahuty 3.2.0 → 3.4.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 42d427523be1564e07087d282367b7c13b9e80ac7219522a26a86a04f6fd23e7
4
- data.tar.gz: 5f164380a18fda536c08c918dbfaaba6aaffc02183cfb2e74c6944b3e0bc42c3
3
+ metadata.gz: dc03377d980089b275af98c4bbd57d56c9a5a7e017bd9bce90dd53c299340be7
4
+ data.tar.gz: d7b0463dbfd93a713cf4c718e3ef175926af4228a69d72c6798ae7ae033e1b06
5
5
  SHA512:
6
- metadata.gz: f5b8c35c587b3f26a7fce8830963c98c859307e444edf5a0b058695e954fc5ce1dd0220b25f99d874ed983f1c72474546b51a2294f718bbea0358198d01ce6f6
7
- data.tar.gz: 6f037d7ee49936532c2bd2ed5ed6f91942352f95082da4af28bd390afd3bc0d0dfdcda847f2c4e4ad742e4b1702562c9c6cba6c0fd5df4c923756c4113aa3d6a
6
+ metadata.gz: ae1da4327c9e6e5c8bcc91f95e10f37c8d2eed73cd9b569d6b9f369f4261c2b73ee78f693b2b7d60274b33e40bb0417743638c92a2130bb9bd05492c4cd78f27
7
+ data.tar.gz: 9bdc2c24d3b666d17106329bd34ba18cc6643322b1b45905ef9dd1e3503f1889fb1bf7320e55e4ffca864300f39643c273782a27f7b4c0c8902730dc427d47fe
data/CHANGELOG.md CHANGED
@@ -5,18 +5,41 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
- ## 3.2.0 - 2020-03-08
8
+ ## [3.4.0] - 2021-07-29
9
9
 
10
- * Added collections to the library with `all_renders` method. This was a rather large change and required adding new objects like `Action::Show`, refactoring old ones like `Resource::Factory`, and removing some objects like `Cache::Manager` and `Service::Factory` which added unnecessary complexity.
11
- * Added `snippet_id` to `Resource::Render` to help keep track of a render's parent snippet.
10
+ ### Added
12
11
 
13
- ## 3.1.1 - 2020-02-26
12
+ - Support for Ruby 3.
13
+ - Builds for the latest versions of Ruby 2.6.x, 2.7.x, and 3.0.x.
14
+ - A `location` parameter to the `render` method to enable display tracking.
15
+
16
+ ## 3.3.1 - 2021-05-02
17
+
18
+ ### Fixed
19
+
20
+ - Fixed [#19](https://github.com/jahuty/jahuty-ruby/issues/19) where renders were cached without regard for their content version.
21
+
22
+ ## 3.3.0 - 2021-04-29
23
+
24
+ - Add the `prefer_latest` configuration option to the client and render methods. This setting allows you to render a snippet's _latest_ content instead of the default _published_ content.
25
+
26
+ ## 3.2.1 - 2021-03-16
27
+
28
+ - Fix issue with double-enveloping the `params` query string parameter.
29
+ - Add system tests for params, caching, problems, and collections.
30
+
31
+ ## 3.2.0 - 2021-03-08
32
+
33
+ - Added collections to the library with `all_renders` method. This was a rather large change and required adding new objects like `Action::Show`, refactoring old ones like `Resource::Factory`, and removing some objects like `Cache::Manager` and `Service::Factory` which added unnecessary complexity.
34
+ - Added `snippet_id` to `Resource::Render` to help keep track of a render's parent snippet.
35
+
36
+ ## 3.1.1 - 2021-02-26
14
37
 
15
38
  - Add support for extra, unused attributes returned by the API to support evolution.
16
39
  - Fix the `method redefined` warnings in `cache/manager_spec.rb` and `cache/facade_spec.rb`.
17
40
  - Fix the `expect { }.not_to raise_error(SpecificErrorClass)` false positives warnings in `resource/render_spec.rb`.
18
41
 
19
- ## 3.1.0 - 2020-01-04
42
+ ## 3.1.0 - 2021-01-04
20
43
 
21
44
  - Add caching support for any cache implementation that supports `get/set` or `read/write` methods.
22
45
  - Default to using in-memory [mini-cache](https://github.com/derrickreimer/mini_cache) storage.
data/README.md CHANGED
@@ -6,14 +6,18 @@ Welcome to the [Ruby SDK](https://docs.jahuty.com/sdks/ruby) for [Jahuty's API](
6
6
 
7
7
  ## Installation
8
8
 
9
- This library requires [Ruby 2.6+](https://www.ruby-lang.org/en/downloads/releases/).
9
+ This library is tested with the following [Ruby versions](https://www.ruby-lang.org/en/downloads/releases/):
10
+
11
+ * MRI 2.6.8
12
+ * MRI 2.7.4
13
+ * MRI 3.0.2
10
14
 
11
15
  It is multi-platform, and we strive to make it run equally well on Windows, Linux, and OSX.
12
16
 
13
17
  To install, add this line to your application's `Gemfile` and run `bundle install`:
14
18
 
15
19
  ```ruby
16
- gem 'jahuty', '~> 3.1'
20
+ gem 'jahuty', '~> 3.4'
17
21
  ```
18
22
 
19
23
  ## Usage
@@ -33,11 +37,8 @@ jahuty = Jahuty::Client.new(api_key: 'YOUR_API_KEY')
33
37
 
34
38
  render = jahuty.snippets.render YOUR_SNIPPET_ID
35
39
 
36
- a = render.to_s
37
-
38
- b = render.content
39
-
40
- a == b # returns true
40
+ render.to_s
41
+ render.content
41
42
  ```
42
43
 
43
44
  In an HTML view:
@@ -61,12 +62,36 @@ jahuty = Jahuty::Client.new(api_key: 'YOUR_API_KEY')
61
62
 
62
63
  renders = jahuty.snippets.all_renders 'YOUR_TAG'
63
64
 
64
- renders.each { |render| puts render }
65
+ renders.each { |r| puts r }
66
+ ```
67
+
68
+ ## Rendering content
69
+
70
+ By default, Jahuty will render a snippet's _published_ content, the content that existed the last time someone clicked the "Publish" button, to avoid exposing your creative process to customers.
71
+
72
+ You can use the `prefer_latest` configuration option, however, to render a snippet's _latest_ content, the content that currently exists in the editor. This allows you to render a snippet's _latest_ content to your team in _development_ and its _published_ content to your customers in _production_.
73
+
74
+ ```ruby
75
+ jahuty = Jahuty::Client.new api_key: 'YOUR_API_KEY', prefer_latest: true
76
+ ```
77
+
78
+ You can also prefer the latest content (or not) for a single render:
79
+
80
+ ```ruby
81
+ # Render the _published_ content for all snippets...
82
+ jahuty = Jahuty::Client.new api_key: 'YOUR_API_KEY'
83
+
84
+ # ... except, render the _latest_ content for this one.
85
+ jahuty.snippets.render YOUR_SNIPPET_ID, prefer_latest: true
65
86
  ```
66
87
 
67
- ## Parameters
88
+ ## Passing dynamic parameters
89
+
90
+ You can use the _same_ snippet to generate _different_ content by defining [variables](https://docs.jahuty.com/liquid/variables) in your snippets and setting their values via [parameters](https://docs.jahuty.com/liquid/parameters).
68
91
 
69
- You can [pass parameters](https://docs.jahuty.com/liquid/parameters) into your renders using the `params` option:
92
+ ### Snippet parameters
93
+
94
+ Use the `params` option to pass parameters into your snippet:
70
95
 
71
96
  ```ruby
72
97
  jahuty = Jahuty::Client.new(api_key: 'YOUR_API_KEY')
@@ -74,12 +99,16 @@ jahuty = Jahuty::Client.new(api_key: 'YOUR_API_KEY')
74
99
  jahuty.snippets.render YOUR_SNIPPET_ID, params: { foo: 'bar' }
75
100
  ```
76
101
 
77
- The parameters above would be equivalent to [assigning the variable](https://docs.jahuty.com/liquid/variables) below in your snippet:
102
+ The parameters above would be equivalent to assigning the following variable in your snippet:
78
103
 
79
104
  ```html
80
105
  {% assign foo = "bar" %}
81
106
  ```
82
107
 
108
+ ### Collection parameters
109
+
110
+ Collection parameters use a slightly different syntax.
111
+
83
112
  If you're rendering a collection, the first dimension of the `params` key determines the parameters' scope. Use an asterisk key (`*`) to pass the same parameters to all snippets, or use a snippet id as key to pass parameters to a specific snippet.
84
113
 
85
114
  ```ruby
@@ -104,7 +133,20 @@ jahuty.snippets.all_renders 'YOUR_TAG', params: {
104
133
  }
105
134
  ```
106
135
 
107
- ## Caching
136
+ ## Tracking renders
137
+
138
+ You can record where snippets are rendered using the `location` configuration option. This helps your team preview their changes, and it helps you find and replace deprecated snippets.
139
+
140
+ ```ruby
141
+ jahuty = Jahuty::Client.new(api_key: 'YOUR_API_KEY')
142
+
143
+ render = jahuty.snippets.render YOUR_SNIPPET_ID, location: 'https://example.com'
144
+ ]);
145
+ ```
146
+
147
+ Note, this configuration option is only supported by the `render` method, not the `all_renders` method, and locations are only reported when a request is sent to Jahuty's API. As a result of this limitation, locations may not be reported in all scenarios. For example, if a call to `render` results in a cache hit, the location will not be reported.
148
+
149
+ ## Caching for performance
108
150
 
109
151
  You can use caching to control how frequently this library requests the latest content from Jahuty's API.
110
152
 
@@ -135,10 +177,7 @@ A persistent cache allows renders to be cached across multiple requests. This re
135
177
  To configure Jahuty to use your persistent cache, pass a cache implementation to the client via the `cache` configuration option:
136
178
 
137
179
  ```ruby
138
- jahuty = new Jahuty::Client.new(
139
- api_key: 'YOUR_API_KEY',
140
- cache: cache
141
- )
180
+ jahuty = new Jahuty::Client.new(api_key: 'YOUR_API_KEY', cache: cache)
142
181
  ```
143
182
 
144
183
  The persistent cache implementation you choose and configure is up to you. There are many libraries available, and most frameworks provide their own. At this time, we support any object which responds to `get(key)`/`set(key, value, expires_in:)` or `read(key)`/`write(key, value, expires_in:)` including [ActiveSupport::Cache::Store](https://api.rubyonrails.org/classes/ActiveSupport/Cache/Store.html#method-i-fetch).
@@ -160,11 +199,8 @@ You can usually configure your caching implementation with a default `:expires_i
160
199
  You can configure a default `:expires_in` for all of this library's renders by passing an integer number of seconds via the client's `:expires_in` configuration option:
161
200
 
162
201
  ```ruby
163
- jahuty = Jahuty::Client.new(
164
- api_key: 'YOUR_API_KEY',
165
- cache: cache,
166
- expires_in: 60 # <- Cache all renders for sixty seconds
167
- )
202
+ # Cache all renders for sixty seconds.
203
+ jahuty = Jahuty::Client.new(api_key: 'YOUR_API_KEY', cache: cache, expires_in: 60)
168
204
  ```
169
205
 
170
206
  If this library's default `:expires_in` is set, it will take precedence over the default `:expires_in` of the caching implementation.
@@ -194,11 +230,11 @@ By default, this library will cache each render returned by `all_renders`:
194
230
  jahuty = Jahuty::Client.new(api_key: 'YOUR_API_KEY', cache: cache)
195
231
 
196
232
  # Sends a network request, caches each render, and returns the collection.
197
- jahuty.snippets.all_renders 'YOUR_TAG';
233
+ jahuty.snippets.all_renders 'YOUR_TAG'
198
234
 
199
235
  # If this reder exists in the collection, the cached value will be used instead
200
236
  # of sending a network request for the latest version.
201
- jahuty.snippets.render YOUR_SNIPPET_ID;
237
+ jahuty.snippets.render YOUR_SNIPPET_ID
202
238
  ```
203
239
 
204
240
  This is a powerful feature, especially when combined with a persistent cache. Using the `all_renders` method, you can render and cache an arbitrarily large chunk of content with a single network request. Because any subsequent call to `render` a snippet in the collection will use its cached version, you can reduce the number of network requests to load your content.
@@ -218,7 +254,7 @@ jahuty2 = Jahuty::Client.new(api_key: 'YOUR_API_KEY', expires_in: 60)
218
254
  jahuty2.snippets.render 1, expires_in: 0
219
255
  ```
220
256
 
221
- ## Errors
257
+ ## Handling errors
222
258
 
223
259
  If an error occurs with [Jahuty's API](https://docs.jahuty.com/api#errors), a `Jahuty::Exception::Error` will be raised:
224
260
 
@@ -20,10 +20,11 @@ module Jahuty
20
20
  def send(request)
21
21
  @client ||= Faraday.new(url: ::Jahuty::BASE_URI, headers: headers)
22
22
 
23
+ # Cnvert the action's string method to Faraday's verb-based methods.
23
24
  @client.send(
24
25
  request.method.to_sym,
25
26
  request.path,
26
- { params: request.params }
27
+ request.params
27
28
  )
28
29
  end
29
30
 
data/lib/jahuty/client.rb CHANGED
@@ -5,11 +5,12 @@ require 'mini_cache'
5
5
  module Jahuty
6
6
  # Executes requests against Jahuty's API and returns resources.
7
7
  class Client
8
- def initialize(api_key:, cache: nil, expires_in: nil)
9
- @api_key = api_key
10
- @cache = Cache::Facade.new(cache || ::MiniCache::Store.new)
8
+ def initialize(api_key:, cache: nil, expires_in: nil, prefer_latest: false)
9
+ @api_key = api_key
10
+ @cache = Cache::Facade.new(cache || ::MiniCache::Store.new)
11
11
  @expires_in = expires_in
12
- @services = {}
12
+ @services = {}
13
+ @prefer_latest = prefer_latest
13
14
  end
14
15
 
15
16
  # Allows services to be accessed as properties (e.g., jahuty.snippets).
@@ -17,7 +18,7 @@ module Jahuty
17
18
  if args.empty? && name == :snippets
18
19
  unless @services.key?(name)
19
20
  @services[name] = Service::Snippet.new(
20
- client: self, cache: @cache, expires_in: @expires_in
21
+ client: self, cache: @cache, expires_in: @expires_in, prefer_latest: @prefer_latest
21
22
  )
22
23
  end
23
24
  @services[name]
@@ -18,7 +18,7 @@ module Jahuty
18
18
  raise ArgumentError.new, 'Key :type missing' unless data.key?(:type)
19
19
  raise ArgumentError.new, 'Key :detail missing' unless data.key?(:detail)
20
20
 
21
- Problem.new(data.slice(:status, :type, :detail))
21
+ Problem.new(**data.slice(:status, :type, :detail))
22
22
  end
23
23
  end
24
24
  end
@@ -15,7 +15,7 @@ module Jahuty
15
15
  raise ArgumentError.new, 'Key :content missing' unless data.key?(:content)
16
16
  raise ArgumentError.new, 'Key :snippet_id missing' unless data.key?(:snippet_id)
17
17
 
18
- Render.new(data.slice(:content, :snippet_id))
18
+ Render.new(**data.slice(:content, :snippet_id))
19
19
  end
20
20
 
21
21
  def to_s
@@ -13,9 +13,9 @@ module Jahuty
13
13
 
14
14
  @resources ||= ::Jahuty::Resource::Factory.new
15
15
 
16
- if collection?(action, payload)
16
+ if collection?(payload)
17
17
  payload.map { |data| @resources.call resource_name, data }
18
- elsif resource?(action, payload)
18
+ elsif resource?(payload)
19
19
  @resources.call resource_name, payload
20
20
  else
21
21
  raise ArgumentError, 'Action and payload mismatch'
@@ -24,8 +24,8 @@ module Jahuty
24
24
 
25
25
  private
26
26
 
27
- def collection?(action, payload)
28
- action.is_a?(Action::Index) && payload.is_a?(::Array)
27
+ def collection?(payload)
28
+ payload.is_a?(::Array)
29
29
  end
30
30
 
31
31
  def name_resource(action, response)
@@ -47,8 +47,8 @@ module Jahuty
47
47
  (response.status < 200 || response.status >= 300)
48
48
  end
49
49
 
50
- def resource?(action, payload)
51
- !action.is_a?(Action::Index) && payload.is_a?(::Object)
50
+ def resource?(payload)
51
+ payload.is_a?(::Object)
52
52
  end
53
53
 
54
54
  def success?(response)
@@ -4,32 +4,31 @@ module Jahuty
4
4
  module Service
5
5
  # A service for interacting with snippets.
6
6
  class Snippet < Base
7
- def initialize(client:, cache:, expires_in: nil)
7
+ def initialize(client:, cache:, expires_in: nil, prefer_latest: false)
8
8
  super(client: client)
9
9
 
10
10
  @cache = cache
11
11
  @expires_in = expires_in
12
+ @prefer_latest = prefer_latest
12
13
  end
13
14
 
14
- def all_renders(tag, params: {}, expires_in: nil)
15
- renders = index_renders tag: tag, params: params
15
+ def all_renders(tag, params: {}, expires_in: @expires_in, prefer_latest: @prefer_latest)
16
+ renders = index_renders tag: tag, params: params, prefer_latest: prefer_latest
16
17
 
17
- cache_renders renders: renders, params: params, expires_in: expires_in
18
+ cache_renders renders: renders, params: params, expires_in: expires_in, latest: prefer_latest
18
19
 
19
20
  renders
20
21
  end
21
22
 
22
- def render(snippet_id, params: {}, expires_in: nil)
23
- expires_in ||= @expires_in
23
+ def render(snippet_id, params: {}, expires_in: @expires_in, prefer_latest: @prefer_latest, location: nil)
24
+ key = cache_key snippet_id: snippet_id, params: params, latest: prefer_latest
24
25
 
25
- key = cache_key snippet_id: snippet_id, params: params
26
-
27
- render = @cache.read(key)
26
+ render = @cache.read key
28
27
 
29
28
  @cache.delete key unless render.nil? || cacheable?(expires_in)
30
29
 
31
30
  if render.nil?
32
- render = show_render snippet_id: snippet_id, params: params
31
+ render = show_render snippet_id: snippet_id, params: params, prefer_latest: prefer_latest, location: location
33
32
 
34
33
  @cache.write key, render, expires_in: expires_in if cacheable?(expires_in)
35
34
  end
@@ -39,16 +38,17 @@ module Jahuty
39
38
 
40
39
  private
41
40
 
42
- def cache_key(snippet_id:, params: {})
41
+ def cache_key(snippet_id:, params: {}, latest: false)
43
42
  fingerprint = Digest::MD5.new
44
43
  fingerprint << "snippets/#{snippet_id}/render/"
45
44
  fingerprint << params.to_json
45
+ fingerprint << '/latest' if latest
46
46
 
47
47
  "jahuty_#{fingerprint.hexdigest}"
48
48
  end
49
49
 
50
- def cache_renders(renders:, params:, expires_in: nil)
51
- expires_in ||= @expires_in
50
+ def cache_renders(renders:, params:, expires_in: @expires_in, latest: false)
51
+ return if renders.nil?
52
52
 
53
53
  return unless cacheable?(expires_in)
54
54
 
@@ -58,7 +58,7 @@ module Jahuty
58
58
  local_params = params[render.snippet_id.to_s] || {}
59
59
  render_params = ::Jahuty::Util.deep_merge global_params, local_params
60
60
 
61
- key = cache_key snippet_id: render.snippet_id, params: render_params
61
+ key = cache_key snippet_id: render.snippet_id, params: render_params, latest: latest
62
62
 
63
63
  @cache.write key, render, expires_in: expires_in
64
64
  end
@@ -68,9 +68,10 @@ module Jahuty
68
68
  expires_in.nil? || expires_in.positive?
69
69
  end
70
70
 
71
- def index_renders(tag:, params: {})
71
+ def index_renders(tag:, params: {}, prefer_latest: false)
72
72
  request_params = { tag: tag }
73
73
  request_params[:params] = params.to_json unless params.empty?
74
+ request_params[:latest] = 1 if prefer_latest
74
75
 
75
76
  action = ::Jahuty::Action::Index.new(
76
77
  resource: 'render',
@@ -80,9 +81,11 @@ module Jahuty
80
81
  @client.request action
81
82
  end
82
83
 
83
- def show_render(snippet_id:, params: {})
84
+ def show_render(snippet_id:, params: {}, prefer_latest: false, location: nil)
84
85
  request_params = {}
85
86
  request_params[:params] = params.to_json unless params.empty?
87
+ request_params[:latest] = 1 if prefer_latest
88
+ request_params[:location] = location unless location.nil?
86
89
 
87
90
  action = ::Jahuty::Action::Show.new(
88
91
  id: snippet_id,
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Jahuty
4
- VERSION = '3.2.0'
4
+ VERSION = '3.4.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jahuty
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.0
4
+ version: 3.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jack Clayton
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-03-09 00:00:00.000000000 Z
11
+ date: 2021-07-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -108,6 +108,20 @@ dependencies:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
110
  version: '1.7'
111
+ - !ruby/object:Gem::Dependency
112
+ name: rubocop-packaging
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: '0.5'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: '0.5'
111
125
  - !ruby/object:Gem::Dependency
112
126
  name: rubocop-performance
113
127
  requirement: !ruby/object:Gem::Requirement
@@ -185,18 +199,9 @@ executables: []
185
199
  extensions: []
186
200
  extra_rdoc_files: []
187
201
  files:
188
- - ".circleci/config.yml"
189
- - ".gitignore"
190
- - ".rspec"
191
- - ".rubocop.yml"
192
202
  - CHANGELOG.md
193
- - Gemfile
194
203
  - LICENSE
195
204
  - README.md
196
- - Rakefile
197
- - bin/console
198
- - bin/setup
199
- - jahuty.gemspec
200
205
  - lib/jahuty.rb
201
206
  - lib/jahuty/action/base.rb
202
207
  - lib/jahuty/action/index.rb
@@ -223,13 +228,13 @@ metadata:
223
228
  homepage_uri: https://www.jahuty.com
224
229
  source_code_uri: https://github.com/jahuty/jahuty-ruby
225
230
  changelog_uri: https://github.com/jahuty/jahuty-ruby/blob/master/CHANGELOG.md
226
- post_install_message:
231
+ post_install_message:
227
232
  rdoc_options: []
228
233
  require_paths:
229
234
  - lib
230
235
  required_ruby_version: !ruby/object:Gem::Requirement
231
236
  requirements:
232
- - - "~>"
237
+ - - ">="
233
238
  - !ruby/object:Gem::Version
234
239
  version: '2.6'
235
240
  required_rubygems_version: !ruby/object:Gem::Requirement
@@ -238,8 +243,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
238
243
  - !ruby/object:Gem::Version
239
244
  version: '0'
240
245
  requirements: []
241
- rubygems_version: 3.1.4
242
- signing_key:
246
+ rubygems_version: 3.2.22
247
+ signing_key:
243
248
  specification_version: 4
244
249
  summary: Jahuty's Ruby SDK.
245
250
  test_files: []
data/.circleci/config.yml DELETED
@@ -1,33 +0,0 @@
1
- version: 2.1
2
- orbs:
3
- ruby: circleci/ruby@0.1.2
4
- codecov: codecov/codecov@1.1.3
5
- jobs:
6
- build:
7
- docker:
8
- - image: circleci/ruby:2.6.3-stretch-node
9
- executor: ruby/default
10
- steps:
11
- - checkout
12
- - run:
13
- name: Update bundler
14
- command: gem install bundler
15
- - run:
16
- name: Which bundler?
17
- command: bundle -v
18
- - ruby/bundle-install
19
- - run:
20
- name: Run rubocop
21
- command: bundle exec rake rubocop
22
- - run:
23
- name: Run specs
24
- command: |
25
- bundle exec rspec --profile 10 \
26
- --format RspecJunitFormatter \
27
- --out test_results/rspec.xml \
28
- --format progress \
29
- $(circleci tests glob "spec/**/*_spec.rb" | circleci tests split --split-by=timings)
30
- - store_test_results:
31
- path: test_results
32
- - codecov/upload:
33
- file: ./coverage/coverage.xml
data/.gitignore DELETED
@@ -1,45 +0,0 @@
1
- *.gem
2
- *.rbc
3
- /.config
4
- /coverage/
5
- /InstalledFiles
6
- /pkg/
7
- /spec/reports/
8
- /spec/examples.txt
9
- /test/tmp/
10
- /test/version_tmp/
11
- /tmp/
12
-
13
- # RSpec artifacts
14
- .rspec_status
15
-
16
- # Used by dotenv library to load environment variables.
17
- .env
18
-
19
- ## Specific to RubyMotion:
20
- .dat*
21
- .repl_history
22
- build/
23
- *.bridgesupport
24
- build-iPhoneOS/
25
- build-iPhoneSimulator/
26
-
27
- ## Documentation cache and generated files:
28
- /.yardoc/
29
- /_yardoc/
30
- /doc/
31
- /rdoc/
32
-
33
- ## Environment normalization:
34
- /.bundle/
35
- /vendor/bundle
36
- /lib/bundler/man/
37
-
38
- # for a library or gem, you might want to ignore these files since the code is
39
- # intended to run in multiple environments; otherwise, check them in:
40
- Gemfile.lock
41
- .ruby-version
42
- .ruby-gemset
43
-
44
- # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
45
- .rvmrc
data/.rspec DELETED
@@ -1,3 +0,0 @@
1
- --format documentation
2
- --color
3
- --require spec_helper
data/.rubocop.yml DELETED
@@ -1,15 +0,0 @@
1
- require:
2
- - rubocop-performance
3
- - rubocop-rspec
4
- AllCops:
5
- TargetRubyVersion: 2.6
6
- NewCops: enable
7
- Metrics/BlockLength:
8
- Exclude:
9
- - 'jahuty.gemspec'
10
- - 'Rakefile'
11
- - '**/*.rake'
12
- - 'spec/**/*.rb'
13
- Metrics/ModuleLength:
14
- Exclude:
15
- - 'spec/**/*.rb'
data/Gemfile DELETED
@@ -1,6 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- source 'https://rubygems.org'
4
-
5
- # Specify your gem's dependencies in jahuty.gemspec
6
- gemspec
data/Rakefile DELETED
@@ -1,14 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'bundler/gem_tasks'
4
- require 'rspec/core/rake_task'
5
- require 'rubocop/rake_task'
6
-
7
- RSpec::Core::RakeTask.new(:spec)
8
-
9
- task default: :spec
10
-
11
- RuboCop::RakeTask.new do |task|
12
- task.requires << 'rubocop-performance'
13
- task.requires << 'rubocop-rspec'
14
- end
data/bin/console DELETED
@@ -1,15 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- require 'bundler/setup'
5
- require 'jahuty/snippets'
6
-
7
- # You can add fixtures and/or initialization code here to make experimenting
8
- # with your gem easier. You can also use a different console, if you like.
9
-
10
- # (If you use this, don't forget to add pry to your Gemfile!)
11
- # require "pry"
12
- # Pry.start
13
-
14
- require 'irb'
15
- IRB.start(__FILE__)
data/bin/setup DELETED
@@ -1,10 +0,0 @@
1
- #!/usr/bin/env bash
2
- # frozen_string_literal: true
3
-
4
- set -euo pipefail
5
- IFS=$'\n\t'
6
- set -vx
7
-
8
- bundle install
9
-
10
- # Do any other automated setup that you need to do here
data/jahuty.gemspec DELETED
@@ -1,47 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- lib = File.expand_path('lib', __dir__)
4
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
-
6
- require 'jahuty/version'
7
-
8
- Gem::Specification.new do |spec|
9
- spec.name = 'jahuty'
10
- spec.version = Jahuty::VERSION
11
- spec.authors = ['Jack Clayton']
12
- spec.email = ['jack@jahuty.com']
13
-
14
- spec.summary = 'Jahuty\'s Ruby SDK.'
15
- spec.description = 'Turn any page into a content-managed page.'
16
- spec.homepage = 'https://www.jahuty.com'
17
- spec.license = 'MIT'
18
-
19
- spec.metadata['allowed_push_host'] = 'https://rubygems.org'
20
-
21
- spec.metadata['homepage_uri'] = spec.homepage
22
- spec.metadata['source_code_uri'] = 'https://github.com/jahuty/jahuty-ruby'
23
- spec.metadata['changelog_uri'] = 'https://github.com/jahuty/jahuty-ruby/blob/master/CHANGELOG.md'
24
-
25
- spec.files = Dir.chdir(File.expand_path(__dir__)) do
26
- `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
27
- end
28
- spec.bindir = 'exe'
29
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
30
- spec.require_paths = ['lib']
31
-
32
- spec.required_ruby_version = '~> 2.6'
33
-
34
- spec.add_dependency 'faraday', '~> 1.0'
35
- spec.add_dependency 'mini_cache', '~> 1.1'
36
-
37
- spec.add_development_dependency 'bundler', '~> 2.0'
38
- spec.add_development_dependency 'rake', '~> 12.3'
39
- spec.add_development_dependency 'rspec', '~> 3.0'
40
- spec.add_development_dependency 'rspec_junit_formatter', '~>0.4'
41
- spec.add_development_dependency 'rubocop', '~> 1.7'
42
- spec.add_development_dependency 'rubocop-performance', '~> 1.9'
43
- spec.add_development_dependency 'rubocop-rspec', '~> 2.1'
44
- spec.add_development_dependency 'simplecov', '~>0.20'
45
- spec.add_development_dependency 'simplecov-cobertura', '~> 1.4'
46
- spec.add_development_dependency 'webmock', '~> 3.11'
47
- end