Skip to content

Commit aee8a93

Browse files
committed
Add boilerplate files for the gem.
1 parent a304849 commit aee8a93

13 files changed

+353
-0
lines changed

.hgignore

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
syntax: glob
2+
3+
.bundle/
4+
pkg/
5+
.rspec_status
6+
.swp
7+
Gemfile.lock

.rspec

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
--format documentation
2+
--color
3+
--require spec_helper

.rubocop.yml

+249
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,249 @@
1+
require:
2+
- 'rubocop-rspec'
3+
4+
AllCops:
5+
NewCops: enable
6+
SuggestExtensions: false
7+
8+
9+
# Bundler
10+
11+
Bundler/OrderedGems:
12+
Enabled: false
13+
14+
# Layout
15+
16+
Layout/AccessModifierIndentation:
17+
Enabled: false
18+
19+
Layout/CaseIndentation:
20+
Enabled: true
21+
IndentOneStep: true
22+
23+
Layout/EndOfLine:
24+
Enabled: true
25+
EnforcedStyle: lf
26+
27+
# This cop does not seem to properly detect some alignment spacings.
28+
Layout/ExtraSpacing:
29+
Enabled: false
30+
31+
Layout/FirstArrayElementLineBreak:
32+
Enabled: true
33+
34+
Layout/FirstHashElementIndentation:
35+
Enabled: true
36+
EnforcedStyle: consistent
37+
38+
Layout/FirstHashElementLineBreak:
39+
Enabled: true
40+
41+
Layout/HashAlignment:
42+
Enabled: true
43+
EnforcedHashRocketStyle: table
44+
EnforcedColonStyle: table
45+
EnforcedLastArgumentHashStyle: always_inspect
46+
47+
Layout/IndentationConsistency:
48+
Enabled: true
49+
50+
Layout/IndentationStyle:
51+
Enabled: true
52+
EnforcedStyle: tabs
53+
54+
Layout/IndentationWidth:
55+
Enabled: true
56+
Width: 1
57+
58+
Layout/LeadingEmptyLines:
59+
Enabled: true
60+
61+
Layout/LineLength:
62+
Enabled: false
63+
64+
Layout/SpaceAroundBlockParameters:
65+
Enabled: false
66+
67+
Layout/SpaceAroundEqualsInParameterDefault:
68+
Enabled: true
69+
EnforcedStyle: no_space
70+
71+
Layout/SpaceAroundMethodCallOperator:
72+
Enabled: false
73+
74+
Layout/SpaceAroundOperators:
75+
Enabled: true
76+
AllowForAlignment: true
77+
EnforcedStyleForExponentOperator: no_space
78+
79+
Layout/SpaceBeforeBlockBraces:
80+
Enabled: false
81+
82+
Layout/SpaceBeforeComma:
83+
Enabled: true
84+
85+
Layout/SpaceInsideArrayLiteralBrackets:
86+
Enabled: false
87+
88+
Layout/SpaceInsideBlockBraces:
89+
Enabled: true
90+
EnforcedStyle: space
91+
EnforcedStyleForEmptyBraces: no_space
92+
SpaceBeforeBlockParameters: true
93+
Exclude:
94+
- 'spec/**/*'
95+
96+
Layout/SpaceInsideHashLiteralBraces:
97+
Enabled: false
98+
99+
Layout/SpaceInsideParens:
100+
Enabled: false
101+
102+
Layout/SpaceInsideReferenceBrackets:
103+
Enabled: false
104+
105+
Layout/SpaceInsideStringInterpolation:
106+
Enabled: false
107+
108+
Layout/TrailingEmptyLines:
109+
Enabled: true
110+
EnforcedStyle: final_newline
111+
112+
# Trailing whitespace is actually not wanted, but Rubocop does not have an option to allow indenting empty lines.
113+
Layout/TrailingWhitespace:
114+
Enabled: false
115+
116+
# Lint
117+
118+
Lint/UnusedBlockArgument:
119+
Exclude:
120+
- 'spec/**/*'
121+
122+
Lint/UselessAssignment:
123+
Exclude:
124+
- 'bin/console'
125+
126+
# Naming
127+
128+
# TODO: Decide on a naming scheme or remove this TODO.
129+
Naming/VariableNumber:
130+
Enabled: false
131+
132+
# RSpec
133+
134+
RSpec/ExampleLength:
135+
Enabled: false
136+
137+
RSpec/MessageSpies:
138+
Enabled: true
139+
EnforcedStyle: receive
140+
141+
RSpec/MultipleExpectations:
142+
Enabled: false
143+
144+
RSpec/StubbedMock:
145+
Enabled: false
146+
147+
# Metrics
148+
149+
Metrics/AbcSize:
150+
Enabled: false
151+
152+
Metrics/BlockLength:
153+
Enabled: false
154+
155+
Metrics/BlockNesting:
156+
Enabled: false
157+
158+
Metrics/ClassLength:
159+
Enabled: false
160+
161+
Metrics/CyclomaticComplexity:
162+
Enabled: false
163+
164+
Metrics/MethodLength:
165+
Enabled: false
166+
167+
Metrics/ModuleLength:
168+
Enabled: false
169+
170+
Metrics/ParameterLists:
171+
Enabled: false
172+
173+
Metrics/PerceivedComplexity:
174+
Enabled: false
175+
176+
# RSpec
177+
178+
RSpec/DescribeClass:
179+
Enabled: false
180+
181+
RSpec/DescribedClass:
182+
Enabled: true
183+
EnforcedStyle: explicit
184+
185+
# Style
186+
187+
Style/AccessorGrouping:
188+
Enabled: true
189+
EnforcedStyle: separated
190+
191+
Style/BarePercentLiterals:
192+
Enabled: true
193+
EnforcedStyle: percent_q
194+
195+
Style/Documentation:
196+
Enabled: false
197+
198+
Style/EmptyBlockParameter:
199+
Enabled: false
200+
201+
Style/EmptyElse:
202+
Enabled: true
203+
EnforcedStyle: empty
204+
205+
Style/FrozenStringLiteralComment:
206+
Enabled: false
207+
208+
Style/GuardClause:
209+
Enabled: false
210+
211+
Style/IfUnlessModifier:
212+
Enabled: false
213+
214+
Style/KeywordParametersOrder:
215+
Enabled: false
216+
217+
Style/MultilineBlockChain:
218+
Enabled: false
219+
220+
Style/NegatedIf:
221+
Enabled: false
222+
223+
Style/NegatedIfElseCondition:
224+
Enabled: false
225+
226+
Style/NumericLiterals:
227+
Enabled: false
228+
229+
Style/RaiseArgs:
230+
Enabled: true
231+
EnforcedStyle: exploded
232+
233+
Style/RedundantSelf:
234+
Enabled: false
235+
236+
Style/SafeNavigation:
237+
Enabled: false
238+
239+
Style/SymbolArray:
240+
Enabled: true
241+
EnforcedStyle: brackets
242+
243+
Style/TrailingCommaInArrayLiteral:
244+
Enabled: true
245+
EnforcedStyleForMultiline: comma
246+
247+
Style/TrailingCommaInHashLiteral:
248+
Enabled: true
249+
EnforcedStyleForMultiline: comma

