Skip to content

Commit

Permalink
adding project_root to services
Browse files Browse the repository at this point in the history
  • Loading branch information
niquerio committed Jan 25, 2024
1 parent 86ec086 commit 11c8279
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 5 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,4 @@ jobs:
- name: Run linter for Ruby
run: bundle exec standardrb
- name: Run tests
shell: bash
run: set -o pipefail && bundle exec rspec
run: bundle exec rspec
2 changes: 1 addition & 1 deletion exe/aim
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env ruby
$LOAD_PATH.unshift("/app/lib")
$LOAD_PATH.unshift(File.absolute_path(File.join(__dir__, "..", "lib")))

require "bundler/setup"
require "aim"
Expand Down
2 changes: 1 addition & 1 deletion lib/aim/hathifiles/modifier.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module Hathifiles
class Modifier
attr_reader :scratch_dir
def initialize(date:,
scratch_dir: "/app/scratch/#{SecureRandom.alphanumeric(8)}",
scratch_dir: "#{S.project_root}/scratch/#{SecureRandom.alphanumeric(8)}",
logger: S.logger,
connection: HathifilesDatabase.new(S.ht_mysql_connection))

Expand Down
4 changes: 4 additions & 0 deletions lib/services.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
ENV["APP_NAME"] || "AIM"
}

S.register(:project_root) do
File.absolute_path(File.join(__dir__, ".."))
end

S.register(:today_str) { Date.today.to_s }
S.register(:first_of_the_month) do
Date.new(Date.today.year, Date.today.month, 1).to_s
Expand Down
2 changes: 1 addition & 1 deletion spec/aim/integrations/cli_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
RSpec.describe "CLI" do
it "shows only the commands related to the app name" do
with_modified_env APP_NAME: "hathifiles" do
output = `aim help`
output = `exe/aim help`
expect(output).to include("hathifiles")
expect(output).not_to include("sms")
end
Expand Down

0 comments on commit 11c8279

Please sign in to comment.