Skip to content

Commit

Permalink
Version upgrades
Browse files Browse the repository at this point in the history
This change upgrades the versions of the dependencies to their latest.
As part of this upgrade, Rubocop underwent a major version upgrade.
This necessitated major updates to the code.
  • Loading branch information
nebhale committed Mar 17, 2014
1 parent 5051406 commit 67a57bc
Show file tree
Hide file tree
Showing 107 changed files with 3,930 additions and 3,704 deletions.
4 changes: 4 additions & 0 deletions .idea/codeStyleSettings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 5 additions & 3 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -31,23 +31,25 @@ GEM
rspec-mocks (3.0.0.beta2)
rspec-support (= 3.0.0.beta2)
rspec-support (3.0.0.beta2)
rubocop (0.18.1)
rubocop (0.19.0)
json (>= 1.7.7, < 2)
parser (~> 2.1.3)
parser (~> 2.1.7)
powerpack (~> 0.0.6)
rainbow (>= 1.99.1, < 3.0)
ruby-progressbar (~> 1.4)
ruby-debug-base19x (0.11.30.pre15)
debugger-ruby_core_source (> 0)
rake (>= 0.8.1)
ruby-debug-ide (0.4.22)
rake (>= 0.8.1)
ruby-progressbar (1.4.2)
safe_yaml (1.0.1)
simplecov (0.8.2)
docile (~> 1.1.0)
multi_json
simplecov-html (~> 0.8.0)
simplecov-html (0.8.0)
slop (3.4.7)
slop (3.5.0)
tee (1.0.0)
webmock (1.17.4)
addressable (>= 2.2.7)
Expand Down
5 changes: 3 additions & 2 deletions java-buildpack.iml
Original file line number Diff line number Diff line change
Expand Up @@ -288,13 +288,14 @@
<orderEntry type="library" scope="PROVIDED" name="rspec-expectations (v3.0.0.beta2, rbenv: 1.9.3-p545) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="rspec-mocks (v3.0.0.beta2, rbenv: 1.9.3-p545) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="rspec-support (v3.0.0.beta2, rbenv: 1.9.3-p545) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="rubocop (v0.18.1, rbenv: 1.9.3-p545) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="rubocop (v0.19.0, rbenv: 1.9.3-p545) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="ruby-debug-base19x (v0.11.30.pre15, rbenv: 1.9.3-p545) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="ruby-debug-ide (v0.4.22, rbenv: 1.9.3-p545) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="ruby-progressbar (v1.4.2, rbenv: 1.9.3-p545) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="safe_yaml (v1.0.1, rbenv: 1.9.3-p545) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="simplecov (v0.8.2, rbenv: 1.9.3-p545) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="simplecov-html (v0.8.0, rbenv: 1.9.3-p545) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="slop (v3.4.7, rbenv: 1.9.3-p545) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="slop (v3.5.0, rbenv: 1.9.3-p545) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="tee (v1.0.0, rbenv: 1.9.3-p545) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="webmock (v1.17.4, rbenv: 1.9.3-p545) [gem]" level="application" />
<orderEntry type="library" scope="PROVIDED" name="yard (v0.8.7.3, rbenv: 1.9.3-p545) [gem]" level="application" />
Expand Down
16 changes: 8 additions & 8 deletions lib/java_buildpack/buildpack.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,9 @@ def release
command = container.release

payload = {
'addons' => [],
'config_vars' => {},
'default_process_types' => { 'web' => command }
'addons' => [],
'config_vars' => {},
'default_process_types' => { 'web' => command }
}.to_yaml

@logger.debug { "Release Payload #{payload}" }
Expand Down Expand Up @@ -125,7 +125,7 @@ def component_detection(components)

def diagnose_git_info(print)
if system("git --git-dir=#{GIT_DIR} status 2>/dev/null 1>/dev/null")
remote_url = diagnose_remotes
remote_url = diagnose_remotes
head_commit_sha = diagnose_head_commit
puts "-----> Java Buildpack source: #{remote_url}##{head_commit_sha}" if print
else
Expand Down Expand Up @@ -156,9 +156,9 @@ def instantiate(components, additional_libraries, application, java_home, java_o

component_id = component.split('::').last.snake_case
context = {
application: application,
configuration: Util::ConfigurationUtils.load(component_id),
droplet: Component::Droplet.new(additional_libraries, component_id, java_home, java_opts, root) }
application: application,
configuration: Util::ConfigurationUtils.load(component_id),
droplet: Component::Droplet.new(additional_libraries, component_id, java_home, java_opts, root) }

component.constantize.new(context)
end
Expand Down Expand Up @@ -199,7 +199,7 @@ class << self
# @yield [Buildpack] the buildpack to work with
# @return [Object] the return value from the given block
def with_buildpack(app_dir, message)
app_dir = Pathname.new(File.expand_path(app_dir))
app_dir = Pathname.new(File.expand_path(app_dir))
application = Component::Application.new(app_dir)
Logging::LoggerFactory.setup app_dir

Expand Down
8 changes: 6 additions & 2 deletions lib/java_buildpack/component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@

require 'java_buildpack'

# A module encapsulating the component abstractions and base classes for the Java buildpack
module JavaBuildpack::Component
module JavaBuildpack

# A module encapsulating the component abstractions and base classes for the Java buildpack
module Component
end

