Skip to content

Commit e78fa0e

Browse files
author
savitaashture
committed
Updated the document
1 parent 50d9b5f commit e78fa0e

6 files changed

Lines changed: 33 additions & 19 deletions

docs/extending-application.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,11 @@ A helper type (`JavaBuildpack::Component::Services`) that enables querying of th
3838
# +filter+ matches exactly one service, +false+ otherwise.
3939
#
4040
# @param [Regexp, String] filter a +RegExp+ or +String+ to match against the name, label, and tags of the services
41-
# @return [Boolean] +true+ if the +filter+ matches exactly one service, +false+ otherwise.
42-
def one_service?(filter)
41+
# @param [String] required_credentials an optional list of keys or groups of keys, where at least one key from the
42+
# group, must exist in the credentials payload of the candidate service
43+
# @return [Boolean] +true+ if the +filter+ matches exactly one service with the required credentials, +false+
44+
# otherwise.
45+
def one_service?(filter, *required_credentials)
4346

4447
# Compares the name, label, and tags of each service to the given +filter+. The method returns the first service
4548
# that the +filter+ matches. If no service matches, returns +nil+

docs/extending-base_component.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def release
4848
# @param [String] uri
4949
# @param [String] name an optional name for the download. Defaults to +@component_name+.
5050
# @return [Void]
51-
def download(version, uri, name = @component_name, &block)
51+
def download(version, uri, name = @component_name)
5252

5353
# Downloads a given JAR file and stores it.
5454
#
@@ -57,6 +57,7 @@ def download(version, uri, name = @component_name, &block)
5757
# @param [String] jar_name the name to save the jar as
5858
# @param [Pathname] target_directory the directory to store the JAR file in. Defaults to the component's sandbox.
5959
# @param [String] name an optional name for the download. Defaults to +@component_name+.
60+
# @return [Void]
6061
def download_jar(version, uri, jar_name, target_directory = @droplet.sandbox, name = @component_name)
6162