Gemfile

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# frozen_string_literal: true
2+
3+
source 'https://rubygems.org'
4+
5+
gemspec
6+
7+
gem 'rake', '~> 13.0'
8+
gem 'pry'
9+
gem 'pry-byebug'
10+
gem 'rspec', '~> 3.0'
11+
12+
gem 'rubocop', require: false
13+
gem 'rubocop-rspec', require: false

README.adoc

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
== ApiFrame
2+
3+
ApiFrame is a gem that aims to provide an easy-to-use way of implementing high-level and low-level interactions with APIs working over HTTP.
4+
5+
=== Installation
6+
7+
Add the gem `api_frame` as a runtime dependency to your library’s `gemspec`.
8+
9+
=== Development
10+
11+
After checking out the repository, run `bin/setup` to install dependencies.
12+
For an interactive Pry session, run `bin/console`.
13+
Run `rake spec` to run the tests.

Rakefile

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# frozen_string_literal: true
2+
3+
require 'bundler/gem_tasks'
4+
require 'rspec/core/rake_task'
5+
6+
RSpec::Core::RakeTask.new(:spec)
7+
8+
task default: :spec

api_frame.gemspec

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# frozen_string_literal: true
2+
3+
require_relative 'lib/api_frame/version'
4+
5+
Gem::Specification.new do |spec|
6+
spec.name = 'api_frame'
7+
spec.version = ApiFrame::VERSION
8+
spec.authors = ['expeehaa']
9+
spec.email = ['[email protected]']
10+
spec.summary = 'Small framework to define API clients in Ruby'
11+
12+
spec.metadata['allowed_push_host' ] = 'https://rubygems.org'
13+
spec.metadata['rubygems_mfa_required'] = 'true'
14+
15+
spec.files = Dir['lib/**/*.rb', 'README.adoc']
16+
spec.require_paths = ['lib']
17+
18+
spec.required_ruby_version = '>= 2.6.0'
19+
end

bin/console

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/usr/bin/env ruby
2+
# frozen_string_literal: true
3+
4+
require 'bundler/setup'
5+
require 'api_frame'
6+
7+
require 'pry'
8+
Pry.start

bin/setup

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
IFS=$'\n\t'
4+
set -vx
5+
6+
bundle install

lib/api_frame.rb

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
require_relative 'api_frame/version'
2+
3+
module ApiFrame
4+
5+
end

lib/api_frame/version.rb

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module ApiFrame
2+
VERSION = '0.1.0'.freeze
3+
end

spec/api_frame_spec.rb

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
RSpec.describe ApiFrame do
2+
it 'has a version number' do
3+
expect(ApiFrame::VERSION).not_to be_nil
4+
end
5+
end

spec/spec_helper.rb

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
require 'pry'
2+
require 'pry-byebug'
3+
4+
require 'api_frame'
5+
6+
RSpec.configure do |config|
7+
config.example_status_persistence_file_path = '.rspec_status'
8+
9+
config.disable_monkey_patching!
10+
11+
config.expect_with :rspec do |c|
12+
c.syntax = :expect
13+
end
14+
end

0 commit comments

Comments
 (0)