Skip to content

Commit

Permalink
Merge pull request #15589 from durandom/bundle_env
Browse files Browse the repository at this point in the history
change ManageIQ::Environment to run bundle install on plugin_setup
  • Loading branch information
Fryguy authored Jul 18, 2017
2 parents 03df095 + 4c87a46 commit 703b6d6
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
2 changes: 1 addition & 1 deletion lib/generators/provider/templates/bin/setup
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ unless gem_root.join("spec/manageiq").exist?
end

require gem_root.join("spec/manageiq/lib/manageiq/environment").to_s
ManageIQ::Environment.manageiq_plugin_setup
ManageIQ::Environment.manageiq_plugin_setup(gem_root)
2 changes: 1 addition & 1 deletion lib/generators/provider/templates/bin/update
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ else
end

require gem_root.join("spec/manageiq/lib/manageiq/environment").to_s
ManageIQ::Environment.manageiq_plugin_setup
ManageIQ::Environment.manageiq_plugin_setup(gem_root)
17 changes: 13 additions & 4 deletions lib/manageiq/environment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ module ManageIQ
module Environment
APP_ROOT = Pathname.new(__dir__).join("../..")

def self.manageiq_plugin_setup
def self.manageiq_plugin_setup(plugin_root = nil)
# determine plugin root dir. Assume we are called from a 'bin/setup' script in the plugin root
plugin_root = Pathname.new(caller_locations.last.absolute_path).dirname.parent
plugin_root ||= Pathname.new(caller_locations.last.absolute_path).dirname.parent

install_bundler
bundle_update(plugin_root)
bundle_install(plugin_root)

ensure_config_files

Expand All @@ -19,6 +19,15 @@ def self.manageiq_plugin_setup
setup_test_environment(:task_prefix => 'app:', :root => plugin_root)
end

def self.manageiq_plugin_update(plugin_root = nil)
# determine plugin root dir. Assume we are called from a 'bin/setup' script in the plugin root
plugin_root ||= Pathname.new(caller_locations.last.absolute_path).dirname.parent

bundle_update(plugin_root)

setup_test_environment(:task_prefix => 'app:', :root => plugin_root)
end

def self.ensure_config_files
config_files = {
"certs/v2_key.dev" => "certs/v2_key",
Expand Down Expand Up @@ -57,7 +66,7 @@ def self.bundle_install(root = APP_ROOT)
end

def self.bundle_update(root = APP_ROOT)
system!("bundle update #{bundle_params}", :chdir => root)
system!("bundle update", :chdir => root)
end

def self.bundle_params
Expand Down

0 comments on commit 703b6d6

Please sign in to comment.