Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 6acad21

Browse files
committed
Use :install as the default action
1 parent 6d2451d commit 6acad21

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

README.md

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ Install packages using the new hotness in Python package management...[`pip`](ht
4747

4848
# Actions
4949

50-
- :install: Install a pip package - if version is provided, install that specific version
50+
- :install: Install a pip package - if version is provided, install that specific version (default)
5151
- :upgrade: Upgrade a pip package - if version is provided, upgrade to that specific version
5252
- :remove: Remove a pip package
5353
- :user: User to run pip as, for using with virtualenv
@@ -65,26 +65,21 @@ Install packages using the new hotness in Python package management...[`pip`](ht
6565
# Example
6666

6767
# install latest gunicorn into system path
68-
python_pip "gunicorn" do
69-
action :install
70-
end
68+
python_pip "gunicorn"
7169

7270
# target a virtualenv
7371
python_pip "gunicorn" do
7472
virtualenv "/home/ubunut/my_ve"
75-
action :install
7673
end
7774

7875
# install Django 1.1.4
7976
python_pip "django" do
8077
version "1.1.4"
81-
action :install
8278
end
8379

8480
# use this provider with the core package resource
8581
package "django" do
8682
provider Chef::Provider::PythonPip
87-
action :install
8883
end
8984

9085
`python_virtualenv`

resources/pip.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,13 @@
1919
#
2020

2121
actions :install, :upgrade, :remove, :purge
22+
default_action :install
23+
24+
# Covers 0.10.8 and earlier :default_action
25+
def initialize(*args)
26+
super
27+
@action = :install
28+
end
2229

2330
attribute :package_name, :kind_of => String, :name_attribute => true
2431
attribute :version, :default => nil

0 commit comments

Comments
 (0)