Skip to content

Commit

Permalink
chore: Remove Gemfile from ruby gems (#2)
Browse files Browse the repository at this point in the history
* chore: Remove Gemfile.lock from gem

* chore: Remove deprecated ruby version
  • Loading branch information
LuukvH authored and KoenSengers committed Feb 2, 2024
1 parent 1005ed3 commit 130b71c
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 68 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/reviewdog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ jobs:
fail-fast: false
matrix:
ruby:
- 2.7
- 3.0
- 3.1
- 3.2
- 3.3

runs-on: ubuntu-latest
steps:
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Ignore Gemfile.lock for ruby gems
Gemfile.lock
50 changes: 0 additions & 50 deletions Gemfile.lock

This file was deleted.

8 changes: 5 additions & 3 deletions appsignal-sourcemap.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,21 @@ require "appsignal/sourcemap/version"
Gem::Specification.new do |spec|
spec.name = "appsignal-sourcemap"
spec.version = Appsignal::Sourcemap::VERSION
spec.authors = ["Stef Schenkelaars"]
spec.email = ["stef.schenkelaars@gmail.com"]
spec.authors = ["Drieam"]
spec.email = ["dev@drieam.com"]
spec.homepage = "https://github.com/drieam/appsignal-sourcemap"
spec.summary = "Upload private sourcemaps to appsignal"

spec.metadata["allowed_push_host"] = "https://rubygems.pkg.github.com/Drieam"

spec.required_ruby_version = ">= 2.7"
spec.required_ruby_version = ">= 3.1"

spec.files = Dir["lib/**/*", "README.md"]

spec.add_dependency 'rails', '>= 6.1', '< 8.0'

Check failure on line 23 in appsignal-sourcemap.gemspec

View workflow job for this annotation

GitHub Actions / standardrb

[standardrb] appsignal-sourcemap.gemspec#L23

Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
Raw output
  appsignal-sourcemap.gemspec:23:23: Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

Check failure on line 23 in appsignal-sourcemap.gemspec

View workflow job for this annotation

GitHub Actions / standardrb

[standardrb] appsignal-sourcemap.gemspec#L23

Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
Raw output
  appsignal-sourcemap.gemspec:23:32: Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

Check failure on line 23 in appsignal-sourcemap.gemspec

View workflow job for this annotation

GitHub Actions / standardrb

[standardrb] appsignal-sourcemap.gemspec#L23

Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
Raw output
  appsignal-sourcemap.gemspec:23:42: Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
spec.add_dependency "appsignal", "~> 3.0"
spec.add_dependency "parallel", "~> 1.0"

spec.add_development_dependency "standard"
spec.metadata["rubygems_mfa_required"] = "true"
end
12 changes: 5 additions & 7 deletions lib/appsignal/sourcemap/supervisor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,27 +15,25 @@ def self.start
def start
return if invalid_preconditions

Appsignal.logger.info("Starting sourcemaps upload")
Rails.logger.info("Starting sourcemaps upload")

Parallel.each(source_map_paths, in_threads: PARALLEL_THREADS) do |source_map_path|
Uploader.upload(source_map_path)
end

Appsignal.logger.info("Finished sourcemaps upload")
Rails.logger.info("Finished sourcemaps upload")
end

private

def invalid_preconditions
unless Appsignal.config.valid?
return Appsignal.logger.error("Skipping sourcemaps upload since Appsignal config is invalid")
return Rails.logger.error("Skipping sourcemaps upload since Appsignal config is invalid")
end
if asset_host.blank?
return Appsignal.logger.error("Skipping sourcemaps upload since Rails asset_host is not set")
end
if source_map_paths.empty?
return Appsignal.logger.info("Skipping sourcemaps upload since no javascript maps are found")
return Rails.logger.error("Skipping sourcemaps upload since Rails asset_host is not set")
end
return Rails.logger.info("Skipping sourcemaps upload since no javascript maps are found") if source_map_paths.empty?

false
end
Expand Down
10 changes: 4 additions & 6 deletions lib/appsignal/sourcemap/uploader.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,22 @@ def initialize(sourcemap_path)
@sourcemap_path = sourcemap_path
end

def upload # rubocop:disable Metrics/AbcSize
Appsignal.logger.debug "Starting sourcemap upload '#{@sourcemap_path}' with parameters: #{request_form_data}"
def upload
Rails.logger.debug("Starting sourcemap upload '#{@sourcemap_path}' with parameters: #{request_form_data}")

response = Net::HTTP.start(UPLOAD_URI.hostname, UPLOAD_URI.port, use_ssl: true) do |http|
http.request(request)
end

if response.is_a?(Net::HTTPSuccess)
Appsignal.logger.debug("Finished sourcemap upload '#{@sourcemap_path}'")
Rails.logger.debug("Finished sourcemap upload '#{@sourcemap_path}'")
File.delete(sourcemap_full_path)
return
end

Appsignal.logger.error <<~MESSAGE
Rails.logger.error <<~MESSAGE
Uploading sourcemap #{@sourcemap_path} failed with message '#{response.message}'.
Response: #{response.body}
MESSAGE
end

Expand Down

0 comments on commit 130b71c

Please sign in to comment.