6263
# Downloads a given TAR file and expands it.
@@ -65,18 +66,21 @@ def download_jar(version, uri, jar_name, target_directory = @droplet.sandbox, na
6566
# @param [String] uri the uri of the download
6667
# @param [Pathname] target_directory the directory to expand the TAR file to. Defaults to the component's sandbox.
6768
# @param [String] name an optional name for the download and expansion. Defaults to +@component_name+.
69+
# @return [Void]
6870
def download_tar(version, uri, target_directory = @droplet.sandbox, name = @component_name)
6971

7072
# Downloads a given ZIP file and expands it.
7173
#
7274
# @param [Boolean] strip_top_level whether to strip the top-level directory when expanding. Defaults to +true+.
7375
# @param [Pathname] target_directory the directory to expand the ZIP file to. Defaults to the component's sandbox.
7476
# @param [String] name an optional name for the download. Defaults to +@component_name+.
77+
# @return [Void]
7578
def download_zip(version, uri, strip_top_level = true, target_directory = @droplet.sandbox, name = @component_name)
7679

7780
# Wrap the execution of a block with timing information
7881
#
7982
# @param [String] caption the caption to print when timing starts
83+
# @return [Void]
8084
def with_timing(caption)
8185
```
8286

docs/extending-caches.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,20 +51,21 @@ Caching can be configured by modifying the [`config/cache.yml`][] file in the bu
5151
The [`DownloadCache`][] is the most generic of the two caches. It allows you to create a cache that persists files any that write access is available. The constructor signature looks the following:
5252

5353
```ruby
54-
# Creates an instance of the cache that is backed by the filesystem rooted at +cache_root+
54+
# Creates an instance of the cache that is backed by a number of filesystem locations. The first argument
55+
# (+mutable_cache_root+) is the only location that downloaded files will be stored in.
5556
#
56-
# @param [String] cache_root the filesystem root for downloaded files to be cached in
57-
def initialize(cache_root = Dir.tmpdir)
57+
# @param [Pathname] mutable_cache_root the filesystem location in which find cached files in. This will also be
58+
# the location that all downloaded files are written to.
59+
# @param [Pathname] immutable_cache_roots other filesystem locations to find cached files in. No files will be
60+
# written to these locations.
61+
def initialize(mutable_cache_root = Pathname.new(Dir.tmpdir), *immutable_cache_roots)
5862
```
5963

6064
## `JavaBuildpack::Util::Cache::ApplicationCache`
6165
The [`ApplicationCache`][] is a cache that persists files into the application cache passed to the `compile` script. It examines `ARGV[1]` for the cache location and configures itself accordingly.
6266

6367
```ruby
64-
# Creates an instance that is configured to use the application cache. The application cache location is defined by
65-
# the second argument (<tt>ARGV[1]</tt>) to the +compile+ script.
66-
#
67-
# @raise if the second argument (<tt>ARGV[1]</tt>) to the +compile+ script is +nil+
68+
# Creates an instance of the cache that is backed by the the application cache
6869
def initialize
6970
```
7071

docs/extending-droplet.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ attr_reader :sandbox
3232

3333
# Copy resources from a components resources directory to a directory
3434
#
35-
# @param [Pathname] target_directory the directory to copy to. Default to a component's +sandbox+
35+
# @param [Pathname] target_directory the directory to copy to. Defaults to the component's +sandbox+.
36+
# @return [Void]
3637
def copy_resources(target_directory = @sandbox)
3738
```
3839

@@ -48,6 +49,7 @@ def as_classpath
4849
# Symlink the contents of the collection to a destination directory.
4950
#
5051
# @param [Pathname] destination the destination to link to
52+
# @return [Void]
5153
def link_to(destination)
5254
```
5355

@@ -58,17 +60,18 @@ The id of the component, as determined by the buildpack. This is used in variou
5860
One of two helper types (`JavaBuildpack::Component::ImmutableJavaHome`, `JavaBuildpack::Component::MutableJavaHome`) that enables the mutation and retrieval of the droplet's `JAVA_HOME`. Components that are JREs will be given the `MutableJavaHome` in order to set the value. All other components will be given the `ImmutableJavaHome` in order to retrieve the value.
5961

6062
```ruby
61-
# Returns the path of +JAVA_HOME+ as an environment variable formatted as +JAVA_HOME="$PWD/<value>"+
63+
# Returns the path of +JAVA_HOME+ as an environment variable formatted as +JAVA_HOME=$PWD/<value>+
6264
#
6365
# @return [String] the path of +JAVA_HOME+ as an environment variable
6466
def as_env_var
6567

6668
# Execute a block with the +JAVA_HOME+ environment variable set
6769
#
6870
# @yield yields to block with the +JAVA_HOME+ environment variable set
71+
# @return [Object] the returned value of the block
6972
def do_with
7073

71-
# @return [String] the root of the droplet's +JAVA_HOME+
74+
# @return [String] the root of the droplet's +JAVA_HOME+ formatted as +$PWD/<value>+
7275
def root
7376

7477
# Sets the root of the droplet's +JAVA_HOME+

docs/extending-modular_component.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,12 @@ This base class is recommended for use by any component that is sufficiently com
1010
# components are expected to return the command required to run the application.
1111
def command
1212

13-
# The modules that make up this component
13+
# The sub_components that make up this component
1414
#
1515
# @param [Hash] context the context of the component
16-
# @return [Array<BaseComponent>] a collection of +BaseComponent+s that make up the modules of this component
17-
def modules(context)
16+
# @return [Array<BaseComponent>] a collection of +BaseComponent+s that make up the sub_components of this
17+
# component
18+
def sub_components(_context)
1819

1920
# Whether or not this component supports this application
2021
#

docs/extending-repositories.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,17 @@ An example filesystem might look like:
2222
The main class used when dealing with a repository is [`JavaBuildpack::Repository::ConfiguredItem`][]. It provides a single method that is used to resolve a specific version and its URI.
2323

2424
```ruby
25-
# Finds an instance of the file based on the configuration.
25+
# Finds an instance of the file based on the configuration and wraps any exceptions
26+
# to identify the component.
2627
#
28+
# @param [String] component_name the name of the component
2729
# @param [Hash] configuration the configuration
2830
# @option configuration [String] :repository_root the root directory of the repository
2931
# @option configuration [String] :version the version of the file to resolve
3032
# @param [Block, nil] version_validator an optional version validation block
31-
# @return [JavaBuildpack::Util::TokenizedVersion] the chosen version of the file
3233
# @return [String] the URI of the chosen version of the file
33-
def find_item(configuration, &version_validator)
34+
# @return [JavaBuildpack::Util::TokenizedVersion] the chosen version of the file
35+
def find_item(component_name, configuration)
3436
```
3537

3638
Usage of the class might look like the following:

0 commit comments

Comments
 (0)