Skip to content

Commit

Permalink
Merge pull request #63 from paul/maintenance
Browse files Browse the repository at this point in the history
Maintenance
  • Loading branch information
paul authored May 28, 2024
2 parents 1f7880c + 634b3ab commit 86c3ad2
Show file tree
Hide file tree
Showing 10 changed files with 62 additions and 67 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/danger.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Run Danger on PRs

on:
pull_request:
types: [opened, synchronize]

jobs:
danger:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
- run: bundle exec danger
env:
DANGER_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
32 changes: 0 additions & 32 deletions .github/workflows/pronto.yml

This file was deleted.

23 changes: 11 additions & 12 deletions .github/workflows/rspec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,19 @@ jobs:
strategy:
matrix:
ruby:
- 2.4.x
- 2.5.x
- 2.6.x
- 2.7.x
- "2.7"
- "3.0"
- "3.1"
- "3.2"
- "3.3"
- "3.4"
- head
steps:
- uses: actions/checkout@v1
- uses: actions/setup-ruby@v1
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
- name: Install dependencies
run: |
gem install bundler --no-document
bundle install
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
- name: RSpec
run: |
rspec
bundle exec rspec
6 changes: 2 additions & 4 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Layout/HashAlignment:
EnforcedColonStyle: table
Lint/AmbiguousBlockAssociation:
Exclude:
- "spec/**/*" # `expect { }.to change { }` is fine
- "spec/**/*" # `expect { }.to change { }` is fine
Lint/ShadowingOuterLocalVariable:
# Shadowing outer local variables with block parameters is often useful to
# not reinvent a new name for the same thing, it highlights the relation
Expand All @@ -37,7 +37,7 @@ Metrics/BlockLength:
- Guardfile
- shared_context
- feature
ExcludedMethods:
AllowedMethods:
- configure
- context
- define
Expand Down Expand Up @@ -83,8 +83,6 @@ Style/SymbolArray:
MinSize: 4

# Rspec
Capybara/FeatureMethods:
Enabled: false
RSpec/ContextWording:
Enabled: false
RSpec/DescribeClass:
Expand Down
1 change: 1 addition & 0 deletions .ruby-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.3.0
6 changes: 6 additions & 0 deletions Dangerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# frozen_string_literal: true

# vi: ft=ruby

github.dismiss_out_of_range_messages
rubocop.lint inline_comment: true
11 changes: 11 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,14 @@
source "https://rubygems.org"

gemspec

group :development, :test do
gem "rake"
gem "reek"
gem "rspec"
gem "rubocop"
gem "rubocop-rspec"
gem "timecop"

gem "danger-rubocop", "~> 0.13.0"
end
20 changes: 11 additions & 9 deletions lib/progress_bar.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ def initialize(*args)
def increment!(count = 1)
@count += count
now = ::Time.now
if (now - @last_write) > 0.2 || @count >= max
write
@last_write = now
end
return unless (now - @last_write) > 0.2 || @count >= max

write
@last_write = now
end

def puts(text)
Expand Down Expand Up @@ -93,7 +93,7 @@ def print(str)
end

def clear!
print "\r" + " " * terminal_width + "\r"
print "\r" + (" " * terminal_width) + "\r"
end

def render(meter)
Expand Down Expand Up @@ -152,12 +152,13 @@ def bar_width

def non_bar_width
meters.reject { |meter| meter == :bar }.inject(0) do |width, meter|
width += width_of(meter) + 1
width + width_of(meter) + 1
end
end

def counter_width # [ 1/100]
max_width * 2 + 3
# [ 1/100]
def counter_width
(max_width * 2) + 3
end

def percentage_width
Expand All @@ -176,7 +177,8 @@ def eta_width
format_interval(eta).length + 2
end

def rate_width # [ 23.45/s]
# [ 23.45/s]
def rate_width
render_rate.length
end

Expand Down
11 changes: 2 additions & 9 deletions progress_bar.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,11 @@ Gem::Specification.new do |s|

s.required_ruby_version = ">= 2.4.0"

s.add_dependency("highline", [">= 1.6", "< 3"])
s.add_dependency("highline", ">= 1.6")
s.add_dependency("options", "~> 2.3.0")

s.add_development_dependency("rake")
s.add_development_dependency("reek")
s.add_development_dependency("rspec")
s.add_development_dependency("rubocop")
s.add_development_dependency("rubocop-rspec")
s.add_development_dependency("timecop")

s.files = `git ls-files`.split("\n")
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
s.require_paths = ["lib"]
s.metadata["rubygems_mfa_required"] = "true"
end
2 changes: 1 addition & 1 deletion spec/with_progress_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

it "should give Enumerator" do
enum = (1..20).each_with_progress
expect(enum).to be_kind_of(Enumerator)
expect(enum).to be_a(Enumerator)
expect(bar.max).to eq 20
expect(bar.count).to eq 0

Expand Down

0 comments on commit 86c3ad2

Please sign in to comment.