Skip to content

Commit

Permalink
Merge pull request ManageIQ#18071 from himdel/bower-clean
Browse files Browse the repository at this point in the history
Bower cleanup
  • Loading branch information
bdunne authored Oct 10, 2018
2 parents 8a9222c + e70930f commit dbbced8
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 26 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ tmp/*

# vendor/
vendor/bundle
vendor/assets/bower_components/
vendor/node_root/

# npm
Expand Down
2 changes: 1 addition & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ before_script:
test:vmdb:
script:
- bundle update
- bundle exec rake update:bower
- bundle exec rake update:ui
- bundle exec rake test:vmdb:setup
- bundle exec rake test:vmdb
test:brakeman:
Expand Down
2 changes: 1 addition & 1 deletion bin/setup
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Dir.chdir(ManageIQ::Environment::APP_ROOT) do
ManageIQ::Environment.install_bundler
ManageIQ::Environment.bundle_update

ManageIQ::Environment.while_updating_bower do
ManageIQ::Environment.while_updating_ui do
unless ENV["SKIP_DATABASE_SETUP"]
ManageIQ::Environment.create_database
ManageIQ::Environment.migrate_database
Expand Down
6 changes: 3 additions & 3 deletions bin/update
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Dir.chdir(ManageIQ::Environment::APP_ROOT) do
ManageIQ::Environment.install_bundler
ManageIQ::Environment.bundle_update

ManageIQ::Environment.while_updating_bower do
ManageIQ::Environment.while_updating_ui do
unless ENV["SKIP_DATABASE_SETUP"]
ManageIQ::Environment.migrate_database
ManageIQ::Environment.seed_database
Expand All @@ -33,8 +33,8 @@ Dir.chdir(ManageIQ::Environment::APP_ROOT) do
ManageIQ::Environment.reset_automate_domain unless ENV["SKIP_AUTOMATE_RESET"]
end

# Make sure bower is done before compiling assets
# Make sure update_ui is done before compiling assets
ManageIQ::Environment.compile_assets if ENV['RAILS_ENV'] == 'production'

ManageIQ::Environment.clear_logs_and_temp
ManageIQ::Environment.clear_obsolete
end
29 changes: 9 additions & 20 deletions lib/manageiq/environment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,20 @@ def self.ensure_config_files
Dir.mkdir(logdir) unless Dir.exist?(logdir)
end

def self.while_updating_bower
# Run bower in a thread and continue to do the non-js stuff
puts "\n== Updating bower assets in parallel =="
bower_thread = Thread.new do
def self.while_updating_ui
# Run update:ui in a thread and continue to do the non-js stuff
puts "\n== Updating UI assets (in parallel) =="

ui_thread = Thread.new do
update_ui
puts "\n== Updating bower assets complete =="
puts "\n== Updating UI assets complete =="
end
bower_thread.abort_on_exception = true

ui_thread.abort_on_exception = true

yield

bower_thread.join
ui_thread.join
end

def self.install_bundler(root = APP_ROOT)
Expand Down Expand Up @@ -106,19 +108,6 @@ def self.clear_logs_and_temp
run_rake_task("log:clear tmp:clear")
end

# In development, when switching branches to old versions prior to the
# ui-classic split, it's possible that bower_components end up cached in
# manageiq proper as well as manageiq-ui-classic, which causes duplicate
# sets of dependencies, with different versions, that bower can't handle.
#
# Once we no longer support versions of manageiq prior to the ui-classic
# split, this can be removed.
def self.clear_obsolete
return unless APP_ROOT.join("vendor/assets/bower_components").exist?
puts "\n== Removing obsolete bower install =="
FileUtils.rm_rf(APP_ROOT.join("vendor/assets/bower_components"))
end

def self.create_database_user
system!(%q(psql -c "CREATE USER root SUPERUSER PASSWORD 'smartvm';" -U postgres))
end
Expand Down

0 comments on commit dbbced8

Please sign in to comment.