Sha256: 003ae1207ac33d65bd2e7e119dceee8b435279c1a4fc9bbba661f4f0fd4eed1c

Contents?: true

Size: 1.04 KB

Versions: 7

Compression:

Stored size: 1.04 KB

Contents

module Sunzi
  class Dependency
    def self.all
      {
        'linode' =>   { :require => 'linode',   :version => '>= 0.7.9' },
        'highline' => { :require => 'highline', :version => '>= 1.6.11'},
        'route53' =>  { :require => 'route53',  :version => '>= 0.2.1' },
        'digital_ocean' =>  { :require => 'digital_ocean',  :version => '>= 1.0.0' },
      }
    end

    def self.load(name)
      begin
        gem(name, all[name][:version])
        require(all[name][:require])
      rescue LoadError
        if $!.to_s =~ /Gemfile/
          Logger.error <<-EOS
Dependency missing: #{name}
Add this line to your application's Gemfile.

    gem '#{name}', '#{all[name][:version]}'

Please try again after running "bundle install".
          EOS
        else
          Logger.error <<-EOS
Dependency missing: #{name}
To install the gem, issue the following command:

    gem install #{name} -v '#{all[name][:version]}'

Please try again after installing the missing dependency.
          EOS
        end
        abort
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
sunzi-1.5.2 lib/sunzi/dependency.rb
sunzi-1.5.1 lib/sunzi/dependency.rb
sunzi-1.5.0 lib/sunzi/dependency.rb
sunzi-1.4.0 lib/sunzi/dependency.rb
sunzi-1.3.0 lib/sunzi/dependency.rb
sunzi-1.2.0 lib/sunzi/dependency.rb
sunzi-1.1.2 lib/sunzi/dependency.rb