Skip to content

Commit

Permalink
[wip] Add task to connect all enterprises
Browse files Browse the repository at this point in the history
Example usage:
 rake ofn:enterprises:activate_connected_app_type[affiliate_sales_data]
  • Loading branch information
dacook committed Jul 25, 2024
1 parent b8161bd commit 37afae9
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions lib/tasks/enterprises.rake
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,21 @@ namespace :ofn do
enterprise.destroy
end

namespace :enterprises do
# TODO: avoid duplicates
desc "Activate connected app type for ALL enterprises"
task :activate_connected_app_type, [:type] => :environment do |_task, args|
Enterprise.find_each do |enterprise|
begin

Check warning on line 20 in lib/tasks/enterprises.rake

View workflow job for this annotation

GitHub Actions / runner / rubocop

[rubocop] reported by reviewdog 🐶 Redundant `begin` block detected. Raw Output: lib/tasks/enterprises.rake:20:9: C: Style/RedundantBegin: Redundant `begin` block detected.
connected_app = "ConnectedApps::#{args.type.camelize}".constantize.new(enterprise:).connect({})

Check warning on line 21 in lib/tasks/enterprises.rake

View workflow job for this annotation

GitHub Actions / runner / rubocop

[rubocop] reported by reviewdog 🐶 Useless assignment to variable - `connected_app`. Raw Output: lib/tasks/enterprises.rake:21:11: W: Lint/UselessAssignment: Useless assignment to variable - `connected_app`.

Check warning on line 21 in lib/tasks/enterprises.rake

View workflow job for this annotation

GitHub Actions / runner / rubocop

[rubocop] reported by reviewdog 🐶 Line is too long. [105/100] Raw Output: lib/tasks/enterprises.rake:21:101: C: Layout/LineLength: Line is too long. [105/100]
puts "Enterprise #{enterprise.id} connected."
rescue Exception => e

Check warning on line 23 in lib/tasks/enterprises.rake

View workflow job for this annotation

GitHub Actions / runner / rubocop

[rubocop] reported by reviewdog 🐶 Avoid rescuing the `Exception` class. Perhaps you meant to rescue `StandardError`? Raw Output: lib/tasks/enterprises.rake:23:9: W: Lint/RescueException: Avoid rescuing the `Exception` class. Perhaps you meant to rescue `StandardError`?
puts e
end
end
end
end

namespace :dev do
desc 'export enterprises to CSV'
task export_enterprises: :environment do
Expand Down

0 comments on commit 37afae9

Please sign in to comment.