diff --git a/README.md b/README.md index fe07d04..caad30f 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ Install packages using the new hotness in Python package management...[`pip`](ht # Actions -- :install: Install a pip package - if version is provided, install that specific version +- :install: Install a pip package - if version is provided, install that specific version (default) - :upgrade: Upgrade a pip package - if version is provided, upgrade to that specific version - :remove: Remove a pip package - :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 # Example # install latest gunicorn into system path - python_pip "gunicorn" do - action :install - end + python_pip "gunicorn" # target a virtualenv python_pip "gunicorn" do virtualenv "/home/ubunut/my_ve" - action :install end # install Django 1.1.4 python_pip "django" do version "1.1.4" - action :install end # use this provider with the core package resource package "django" do provider Chef::Provider::PythonPip - action :install end `python_virtualenv` diff --git a/resources/pip.rb b/resources/pip.rb index 3276000..cccb224 100644 --- a/resources/pip.rb +++ b/resources/pip.rb @@ -19,6 +19,13 @@ # actions :install, :upgrade, :remove, :purge +default_action :install if defined?(default_action) # Chef > 10.8 + +# Default action for Chef <= 10.8 +def initialize(*args) + super + @action = :install +end attribute :package_name, :kind_of => String, :name_attribute => true attribute :version, :default => nil