Skip to content

Commit 359193c

Browse files
committed
Remove dead staff applications code
1 parent ca96427 commit 359193c

4 files changed

Lines changed: 1 addition & 148 deletions

File tree

app/views/inspect/pages/_staff_application.html.haml

Lines changed: 0 additions & 77 deletions
This file was deleted.

bin/import-db

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,9 @@ end
7575
# DB file.
7676
def import_db_commands(import_command, file)
7777
[
78-
['Dump staff applications', 'bundle exec rails RAILS_ENV=development db:dump_staff_applications > /dev/null'],
7978
['Remove and recreate DB', 'bundle exec rails RAILS_ENV=development db:environment:set db:drop db:create > /dev/null'],
8079
['Import DB', Kernel.format(import_command, file.path.shellescape)],
81-
['Set DB environment', 'bundle exec rails RAILS_ENV=development db:environment:set > /dev/null'],
82-
['Load staff applications', 'bundle exec rails RAILS_ENV=development db:load_staff_applications']
80+
['Set DB environment', 'bundle exec rails RAILS_ENV=development db:environment:set > /dev/null']
8381
]
8482
end
8583

config/routes.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,6 @@
155155
get '/' => 'pages#start_inspect'
156156
get '/redirect' => 'base#redirect', as: 'redirect'
157157

158-
put '/staff_application/:id' => 'staff_applications#update', as: :staff_application
159-
160158
get 'search.js' => 'search#index', as: :search_autocomplete
161159

162160
resources :scenarios, only: [] do

lib/tasks/dump_db.rake

Lines changed: 0 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -17,70 +17,4 @@ namespace :db do
1717

1818
puts "tmp/#{ dump_to }"
1919
end
20-
21-
desc 'Dumps staff applications to be reloaded later'
22-
task dump_staff_applications: :environment do
23-
FileUtils.rm_rf('tmp/staff_applications.yml')
24-
25-
applications = []
26-
staff_applications = []
27-
tokens = []
28-
29-
StaffApplication.all.includes(:application).map do |app|
30-
applications.push(app.application.attributes)
31-
staff_applications.push(app.attributes)
32-
tokens.push(*app.application.access_tokens.map(&:attributes))
33-
end
34-
35-
File.write(
36-
'tmp/staff_applications.yml',
37-
{
38-
'applications' => applications,
39-
'staff_applications' => staff_applications,
40-
'tokens' => tokens
41-
}.to_yaml
42-
)
43-
44-
FileUtils.chmod(0o600, 'tmp/staff_applications.yml')
45-
rescue StandardError
46-
FileUtils.rm('tmp/staff_applications.yml') if File.exist?('tmp/staff_applications.yml')
47-
end
48-
49-
desc 'Loads staff applications from a dump'
50-
task load_staff_applications: :environment do
51-
unless File.exist?('tmp/staff_applications.yml')
52-
puts 'No staff applications dump found'
53-
exit
54-
end
55-
56-
apps = YAML.unsafe_load_file('tmp/staff_applications.yml')
57-
58-
StaffApplication.transaction do
59-
StaffApplication.destroy_all
60-
61-
OAuthApplication.insert_all!(apps['applications']) if apps['applications'].any?
62-
StaffApplication.insert_all!(apps['staff_applications']) if apps['staff_applications'].any?
63-
Doorkeeper::AccessToken.insert_all!(apps['tokens']) if apps['tokens'].any?
64-
65-
FileUtils.rm('tmp/staff_applications.yml')
66-
rescue StandardError
67-
puts <<~MESSAGE
68-
┌─────────────────────────────────────────────────────────────────────────┐
69-
│ !!!️ CONNECTING ETMODEL AND TRANSITION PATHS !!!️ │
70-
├─────────────────────────────────────────────────────────────────────────┤
71-
│ Importing a database dump removed the credentials used to connect your │
72-
│ local ETModel or Transition Paths app with ETEngine. │
73-
│ │
74-
│ If you wish you connect ETModel or Transition Paths with your local │
75-
│ ETEngine: │
76-
│ │
77-
│ 1. Start ETEngine: bundle exec rails server. │
78-
│ 2. Sign in to your account at http://localhost:3000. │
79-
│ 3. Scroll down and create a new ETModel or Transition Path application. │
80-
│ 4. Copy the generated config to the other application. │
81-
│ 5. Restart the other application. │
82-
└─────────────────────────────────────────────────────────────────────────┘
83-
MESSAGE
84-
end
85-
end
8620
end

0 commit comments

Comments
 (0)