okay 9.0.0 → 12.0.1
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 +4 -4
- data/README.md +21 -1
- data/lib/okay/graphql.rb +5 -1
- data/lib/okay/http.rb +23 -5
- data/lib/okay/simple_opts.rb +31 -0
- data/lib/okay/version.rb +1 -1
- data/okay.gemspec +11 -4
- metadata +8 -47
- data/.github_changelog_generator +0 -2
- data/.gitignore +0 -12
- data/.rspec +0 -2
- data/.rubocop.yml +0 -223
- data/.travis.yml +0 -25
- data/CODE_OF_CONDUCT.md +0 -74
- data/Gemfile +0 -6
- data/Rakefile +0 -8
- data/bin/console +0 -14
- data/bin/setup +0 -8
- data/examples/github-graphql-example.rb +0 -11
- data/examples/github-graphql-intentional-failure-example.rb +0 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8d00ba14dec86133bf583190685d2df4145dad9bcc741b9934a6f1deed7efdbc
|
4
|
+
data.tar.gz: 9f2997054914a1df28dbc968f3d0d7f950253b572dfbc9e7981d0c4847e61978
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2bc3352be68702f3dda8c9c214103c75bbd39b4def0592d0b5797c744e1b18f7bf9ae0975aa267cf4b7c49415536f3e23b55a9a76c99537995bc2af717be0d8a
|
7
|
+
data.tar.gz: 1460955b26d90c22373590a5a6573e5696c5ca8d023a1403f532b60729d48d14d44a1608bf4c761bff482d12c400b7bb9d64bc8c09d8b434c1aea4755f368b12
|
data/README.md
CHANGED
@@ -43,7 +43,7 @@ Or install it yourself as:
|
|
43
43
|
### HTTP
|
44
44
|
|
45
45
|
* `GET` and `POST` requests supported.
|
46
|
-
* TLS is
|
46
|
+
* TLS is used automatically for HTTPS URLs.
|
47
47
|
* Does not handle HTTP 307 redirects correctly. (Because it changes it to a GET
|
48
48
|
request.)
|
49
49
|
|
@@ -108,6 +108,26 @@ response.body.from_json
|
|
108
108
|
|
109
109
|
```
|
110
110
|
|
111
|
+
### Template Engine
|
112
|
+
|
113
|
+
Okay also provides a basic templating engine.
|
114
|
+
|
115
|
+
It is literally just a wrapper around `Kernel.format()` and `Pathname`.
|
116
|
+
|
117
|
+
Assuming a `./templates/example.html` containing: `a %{foo} c %{bar} e`
|
118
|
+
|
119
|
+
```ruby
|
120
|
+
require "okay/template"
|
121
|
+
|
122
|
+
template = Okay::Template.new("./templates/")
|
123
|
+
template.apply("example.html", {foo: "b", bar: "d"}) #=> "a b c d e"
|
124
|
+
```
|
125
|
+
|
126
|
+
### SimpleOpts (OptionParser improvements)
|
127
|
+
|
128
|
+
See the [example usage in
|
129
|
+
HowIs](https://github.com/how-is/how_is/blob/ad81620/lib/how_is/cli.rb#L39-L74).
|
130
|
+
|
111
131
|
## Development
|
112
132
|
|
113
133
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
data/lib/okay/graphql.rb
CHANGED
@@ -17,7 +17,9 @@ module Okay
|
|
17
17
|
# login
|
18
18
|
# }
|
19
19
|
# }
|
20
|
-
#
|
20
|
+
#
|
21
|
+
# token = ENV["DEMO_GITHUB_TOKEN"]
|
22
|
+
# response = request.submit!(:github, {bearer_token: token})
|
21
23
|
# pp JSON.parse(response.body)
|
22
24
|
class GraphQL
|
23
25
|
Container = Struct.new(:value) do
|
@@ -36,6 +38,7 @@ module Okay
|
|
36
38
|
instance_exec(&query)
|
37
39
|
end
|
38
40
|
|
41
|
+
# rubocop:disable Metrics/AbcSize
|
39
42
|
def method_missing(name, *args, **kwargs, &block)
|
40
43
|
query_part = @indent_str + name.to_s
|
41
44
|
if !args.empty? || !kwargs.empty?
|
@@ -59,6 +62,7 @@ module Okay
|
|
59
62
|
|
60
63
|
@query += "#{query_part}\n"
|
61
64
|
end
|
65
|
+
# rubocop:enable Metrics/AbcSize
|
62
66
|
|
63
67
|
def to_s
|
64
68
|
@query
|
data/lib/okay/http.rb
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require "okay/version"
|
4
|
-
require "openssl/better_defaults"
|
5
4
|
require "net/https"
|
6
5
|
require "cacert"
|
7
6
|
|
@@ -66,7 +65,8 @@ module Okay
|
|
66
65
|
# were a form.
|
67
66
|
def self.post(url, data: nil, form_data: nil, headers: {})
|
68
67
|
if !data.nil? && !form_data.nil?
|
69
|
-
raise ArgumentError,
|
68
|
+
raise ArgumentError,
|
69
|
+
"cannot specify data and form_data arguments simultaneously."
|
70
70
|
end
|
71
71
|
|
72
72
|
if form_data.nil?
|
@@ -78,6 +78,8 @@ module Okay
|
|
78
78
|
send_request(:Post, url, nil, body, headers)
|
79
79
|
end
|
80
80
|
|
81
|
+
# rubocop:disable Metrics/AbcSize
|
82
|
+
|
81
83
|
# Helper method for actually creating a request.
|
82
84
|
#
|
83
85
|
# @param http_method [Symbol] A symbol representing the class name for
|
@@ -86,7 +88,8 @@ module Okay
|
|
86
88
|
# @param parameters [Hash, nil] Request parameters (for the query string).
|
87
89
|
# @param body [String, nil] Request body.
|
88
90
|
# @param redirect_limit [Numeric] The maximum number of redirects allowed.
|
89
|
-
def self.send_request(http_method, url, parameters, body, headers,
|
91
|
+
def self.send_request(http_method, url, parameters, body, headers,
|
92
|
+
redirect_limit = DEFAULT_REDIRECT_LIMIT)
|
90
93
|
if redirect_limit <= 0
|
91
94
|
raise RedirectLimitError, "request exceeded redirect limit"
|
92
95
|
end
|
@@ -95,7 +98,9 @@ module Okay
|
|
95
98
|
uri = URI.parse(url)
|
96
99
|
|
97
100
|
# Set the query string for the request.
|
98
|
-
|
101
|
+
unless parameters.nil? || parameters.empty?
|
102
|
+
uri.query = URI.encode_www_form(parameters)
|
103
|
+
end
|
99
104
|
|
100
105
|
options = {
|
101
106
|
# If the URI starts with "https://", enable SSL/TLS.
|
@@ -127,13 +132,26 @@ module Okay
|
|
127
132
|
# Follow a redirect.
|
128
133
|
# Decrements +redirect_limit+ while doing so, to avoid redirect loops.
|
129
134
|
# NOTE: Does not handle HTTP 307. https://httpstatuses.com/307
|
130
|
-
|
135
|
+
new_url = response["location"]
|
136
|
+
if new_url.start_with?("/")
|
137
|
+
new_uri = uri.dup
|
138
|
+
new_uri.path = response["location"]
|
139
|
+
new_url = new_uri.to_s
|
140
|
+
elsif new_url.start_with?(".")
|
141
|
+
new_uri = uri.dup
|
142
|
+
new_uri.path += "/" + response["location"]
|
143
|
+
new_url = new_uri.to_s
|
144
|
+
end
|
145
|
+
send_request(:Get, new_url, parameters, body, headers,
|
146
|
+
redirect_limit - 1)
|
131
147
|
else
|
132
148
|
response
|
133
149
|
end
|
134
150
|
end
|
135
151
|
end
|
136
152
|
|
153
|
+
# rubocop:enable Metrics/AbcSize
|
154
|
+
|
137
155
|
# Make +send_request+ a private method.
|
138
156
|
private_class_method :send_request
|
139
157
|
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "okay/version"
|
4
|
+
require "optparse"
|
5
|
+
|
6
|
+
module Okay
|
7
|
+
##
|
8
|
+
# An OptionParser wrapper providing a few convenience functions.
|
9
|
+
class SimpleOpts < OptionParser
|
10
|
+
def initialize(*args, defaults: nil)
|
11
|
+
super(*args)
|
12
|
+
@okay_options = defaults || {}
|
13
|
+
end
|
14
|
+
|
15
|
+
# simple(..., :a)
|
16
|
+
# simple(..., :b)
|
17
|
+
# ==
|
18
|
+
# options = {}
|
19
|
+
# on(...) { |val| options[:a] = val }
|
20
|
+
# on(...) { |val| options[:b] = val }
|
21
|
+
def simple(*args)
|
22
|
+
key = args.pop
|
23
|
+
on(*args) { |*x| @okay_options[key] = x[0] }
|
24
|
+
end
|
25
|
+
|
26
|
+
def parse(args)
|
27
|
+
parse!(args.dup)
|
28
|
+
@okay_options
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
data/lib/okay/version.rb
CHANGED
data/okay.gemspec
CHANGED
@@ -16,18 +16,25 @@ Gem::Specification.new do |spec|
|
|
16
16
|
spec.homepage = "https://github.com/duckinator/okay"
|
17
17
|
spec.license = "MIT"
|
18
18
|
|
19
|
-
spec.files = `git ls-files -z`.split("\x0").
|
20
|
-
f.match(%r{^(
|
19
|
+
spec.files = `git ls-files -z`.split("\x0").select do |f|
|
20
|
+
f.match(%r{^(README.md|LICENSE.txt|okay.gemspec|lib)})
|
21
21
|
end
|
22
22
|
spec.bindir = "exe"
|
23
23
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
24
24
|
spec.require_paths = ["lib"]
|
25
25
|
|
26
|
-
|
26
|
+
# Okay only supports Ruby versions under "normal maintenance".
|
27
|
+
# This number should be updated when a Ruby version goes into security
|
28
|
+
# maintenance.
|
29
|
+
#
|
30
|
+
# Ruby maintenance info: https://www.ruby-lang.org/en/downloads/branches/
|
31
|
+
#
|
32
|
+
# NOTE: Update Gemfile when this is updated!
|
33
|
+
spec.required_ruby_version = ">= 2.6"
|
34
|
+
|
27
35
|
spec.add_runtime_dependency "cacert"
|
28
36
|
|
29
37
|
spec.add_development_dependency "bundler", "~> 2.0"
|
30
38
|
spec.add_development_dependency "rake", "~> 12.3"
|
31
39
|
spec.add_development_dependency "rspec", "~> 3.8"
|
32
|
-
spec.add_development_dependency "rubocop", "~> 0.49.1"
|
33
40
|
end
|
metadata
CHANGED
@@ -1,29 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: okay
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 12.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ellen Marie Dash
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-09-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: openssl-better_defaults
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - ">="
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '0'
|
20
|
-
type: :runtime
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - ">="
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '0'
|
27
13
|
- !ruby/object:Gem::Dependency
|
28
14
|
name: cacert
|
29
15
|
requirement: !ruby/object:Gem::Requirement
|
@@ -80,20 +66,6 @@ dependencies:
|
|
80
66
|
- - "~>"
|
81
67
|
- !ruby/object:Gem::Version
|
82
68
|
version: '3.8'
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: rubocop
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - "~>"
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: 0.49.1
|
90
|
-
type: :development
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - "~>"
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: 0.49.1
|
97
69
|
description: Okay, minimalist implementations of common utilities in Ruby. E.g., HTTP
|
98
70
|
fetchers.
|
99
71
|
email:
|
@@ -102,24 +74,13 @@ executables: []
|
|
102
74
|
extensions: []
|
103
75
|
extra_rdoc_files: []
|
104
76
|
files:
|
105
|
-
- ".github_changelog_generator"
|
106
|
-
- ".gitignore"
|
107
|
-
- ".rspec"
|
108
|
-
- ".rubocop.yml"
|
109
|
-
- ".travis.yml"
|
110
|
-
- CODE_OF_CONDUCT.md
|
111
|
-
- Gemfile
|
112
77
|
- LICENSE.txt
|
113
78
|
- README.md
|
114
|
-
- Rakefile
|
115
|
-
- bin/console
|
116
|
-
- bin/setup
|
117
|
-
- examples/github-graphql-example.rb
|
118
|
-
- examples/github-graphql-intentional-failure-example.rb
|
119
79
|
- lib/okay.rb
|
120
80
|
- lib/okay/default.rb
|
121
81
|
- lib/okay/graphql.rb
|
122
82
|
- lib/okay/http.rb
|
83
|
+
- lib/okay/simple_opts.rb
|
123
84
|
- lib/okay/template.rb
|
124
85
|
- lib/okay/version.rb
|
125
86
|
- lib/okay/warning_helpers.rb
|
@@ -128,7 +89,7 @@ homepage: https://github.com/duckinator/okay
|
|
128
89
|
licenses:
|
129
90
|
- MIT
|
130
91
|
metadata: {}
|
131
|
-
post_install_message:
|
92
|
+
post_install_message:
|
132
93
|
rdoc_options: []
|
133
94
|
require_paths:
|
134
95
|
- lib
|
@@ -136,15 +97,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
136
97
|
requirements:
|
137
98
|
- - ">="
|
138
99
|
- !ruby/object:Gem::Version
|
139
|
-
version: '
|
100
|
+
version: '2.6'
|
140
101
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
141
102
|
requirements:
|
142
103
|
- - ">="
|
143
104
|
- !ruby/object:Gem::Version
|
144
105
|
version: '0'
|
145
106
|
requirements: []
|
146
|
-
rubygems_version: 3.0.
|
147
|
-
signing_key:
|
107
|
+
rubygems_version: 3.3.0.dev
|
108
|
+
signing_key:
|
148
109
|
specification_version: 4
|
149
110
|
summary: Okay, minimalist implementations of common utilities.
|
150
111
|
test_files: []
|
data/.github_changelog_generator
DELETED
data/.gitignore
DELETED
data/.rspec
DELETED
data/.rubocop.yml
DELETED
@@ -1,223 +0,0 @@
|
|
1
|
-
AllCops:
|
2
|
-
DisplayCopNames: true
|
3
|
-
DisplayStyleGuide: true
|
4
|
-
TargetRubyVersion: 2.4
|
5
|
-
Exclude:
|
6
|
-
- 'okay.gemspec'
|
7
|
-
- 'bin/*'
|
8
|
-
- 'examples/*'
|
9
|
-
- '**/*~'
|
10
|
-
- 'spec/capture_warnings.rb'
|
11
|
-
|
12
|
-
# Exceptions should inherit from StandardError.
|
13
|
-
# (RuboCop default is to inherit from RuntimeError.)
|
14
|
-
Lint/InheritException:
|
15
|
-
EnforcedStyle: standard_error
|
16
|
-
|
17
|
-
Metrics/AbcSize:
|
18
|
-
Max: 17
|
19
|
-
|
20
|
-
Metrics/BlockLength:
|
21
|
-
Exclude:
|
22
|
-
- 'spec/**/*_spec.rb'
|
23
|
-
|
24
|
-
|
25
|
-
# Getting this back to the default of 100 would be nice,
|
26
|
-
# but the few cases that exceed it don't seem overly concerning.
|
27
|
-
Metrics/ClassLength:
|
28
|
-
Max: 120
|
29
|
-
|
30
|
-
# Still try for 80, but we'll allow 110 because there's a not-insignificant
|
31
|
-
# number of cases where we have long lines.
|
32
|
-
#
|
33
|
-
# It may be worth revisiting this in the future and refactoring those lines.
|
34
|
-
Metrics/LineLength:
|
35
|
-
Max: 120
|
36
|
-
AllowHeredoc: true
|
37
|
-
|
38
|
-
# Too short methods lead to extraction of single-use methods, which can make
|
39
|
-
# the code easier to read (by naming things), but can also clutter the class
|
40
|
-
Metrics/MethodLength:
|
41
|
-
Max: 25
|
42
|
-
|
43
|
-
Metrics/ParameterLists:
|
44
|
-
Max: 6
|
45
|
-
|
46
|
-
Style/Alias:
|
47
|
-
EnforcedStyle: prefer_alias_method
|
48
|
-
|
49
|
-
# Most readable form.
|
50
|
-
Layout/AlignHash:
|
51
|
-
EnforcedHashRocketStyle: table
|
52
|
-
EnforcedColonStyle: table
|
53
|
-
# Disable because it wound up conflicting with a lot of things like:
|
54
|
-
# foo('bar',
|
55
|
-
# baz: 'asdf',
|
56
|
-
# beep: 'boop')
|
57
|
-
#
|
58
|
-
# I suspect these'll disappear when overarching architectural issues are
|
59
|
-
# addressed.
|
60
|
-
Enabled: false
|
61
|
-
|
62
|
-
Layout/AlignParameters:
|
63
|
-
# See Style/AlignedHash.
|
64
|
-
Enabled: false
|
65
|
-
|
66
|
-
# This codebase may be English, but some English words contain diacritics.
|
67
|
-
Style/AsciiComments:
|
68
|
-
Enabled: false
|
69
|
-
|
70
|
-
# Despite the fact that some English words contain diacritics, we want all
|
71
|
-
# method names to be writable by people who don't have an easy way to type
|
72
|
-
# words with diacritics.
|
73
|
-
Style/AsciiIdentifiers:
|
74
|
-
Enabled: true
|
75
|
-
|
76
|
-
# { ... } for multi-line blocks is okay, follow Weirichs rule instead:
|
77
|
-
# https://web.archive.org/web/20140221124509/http://onestepback.org/index.cgi/Tech/Ruby/BraceVsDoEnd.rdoc
|
78
|
-
Style/BlockDelimiters:
|
79
|
-
Enabled: false
|
80
|
-
|
81
|
-
# There's more nuance around this than RuboCop seems capable of.
|
82
|
-
Style/BracesAroundHashParameters:
|
83
|
-
Enabled: false
|
84
|
-
|
85
|
-
# Don't force use of Time or Date; DateTime is okay.
|
86
|
-
Style/DateTime:
|
87
|
-
Enabled: false
|
88
|
-
|
89
|
-
# Unicode is good, mkay?
|
90
|
-
Style/Encoding:
|
91
|
-
Enabled: true
|
92
|
-
|
93
|
-
Style/RedundantSelf:
|
94
|
-
Enabled: false
|
95
|
-
|
96
|
-
# Force Unix line endings.
|
97
|
-
Layout/EndOfLine:
|
98
|
-
Enabled: true
|
99
|
-
EnforcedStyle: lf
|
100
|
-
|
101
|
-
# A lot of the approaches I use for making things readable makes this angry.
|
102
|
-
# E.g., formatting multiple consecutive assignments so that the equal signs
|
103
|
-
# and values line up.
|
104
|
-
#
|
105
|
-
# foobar = 'blah'
|
106
|
-
# baz = 'asdf'
|
107
|
-
# beep = 'boop'
|
108
|
-
Layout/ExtraSpacing:
|
109
|
-
Enabled: false
|
110
|
-
|
111
|
-
# # bad
|
112
|
-
#
|
113
|
-
# format('%<greeting>s', greeting: 'Hello')
|
114
|
-
# format('%s', 'Hello')
|
115
|
-
#
|
116
|
-
# # good
|
117
|
-
#
|
118
|
-
# format('%{greeting}', greeting: 'Hello')
|
119
|
-
Style/FormatStringToken:
|
120
|
-
EnforcedStyle: template
|
121
|
-
|
122
|
-
# Freeze string literals to future-proof the code.
|
123
|
-
Style/FrozenStringLiteralComment:
|
124
|
-
Enabled: true
|
125
|
-
EnforcedStyle: always
|
126
|
-
|
127
|
-
# Mixing hash styles just looks silly.
|
128
|
-
# http://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Style/HashSyntax
|
129
|
-
Style/HashSyntax:
|
130
|
-
EnforcedStyle: no_mixed_keys
|
131
|
-
|
132
|
-
Layout/IndentHash:
|
133
|
-
Enabled: true
|
134
|
-
EnforcedStyle: consistent
|
135
|
-
|
136
|
-
Layout/IndentArray:
|
137
|
-
Enabled: true
|
138
|
-
EnforcedStyle: consistent
|
139
|
-
|
140
|
-
Style/ConditionalAssignment:
|
141
|
-
Enabled: false
|
142
|
-
|
143
|
-
# I deplore assignments in conditions and never want them in any codebase
|
144
|
-
# I have direct control over.
|
145
|
-
Style/ParenthesesAroundCondition:
|
146
|
-
AllowSafeAssignment: false
|
147
|
-
Lint/AssignmentInCondition:
|
148
|
-
AllowSafeAssignment: false
|
149
|
-
|
150
|
-
# Use [] for `%`-literal delimiters (e.g. for %q[]) that RuboCop doesn't define
|
151
|
-
# anything for. (E.g., %q[].)
|
152
|
-
#
|
153
|
-
# The reason I prefer [] instead of () is that most of the time I use
|
154
|
-
# `%`-literals is inside of function calls, and using () makes it blend in too
|
155
|
-
# much.
|
156
|
-
Style/PercentLiteralDelimiters:
|
157
|
-
Enabled: true
|
158
|
-
PreferredDelimiters:
|
159
|
-
default: "[]"
|
160
|
-
'%w': '[]'
|
161
|
-
'%W': '[]'
|
162
|
-
|
163
|
-
# `has_key?` and `has_value?` are clearer than `key?` and `value?`.
|
164
|
-
Style/PreferredHashMethods:
|
165
|
-
Enabled: true
|
166
|
-
EnforcedStyle: verbose
|
167
|
-
|
168
|
-
# do / end blocks should be used for side effects,
|
169
|
-
# methods that run a block for side effects and have
|
170
|
-
# a useful return value are rare, assign the return
|
171
|
-
# value to a local variable for those cases.
|
172
|
-
Style/MethodCalledOnDoEndBlock:
|
173
|
-
Enabled: true
|
174
|
-
|
175
|
-
# Indent method calls relative to the receiver, e.g.:
|
176
|
-
# foo \
|
177
|
-
# .bar \
|
178
|
-
# .baz \
|
179
|
-
# .asdf
|
180
|
-
Layout/MultilineMethodCallIndentation:
|
181
|
-
EnforcedStyle: indented_relative_to_receiver
|
182
|
-
|
183
|
-
# Indenting the chained dots beneath each other is not supported by this cop,
|
184
|
-
# see https://github.com/bbatsov/rubocop/issues/1633
|
185
|
-
Layout/MultilineOperationIndentation:
|
186
|
-
Enabled: false
|
187
|
-
|
188
|
-
# {'foo' => 'bar'} not { 'foo' => 'bar' }
|
189
|
-
Layout/SpaceInsideHashLiteralBraces:
|
190
|
-
Enabled: true
|
191
|
-
EnforcedStyle: no_space
|
192
|
-
|
193
|
-
# I find "foo > 0" more readable than "foo.positive?" personally.
|
194
|
-
Style/NumericPredicate:
|
195
|
-
Enabled: false
|
196
|
-
|
197
|
-
# https://www.rubydoc.info/gems/rubocop/RuboCop/Cop/Style/RegexpLiteral
|
198
|
-
Style/RegexpLiteral:
|
199
|
-
Enabled: false
|
200
|
-
|
201
|
-
# Use double quotes everywhere by default.
|
202
|
-
Style/StringLiterals:
|
203
|
-
EnforcedStyle: double_quotes
|
204
|
-
|
205
|
-
# Prefer [:foo, :bar] over %i[foo bar].
|
206
|
-
Style/SymbolArray:
|
207
|
-
Enabled: true
|
208
|
-
EnforcedStyle: brackets
|
209
|
-
|
210
|
-
# Prefer ["foo", "bar"] over %w[foo bar].
|
211
|
-
Style/WordArray:
|
212
|
-
Enabled: true
|
213
|
-
EnforcedStyle: brackets
|
214
|
-
|
215
|
-
# Require parentheses around complex ternary conditions.
|
216
|
-
Style/TernaryParentheses:
|
217
|
-
Enabled: true
|
218
|
-
EnforcedStyle: require_parentheses_when_complex
|
219
|
-
|
220
|
-
# Require a comma after the last item in an array or hash if each item is on
|
221
|
-
# its own line.
|
222
|
-
Style/TrailingCommaInLiteral:
|
223
|
-
EnforcedStyleForMultiline: comma
|
data/.travis.yml
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
sudo: false
|
2
|
-
language: ruby
|
3
|
-
rvm:
|
4
|
-
- 2.4
|
5
|
-
- 2.5
|
6
|
-
- 2.6
|
7
|
-
- ruby-head
|
8
|
-
|
9
|
-
matrix:
|
10
|
-
allow_failures:
|
11
|
-
- rvm:
|
12
|
-
- ruby-head
|
13
|
-
|
14
|
-
before_install:
|
15
|
-
- gem install bundler
|
16
|
-
|
17
|
-
# See https://bors.tech/documentation/getting-started/
|
18
|
-
branches:
|
19
|
-
only:
|
20
|
-
# This is where pull requests from "bors r+" are built.
|
21
|
-
- staging
|
22
|
-
# This is where pull requests from "bors try" are built.
|
23
|
-
- trying
|
24
|
-
# Build pull requests.
|
25
|
-
- master
|
data/CODE_OF_CONDUCT.md
DELETED
@@ -1,74 +0,0 @@
|
|
1
|
-
# Contributor Covenant Code of Conduct
|
2
|
-
|
3
|
-
## Our Pledge
|
4
|
-
|
5
|
-
In the interest of fostering an open and welcoming environment, we as
|
6
|
-
contributors and maintainers pledge to making participation in our project and
|
7
|
-
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
-
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
-
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
-
orientation.
|
11
|
-
|
12
|
-
## Our Standards
|
13
|
-
|
14
|
-
Examples of behavior that contributes to creating a positive environment
|
15
|
-
include:
|
16
|
-
|
17
|
-
* Using welcoming and inclusive language
|
18
|
-
* Being respectful of differing viewpoints and experiences
|
19
|
-
* Gracefully accepting constructive criticism
|
20
|
-
* Focusing on what is best for the community
|
21
|
-
* Showing empathy towards other community members
|
22
|
-
|
23
|
-
Examples of unacceptable behavior by participants include:
|
24
|
-
|
25
|
-
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
-
advances
|
27
|
-
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
-
* Public or private harassment
|
29
|
-
* Publishing others' private information, such as a physical or electronic
|
30
|
-
address, without explicit permission
|
31
|
-
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
-
professional setting
|
33
|
-
|
34
|
-
## Our Responsibilities
|
35
|
-
|
36
|
-
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
-
behavior and are expected to take appropriate and fair corrective action in
|
38
|
-
response to any instances of unacceptable behavior.
|
39
|
-
|
40
|
-
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
-
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
-
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
-
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
-
threatening, offensive, or harmful.
|
45
|
-
|
46
|
-
## Scope
|
47
|
-
|
48
|
-
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
-
when an individual is representing the project or its community. Examples of
|
50
|
-
representing a project or community include using an official project e-mail
|
51
|
-
address, posting via an official social media account, or acting as an appointed
|
52
|
-
representative at an online or offline event. Representation of a project may be
|
53
|
-
further defined and clarified by project maintainers.
|
54
|
-
|
55
|
-
## Enforcement
|
56
|
-
|
57
|
-
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
-
reported by contacting the project team at me@duckie.co. All
|
59
|
-
complaints will be reviewed and investigated and will result in a response that
|
60
|
-
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
-
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
-
Further details of specific enforcement policies may be posted separately.
|
63
|
-
|
64
|
-
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
-
faith may face temporary or permanent repercussions as determined by other
|
66
|
-
members of the project's leadership.
|
67
|
-
|
68
|
-
## Attribution
|
69
|
-
|
70
|
-
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
-
available at [http://contributor-covenant.org/version/1/4][version]
|
72
|
-
|
73
|
-
[homepage]: http://contributor-covenant.org
|
74
|
-
[version]: http://contributor-covenant.org/version/1/4/
|
data/Gemfile
DELETED
data/Rakefile
DELETED
data/bin/console
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require "bundler/setup"
|
4
|
-
require "okay"
|
5
|
-
|
6
|
-
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
-
# with your gem easier. You can also use a different console, if you like.
|
8
|
-
|
9
|
-
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
-
# require "pry"
|
11
|
-
# Pry.start
|
12
|
-
|
13
|
-
require "irb"
|
14
|
-
IRB.start(__FILE__)
|
data/bin/setup
DELETED