end
62 changes: 32 additions & 30 deletions lib/java_buildpack/component/additional_libraries.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,40 +17,42 @@
require 'java_buildpack/component'
require 'java_buildpack/util/qualify_path'

module JavaBuildpack::Component
module JavaBuildpack
module Component

# An abstraction around the additional libraries provided to a droplet by components.
#
# A new instance of this type should be created once for the application.
class AdditionalLibraries < Array
include JavaBuildpack::Util

# Creates an instance of the +JAVA_OPTS+ abstraction.
#
# @param [Pathname] droplet_root the root directory of the droplet
def initialize(droplet_root)
@paths = []
@droplet_root = droplet_root
end

# Returns the contents of the collection as a classpath formatted as +-cp <value1>:<value2>+
# An abstraction around the additional libraries provided to a droplet by components.
#
# @return [String] the contents of the collection as a classpath
def as_classpath
qualified_paths = sort.map { |path| qualify_path path }
# A new instance of this type should be created once for the application.
class AdditionalLibraries < Array
include JavaBuildpack::Util

# Creates an instance of the +JAVA_OPTS+ abstraction.
#
# @param [Pathname] droplet_root the root directory of the droplet
def initialize(droplet_root)
@paths = []
@droplet_root = droplet_root
end

# Returns the contents of the collection as a classpath formatted as +-cp <value1>:<value2>+
#
# @return [String] the contents of the collection as a classpath
def as_classpath
qualified_paths = sort.map { |path| qualify_path path }

"-cp #{qualified_paths.join ':'}"
end

# Symlink the contents of the collection to a destination directory.
#
# @param [Pathname] destination the destination to link to
# @return [void]
def link_to(destination)
FileUtils.mkdir_p destination
each { |path| (destination + path.basename).make_symlink(path.relative_path_from(destination)) }
end

"-cp #{qualified_paths.join ':'}"
end

# Symlink the contents of the collection to a destination directory.
#
# @param [Pathname] destination the destination to link to
# @return [void]
def link_to(destination)
FileUtils.mkdir_p destination
each { |path| (destination + path.basename).make_symlink(path.relative_path_from(destination)) }
end

end

end
82 changes: 42 additions & 40 deletions lib/java_buildpack/component/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,57 +19,59 @@
require 'java_buildpack/util/filtering_pathname'
require 'yaml'

module JavaBuildpack::Component
module JavaBuildpack
module Component

# An abstraction around the application as uploaded by the user. This abstraction is intended to hide any
# modifications made to the filesystem by other components. Think of this as an immutable representation of the
# application as it was uploaded.
#
# A new instance of this type should be created once for the application.
class Application
# An abstraction around the application as uploaded by the user. This abstraction is intended to hide any
# modifications made to the filesystem by other components. Think of this as an immutable representation of the
# application as it was uploaded.
#
# A new instance of this type should be created once for the application.
class Application

# @!attribute [r] details
# @return [Hash] the parsed contents of the +VCAP_APPLICATION+ environment variable
attr_reader :details
# @!attribute [r] details
# @return [Hash] the parsed contents of the +VCAP_APPLICATION+ environment variable
attr_reader :details

# @!attribute [r] environment
# @return [Hash] all environment variables except +VCAP_APPLICATION+ and +VCAP_SERVICES+. Those values are
# available separately in parsed form.
attr_reader :environment
# @!attribute [r] environment
# @return [Hash] all environment variables except +VCAP_APPLICATION+ and +VCAP_SERVICES+. Those values are
# available separately in parsed form.
attr_reader :environment

# @!attribute [r] root
# @return [JavaBuildpack::Util::FilteringPathname] the root of the application's fileystem filtered so that it
# only shows files that have been uploaded by the user
attr_reader :root
# @!attribute [r] root
# @return [JavaBuildpack::Util::FilteringPathname] the root of the application's fileystem filtered so that it
# only shows files that have been uploaded by the user
attr_reader :root

# @!attribute [r] services
# @return [Hash] the parsed contents of the +VCAP_SERVICES+ environment variable
attr_reader :services
# @!attribute [r] services
# @return [Hash] the parsed contents of the +VCAP_SERVICES+ environment variable
attr_reader :services

# Create a new instance of the application abstraction
#
# @param [Pathname] root the root of the application
def initialize(root)
initial = children(root)
@root = JavaBuildpack::Util::FilteringPathname.new(root, ->(path) { initial.member? path }, false)
# Create a new instance of the application abstraction
#
# @param [Pathname] root the root of the application
def initialize(root)
initial = children(root)
@root = JavaBuildpack::Util::FilteringPathname.new(root, ->(path) { initial.member? path }, false)

@environment = ENV.to_hash
@details = parse(@environment.delete('VCAP_APPLICATION'))
@services = Services.new(parse(@environment.delete('VCAP_SERVICES')))
end
@environment = ENV.to_hash
@details = parse(@environment.delete('VCAP_APPLICATION'))
@services = Services.new(parse(@environment.delete('VCAP_SERVICES')))
end

private
private

def children(root, s = Set.new)
s << root
root.children.each { |child| children(child, s) } if root.directory?
s
end
def children(root, s = Set.new)
s << root
root.children.each { |child| children(child, s) } if root.directory?
s
end

def parse(input)
input ? YAML.load(input) : {}
end

def parse(input)
input ? YAML.load(input) : {}
end

end

end
Loading

0 comments on commit 67a57bc

Please sign in to comment.