Class: EY::Serverside::DependencyManager::Bundler

Inherits:
Base
  • Object
show all
Defined in:
lib/engineyard-serverside/dependency_manager/bundler.rb

Defined Under Namespace

Classes: Lockfile

Constant Summary collapse

DEFAULT_VERSION =
"1.14.6"
JOBS_NUMBER =

Number of Bundler workers (–jobs)

4

Instance Attribute Summary

Attributes inherited from Base

#config, #runner, #servers, #shell

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

detect, #initialize

Constructor Details

This class inherits a constructor from EY::Serverside::DependencyManager::Base

Class Method Details

.default_versionObject


12
13
14
# File 'lib/engineyard-serverside/dependency_manager/bundler.rb', line 12

def self.default_version
  DEFAULT_VERSION
end

.jobs_numberObject


16
17
18
# File 'lib/engineyard-serverside/dependency_manager/bundler.rb', line 16

def self.jobs_number
  JOBS_NUMBER
end

Instance Method Details

#checkObject


28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/engineyard-serverside/dependency_manager/bundler.rb', line 28

def check
  if lockfile
    shell.status "Gemfile and Gemfile.lock found"

    if config.check_database_adapter? && !lockfile.any_database_adapter?
      shell.warning <<-WARN
Gemfile.lock does not contain a recognized database adapter.
A database-adapter gem such as pg, mysql2, mysql, or do_mysql was expected.
This can prevent applications that use PostgreSQL or MySQL from booting.

To fix, add any needed adapter to your Gemfile, bundle, commit, and redeploy.
Applications not using PostgreSQL or MySQL can safely ignore this warning by
adding ignore_database_adapter_warning: true to the application's ey.yml file
under the defaults: top level key and committing the file to the repository.
      WARN
    end
  elsif ! config.ignore_gemfile_lock_warning
    shell.warning <<-WARN
Gemfile found but Gemfile.lock is missing!
You can get different versions of gems in production than what you tested with.
You can get different versions of gems on every deployment even if your Gemfile hasn't changed.
Deploying will take longer and some deploy options will be limited.

To fix this problem, commit your Gemfile.lock to your repository and redeploy.
    WARN
  end
end

#detected?Boolean

Returns:

  • (Boolean)

20
21
22
# File 'lib/engineyard-serverside/dependency_manager/bundler.rb', line 20

def detected?
  gemfile?
end

#gemfile?Boolean

Returns:

  • (Boolean)

24
25
26
# File 'lib/engineyard-serverside/dependency_manager/bundler.rb', line 24

def gemfile?
  paths.gemfile.exist?
end

#installObject


56
57
58
59
60
61
62
# File 'lib/engineyard-serverside/dependency_manager/bundler.rb', line 56

def install
  shell.status "Bundling gems..."
  clean_bundle_on_system_version_change
  install_bundler_gem
  run "#{clean_environment} && cd #{paths.active_release} && #{bundle_install_command}"
  write_system_version
end

#rails_versionObject


74
75
76
# File 'lib/engineyard-serverside/dependency_manager/bundler.rb', line 74

def rails_version
  lockfile && lockfile.rails_version
end

#show_ey_config_instructionsObject


68
69
70
71
72
# File 'lib/engineyard-serverside/dependency_manager/bundler.rb', line 68

def show_ey_config_instructions
  if lockfile && !lockfile.has_ey_config? && !config.ignore_ey_config_warning
    shell.warning "Gemfile.lock does not contain ey_config. Add gem 'ey_config' to your Gemfile to access service configurations through EY::Config."
  end
end

#uses_sqlite3?Boolean

Returns:

  • (Boolean)

64
65
66
# File 'lib/engineyard-serverside/dependency_manager/bundler.rb', line 64

def uses_sqlite3?
  lockfile && lockfile.uses_sqlite3?
end