Skip to content

Commit

Permalink
Minor cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
ddnexus committed Aug 3, 2024
1 parent 115b7d7 commit 7f520dc
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 23 deletions.
2 changes: 0 additions & 2 deletions .gitattributes

This file was deleted.

2 changes: 1 addition & 1 deletion .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Pull Requests are welcome!

Here are a few useful information for contributors:
Here are a few useful information for contributing:

1. If you are planning for a complex PR, we suggest that you check before hand whether your
proposed changes are going to be accepted by posting your ideas in
Expand Down
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/Code.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ body:
Please, understand that code issues are reserved for real, reproducible pagy bugs.
_If you are not sure that your problem is actually a bug,
_If you are not sure that your problem is actually a bug, or you have problems reproducing it,
please ask for [support](https://github.com/ddnexus/pagy/discussions/categories/q-a) instead._
- type: checkboxes
Expand All @@ -38,7 +38,7 @@ body:
#### 👍 VALID code files
- Edited copy of a single-file APP from the [Pagy Playground](https://ddnexus.github.io/pagy/playground)
- (Edited) copy of a single-file APP from the [Pagy Playground](https://ddnexus.github.io/pagy/playground)
- Link to a pagy fork containing an added test file
- A plain ruby file that can run as a single command like `ruby my_issue.rb`
_(without any other setup step, installation or guessing, and with no or minimal interaction required)_
Expand Down
8 changes: 4 additions & 4 deletions scripts/bump.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
require_relative 'scripty'

# Abort if the working tree is dirty
Scripty.abort('Working tree dirty!') unless `git status --porcelain`.empty?
abort('Working tree dirty!') unless `git status --porcelain`.empty?

# Prompt for the new version
require_relative '../gem/lib/pagy'
Expand All @@ -15,14 +15,14 @@
new_version = gets.chomp

# Abort if the version is missing
Scripty.abort('Missing new version!') if new_version.empty?
abort('Missing new version!') if new_version.empty?

# Abort if the version is invalid
new_fragments = new_version.split('.')
Scripty.abort('Incomplete semantic version!') if new_fragments.size < 3
abort('Incomplete semantic version!') if new_fragments.size < 3

# Abort if there is no gem change
Scripty.abort("No gem changes since version #{old_version}!") \
abort("No gem changes since version #{old_version}!") \
if `git diff --name-only --relative=gem "#{old_version}"..HEAD`.empty?

# Bump the version in files
Expand Down
22 changes: 8 additions & 14 deletions scripts/scripty.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,6 @@ def ask_and_do(question)
end
module_function :ask_and_do

# Warn and exit
def abort(message)
warn message
exit 1
end
module_function :abort

# Optional edit
def file_edit?(name, filepath)
filepath = ROOT.join(filepath).to_s
Expand All @@ -39,6 +32,14 @@ def file_sub(filepath, search, replace)
end
module_function :file_sub

# Extract a tagged string in filepth
def tagged_extract(filepath, tag)
filepath = ROOT.join(filepath).to_s
content = File.read(filepath)
content[/<!-- #{tag}_start -->\n(.*)<!-- #{tag}_end -->/m, 1]
end
module_function :tagged_extract

# Substitute a tagged string in filepth
def tagged_file_sub(filepath, tag, new_content)
filepath = ROOT.join(filepath).to_s
Expand All @@ -48,11 +49,4 @@ def tagged_file_sub(filepath, tag, new_content)
File.write(filepath, content)
end
module_function :tagged_file_sub

def tagged_extract(filepath, tag)
filepath = ROOT.join(filepath).to_s
content = File.read(filepath)
content[/<!-- #{tag}_start -->\n(.*)<!-- #{tag}_end -->/m, 1]
end
module_function :tagged_extract
end

0 comments on commit 7f520dc

Please sign in to comment.