cookbook 'rubygems', '= 1.0.1'
rubygems (11) Versions 1.0.1 Follow16
Configures rubygems and bundler
cookbook 'rubygems', '= 1.0.1', :supermarket
knife supermarket install rubygems
knife supermarket download rubygems
Description
This cookbook configures "system" and Omnibus Chef gem sources, as well as
providing the rubygems_api
resource, which lets you manage ownership of
gems on rubygems.org.
Requirements
Omnibus Chef 12.5.1 or above
Usage
There are two ways to use this cookbook. The legacy way is to set the desired
attributes and simply include_recipe 'rubygems'
. The modern and recommended
way is to call the gemrc
and/or bundle_config
resources as shown in the
Resources section below.
Attributes
# From attributes/default.rb
default['rubygems']['gem_disable_default'] = false
default['rubygems']['gem_sources'] = [ 'https://rubygems.org' ]
default['rubygems']['chef_gem_disable_default'] = false
default['rubygems']['chef_gem_sources'] = [ 'https://rubygems.org' ]
Resources
This cookbook provides two simple resources which allow you to set any
key/value configuration for the gemrc or bundle config files. Additionaly
this cookbook provides the rubygems_api
resource, which lets you manage
ownership of gems on rubygems.org.
rubygems_api
rubygems_api do gem "chef" do owners << "jkeiser" end end
Or this:
rubygems_api do user "jkeiser" do owned_gems << "chef" end end
If you want to set owners
or owned_gems
to a specific set of users and have it
remove all others, you can add purge true
to either user
or gem
resource.
To talk to a custom gem server, you can say rubygems_api "https://otherserver.com" do ... end
.
You can also modify the API key you are by specifying the api_key
property under rubygems_api
.
gemrc
Configures the gemrc.
Attributes
-
path
- Accepts sybols:global
,:local
, or a string litteral path to the.gemrc
file. Default: Name of Resource Instance -
user
- Owner of gemrc file. -
group
- Group associated to gemrc file. -
values
- Hash containing all key/values to configure.
Action
-
:create
- Default Action
Usage
Global configuration usage:
ruby
gemrc :global do
values(
sources: %w{ http://localhost:9292 https://rubygems.org }
)
end
Litteral path usage:
gemrc '/path/to/.gemrc' do values( sources: %w{ http://localhost:9292 https://rubygems.org } ) end
bundle_config
Configures bundler.
Attributes
-
path
- A litteral path to the.gemrc
file. Default: Name of Resource Instance -
user
- Owner of gemrc file. -
group
- Group associated to gemrc file. -
values
- Hash containing all key/values to configure.
Action
-
:create
- Default Action
Usage
bundle_config '/path/to/.bundle/config' do values( { 'BUNDLE_MIRROR__HTTPS://RUBYGEMS__ORG/' => 'http://localhost:9292' } ) end
Recipes
- default
License and Authors
- Author:: Sean OMeara (sean@sean.io)
- Author:: John Keiser (jkeiser@chef.io)
- Author:: Ryan Hass (rhass@chef.io)
Copyright (c) 2009-2016, Chef Software Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
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.
Dependent cookbooks
This cookbook has no specified dependencies.
Contingent cookbooks
Collaborator Number Metric
1.0.1 passed this metric
Foodcritic Metric
1.0.1 failed this metric
FC016: LWRP does not declare a default action: /tmp/3e19961b1cdccb2e4bf4dfe1/rubygems/resources/api.rb:1
FC016: LWRP does not declare a default action: /tmp/3e19961b1cdccb2e4bf4dfe1/rubygems/resources/bundle_config.rb:1
FC016: LWRP does not declare a default action: /tmp/3e19961b1cdccb2e4bf4dfe1/rubygems/resources/gem.rb:1
FC016: LWRP does not declare a default action: /tmp/3e19961b1cdccb2e4bf4dfe1/rubygems/resources/gemrc.rb:1
FC016: LWRP does not declare a default action: /tmp/3e19961b1cdccb2e4bf4dfe1/rubygems/resources/user.rb:1
1.0.1 passed this metric
1.0.1 failed this metric
FC016: LWRP does not declare a default action: /tmp/3e19961b1cdccb2e4bf4dfe1/rubygems/resources/api.rb:1
FC016: LWRP does not declare a default action: /tmp/3e19961b1cdccb2e4bf4dfe1/rubygems/resources/bundle_config.rb:1
FC016: LWRP does not declare a default action: /tmp/3e19961b1cdccb2e4bf4dfe1/rubygems/resources/gem.rb:1
FC016: LWRP does not declare a default action: /tmp/3e19961b1cdccb2e4bf4dfe1/rubygems/resources/gemrc.rb:1
FC016: LWRP does not declare a default action: /tmp/3e19961b1cdccb2e4bf4dfe1/rubygems/resources/user.rb:1