Adoptable Cookbooks List

Supermarket Belongs to the Community

Supermarket belongs to the community. While Chef has the responsibility to keep it running and be stewards of its functionality, what it does and how it works is driven by the community. The chef/supermarket repository will continue to be where development of the Supermarket application takes place. Come be part of shaping the direction of Supermarket by opening issues and pull requests or by joining us on the Chef Mailing List.

Recipes

default

The default recipe installs Node.js or io.js based on the node attributes. It is
entirely optional and can be ignored in favor of direct use of the
javascript_runtime resource.

Resources

javascript_runtime

The javascript_runtime resource installs a JavaScript interpreter.

javascript_runtime '0.12'

Actions

:install – Install the JavaScript interpreter. (default)

:uninstall – Uninstall the JavaScript interpreter.

Properties

version – Version of the runtime to install. If a partial version is given,
use the latest available version matching that prefix. (name property)

Provider Options

The poise-javascript library offers an additional way to pass configuration
information to the final provider called "options". Options are key/value pairs
that are passed down to the javascript_runtime provider and can be used to control how it
installs JavaScript. These can be set in the javascript_runtime
resource using the options method, in node attributes or via the
javascript_runtime_options resource. The options from all sources are merged
together in to a single hash.

When setting options in the resource you can either set them for all providers:

javascript_runtime 'myapp' do
version '0.10'
options dev_package: false
end

or for a single provider:

javascript_runtime 'myapp' do
version '0.10'
options :system, dev_package: false
end

Setting via node attributes is generally how an end-user or application cookbook
will set options to customize installations in the library cookbooks they are using.
You can set options for all installations or for a single runtime:

The javascript_runtime_options resource is also available to set node attributes
for a specific installation in a DSL-friendly way:

javascript_runtime_options 'myapp' do
version 'iojs'
end

Unlike resource attributes, provider options can be different for each provider.
Not all providers support the same options so make sure to the check the
documentation for each provider to see what options the use.

javascript_runtime_options

The javascript_runtime_options resource allows setting provider options in a
DSL-friendly way. See the Provider Options section for more
information about provider options overall.

javascript_runtime_options 'myapp' do
version 'iojs'
end

Actions

:run – Apply the provider options. (default)

Properties

resource – Name of the javascript_runtime resource. (name property)

for_provider – Provider to set options for.

All other attribute keys will be used as options data.

javascript_execute

The javascript_execute resource executes a JavaScript script using the configured runtime.

javascript_execute 'myapp.js' do
user 'myuser'
end

This uses the built-in execute resource and supports all the same properties.

Actions

:run – Execute the script. (default)

Properties

command – Script and arguments to run. Must not include the node. (name attribute)

javascript – Name of the javascript_runtime resource to use. If not specified, the
most recently declared javascript_runtime will be used. Can also be set to the
full path to a node binary.

Actions

Properties

javascript – Name of the javascript_runtime resource to use. If not specified, the
most recently declared javascript_runtime will be used. Can also be set to the
full path to a node binary.

production – Enable production install mode. (default: true)

unsafe_perm – Enable --unsafe-perm. (default: true)

user – System user to install the packages.

Javascript Providers

Common Options

These provider options are supported by all providers.

version – Override the runtime version.

system

The system provider installs Node.js using system packages. This is currently
only tested on platforms using apt-get and yum (Debian, Ubuntu, RHEL, CentOS
Amazon Linux, and Fedora). It may work on other platforms but is untested.

javascript_runtime 'myapp' do
provider :system
version '0.10'
end

Options

dev_package – Install the package with the headers and other development
files. Can be set to a string to select the dev package specifically.
(default: true)

package_name – Override auto-detection of the package name.

package_upgrade – Install using action :upgrade. (default: false)

package_version – Override auto-detection of the package version.

scl

The scl provider installs Node.js using the Software Collections
packages. This is only available on RHEL and CentOS. SCL offers more
recent versions of Node.js than the system packages for the most part. If an SCL
package exists for the requests version, it will be used in preference to the
system provider.

javascript_runtime 'myapp' do
provider :scl
version '0.10'
end

nodejs

The nodejs provider installs Node.js from the static binaries on nodejs.org.
Support is included for Linux and OS X.

javascript_runtime 'myapp' do
provider :nodejs
version '0.12'
end

Options

path – Folder to install Node.js to. (default: /opt/nodejs-<version>)

static_version – Specific version number to use for computing the URL and
path. (default: automatic from version)

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.