Module: OnContainer::Dev::BundlerOps
- Defined in:
- lib/on_container/dev/bundler_ops.rb
Instance Method Summary collapse
- #bundle_belongs_to_current_user? ⇒ Boolean
- #bundle_owner_id ⇒ Object
- #bundle_path ⇒ Object
- #current_user_id ⇒ Object
- #ensure_bundle_belongs_to_current_user ⇒ Object
- #ensure_project_gems_are_installed ⇒ Object
- #make_bundle_belong_to_current_user ⇒ Object
Instance Method Details
#bundle_belongs_to_current_user? ⇒ Boolean
18 19 20 |
# File 'lib/on_container/dev/bundler_ops.rb', line 18 def bundle_belongs_to_current_user? bundle_owner_id == current_user_id end |
#bundle_owner_id ⇒ Object
10 11 12 |
# File 'lib/on_container/dev/bundler_ops.rb', line 10 def bundle_owner_id File.stat(bundle_path).uid end |
#bundle_path ⇒ Object
6 7 8 |
# File 'lib/on_container/dev/bundler_ops.rb', line 6 def bundle_path '/usr/local/bundle' end |
#current_user_id ⇒ Object
14 15 16 |
# File 'lib/on_container/dev/bundler_ops.rb', line 14 def current_user_id Etc.getpwuid.uid end |
#ensure_bundle_belongs_to_current_user ⇒ Object
27 28 29 30 31 |
# File 'lib/on_container/dev/bundler_ops.rb', line 27 def ensure_bundle_belongs_to_current_user return if bundle_belongs_to_current_user? make_bundle_belong_to_current_user end |
#ensure_project_gems_are_installed ⇒ Object
33 34 35 36 37 |
# File 'lib/on_container/dev/bundler_ops.rb', line 33 def ensure_project_gems_are_installed ensure_bundle_belongs_to_current_user system 'bundle check || bundle install' end |
#make_bundle_belong_to_current_user ⇒ Object
22 23 24 25 |
# File 'lib/on_container/dev/bundler_ops.rb', line 22 def make_bundle_belong_to_current_user target_ownership = "#{current_user_id}:#{current_user_id}" system "sudo chown -R #{target_ownership} #{bundle_path}" end |