Skip to content

Commit 4b36e92

Browse files
leefaisonrbess
andauthored
Add CardImage import rake task (#122)
Co-authored-by: Bess Sadler <[email protected]>
1 parent 99fc083 commit 4b36e92

File tree

4 files changed

+21
-5
lines changed

4 files changed

+21
-5
lines changed

.rubocop.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,13 @@ Metrics/BlockLength:
1414
- "spec/**/*"
1515

1616
Rails/Output:
17-
Enabled: false
17+
Enabled: false
18+
19+
Metrics/MethodLength:
20+
Exclude:
21+
- "app/services/card_image_loading_service.rb"
22+
- "app/services/guide_card_loading_service.rb"
23+
24+
Metrics/AbcSize:
25+
Exclude:
26+
- "app/services/guide_card_loading_service.rb"

app/services/card_image_loading_service.rb

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,11 @@ def import
1414
ci.path = sgc.path
1515
ci.image_name = file_name
1616
ci.save
17+
print '#'
18+
$stdout.flush
1719
end
1820
end
21+
puts 'task completed!'
1922
end
2023

2124
# returns something like
@@ -31,7 +34,3 @@ def s3_image_list(path)
3134
`#{s3_query}`
3235
end
3336
end
34-
# Next steps: to fill in s3_image_list method
35-
# We should get the path from the SubGuideCard and turn it into the hyphenated format
36-
# We should then use that in the `aws s3 ls` command
37-
# This method should take the arguments of the SubGuideCard path

app/services/guide_card_loading_service.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@ def import
1919
gc.sortid = card[2]
2020
gc.path = card[3]
2121
gc.save
22+
print '#'
23+
$stdout.flush
2224
end
25+
puts 'task completed!'
2326
end
2427

2528
def scan

lib/tasks/import.rake

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,9 @@ namespace :import do
1010
task import_sub_guide_cards: :environment do
1111
SubGuideLoadingService.new.import
1212
end
13+
14+
desc 'Import CardImage data'
15+
task import_card_images: :environment do
16+
CardImageLoadingService.new.import
17+
end
1318
end

0 commit comments

Comments
 (0)