Skip to content

Commit 3a02c74

Browse files
committed
update
1 parent e61fc90 commit 3a02c74

File tree

10 files changed

+224
-4
lines changed

10 files changed

+224
-4
lines changed

.rubocop.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
---
22

3-
require:
3+
plugins:
44
- rubocop-performance
5+
- rubocop-rake
56

67
AllCops:
78
NewCops: enable
89
TargetRubyVersion: 3.0
10+
11+
Style/Documentation:
12+
Enabled: false

Gemfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ gemspec
88
gem 'rake', '~> 12.0'
99

1010
group :development do
11+
gem 'minitest-power_assert'
1112
gem 'rubocop'
1213
gem 'rubocop-performance'
1314
gem 'rubocop-rails'

Gemfile.lock

Lines changed: 166 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,166 @@
1+
PATH
2+
remote: .
3+
specs:
4+
sample_gem (0.1.0)
5+
minitest-power_assert
6+
7+
GEM
8+
remote: https://rubygems.org/
9+
specs:
10+
activesupport (8.0.2)
11+
base64
12+
benchmark (>= 0.3)
13+
bigdecimal
14+
concurrent-ruby (~> 1.0, >= 1.3.1)
15+
connection_pool (>= 2.2.5)
16+
drb
17+
i18n (>= 1.6, < 2)
18+
logger (>= 1.4.2)
19+
minitest (>= 5.1)
20+
securerandom (>= 0.3)
21+
tzinfo (~> 2.0, >= 2.0.5)
22+
uri (>= 0.13.1)
23+
ast (2.4.3)
24+
backport (1.2.0)
25+
base64 (0.2.0)
26+
benchmark (0.4.0)
27+
bigdecimal (3.1.9)
28+
concurrent-ruby (1.3.5)
29+
connection_pool (2.5.0)
30+
diff-lcs (1.6.1)
31+
drb (2.2.1)
32+
i18n (1.14.7)
33+
concurrent-ruby (~> 1.0)
34+
jaro_winkler (1.6.0)
35+
json (2.10.2)
36+
kramdown (2.5.1)
37+
rexml (>= 3.3.9)
38+
kramdown-parser-gfm (1.1.0)
39+
kramdown (~> 2.0)
40+
language_server-protocol (3.17.0.4)
41+
lint_roller (1.1.0)
42+
logger (1.7.0)
43+
minitest (5.25.5)
44+
minitest-power_assert (0.3.1)
45+
minitest
46+
power_assert (>= 1.1)
47+
nokogiri (1.18.7-aarch64-linux-gnu)
48+
racc (~> 1.4)
49+
nokogiri (1.18.7-aarch64-linux-musl)
50+
racc (~> 1.4)
51+
nokogiri (1.18.7-arm-linux-gnu)
52+
racc (~> 1.4)
53+
nokogiri (1.18.7-arm-linux-musl)
54+
racc (~> 1.4)
55+
nokogiri (1.18.7-arm64-darwin)
56+
racc (~> 1.4)
57+
nokogiri (1.18.7-x86_64-darwin)
58+
racc (~> 1.4)
59+
nokogiri (1.18.7-x86_64-linux-gnu)
60+
racc (~> 1.4)
61+
nokogiri (1.18.7-x86_64-linux-musl)
62+
racc (~> 1.4)
63+
observer (0.1.2)
64+
ostruct (0.6.1)
65+
parallel (1.26.3)
66+
parser (3.3.7.4)
67+
ast (~> 2.4.1)
68+
racc
69+
power_assert (2.0.5)
70+
prism (1.4.0)
71+
racc (1.8.1)
72+
rack (3.1.12)
73+
rainbow (3.1.1)
74+
rake (12.3.3)
75+
rbs (3.9.2)
76+
logger
77+
regexp_parser (2.10.0)
78+
reverse_markdown (3.0.0)
79+
nokogiri
80+
rexml (3.4.1)
81+
rubocop (1.75.2)
82+
json (~> 2.3)
83+
language_server-protocol (~> 3.17.0.2)
84+
lint_roller (~> 1.1.0)
85+
parallel (~> 1.10)
86+
parser (>= 3.3.0.2)
87+
rainbow (>= 2.2.2, < 4.0)
88+
regexp_parser (>= 2.9.3, < 3.0)
89+
rubocop-ast (>= 1.44.0, < 2.0)
90+
ruby-progressbar (~> 1.7)
91+
unicode-display_width (>= 2.4.0, < 4.0)
92+
rubocop-ast (1.44.0)
93+
parser (>= 3.3.7.2)
94+
prism (~> 1.4)
95+
rubocop-performance (1.25.0)
96+
lint_roller (~> 1.1)
97+
rubocop (>= 1.75.0, < 2.0)
98+
rubocop-ast (>= 1.38.0, < 2.0)
99+
rubocop-rails (2.31.0)
100+
activesupport (>= 4.2.0)
101+
lint_roller (~> 1.1)
102+
rack (>= 1.1)
103+
rubocop (>= 1.75.0, < 2.0)
104+
rubocop-ast (>= 1.38.0, < 2.0)
105+
rubocop-rake (0.7.1)
106+
lint_roller (~> 1.1)
107+
rubocop (>= 1.72.1)
108+
rubocop-rspec (3.5.0)
109+
lint_roller (~> 1.1)
110+
rubocop (~> 1.72, >= 1.72.1)
111+
ruby-progressbar (1.13.0)
112+
securerandom (0.4.1)
113+
solargraph (0.53.4)
114+
backport (~> 1.2)
115+
benchmark
116+
bundler (~> 2.0)
117+
diff-lcs (~> 1.4)
118+
jaro_winkler (~> 1.6)
119+
kramdown (~> 2.3)
120+
kramdown-parser-gfm (~> 1.1)
121+
logger (~> 1.6)
122+
observer (~> 0.1)
123+
ostruct (~> 0.6)
124+
parser (~> 3.0)
125+
rbs (~> 3.3)
126+
reverse_markdown (>= 2.0, < 4)
127+
rubocop (~> 1.38)
128+
thor (~> 1.0)
129+
tilt (~> 2.0)
130+
yard (~> 0.9, >= 0.9.24)
131+
yard-solargraph (~> 0.1)
132+
thor (1.3.2)
133+
tilt (2.6.0)
134+
tzinfo (2.0.6)
135+
concurrent-ruby (~> 1.0)
136+
unicode-display_width (3.1.4)
137+
unicode-emoji (~> 4.0, >= 4.0.4)
138+
unicode-emoji (4.0.4)
139+
uri (1.0.3)
140+
yard (0.9.37)
141+
yard-solargraph (0.1.0)
142+
yard (~> 0.9)
143+
144+
PLATFORMS
145+
aarch64-linux-gnu
146+
aarch64-linux-musl
147+
arm-linux-gnu
148+
arm-linux-musl
149+
arm64-darwin
150+
x86_64-darwin
151+
x86_64-linux-gnu
152+
x86_64-linux-musl
153+
154+
DEPENDENCIES
155+
minitest-power_assert
156+
rake (~> 12.0)
157+
rubocop
158+
rubocop-performance
159+
rubocop-rails
160+
rubocop-rake
161+
rubocop-rspec
162+
sample_gem!
163+
solargraph
164+
165+
BUNDLED WITH
166+
2.6.3

Makefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,8 @@ lint:
66

77
lint-fix:
88
bundle exec rubocop -A
9+
10+
test:
11+
bundle exec rake test
12+
13+
.PHONY: test

Rakefile

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,13 @@
11
# frozen_string_literal: true
22

33
require 'bundler/gem_tasks'
4-
task default: :spec
4+
require 'rake/testtask'
5+
6+
Rake::TestTask.new(:test) do |t|
7+
t.libs << 'test'
8+
t.libs << 'lib'
9+
t.test_files = FileList['test/**/*_test.rb']
10+
t.verbose = true
11+
end
12+
13+
task default: %i[test]

bin/run

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/usr/bin/env ruby
2+
# frozen_string_literal: true
3+
4+
require 'bundler/setup'
5+
require 'sample_gem'
6+
7+
puts 'Enter the number:'
8+
number = gets.chomp.to_i
9+
10+
user = SampleGem.half(number)
11+
12+
puts user.inspect

lib/sample_gem.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
require 'sample_gem/version'
44

55
module SampleGem
6-
class Error < StandardError; end
7-
# Your code goes here...
6+
def self.half(num)
7+
num / 2
8+
end
89
end

sample_gem.gemspec

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,7 @@ Gem::Specification.new do |spec|
2424
spec.bindir = 'exe'
2525
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
2626
spec.require_paths = ['lib']
27+
spec.metadata['rubygems_mfa_required'] = 'true'
28+
29+
spec.add_dependency 'minitest-power_assert'
2730
end

test/sample_gem_test.rb

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# frozen_string_literal: true
2+
3+
require 'minitest/autorun'
4+
require 'minitest/power_assert'
5+
require 'sample_gem'
6+
7+
class SampleGemTest < Minitest::Test
8+
def test_half
9+
assert { SampleGem.half(10) == 5 }
10+
assert { SampleGem.half(0).zero? }
11+
assert { SampleGem.half(-10) == 5 }
12+
end
13+
end

test/test_helper.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# frozen_string_literal: true
2+
3+
Dir[File.expand_path('../lib/**/*.rb', __dir__)].each { |file| require file }
4+
5+
require 'minitest/autorun'
6+
require 'minitest/power_assert'

0 commit comments

Comments
 (0)