diff --git a/Gemfile b/Gemfile deleted file mode 100644 index a72fef5..0000000 --- a/Gemfile +++ /dev/null @@ -1,35 +0,0 @@ -# -# Copyright 2015-2017, Noah Kantrowitz -# -# 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. -# - -source 'https://rubygems.org/' - -gemspec path: File.expand_path('..', __FILE__) - -def dev_gem(name, path: File.join('..', name), github: nil) - path = File.expand_path(File.join('..', path), __FILE__) - if File.exist?(path) - gem name, path: path - elsif github - gem name, git: "https://github.com/#{github}.git" - end -end - -dev_gem 'halite', github: 'poise/halite' -dev_gem 'poise' -dev_gem 'poise-archive' -dev_gem 'poise-boiler' -dev_gem 'poise-languages' -dev_gem 'poise-profiler' diff --git a/Rakefile b/Rakefile deleted file mode 100644 index cb942ad..0000000 --- a/Rakefile +++ /dev/null @@ -1,18 +0,0 @@ -# -# Copyright 2015-2017, Noah Kantrowitz -# -# 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. -# - -ENV['KITCHEN_CONCURRENCY'] = '10' -require 'poise_boiler/rakefile' diff --git a/chef/attributes/default.rb b/attributes/default.rb similarity index 100% rename from chef/attributes/default.rb rename to attributes/default.rb diff --git a/lib/poise_python.rb b/files/halite_gem/poise_python.rb similarity index 100% rename from lib/poise_python.rb rename to files/halite_gem/poise_python.rb diff --git a/lib/poise_python/cheftie.rb b/files/halite_gem/poise_python/cheftie.rb similarity index 100% rename from lib/poise_python/cheftie.rb rename to files/halite_gem/poise_python/cheftie.rb diff --git a/lib/poise_python/error.rb b/files/halite_gem/poise_python/error.rb similarity index 100% rename from lib/poise_python/error.rb rename to files/halite_gem/poise_python/error.rb diff --git a/lib/poise_python/python_command_mixin.rb b/files/halite_gem/poise_python/python_command_mixin.rb similarity index 100% rename from lib/poise_python/python_command_mixin.rb rename to files/halite_gem/poise_python/python_command_mixin.rb diff --git a/lib/poise_python/python_providers.rb b/files/halite_gem/poise_python/python_providers.rb similarity index 100% rename from lib/poise_python/python_providers.rb rename to files/halite_gem/poise_python/python_providers.rb diff --git a/lib/poise_python/python_providers/base.rb b/files/halite_gem/poise_python/python_providers/base.rb similarity index 100% rename from lib/poise_python/python_providers/base.rb rename to files/halite_gem/poise_python/python_providers/base.rb diff --git a/lib/poise_python/python_providers/dummy.rb b/files/halite_gem/poise_python/python_providers/dummy.rb similarity index 100% rename from lib/poise_python/python_providers/dummy.rb rename to files/halite_gem/poise_python/python_providers/dummy.rb diff --git a/lib/poise_python/python_providers/msi.rb b/files/halite_gem/poise_python/python_providers/msi.rb similarity index 100% rename from lib/poise_python/python_providers/msi.rb rename to files/halite_gem/poise_python/python_providers/msi.rb diff --git a/lib/poise_python/python_providers/portable_pypy.rb b/files/halite_gem/poise_python/python_providers/portable_pypy.rb similarity index 100% rename from lib/poise_python/python_providers/portable_pypy.rb rename to files/halite_gem/poise_python/python_providers/portable_pypy.rb diff --git a/lib/poise_python/python_providers/portable_pypy3.rb b/files/halite_gem/poise_python/python_providers/portable_pypy3.rb similarity index 100% rename from lib/poise_python/python_providers/portable_pypy3.rb rename to files/halite_gem/poise_python/python_providers/portable_pypy3.rb diff --git a/lib/poise_python/python_providers/scl.rb b/files/halite_gem/poise_python/python_providers/scl.rb similarity index 100% rename from lib/poise_python/python_providers/scl.rb rename to files/halite_gem/poise_python/python_providers/scl.rb diff --git a/lib/poise_python/python_providers/system.rb b/files/halite_gem/poise_python/python_providers/system.rb similarity index 100% rename from lib/poise_python/python_providers/system.rb rename to files/halite_gem/poise_python/python_providers/system.rb diff --git a/lib/poise_python/resources.rb b/files/halite_gem/poise_python/resources.rb similarity index 100% rename from lib/poise_python/resources.rb rename to files/halite_gem/poise_python/resources.rb diff --git a/lib/poise_python/resources/pip_requirements.rb b/files/halite_gem/poise_python/resources/pip_requirements.rb similarity index 100% rename from lib/poise_python/resources/pip_requirements.rb rename to files/halite_gem/poise_python/resources/pip_requirements.rb diff --git a/lib/poise_python/resources/python_execute.rb b/files/halite_gem/poise_python/resources/python_execute.rb similarity index 100% rename from lib/poise_python/resources/python_execute.rb rename to files/halite_gem/poise_python/resources/python_execute.rb diff --git a/lib/poise_python/resources/python_package.rb b/files/halite_gem/poise_python/resources/python_package.rb similarity index 100% rename from lib/poise_python/resources/python_package.rb rename to files/halite_gem/poise_python/resources/python_package.rb diff --git a/lib/poise_python/resources/python_runtime.rb b/files/halite_gem/poise_python/resources/python_runtime.rb similarity index 100% rename from lib/poise_python/resources/python_runtime.rb rename to files/halite_gem/poise_python/resources/python_runtime.rb diff --git a/lib/poise_python/resources/python_runtime_pip.rb b/files/halite_gem/poise_python/resources/python_runtime_pip.rb similarity index 100% rename from lib/poise_python/resources/python_runtime_pip.rb rename to files/halite_gem/poise_python/resources/python_runtime_pip.rb diff --git a/lib/poise_python/resources/python_runtime_test.rb b/files/halite_gem/poise_python/resources/python_runtime_test.rb similarity index 100% rename from lib/poise_python/resources/python_runtime_test.rb rename to files/halite_gem/poise_python/resources/python_runtime_test.rb diff --git a/lib/poise_python/resources/python_virtualenv.rb b/files/halite_gem/poise_python/resources/python_virtualenv.rb similarity index 100% rename from lib/poise_python/resources/python_virtualenv.rb rename to files/halite_gem/poise_python/resources/python_virtualenv.rb diff --git a/lib/poise_python/utils.rb b/files/halite_gem/poise_python/utils.rb similarity index 100% rename from lib/poise_python/utils.rb rename to files/halite_gem/poise_python/utils.rb diff --git a/lib/poise_python/utils/python_encoder.rb b/files/halite_gem/poise_python/utils/python_encoder.rb similarity index 100% rename from lib/poise_python/utils/python_encoder.rb rename to files/halite_gem/poise_python/utils/python_encoder.rb diff --git a/lib/poise_python/version.rb b/files/halite_gem/poise_python/version.rb similarity index 100% rename from lib/poise_python/version.rb rename to files/halite_gem/poise_python/version.rb diff --git a/test/gemfiles/chef-12.gemfile b/libraries/default.rb similarity index 69% rename from test/gemfiles/chef-12.gemfile rename to libraries/default.rb index 1209719..50d8671 100644 --- a/test/gemfiles/chef-12.gemfile +++ b/libraries/default.rb @@ -14,6 +14,6 @@ # limitations under the License. # -eval_gemfile File.expand_path('../../../Gemfile', __FILE__) - -gem 'chef', '~> 12.21' +raise 'Halite is not compatible with no_lazy_load false, please set no_lazy_load true in your Chef configuration file.' unless Chef::Config[:no_lazy_load] +$LOAD_PATH << File.expand_path('../../files/halite_gem', __FILE__) +require "poise_python/cheftie" diff --git a/metadata.rb b/metadata.rb new file mode 100644 index 0000000..69c9555 --- /dev/null +++ b/metadata.rb @@ -0,0 +1,35 @@ +# +# Copyright 2015-2017, Noah Kantrowitz +# +# 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. +# + +name "poise-python" +version "1.7.1" +description "A Chef cookbook for managing Python installations." +long_description "# Poise-Python Cookbook\n\n[![Build Status](https://img.shields.io/travis/poise/poise-python.svg)](https://travis-ci.org/poise/poise-python)\n[![Gem Version](https://img.shields.io/gem/v/poise-python.svg)](https://rubygems.org/gems/poise-python)\n[![Cookbook Version](https://img.shields.io/cookbook/v/poise-python.svg)](https://supermarket.chef.io/cookbooks/poise-python)\n[![Coverage](https://img.shields.io/codecov/c/github/poise/poise-python.svg)](https://codecov.io/github/poise/poise-python)\n[![Gemnasium](https://img.shields.io/gemnasium/poise/poise-python.svg)](https://gemnasium.com/poise/poise-python)\n[![License](https://img.shields.io/badge/license-Apache_2-blue.svg)](https://www.apache.org/licenses/LICENSE-2.0)\n\nA [Chef](https://www.chef.io/) cookbook to provide a unified interface for\ninstalling Python, managing Python packages, and creating virtualenvs.\n\n## Quick Start\n\nTo install the latest available version of Python 2 and then use it to create\na virtualenv and install some packages:\n\n```ruby\npython_runtime '2'\n\npython_virtualenv '/opt/myapp/.env'\n\npython_package 'Django' do\n version '1.8'\nend\n\npip_requirements '/opt/myapp/requirements.txt'\n```\n\n## Installing a Package From a URI\n\nWhile using `python_package 'git+https://github.com/example/mypackage.git'` will\nsometimes work, this approach is not recommended. Unfortunately pip's support\nfor installing directly from URI sources is limited and cannot support the API\nused for the `python_package` resource. You can run the install either directly\nfrom the URI or through an intermediary `git` resource:\n\n```ruby\n# Will re-install on every converge unless you add a not_if/only_if.\npython_execute '-m pip install git+https://github.com/example/mypackage.git'\n\n# Will only re-install when the git repository updates.\npython_execute 'install mypackage' do\n action :nothing\n command '-m pip install .'\n cwd '/opt/mypackage'\nend\ngit '/opt/mypackage' do\n repository 'https://github.com/example/mypackage.git'\n notifies :run, 'python_execute[install mypackage]', :immediately\nend\n```\n\n## Supported Python Versions\n\nThis cookbook can install at least Python 2.7, Python 3, and PyPy on all\nsupported platforms (Debian, Ubuntu, RHEL, CentOS, Fedora).\n\n### Windows Support\n\nThe latest version of `poise-python` includes basic support for managing Python\non Windows. This currently doesn't support Python 3.5, but everything should be\nworking. Consider this support tested but experimental at this time.\n\n## Requirements\n\nChef 12.1 or newer is required.\n\n## Attributes\n\nAttributes are used to configure the default recipe.\n\n* `node['poise-python']['install_python2']` – Install a Python 2.x runtime. *(default: true)*\n* `node['poise-python']['install_python3']` – Install a Python 3.x runtime. *(default: false)*\n* `node['poise-python']['install_pypy']` – Install a PyPy runtime. *(default: false)*\n\n## Recipes\n\n### `default`\n\nThe default recipe installs Python 2, 3, and/or PyPy based on the node\nattributes. It is entirely optional and can be ignored in favor of direct use\nof the `python_runtime` resource.\n\n## Resources\n\n### `python_runtime`\n\nThe `python_runtime` resource installs a Python interpreter.\n\n```ruby\npython_runtime '2'\n```\n\n#### Actions\n\n* `:install` – Install the Python interpreter. *(default)*\n* `:uninstall` – Uninstall the Python interpreter.\n\n#### Properties\n\n* `version` – Version of Python to install. If a partial version is given, use the\n latest available version matching that prefix. *(name property)*\n* `get_pip_url` – URL to download the `get-pip.py` bootstrap script from.\n *(default: https://bootstrap.pypa.io/get-pip.py)*\n* `pip_version` – Version of pip to install. If set to `true`, use the latest.\n If set to `false`, do not install pip. For backward compatibility, can also be\n set to a URL instead of `get_pip_url`. *(default: true)*\n* `setuptools_version` – Version of Setuptools to install. If set to `true`, use\n the latest. If set to `false`, do not install Setuptools. *(default: true)*\n* `virtualenv_version` – Version of virtualenv to install. If set to `true`,\n use the latest. If set to `false`, do not install virtualenv. Will never be\n installed if the `venv` module is already available, such as on Python 3.\n *(default: true)*\n* `wheel_version` – Version of wheel to install. If set to `true`, use the\n latest. If set to `false`, do not install wheel.\n\n#### Provider Options\n\nThe `poise-python` library offers an additional way to pass configuration\ninformation to the final provider called \"options\". Options are key/value pairs\nthat are passed down to the `python_runtime` provider and can be used to control how it\ninstalls Python. These can be set in the `python_runtime`\nresource using the `options` method, in node attributes or via the\n`python_runtime_options` resource. The options from all sources are merged\ntogether in to a single hash.\n\nWhen setting options in the resource you can either set them for all providers:\n\n```ruby\npython_runtime 'myapp' do\n version '2.7'\n options pip_version: false\nend\n```\n\nor for a single provider:\n\n```ruby\npython_runtime 'myapp' do\n version '2.7'\n options :system, dev_package: false\nend\n```\n\nSetting via node attributes is generally how an end-user or application cookbook\nwill set options to customize installations in the library cookbooks they are using.\nYou can set options for all installations or for a single runtime:\n\n```ruby\n# Global, for all installations.\noverride['poise-python']['options']['pip_version'] = false\n# Single installation.\noverride['poise-python']['myapp']['version'] = 'pypy'\n```\n\nThe `python_runtime_options` resource is also available to set node attributes\nfor a specific installation in a DSL-friendly way:\n\n```ruby\npython_runtime_options 'myapp' do\n version '3'\nend\n```\n\nUnlike resource attributes, provider options can be different for each provider.\nNot all providers support the same options so make sure to the check the\ndocumentation for each provider to see what options the use.\n\n### `python_runtime_options`\n\nThe `python_runtime_options` resource allows setting provider options in a\nDSL-friendly way. See [the Provider Options](#provider-options) section for more\ninformation about provider options overall.\n\n```ruby\npython_runtime_options 'myapp' do\n version '3'\nend\n```\n\n#### Actions\n\n* `:run` – Apply the provider options. *(default)*\n\n#### Properties\n\n* `resource` – Name of the `python_runtime` resource. *(name property)*\n* `for_provider` – Provider to set options for.\n\nAll other attribute keys will be used as options data.\n\n### `python_execute`\n\nThe `python_execute` resource executes a Python script using the configured runtime.\n\n```ruby\npython_execute 'myapp.py' do\n user 'myuser'\nend\n```\n\nThis uses the built-in `execute` resource and supports all the same properties.\n\n#### Actions\n\n* `:run` – Execute the script. *(default)*\n\n#### Properties\n\n* `command` – Script and arguments to run. Must not include the `python`. *(name attribute)*\n* `python` – Name of the `python_runtime` resource to use. If not specified, the\n most recently declared `python_runtime` will be used. Can also be set to the\n full path to a `python` binary.\n* `virtualenv` – Name of the `python_virtualenv` resource to use. This is\n mutually exclusive with the `python` property.\n\nFor other properties see the [Chef documentation](https://docs.chef.io/resource_execute.html#attributes).\n\n### `python_package`\n\nThe `python_package` resource installs Python packages using\n[pip](https://pip.pypa.io/).\n\n```ruby\npython_package 'Django' do\n version '1.8'\nend\n```\n\nThis uses the built-in `package` resource and supports the same actions and\nproperties. Multi-package installs are supported using the standard syntax.\n\n#### Actions\n\n* `:install` – Install the package. *(default)*\n* `:upgrade` – Install using the `--upgrade` flag.\n* `:remove` – Uninstall the package.\n\nThe `:purge` and `:reconfigure` actions are not supported.\n\n#### Properties\n\n* `group` – System group to install the package.\n* `package_name` – Package or packages to install. *(name property)*\n* `version` – Version or versions to install.\n* `python` – Name of the `python_runtime` resource to use. If not specified, the\n most recently declared `python_runtime` will be used. Can also be set to the\n full path to a `python` binary.\n* `user` – System user to install the package.\n* `virtualenv` – Name of the `python_virtualenv` resource to use. This is\n mutually exclusive with the `python` property.\n* `options` – Options to pass to `pip`.\n* `install_options` – Options to pass to `pip install` (and similar commands).\n* `list_options` – Options to pass to `pip list` (and similar commands).\n\nFor other properties see the [Chef documentation](https://docs.chef.io/resource_package.html#attributes).\nThe `response_file`, `response_file_variables`, and `source` properties are not\nsupported.\n\n### `python_virtualenv`\n\nThe `python_virtualenv` resource creates Python virtual environments.\n\n```ruby\npython_virtualenv '/opt/myapp'\n```\n\nThis will use the `venv` module if available, or `virtualenv` otherwise.\n\n#### Actions\n\n* `:create` – Create the virtual environment. *(default)*\n* `:delete` – Delete the virtual environment.\n\n#### Properties\n\n* `group` – System group to create the virtualenv.\n* `path` – Path to create the environment at. *(name property)*\n* `pip_version` – Version of pip to install. If set to `true`, use the latest.\n If set to `false`, do not install pip. Can also be set to a URL to a copy of\n the `get-pip.py` script. *(default: true)*\n* `python` – Name of the `python_runtime` resource to use. If not specified, the\n most recently declared `python_runtime` will be used. Can also be set to the\n full path to a `python` binary.\n* `setuptools_version` – Version of Setuptools to install. If set to `true`, use\n the latest. If set to `false`, do not install Setuptools. *(default: true)*\n* `system_site_packages` – Enable or disable visibilty of system packages in\n the environment. *(default: false)*\n* `user` – System user to create the virtualenv.\n* `wheel_version` – Version of wheel to install. If set to `true`, use the\n latest. If set to `false`, do not install wheel.\n\n### `pip_requirements`\n\nThe `pip_requirements` resource installs packages based on a `requirements.txt`\nfile.\n\n```ruby\npip_requirements '/opt/myapp/requirements.txt'\n```\n\nThe underlying `pip install` command will run on every converge, but\nnotifications will only be triggered if a package is actually installed.\n\n#### Actions\n\n* `:install` – Install the requirements. *(default)*\n* `:upgrade` – Install using the `--upgrade` flag.\n\n#### Properties\n\n* `path` – Path to the requirements file, or a folder containing the\n requirements file. *(name property)*\n* `cwd` – Directory to run `pip` from. *(default: directory containing the\n `requirements.txt`)*\n* `group` – System group to install the packages.\n* `options` – Command line options for use with `pip install`.\n* `python` – Name of the `python_runtime` resource to use. If not specified, the\n most recently declared `python_runtime` will be used. Can also be set to the\n full path to a `python` binary.\n* `user` – System user to install the packages.\n* `virtualenv` – Name of the `python_virtualenv` resource to use. This is\n mutually exclusive with the `python` property.\n\n## Python Providers\n\n### Common Options\n\nThese provider options are supported by all providers.\n\n* `pip_version` – Override the pip version.\n* `setuptools_version` – Override the Setuptools version.\n* `version` – Override the Python version.\n* `virtualenv_version` – Override the virtualenv version.\n* `wheel_version` – Override the wheel version.\n\n### `system`\n\nThe `system` provider installs Python using system packages. This is currently\nonly tested on platforms using `apt-get` and `yum` (Debian, Ubuntu, RHEL, CentOS\nAmazon Linux, and Fedora) and is a default provider on those platforms. It may\nwork on other platforms but is untested.\n\n```ruby\npython_runtime 'myapp' do\n provider :system\n version '2.7'\nend\n```\n\n#### Options\n\n* `dev_package` – Install the package with the headers and other development\n files. Can be set to a string to select the dev package specifically.\n *(default: true)*\n* `package_name` – Override auto-detection of the package name.\n* `package_upgrade` – Install using action `:upgrade`. *(default: false)*\n* `package_version` – Override auto-detection of the package version.\n\n### `scl`\n\nThe `scl` provider installs Python using the [Software Collections](https://www.softwarecollections.org/)\npackages. This is only available on RHEL, CentOS, and Fedora. SCL offers more\nrecent versions of Python than the system packages for the most part. If an SCL\npackage exists for the requested version, it will be used in preference to the\n`system` provider.\n\n```ruby\npython_runtime 'myapp' do\n provider :scl\n version '3.4'\nend\n```\n\n### `portable_pypy`\n\nThe `portable_pypy` provider installs Python using the [Portable PyPy](https://github.com/squeaky-pl/portable-pypy)\npackages. These are only available for Linux, but should work on any Linux OS.\n\n```ruby\npython_runtime 'myapp' do\n provider :portable_pypy\n version 'pypy'\nend\n```\n\n### `portable_pypy3`\n\nThe `portable_pypy3` provider installs Python 3 using the [Portable PyPy](https://github.com/squeaky-pl/portable-pypy)\npackages. These are only available for Linux, but should work on any Linux OS.\n\n```ruby\npython_runtime 'myapp' do\n provider :portable_pypy3\n version 'pypy3'\nend\n```\n\n#### Options\n\n* `folder` – Folder to install PyPy in. *(default: /opt/)*\n* `url` – URL to download the package from. *(default: automatic)*\n\n### `deadsnakes`\n\n*Coming soon!*\n\n### `python-build`\n\n*Coming soon!*\n\n## Upgrading from the `python` Cookbook\n\nThe older `python` cookbook is not directly compatible with this one, but the\nbroad strokes overlap well. The `python::default` recipe is roughly equivalent\nto the `poise-python::default` recipe. The `python::pip` and `python::virtualenv`\nrecipes are no longer needed as installing those things is now part of the\n`python_runtime` resource. The `python::package` recipe corresponds with the\n`system` provider for the `python_runtime` resource, and can generally be\nreplaced with `poise-python::default`. At this time there is no provider to\ninstall from source so there is no replacement for the `python::source` recipe,\nhowever this is planned for the future via a `python-build` provider.\n\nThe `python_pip` resource can be replaced with `python_package`, though the\n`environment` property has been removed. The `python_virtualenv` resource can remain\nunchanged except for the `interpreter` property now being `python` and the\n`options` property has been removed.\n\n## Sponsors\n\nDevelopment sponsored by [Bloomberg](http://www.bloomberg.com/company/technology/).\n\nThe Poise test server infrastructure is sponsored by [Rackspace](https://rackspace.com/).\n\n## License\n\nCopyright 2015-2017, Noah Kantrowitz\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\nhttp://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n" +maintainer "Noah Kantrowitz" +maintainer_email "noah@coderanger.net" +source_url "https://github.com/poise/poise-python" if defined?(source_url) +issues_url "https://github.com/poise/poise-python/issues" if defined?(issues_url) +license "Apache-2.0" +depends "poise", "~> 2.7" +depends "poise-languages", "~> 2.0" +chef_version "< 15", ">= 12.16" if defined?(chef_version) +supports "ubuntu" +supports "debian" +supports "redhat" +supports "centos" +supports "fedora" +supports "amazon" +supports "windows" diff --git a/poise-python.gemspec b/poise-python.gemspec deleted file mode 100644 index 551dc68..0000000 --- a/poise-python.gemspec +++ /dev/null @@ -1,43 +0,0 @@ -# -# Copyright 2015-2017, Noah Kantrowitz -# -# 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. -# - -lib = File.expand_path('../lib', __FILE__) -$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) -require 'poise_python/version' - -Gem::Specification.new do |spec| - spec.name = 'poise-python' - spec.version = PoisePython::VERSION - spec.authors = ['Noah Kantrowitz'] - spec.email = %w{noah@coderanger.net} - spec.description = "A Chef cookbook for managing Python installations." - spec.summary = spec.description - spec.homepage = 'https://github.com/poise/poise-python' - spec.license = 'Apache-2.0' - spec.metadata['platforms'] = 'ubuntu debian redhat centos fedora amazon windows' - - spec.files = `git ls-files`.split($/) - spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } - spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) - spec.require_paths = %w{lib} - - spec.add_dependency 'chef', '>= 12.16', '< 15' - spec.add_dependency 'halite', '~> 1.0' - spec.add_dependency 'poise', '~> 2.7' - spec.add_dependency 'poise-languages', '~> 2.0' - - spec.add_development_dependency 'poise-boiler', '~> 1.8' -end diff --git a/chef/recipes/default.rb b/recipes/default.rb similarity index 100% rename from chef/recipes/default.rb rename to recipes/default.rb diff --git a/test/cookbook/metadata.rb b/test/cookbook/metadata.rb deleted file mode 100644 index 0d0f7fb..0000000 --- a/test/cookbook/metadata.rb +++ /dev/null @@ -1,18 +0,0 @@ -# -# Copyright 2015-2017, Noah Kantrowitz -# -# 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. -# - -name 'poise-python_test' -depends 'poise-python' diff --git a/test/cookbook/recipes/default.rb b/test/cookbook/recipes/default.rb deleted file mode 100644 index 0a1c1ef..0000000 --- a/test/cookbook/recipes/default.rb +++ /dev/null @@ -1,101 +0,0 @@ -# -# Copyright 2015-2017, Noah Kantrowitz -# -# 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. -# - -require 'poise_python/resources/python_runtime_test' - -# Install lsb-release because Debian 6 doesn't by default and serverspec requires it -package 'lsb-release' if platform?('debian') && node['platform_version'].start_with?('6') - -# Which tests to run on each platform. -tests_to_run = value_for_platform( - default: %w{py2 py3 system pypy pip}, - centos: {default: %w{py2 py3 system scl pypy pip}}, - redhat: {default: %w{py2 py3 system scl pypy pip}}, - ubuntu: { - '12.04' => %w{py2 pypy pip}, - 'default' => %w{py2 py3 system pypy pip}, - }, - windows: {default: %w{py2 py3}}, -) - -%w{py2 py3 system pypy scl pip msi}.each do |test| - unless tests_to_run.include?(test) - file "/no_#{test}" - next - end - - case test - when 'py2' - python_runtime_test '2' - when 'py3' - python_runtime_test '3' - when 'system' - python_runtime_test 'system' do - version '' - runtime_provider :system - end - when 'scl' - python_runtime_test 'scl' do - version '' - runtime_provider :scl - end - when 'pypy' - python_runtime_test 'pypy' - when 'pip' - # Some pip-related tests that I don't need to run on every Python version. - # Pip does plenty of testing on different Python versions and I already touch - # the basics. - pip_provider = value_for_platform_family(default: :portable_pypy, windows: :msi) - # Check the baseline state, should pull the latest pip. - python_runtime 'pip1' do - provider pip_provider - options path: '/test_pip1' - version '' - end - # Check installing a requested version. - python_runtime 'pip2' do - pip_version '8.1.2' - provider pip_provider - options path: '/test_pip2' - version '' - end - # Check installing the latest and reverting to an old version. - python_runtime 'pip3' do - provider pip_provider - options path: '/test_pip3' - version '' - end - python_runtime 'pip3b' do - pip_version '7.1.2' - provider pip_provider - options path: '/test_pip3' - version '' - end - # Test pip9 specifically just to be safe. - python_runtime 'pip4' do - pip_version '9.0.3' - provider pip_provider - options path: '/test_pip4' - version '' - end - # Run a simple package install on each just to test things. - (1..4).each do |n| - python_package 'structlog' do - python "pip#{n}" - end - end - end -end diff --git a/test/docker/docker.ca b/test/docker/docker.ca deleted file mode 100644 index f381108..0000000 --- a/test/docker/docker.ca +++ /dev/null @@ -1,29 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIFCzCCAvOgAwIBAgIJAJTJgn9tSdKmMA0GCSqGSIb3DQEBBQUAMA0xCzAJBgNV -BAMTAkNBMB4XDTE1MDExMjIwMjk0M1oXDTI1MDEwOTIwMjk0M1owDTELMAkGA1UE -AxMCQ0EwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDDPFn79sz1kQLk -rAS5z/zfCMXuE+V9IEmGXJeSprsXrv+AdjFpVDr52lpvZ36i2gixk8grcWtFqQMC -jB1c2HUe69ebC89rHSPmGCx5eRcWQPQG29fdH/nC+I34EbYadJB7PdzkvTj0KuN8 -YfQj6lhwqltYiELZhuGoXcuhwZ5SC4VcJ2cdvx7oQPECLlMft8dhWyk15WGhp0jL -2H5noGajz9IFzHieoKJyh+oYA3BYCugpNBLTweNw+NuRxMwHixftvkXvlqKeZ402 -4iwmIO8MG9oUxXs6D85gv6tJOau+dD1EDYH9VzYwSvLto3QBzJX0NiHKlmeq4BG2 -1V3n+N1kZmMDgEtX2TDFsGHlUo77Gw0ob/w7qJU+7GAXRwWw7TPhMBLSkOlGM726 -Lq9p5+7mK1YThk0PmlsSAU6/fT79PSdrYpTKr3WkBTnwd76df+Koh8fpN4BHf9L4 -9bWSYc9Nb9/wp0md9xhzjjVHargpVxZmNH7bcIa8YA9tYaW+oifo2hfb7o0qhGQ1 -8pES3LPUi/qtZkBYUQdh8/mkqTvRjeS446iUmYWcrHyiIzQk/cMbrAVYOi3Xnq0J -ui/r48iv7uLhpcDEQl2mENr0syygrPthVKa4gYHAZ0tK3pfe0yUGMiwS2D23xMR4 -WYLWLwYSK0j1JYpEbsBNS3wZX91FIwIDAQABo24wbDAdBgNVHQ4EFgQU1j2CHhNt -sWAvDmu49yRFfHRBp9kwPQYDVR0jBDYwNIAU1j2CHhNtsWAvDmu49yRFfHRBp9mh -EaQPMA0xCzAJBgNVBAMTAkNBggkAlMmCf21J0qYwDAYDVR0TBAUwAwEB/zANBgkq -hkiG9w0BAQUFAAOCAgEAD7apefon65k3Xey7vsTb/A18m7JwBNLB48ILNcSKVgO1 -iuSMCGNQ+4bNU4o9cTpRoijB3w4RY7IIaDlRcUg8FIO6kgEhjhiAjSSqJAaajOFc -urxOmi9E7xYmTDqLxEGF5/5vaG4olAi3tRgZNd2+Ue0ANZ1KMh3ZkE0nA5v1zb/g -Ax/Zs6tATdoG6umMQg8TjiKucwi9J9he+xJ5y0E77/RrdNL9aKcU47wTAwUkokpb -u1JFo1da3yZLDwQuBN5DCc4pgPgxXlfa6DnzQM1veKIhP5sa9T4sCC8S4IjGFenw -yl4xm+9AOZQeLFpczqgVJhun5P41syepnZ433hWoLXKLHd1n0ILgw9JyVF686LIt -bSar3+krmFuzdRCfet0kJR762p8jmxJOwL+KQGELGlkleJK48a+ruWIeeulZhpJ5 -tF4QJxytq4aXpjeFma0Yi/0rQuNi3H1QIW5YPnFL0XlJ8Rvr8gSVc1zhkM9rsnxX -l9Pun0flP/mf/ulOa020hQUPqEYjSfdJOkLy2gZDvHRL2LRXNjGHoteGNJCq34Q1 -wQerxofHn+Hpp61+Ebj+RLK0KJE+QeP3T8rL30aSSzQZQZJVI0ict5C71kiTbQnw -Z0vE6LquvFfMSqfPLt6uuCRVywBjLx19B7TuMf/DgAD+lR+1FFGKy1hO2Q1jfCY= ------END CERTIFICATE----- diff --git a/test/docker/docker.pem b/test/docker/docker.pem deleted file mode 100644 index 571f1dc..0000000 --- a/test/docker/docker.pem +++ /dev/null @@ -1,83 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIFBTCCAu2gAwIBAgIBGTANBgkqhkiG9w0BAQUFADANMQswCQYDVQQDEwJDQTAe -Fw0xNTA2MjQxNjI5MDRaFw0yNTA2MjExNjI5MDRaMGYxJzAlBgNVBAMTHkRvY2tl -ciBjbGllbnQgZm9yIHBvaXNlLXB5dGhvbjEXMBUGA1UECxMOa2l0Y2hlbi1kb2Nr -ZXIxIjAgBgNVBAoTGUNvZGVyYW5nZXIgQ29uc3VsdGluZyBMTEMwggIiMA0GCSqG -SIb3DQEBAQUAA4ICDwAwggIKAoICAQCvQ5r/r09lmqPAlmyaZvt83Ctkiz+40m79 -v1Ut4eKjGbmMAOgFee6aJQJBvYDBG8woImyHb2o/Cc8lvgIGosa/Sq5NvRqCy8dR -2Bx0r0w1KeLSB0Z/rJj05PwvoUHWjL9FmM/oJCaJR+tQqJepNV7LDUeNQ7CUKqdo -cHthEti8CXzRP5waLJMHUg4RsXBb7+0f4O++Lq8iU4e2ifkZMHhLczlsQdU38Th2 -teTp4uNg872t0WdCYUoqcVagviMRTIji5nUQDXCiMyNRL4dzt3Hi5q9UWSw7TQGe -SAwiDC37x2ct3SNvI6H+5QSbEGgtlJ8gJC5Gq6UqTfKK+8xDy3eWJyCzP+g9soC+ -JMNczFhUyEX68eYHUro2Tb/PKiVZa5fzON2sEYAIbLEZ9HORyPI4YDPVyk/DBhXA -xtWkAHiybXph3Z/2WYWK6tRC5C6LjuBnm5yHDwioWF3XhozK9lptLrKix2MpV8x7 -pI7qGC3ycWTWrQkyU/dr2dDQm1Qp2XAhVqu4i8Lo+VcRJG+rZsQznZTQXbvulBa4 -fIrs7Rgg3Sd6KJxQAo5mCHI9tdkjh5LVJgQfPX2b5mjTl5o+TEIEK8t4hsKUThHF -2kNzv/PaIKJmRC2R6Tqt5hce582VTr6s+9HKLxRBUwCSPwZlxeOfLQUOh245o/i8 -czc0eAtHjwIDAQABoxcwFTATBgNVHSUEDDAKBggrBgEFBQcDAjANBgkqhkiG9w0B -AQUFAAOCAgEAIne7ZezRxVsI7iX0KP8IGPcjSQoz/oOwJmYqZDoEJnxGp1pG4YfG -gb0TzO1tsQzx9jczxaZet12OXGNa+8PDRCjxm+8+bS6Oo2GDjSIxeJbC8duip37F -2dn5VWRf8D9C5GC/G1Ylk3KavdA6ye5Q3eaL/wPHzPwmnhEd1QZljx89Fftj+qAv -60No8RJwtfrfALzAroqwiihY6ubv1FXnUY6hEeAoxlFCrpMwV+7Y6uSjNNtYyLRk -7zW535GmDsYOpLnXdk4N0t+TJBu46mw2hX+yz7mXpYcsCcNLd9M4+Fyyri07qQkR -VMMVBfnvgQA+zFB7FpNOY31lR1FL4DDUYY03fgtGe3+4Boxed1v3j1TBkUvAksOS -UDH+FFiWzms1EVXeYBb1RCtBGicq9OwVB61KKrcwku4V9ym0HKzQfCzKENQQbZrN -CPLeG+/fyXofCCR7qcAxpUoQj8yhMONyGZFVcDORTDUf5ckn3gDGjaPH3ycbw2IE -yK5k9Hu2nFB505tzAfwSBCmsBIjygSvBj3NmCPfs3cBVxn/XjwtqTcCdagWd8O58 -TOm06tT6uA/gQwNCZk7j/UEJNS4G2tmnfNltuunOt+mxFMN6xbLRKpCzxoXVrcnf -cFsmnqUhbAt1Q4EICxSzk7RQ3jrI1pJLELuUeXhF8ffmjUw3Jmitdd8= ------END CERTIFICATE----- ------BEGIN RSA PRIVATE KEY----- -Proc-Type: 4,ENCRYPTED -DEK-Info: AES-256-CBC,F879A95B0E208D4A8C16375B3206CCAC - -xuODVH6KSi0YuEW25bFt8vJR4gTbIYMxHTVLcHdkPrsrVGgnEKzEnlvsOiA0M45A -3ehgRyc+BhMFchfp0iXczHR89NY+4pza5rssidmsFm2gaZxhOsunEr3yRvWzn3OH -vJT0Ws85vSKUtmQilmEQ7AACc/NhlJ5AdiwMpWWbo7Wa/DQ28Ml5/7dqeIftBk09 -6o+xn2IniQy4EpUwhOYu3brnyuqTglZrpLq+od6DsWoWPC6eiSV1ymEw32HjxM76 -1kl7aNqvowHEF4TqUDOl0vu+FayAKca3X5CoDmhNQtB/qeSh3nJoL0h6PdaP4EhS -+c5zyMq2a4vVf/UDAs+624TxHJBNLHllIebAgPM898lxNOIQ/PILCe5SjC6v7Pij -0CkPQyOa4NR8pFaBfAMyatb9AcAcKo/NIYwLWhgPDH1MC653Df30nQYY/2EvLaod -vpmQ/6TorxdXHTn0hHVRe7njaXlupegpTNlaIfKS2LRT0mmVO3+k+dzAj6tDRH20 -MoHBE4MspLSeUR1fi7e1CfpeQaYFJ/THg/4wGJHDgTvu3Z3B++N5vQrzIOO6/EOw -kegtm7zpWthnKOC5Iypihgspmcie7mZ4D4wLWnu8hXxPu2LG5pWWYk5iUoMYg3ZK -FQVBffYSOSwR8WwTPRzM2huFfwJ0021n9V3vB+jvjq5qXPI03yvAcZ6PFbMTfJ3S -QlEVThtkevnHsldbJSurHl7YYiMVwosFXov3IRIYhsdH5BGQz/ZGueKBxmVOJ+Oj -TO/b/rveEB7a3SYjVEvJXjmiD60D3mZlW3wuov1PrnWj14/Uo9T+vD8nFHRa7KQB -rcnzy7v2rqgOJ2bucf4WIHQ/NijuUitT0mAk1pDHdWAvfVwL5U7f6VnaAyuaEkCB -eGZbtDj0bymbXLO1NxyKGYi+4+BhoRYO9gxieBdg9qJWbI5sUHbNOIOQS0+t5stc -NVA87oMQ3rWP+wd7NAOegmWRzh4ZzvAO3WCHUKVTzRFaaXq7f2iM9JstN97keJXC -goPRh9HpKdFEYnR0djVvMj93ObxqxPrI8oysdSTl+kh9d85OUiC8NGpUqNA532xQ -6Bi6UPNuv7d4Jk9tpj2QDAW7vRl0CrYflWW+ULR3YA48488YRypdu0fUXklqRQ/+ -WzibGUNDuyjCqm96rxWtl71F3DfY/LJYPGMzG2lWIiXvq5xl2fQ5DwEkhyPClIjK -tljK0PiB+rY+zet3kKVmi53EjRsPR1LO/+L4mJ7GHjLljpm5BPKyMITsXqjTOwCT -vLiRiAg9rGRs1vC51Bc5U1D8GU9pjJcX6M+IhQNPXwHMiN+iql090mWrcdCkKGkv -k2dTOJATDOQ31tHUZl4CGXReVpLKPezUrvSu3yyTUZRCteC6gWfHX0INoQ//7EUq -SkbWGX5DsPUOGplWYoGPdGSLhpRJFg/nSIiL4IHmX/dJQEceAPqBCoZsX8b7pV5Z -0AS9I0qNJU8vZutMxfSS5nO1iZFzUqYLktxeP9T4cDiFK1l+95al+XXbtjproW6I -0xkIuYiwmwnukf05ejIKFzQXXydjjFThgEnQkZgVeyEaNJEPZTQETYWzR5ILLFHX -YVI0JIMqbzH/ocGXz6NZ7D97Q4Bz7sEb+yX5JkJMx8lQMtQlxWhEhs7As0FPiImn -oKwhPJOqLGvCcCqnxmsPyfsZpJjHMqm2327E6jGowEu/sFwnxcqLEMEXJRyGZzQH -q3hO7FyEZPh2QjZP7TiF3NO8wf4a0O05Syf0cMZy35f9bRdp19ESUmNEhycM6Vou -bXxepzqvLf36FI1311o6AxlElKKL9KxNgZLlF0Q4IpO2KZkmYZCIJtYHcy509ll8 -NBWf/mcEFNZtjfLLexNztTdQ43lFTRd2ddErznCvHLbpsOoac+oaLAo09E2EUcm3 -4yhMqDEFqACYd7AhiHvt18k4EybpZ5NIg2A4NxS6nEt/jyV90HGriHZxj675nYEL -gB1F00sEv6ihrnd2y90AJI4K1MNGtJc0nB0R5gi4l/sLRp/lTOqV4Fn0wR/qFJ++ -4XemaOqhLLuQEi9PPMSxFazZpwd0k1OoPuogCsrH4ujzV3xpxrzAzpCsocwh0sZK -J7AguBD+C9sZZOkGLT4kDDeNUJY7OCjdnY5yLjNpLqn+bTqidOUjRtmGzcrZXzh5 -BrmcpfQxzOl3H6e+0rUPr32YC4GF/IrbpDzT8lnceO4QYc3lTZEdqLi0ZjPfrNXm -4CBOfDQfQRvKel6dLSeJAQ6nRmh8bGMA3ZX5PTyb5p9rMXNSA6QJGIyP+5VTbbSP -DKdmcbO7hs0m2tJypiTgOh+8cwsoDLgoA1UKzUvNq349AaYT7Y4hMEGNvetDhjEE -54unpiHlzvzO8VZ41W7mYiYduU8YwFUF8gAPC0B+71jCBqLqgq5XlLzHvn/9+32h -E9rBv9tIt8r8GbnfdTfz83fhpg7ZJZeY3nv7qPyFM9wfgRxwWq741KLmzBoj4T6P -9puy8FjxjHw0mN+U4euVuoqiIil5UHLuecGg5Kx/bbR177Oax3vANwpFtnQCT34f -oqsjjvqii3VijWxt9ynAtPX5flgRmmWmSAnqWlrlr2AvkJBO7R0ID4F0Sq1k3245 -V1fv7BXVt+hnWVrYo+UKjAGa/nqmJVVyhHvAgfntp//h+HrpK7ww+NwVH4gE+K4S -q4m7uMsH2fnTopjYJaNZN7MwV/wPFpWBlEogVGIV7L99oF/0Vzwj14vKhDMIXhgQ -DsbF9vrLwEMCnsm/d8sWjT/mVEznC+A5PI5DDmcORUAY4UEF55NjL/2U5ddmH4+3 -S9KeNURiBdRoYhnUD2nAvTc8EoK+BR9/vpYhlk/V0KGlRGt8GdsuH/BW11mRg4kY -z2K/BdOSLZfJYtHR2nPkUezprnSocQQilMT6/UIx2Tt07ZFB59TDoBT0AX6QuI3w -BCnGmJWul7S8Q4olipE7EYg6nS2YERUzJFTiCVAwTPkhH8TycdmxrNaZ9+Vo5W6t -MIzb5HJo2n4S17BTif02O89Pm+QDnXYRUO9Go178+rnPODGrmup5Tct8E30QD9kI -12FXoN/OaSnKbSskQzOc+HT36QCVFWhXcU7GZC0LPP2jQNkjYVFJnxS+wQlfrcT3 ------END RSA PRIVATE KEY----- diff --git a/test/gemfiles/chef-12.16.gemfile b/test/gemfiles/chef-12.16.gemfile deleted file mode 100644 index 601a96c..0000000 --- a/test/gemfiles/chef-12.16.gemfile +++ /dev/null @@ -1,19 +0,0 @@ -# -# Copyright 2017, Noah Kantrowitz -# -# 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. -# - -eval_gemfile File.expand_path('../../../Gemfile', __FILE__) - -gem 'chef', '~> 12.16.42' diff --git a/test/gemfiles/chef-12.17.gemfile b/test/gemfiles/chef-12.17.gemfile deleted file mode 100644 index 2b2dbab..0000000 --- a/test/gemfiles/chef-12.17.gemfile +++ /dev/null @@ -1,19 +0,0 @@ -# -# Copyright 2017, Noah Kantrowitz -# -# 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. -# - -eval_gemfile File.expand_path('../../../Gemfile', __FILE__) - -gem 'chef', '~> 12.17.44' diff --git a/test/gemfiles/chef-12.18.gemfile b/test/gemfiles/chef-12.18.gemfile deleted file mode 100644 index eef6f42..0000000 --- a/test/gemfiles/chef-12.18.gemfile +++ /dev/null @@ -1,19 +0,0 @@ -# -# Copyright 2017, Noah Kantrowitz -# -# 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. -# - -eval_gemfile File.expand_path('../../../Gemfile', __FILE__) - -gem 'chef', '~> 12.18.31' diff --git a/test/gemfiles/chef-12.19.gemfile b/test/gemfiles/chef-12.19.gemfile deleted file mode 100644 index 62c4b98..0000000 --- a/test/gemfiles/chef-12.19.gemfile +++ /dev/null @@ -1,19 +0,0 @@ -# -# Copyright 2017, Noah Kantrowitz -# -# 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. -# - -eval_gemfile File.expand_path('../../../Gemfile', __FILE__) - -gem 'chef', '~> 12.19.36' diff --git a/test/gemfiles/chef-12.20.gemfile b/test/gemfiles/chef-12.20.gemfile deleted file mode 100644 index 24473c3..0000000 --- a/test/gemfiles/chef-12.20.gemfile +++ /dev/null @@ -1,19 +0,0 @@ -# -# Copyright 2018, Noah Kantrowitz -# -# 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. -# - -eval_gemfile File.expand_path('../../../Gemfile', __FILE__) - -gem 'chef', '~> 12.20.3' diff --git a/test/gemfiles/chef-12.21.gemfile b/test/gemfiles/chef-12.21.gemfile deleted file mode 100644 index b15de0b..0000000 --- a/test/gemfiles/chef-12.21.gemfile +++ /dev/null @@ -1,19 +0,0 @@ -# -# Copyright 2018, Noah Kantrowitz -# -# 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. -# - -eval_gemfile File.expand_path('../../../Gemfile', __FILE__) - -gem 'chef', '~> 12.21.31' diff --git a/test/gemfiles/chef-13.0.gemfile b/test/gemfiles/chef-13.0.gemfile deleted file mode 100644 index 7e864da..0000000 --- a/test/gemfiles/chef-13.0.gemfile +++ /dev/null @@ -1,19 +0,0 @@ -# -# Copyright 2017, Noah Kantrowitz -# -# 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. -# - -eval_gemfile File.expand_path('../../../Gemfile', __FILE__) - -gem 'chef', '~> 13.0.118' diff --git a/test/gemfiles/chef-13.1.gemfile b/test/gemfiles/chef-13.1.gemfile deleted file mode 100644 index 05668a3..0000000 --- a/test/gemfiles/chef-13.1.gemfile +++ /dev/null @@ -1,19 +0,0 @@ -# -# Copyright 2017, Noah Kantrowitz -# -# 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. -# - -eval_gemfile File.expand_path('../../../Gemfile', __FILE__) - -gem 'chef', '~> 13.1.31' diff --git a/test/gemfiles/chef-13.10.gemfile b/test/gemfiles/chef-13.10.gemfile deleted file mode 100644 index daf9679..0000000 --- a/test/gemfiles/chef-13.10.gemfile +++ /dev/null @@ -1,19 +0,0 @@ -# -# Copyright 2018, Noah Kantrowitz -# -# 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. -# - -eval_gemfile File.expand_path('../../../Gemfile', __FILE__) - -gem 'chef', '~> 13.10.4' diff --git a/test/gemfiles/chef-13.2.gemfile b/test/gemfiles/chef-13.2.gemfile deleted file mode 100644 index a466fdb..0000000 --- a/test/gemfiles/chef-13.2.gemfile +++ /dev/null @@ -1,19 +0,0 @@ -# -# Copyright 2017, Noah Kantrowitz -# -# 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. -# - -eval_gemfile File.expand_path('../../../Gemfile', __FILE__) - -gem 'chef', '~> 13.2.20' diff --git a/test/gemfiles/chef-13.3.gemfile b/test/gemfiles/chef-13.3.gemfile deleted file mode 100644 index cf2a9bc..0000000 --- a/test/gemfiles/chef-13.3.gemfile +++ /dev/null @@ -1,19 +0,0 @@ -# -# Copyright 2018, Noah Kantrowitz -# -# 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. -# - -eval_gemfile File.expand_path('../../../Gemfile', __FILE__) - -gem 'chef', '~> 13.3.42' diff --git a/test/gemfiles/chef-13.4.gemfile b/test/gemfiles/chef-13.4.gemfile deleted file mode 100644 index ea6fbee..0000000 --- a/test/gemfiles/chef-13.4.gemfile +++ /dev/null @@ -1,19 +0,0 @@ -# -# Copyright 2018, Noah Kantrowitz -# -# 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. -# - -eval_gemfile File.expand_path('../../../Gemfile', __FILE__) - -gem 'chef', '~> 13.4.24' diff --git a/test/gemfiles/chef-13.5.gemfile b/test/gemfiles/chef-13.5.gemfile deleted file mode 100644 index ecffdfa..0000000 --- a/test/gemfiles/chef-13.5.gemfile +++ /dev/null @@ -1,19 +0,0 @@ -# -# Copyright 2018, Noah Kantrowitz -# -# 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. -# - -eval_gemfile File.expand_path('../../../Gemfile', __FILE__) - -gem 'chef', '~> 13.5.3' diff --git a/test/gemfiles/chef-13.6.gemfile b/test/gemfiles/chef-13.6.gemfile deleted file mode 100644 index 315d54e..0000000 --- a/test/gemfiles/chef-13.6.gemfile +++ /dev/null @@ -1,19 +0,0 @@ -# -# Copyright 2018, Noah Kantrowitz -# -# 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. -# - -eval_gemfile File.expand_path('../../../Gemfile', __FILE__) - -gem 'chef', '~> 13.6.4' diff --git a/test/gemfiles/chef-13.8.gemfile b/test/gemfiles/chef-13.8.gemfile deleted file mode 100644 index 60aa2c3..0000000 --- a/test/gemfiles/chef-13.8.gemfile +++ /dev/null @@ -1,19 +0,0 @@ -# -# Copyright 2018, Noah Kantrowitz -# -# 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. -# - -eval_gemfile File.expand_path('../../../Gemfile', __FILE__) - -gem 'chef', '~> 13.8.0' diff --git a/test/gemfiles/chef-13.9.gemfile b/test/gemfiles/chef-13.9.gemfile deleted file mode 100644 index c06de0f..0000000 --- a/test/gemfiles/chef-13.9.gemfile +++ /dev/null @@ -1,19 +0,0 @@ -# -# Copyright 2018, Noah Kantrowitz -# -# 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. -# - -eval_gemfile File.expand_path('../../../Gemfile', __FILE__) - -gem 'chef', '~> 13.9.4' diff --git a/test/gemfiles/chef-13.gemfile b/test/gemfiles/chef-13.gemfile deleted file mode 100644 index 039b51b..0000000 --- a/test/gemfiles/chef-13.gemfile +++ /dev/null @@ -1,19 +0,0 @@ -# -# Copyright 2017, Noah Kantrowitz -# -# 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. -# - -eval_gemfile File.expand_path('../../../Gemfile', __FILE__) - -gem 'chef', '~> 13.10' diff --git a/test/gemfiles/chef-14.0.gemfile b/test/gemfiles/chef-14.0.gemfile deleted file mode 100644 index 31ec48c..0000000 --- a/test/gemfiles/chef-14.0.gemfile +++ /dev/null @@ -1,19 +0,0 @@ -# -# Copyright 2018, Noah Kantrowitz -# -# 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. -# - -eval_gemfile File.expand_path('../../../Gemfile', __FILE__) - -gem 'chef', '~> 14.0.202' diff --git a/test/gemfiles/chef-14.1.gemfile b/test/gemfiles/chef-14.1.gemfile deleted file mode 100644 index a347dd6..0000000 --- a/test/gemfiles/chef-14.1.gemfile +++ /dev/null @@ -1,19 +0,0 @@ -# -# Copyright 2018, Noah Kantrowitz -# -# 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. -# - -eval_gemfile File.expand_path('../../../Gemfile', __FILE__) - -gem 'chef', '~> 14.1.12' diff --git a/test/gemfiles/chef-14.2.gemfile b/test/gemfiles/chef-14.2.gemfile deleted file mode 100644 index e0db219..0000000 --- a/test/gemfiles/chef-14.2.gemfile +++ /dev/null @@ -1,19 +0,0 @@ -# -# Copyright 2018, Noah Kantrowitz -# -# 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. -# - -eval_gemfile File.expand_path('../../../Gemfile', __FILE__) - -gem 'chef', '~> 14.2.0' diff --git a/test/gemfiles/chef-14.3.gemfile b/test/gemfiles/chef-14.3.gemfile deleted file mode 100644 index b80e938..0000000 --- a/test/gemfiles/chef-14.3.gemfile +++ /dev/null @@ -1,19 +0,0 @@ -# -# Copyright 2018, Noah Kantrowitz -# -# 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. -# - -eval_gemfile File.expand_path('../../../Gemfile', __FILE__) - -gem 'chef', '~> 14.3.37' diff --git a/test/gemfiles/chef-14.4.gemfile b/test/gemfiles/chef-14.4.gemfile deleted file mode 100644 index 47651c8..0000000 --- a/test/gemfiles/chef-14.4.gemfile +++ /dev/null @@ -1,19 +0,0 @@ -# -# Copyright 2018, Noah Kantrowitz -# -# 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. -# - -eval_gemfile File.expand_path('../../../Gemfile', __FILE__) - -gem 'chef', '~> 14.4.56' diff --git a/test/gemfiles/chef-14.gemfile b/test/gemfiles/chef-14.gemfile deleted file mode 100644 index 63ff708..0000000 --- a/test/gemfiles/chef-14.gemfile +++ /dev/null @@ -1,19 +0,0 @@ -# -# Copyright 2018, Noah Kantrowitz -# -# 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. -# - -eval_gemfile File.expand_path('../../../Gemfile', __FILE__) - -gem 'chef', '~> 14.4' diff --git a/test/gemfiles/master.gemfile b/test/gemfiles/master.gemfile deleted file mode 100644 index 15f3464..0000000 --- a/test/gemfiles/master.gemfile +++ /dev/null @@ -1,29 +0,0 @@ -# -# Copyright 2015-2017, Noah Kantrowitz -# -# 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. -# - -eval_gemfile File.expand_path('../../../Gemfile', __FILE__) - -gem 'chef', git: 'https://github.com/chef/chef.git' -gem 'chefspec', git: 'https://github.com/sethvargo/chefspec.git' -gem 'fauxhai', git: 'https://github.com/customink/fauxhai.git' -gem 'foodcritic', git: 'https://github.com/foodcritic/foodcritic.git' -# gem 'halite', git: 'https://github.com/poise/halite.git' -gem 'ohai', git: 'https://github.com/chef/ohai.git' -gem 'poise', git: 'https://github.com/poise/poise.git' -gem 'poise-archive', git: 'https://github.com/poise/poise-archive.git' -gem 'poise-boiler', git: 'https://github.com/poise/poise-boiler.git' -gem 'poise-languages', git: 'https://github.com/poise/poise-languages.git' -gem 'poise-profiler', git: 'https://github.com/poise/poise-profiler.git' diff --git a/test/integration/default/serverspec/default_spec.rb b/test/integration/default/serverspec/default_spec.rb deleted file mode 100644 index 6720d74..0000000 --- a/test/integration/default/serverspec/default_spec.rb +++ /dev/null @@ -1,168 +0,0 @@ -# -# Copyright 2015-2017, Noah Kantrowitz -# -# 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. -# - -require 'rbconfig' - -require 'serverspec' - -if RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/ - set :backend, :cmd - set :os, :family => 'windows' -else - set :backend, :exec -end - -# Set up the shared example for python_runtime_test. -RSpec.shared_examples 'a python_runtime_test' do |python_name, version=nil| - let(:python_name) { python_name } - let(:python_path) { File.join('', "python_test_#{python_name}") } - # Helper for all the file checks. - def self.assert_file(rel_path, should_exist=true, &block) - describe rel_path do - subject { file(File.join(python_path, rel_path)) } - # Do nothing for nil. - if should_exist == true - it { is_expected.to be_a_file } - elsif should_exist == false - it { is_expected.to_not exist } - end - instance_eval(&block) if block - end - end - - describe 'python_runtime' do - assert_file('version') do - its(:content) { is_expected.to start_with version } if version - end - end - - describe 'python_package' do - describe 'sqlparse' do - assert_file('import_sqlparse_before', false) - assert_file('import_sqlparse_mid') - assert_file('import_sqlparse_after', false) - assert_file('sentinel_sqlparse') - assert_file('sentinel_sqlparse2', false) - end - - describe 'setuptools' do - assert_file('sentinel_setuptools', false) - end - - describe 'pep8' do - assert_file('import_pep8') - end - - describe 'pytz' do - assert_file('import_pytz') - end - end - - describe 'python_virtualenv' do - assert_file('venv', nil) do - it { is_expected.to be_a_directory } - end - assert_file('import_pytest', false) - assert_file('import_pytest_venv') - end - - describe 'pip_requirements' do - assert_file('import_requests') do - its(:content) { is_expected.to match /^2\.7\.0\s*$/ } - end - assert_file('import_six') do - its(:content) { is_expected.to match /^1\.8\.0\s*$/ } - end - end - - describe 'non default version' do - assert_file('import_requests_version') do - its(:content) { is_expected.to match /^2\.8\.0\s*$/ } - end - end - - unless os[:family] == 'windows' - describe 'user install' do - assert_file('import_docopt') - end - end -end - -describe 'python 2', unless: File.exist?('/no_py2') do - it_should_behave_like 'a python_runtime_test', '2', '2' -end - -describe 'python 3', unless: File.exist?('/no_py3') do - it_should_behave_like 'a python_runtime_test', '3', '3' -end - -describe 'pypy', unless: File.exist?('/no_pypy') do - it_should_behave_like 'a python_runtime_test', 'pypy' -end - -describe 'system provider', unless: File.exist?('/no_system') do - it_should_behave_like 'a python_runtime_test', 'system' -end - -describe 'scl provider', unless: File.exist?('/no_scl') do - it_should_behave_like 'a python_runtime_test', 'scl' -end - -describe 'pip reversion test', unless: File.exist?('/no_pip') do - path_suffix = if os[:family] == 'windows' - '/Scripts/python.exe' - else - '/bin/pypy' - end - - # Confirm pip verisons. - describe command("/test_pip1#{path_suffix} -m pip --version") do - its(:exit_status) { is_expected.to eq 0 } - its(:stdout) { is_expected.to include ' 18.' } - end - - describe command("/test_pip2#{path_suffix} -m pip --version") do - its(:exit_status) { is_expected.to eq 0 } - its(:stdout) { is_expected.to include '8.1.2' } - end - - describe command("/test_pip3#{path_suffix} -m pip --version") do - its(:exit_status) { is_expected.to eq 0 } - its(:stdout) { is_expected.to include '7.1.2' } - end - - describe command("/test_pip4#{path_suffix} -m pip --version") do - its(:exit_status) { is_expected.to eq 0 } - its(:stdout) { is_expected.to include '9.0.3' } - end - - # Check that structlog installed. - describe command("/test_pip1#{path_suffix} -c 'import structlog'") do - its(:exit_status) { is_expected.to eq 0 } - end - - describe command("/test_pip2#{path_suffix} -c 'import structlog'") do - its(:exit_status) { is_expected.to eq 0 } - end - - describe command("/test_pip3#{path_suffix} -c 'import structlog'") do - its(:exit_status) { is_expected.to eq 0 } - end - - describe command("/test_pip4#{path_suffix} -c 'import structlog'") do - its(:exit_status) { is_expected.to eq 0 } - end -end diff --git a/test/spec/python_command_mixin_spec.rb b/test/spec/python_command_mixin_spec.rb deleted file mode 100644 index ac3e4ea..0000000 --- a/test/spec/python_command_mixin_spec.rb +++ /dev/null @@ -1,115 +0,0 @@ -# -# Copyright 2015-2017, Noah Kantrowitz -# -# 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. -# - -require 'spec_helper' - -describe PoisePython::PythonCommandMixin do - describe PoisePython::PythonCommandMixin::Resource do - resource(:poise_test) do - include described_class - end - provider(:poise_test) - - describe '#python' do - let(:python) { chef_run.python_runtime('test') } - - context 'with an implicit parent' do - recipe do - python_runtime 'test' do - provider :dummy - end - poise_test 'test' - end - - it { is_expected.to run_poise_test('test').with(parent_python: python, python: '/python') } - end # /context with an implicit parent - - context 'with a parent resource' do - recipe do - r = python_runtime 'test' do - provider :dummy - end - poise_test 'test' do - python r - end - end - - it { is_expected.to run_poise_test('test').with(parent_python: python, python: '/python') } - end # /context with a parent resource - - context 'with a parent resource name' do - recipe do - python_runtime 'test' do - provider :dummy - end - poise_test 'test' do - python 'test' - end - end - - it { is_expected.to run_poise_test('test').with(parent_python: python, python: '/python') } - end # /context with a parent resource name - - context 'with a parent resource name that looks like a path' do - let(:python) { chef_run.python_runtime('/usr/bin/other') } - recipe do - python_runtime '/usr/bin/other' do - provider :dummy - end - poise_test 'test' do - python '/usr/bin/other' - end - end - - it { is_expected.to run_poise_test('test').with(parent_python: python, python: '/python') } - end # /context with a parent resource name that looks like a path - - context 'with a path' do - recipe do - poise_test 'test' do - python '/usr/bin/other' - end - end - - it { is_expected.to run_poise_test('test').with(parent_python: nil, python: '/usr/bin/other') } - end # /context with a path - - context 'with a path and an implicit parent' do - recipe do - python_runtime 'test' do - provider :dummy - end - poise_test 'test' do - python '/usr/bin/other' - end - end - - it { is_expected.to run_poise_test('test').with(parent_python: python, python: '/usr/bin/other') } - end # /context with a path and an implicit parent - - context 'with an invalid parent' do - recipe do - poise_test 'test' do - python 'test' - end - end - - it { expect { subject }.to raise_error Chef::Exceptions::ResourceNotFound } - end # /context with an invalid parent - - end # /describe #python - end # /describe PoisePython::PythonCommandMixin::Resource -end diff --git a/test/spec/python_providers/dummy_spec.rb b/test/spec/python_providers/dummy_spec.rb deleted file mode 100644 index b6b211b..0000000 --- a/test/spec/python_providers/dummy_spec.rb +++ /dev/null @@ -1,56 +0,0 @@ -# -# Copyright 2015-2017, Noah Kantrowitz -# -# 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. -# - -require 'spec_helper' - -describe PoisePython::PythonProviders::Dummy do - let(:python_runtime) { chef_run.python_runtime('test') } - step_into(:python_runtime) - recipe do - python_runtime 'test' do - provider :dummy - end - end - - describe '#python_binary' do - subject { python_runtime.python_binary } - - it { is_expected.to eq '/python' } - end # /describe #python_binary - - describe '#python_environment' do - subject { python_runtime.python_environment } - - it { is_expected.to eq({}) } - end # /describe #python_environment - - describe 'action :install' do - # Just make sure it doesn't error. - it { run_chef } - end # /describe action :install - - describe 'action :uninstall' do - recipe do - python_runtime 'test' do - action :uninstall - provider :dummy - end - end - - # Just make sure it doesn't error. - it { run_chef } - end # /describe action :uninstall -end diff --git a/test/spec/python_providers/portable_pypy3_spec.rb b/test/spec/python_providers/portable_pypy3_spec.rb deleted file mode 100644 index 57bec9e..0000000 --- a/test/spec/python_providers/portable_pypy3_spec.rb +++ /dev/null @@ -1,70 +0,0 @@ -# -# Copyright 2015-2017, Noah Kantrowitz -# -# 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. -# - -require 'spec_helper' - -describe PoisePython::PythonProviders::PortablePyPy3 do - let(:python_version) { nil } - let(:chefspec_options) { {platform: 'ubuntu', version: '14.04'} } - let(:default_attributes) { {poise_python_version: python_version} } - let(:python_runtime) { chef_run.python_runtime('test') } - step_into(:python_runtime) - recipe do - python_runtime 'test' do - provider_no_auto 'dummy' - version node['poise_python_version'] - virtualenv_version false - end - end - - shared_examples_for 'portablepypy3 provider' do |base, url=nil| - it { expect(python_runtime.provider_for_action(:install)).to be_a described_class } - it { is_expected.to install_poise_languages_static(File.join('', 'opt', base)).with(source: url || "https://bitbucket.org/squeaky/portable-pypy/downloads/#{base}-linux_x86_64-portable.tar.bz2") } - it { expect(python_runtime.python_binary).to eq File.join('', 'opt', base, 'bin', 'pypy') } - end - - context 'with version pypy3' do - let(:python_version) { 'pypy3' } - it_behaves_like 'portablepypy3 provider', 'pypy3-2.4' - end # /context with version pypy3 - - context 'with version pypy3-2.3.1' do - let(:python_version) { 'pypy3-2.3.1' } - it_behaves_like 'portablepypy3 provider', 'pypy3-2.3.1' - end # /context with version pypy3-2.3.1 - - - context 'with version pypy3-5.5' do - let(:python_version) { 'pypy3-5.5' } - it_behaves_like 'portablepypy3 provider', 'pypy3-5.5-alpha-20161014', 'https://bitbucket.org/squeaky/portable-pypy/downloads/pypy3.3-5.5-alpha-20161014-linux_x86_64-portable.tar.bz2' - end # /context with version pypy3-5.5 - - context 'with version pypy3-5.7' do - let(:python_version) { 'pypy3-5.7' } - it_behaves_like 'portablepypy3 provider', 'pypy3-5.7.1-beta', 'https://bitbucket.org/squeaky/portable-pypy/downloads/pypy3.5-5.7.1-beta-linux_x86_64-portable.tar.bz2' - end # /context with version pypy3-5.5 - - context 'action :uninstall' do - recipe do - python_runtime 'test' do - version 'pypy3' - action :uninstall - end - end - - it { is_expected.to uninstall_poise_languages_static('/opt/pypy3-2.4') } - end # /context action :uninstall -end diff --git a/test/spec/python_providers/portable_pypy_spec.rb b/test/spec/python_providers/portable_pypy_spec.rb deleted file mode 100644 index d125311..0000000 --- a/test/spec/python_providers/portable_pypy_spec.rb +++ /dev/null @@ -1,59 +0,0 @@ -# -# Copyright 2015-2017, Noah Kantrowitz -# -# 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. -# - -require 'spec_helper' - -describe PoisePython::PythonProviders::PortablePyPy do - let(:python_version) { nil } - let(:chefspec_options) { {platform: 'ubuntu', version: '14.04'} } - let(:default_attributes) { {poise_python_version: python_version} } - let(:python_runtime) { chef_run.python_runtime('test') } - step_into(:python_runtime) - recipe do - python_runtime 'test' do - provider_no_auto 'dummy' - version node['poise_python_version'] - virtualenv_version false - end - end - - shared_examples_for 'portablepypy provider' do |base| - it { expect(python_runtime.provider_for_action(:install)).to be_a described_class } - it { is_expected.to install_poise_languages_static(File.join('', 'opt', base)).with(source: "https://bitbucket.org/squeaky/portable-pypy/downloads/#{base}-linux_x86_64-portable.tar.bz2") } - it { expect(python_runtime.python_binary).to eq File.join('', 'opt', base, 'bin', 'pypy') } - end - - context 'with version pypy' do - let(:python_version) { 'pypy' } - it_behaves_like 'portablepypy provider', 'pypy-5.7.1' - end # /context with version pypy - - context 'with version pypy-2.4' do - let(:python_version) { 'pypy-2.4' } - it_behaves_like 'portablepypy provider', 'pypy-2.4' - end # /context with version pypy-2.4 - - context 'action :uninstall' do - recipe do - python_runtime 'test' do - version 'pypy' - action :uninstall - end - end - - it { is_expected.to uninstall_poise_languages_static('/opt/pypy-5.7.1') } - end # /context action :uninstall -end diff --git a/test/spec/python_providers/scl_spec.rb b/test/spec/python_providers/scl_spec.rb deleted file mode 100644 index 2edcec4..0000000 --- a/test/spec/python_providers/scl_spec.rb +++ /dev/null @@ -1,82 +0,0 @@ -# -# Copyright 2015-2017, Noah Kantrowitz -# -# 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. -# - -require 'spec_helper' - -describe PoisePython::PythonProviders::Scl do - let(:python_version) { '' } - let(:chefspec_options) { {platform: 'centos', version: '7.4.1708'} } - let(:default_attributes) { {poise_python_version: python_version} } - let(:python_runtime) { chef_run.python_runtime('test') } - step_into(:python_runtime) - recipe do - python_runtime 'test' do - provider_no_auto 'dummy' - version node['poise_python_version'] - virtualenv_version false - end - end - - shared_examples_for 'scl provider' do |pkg| - it { expect(python_runtime.provider_for_action(:install)).to be_a described_class } - it { is_expected.to install_poise_languages_scl(pkg) } - it do - expect_any_instance_of(described_class).to receive(:install_scl_package) - run_chef - end - end - - context 'with version ""' do - let(:python_version) { '' } - it_behaves_like 'scl provider', 'rh-python36' - end # /context with version "" - - context 'with version "2"' do - let(:python_version) { '2' } - it_behaves_like 'scl provider', 'python27' - end # /context with version "2" - - context 'with version "3"' do - let(:python_version) { '3' } - it_behaves_like 'scl provider', 'rh-python36' - end # /context with version "3" - - context 'with version "3.3"' do - let(:python_version) { '3.3' } - it_behaves_like 'scl provider', 'python33' - end # /context with version "3.3" - - context 'with version "" on CentOS 6' do - let(:chefspec_options) { {platform: 'centos', version: '6.9'} } - let(:python_version) { '' } - it_behaves_like 'scl provider', 'rh-python36' - end # /context with version "" on CentOS 6 - - context 'action :uninstall' do - recipe do - python_runtime 'test' do - action :uninstall - version node['poise_python_version'] - end - end - - it do - expect_any_instance_of(described_class).to receive(:uninstall_scl_package) - run_chef - end - it { expect(python_runtime.provider_for_action(:uninstall)).to be_a described_class } - end # /context action :uninstall -end diff --git a/test/spec/python_providers/system_spec.rb b/test/spec/python_providers/system_spec.rb deleted file mode 100644 index 055fcf9..0000000 --- a/test/spec/python_providers/system_spec.rb +++ /dev/null @@ -1,106 +0,0 @@ -# -# Copyright 2015-2017, Noah Kantrowitz -# -# 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. -# - -require 'spec_helper' - -describe PoisePython::PythonProviders::System do - let(:python_version) { '' } - let(:chefspec_options) { {platform: 'ubuntu', version: '14.04'} } - let(:default_attributes) { {poise_python_version: python_version} } - let(:python_runtime) { chef_run.python_runtime('test') } - let(:system_package_candidates) { python_runtime.provider_for_action(:install).send(:system_package_candidates, python_version) } - step_into(:python_runtime) - recipe do - python_runtime 'test' do - provider_no_auto 'dummy' - version node['poise_python_version'] - virtualenv_version false - end - end - - shared_examples_for 'system provider' do |candidates=nil, pkg| - it { expect(python_runtime.provider_for_action(:install)).to be_a described_class } - it { expect(system_package_candidates).to eq candidates } if candidates - it { is_expected.to install_poise_languages_system(pkg) } - it do - expect_any_instance_of(described_class).to receive(:install_system_packages) - run_chef - end - end - - context 'with version ""' do - let(:python_version) { '' } - it_behaves_like 'system provider', %w{python3.7 python37 python3.6 python36 python3.5 python35 python3.4 python34 python3.3 python33 python3.2 python32 python3.1 python31 python3.0 python30 python3 python2.7 python27 python2.6 python26 python2.5 python25 python}, 'python3.4' - end # /context with version "" - - context 'with version 2' do - let(:python_version) { '2' } - it_behaves_like 'system provider', %w{python2.7 python27 python2.6 python26 python2.5 python25 python}, 'python2.7' - end # /context with version 2 - - context 'with version 3' do - let(:python_version) { '3' } - it_behaves_like 'system provider', %w{python3.7 python37 python3.6 python36 python3.5 python35 python3.4 python34 python3.3 python33 python3.2 python32 python3.1 python31 python3.0 python30 python3 python}, 'python3.4' - end # /context with version 3 - - context 'with version 2.3' do - let(:python_version) { '2.3' } - before do - default_attributes['poise-python'] ||= {} - default_attributes['poise-python']['test'] = {'package_name' => 'python2.3'} - end - it_behaves_like 'system provider', %w{python2.3 python23 python}, 'python2.3' - end # /context with version 2.3 - - context 'on Ubuntu 18.04' do - let(:chefspec_options) { {platform: 'ubuntu', version: '18.04'} } - let(:python_version) { '3.6' } - - it { is_expected.to install_package(%w{python3.6-venv python3.6-distutils}) } - end # /context on Ubuntu 18.04 - - context 'on Debian 8' do - before { chefspec_options.update(platform: 'debian', version: '8.9') } - it_behaves_like 'system provider', 'python3.4' - end # /context on Debian 8 - - context 'on CentOS 7' do - before { chefspec_options.update(platform: 'centos', version: '7.4.1708') } - recipe do - python_runtime 'test' do - provider :system - version node['poise_python_version'] - virtualenv_version false - end - end - it_behaves_like 'system provider', 'python' - end # /context on CentOS 7 - - context 'action :uninstall' do - recipe do - python_runtime 'test' do - action :uninstall - version node['poise_python_version'] - end - end - - it do - expect_any_instance_of(described_class).to receive(:uninstall_system_packages) - run_chef - end - it { expect(python_runtime.provider_for_action(:uninstall)).to be_a described_class } - end # /context action :uninstall -end diff --git a/test/spec/resources/pip_requirements_spec.rb b/test/spec/resources/pip_requirements_spec.rb deleted file mode 100644 index e34e2d1..0000000 --- a/test/spec/resources/pip_requirements_spec.rb +++ /dev/null @@ -1,114 +0,0 @@ -# -# Copyright 2015-2017, Noah Kantrowitz -# -# 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. -# - -require 'spec_helper' - -describe PoisePython::Resources::PipRequirements do - let(:pip_cmd) { %w{-m pip.__main__ install --requirement /test/requirements.txt} } - let(:pip_output) { '' } - let(:pip_user) { nil } - let(:pip_group) { nil } - let(:pip_cwd) { '/test' } - step_into(:pip_requirements) - before do - allow(File).to receive(:directory?).and_call_original - allow(File).to receive(:directory?).with('/test').and_return(true) - end - before do - expect_any_instance_of(PoisePython::Resources::PipRequirements::Provider).to receive(:python_shell_out!).with(pip_cmd, {user: pip_user, group: pip_group, cwd: pip_cwd}).and_return(double(stdout: pip_output)) - end - - context 'with a directory' do - recipe do - pip_requirements '/test' - end - - it { is_expected.to install_pip_requirements('/test') } - end # /context with a directory - - context 'with a file' do - let(:pip_cmd) { %w{-m pip.__main__ install --requirement /test/reqs.txt} } - recipe do - pip_requirements '/test/reqs.txt' - end - - it { is_expected.to install_pip_requirements('/test/reqs.txt') } - end # /context with a file - - context 'with a user' do - let(:pip_user) { 'testuser' } - recipe do - pip_requirements '/test' do - user 'testuser' - end - end - - it { is_expected.to install_pip_requirements('/test') } - end # /context with a user - - context 'with a group' do - let(:pip_group) { 'testgroup' } - recipe do - pip_requirements '/test' do - group 'testgroup' - end - end - - it { is_expected.to install_pip_requirements('/test') } - end # /context with a group - - context 'action :upgrade' do - let(:pip_cmd) { %w{-m pip.__main__ install --upgrade --requirement /test/requirements.txt} } - recipe do - pip_requirements '/test' do - action :upgrade - end - end - - it { is_expected.to upgrade_pip_requirements('/test') } - end # /context action :upgrade - - context 'with output' do - let(:pip_output) { 'Successfully installed' } - recipe do - pip_requirements '/test' - end - - it { is_expected.to install_pip_requirements('/test').with(updated?: true) } - end # /context with output - - context 'with a cwd' do - let(:pip_cwd) { '/other' } - recipe do - pip_requirements '/test' do - cwd '/other' - end - end - - it { is_expected.to install_pip_requirements('/test') } - end # /context with a cwd - - context 'with options' do - let(:pip_cmd) { '-m pip.__main__ install --index-url=http://example --requirement /test/requirements.txt' } - recipe do - pip_requirements '/test' do - options '--index-url=http://example' - end - end - - it { is_expected.to install_pip_requirements('/test') } - end # /context with options -end diff --git a/test/spec/resources/python_package_spec.rb b/test/spec/resources/python_package_spec.rb deleted file mode 100644 index 6e608d8..0000000 --- a/test/spec/resources/python_package_spec.rb +++ /dev/null @@ -1,324 +0,0 @@ -# -# Copyright 2015-2017, Noah Kantrowitz -# -# 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. -# - -require 'spec_helper' - -describe PoisePython::Resources::PythonPackage do - describe PoisePython::Resources::PythonPackage::Resource do - describe '#response_file' do - recipe do - python_package 'foo' do - response_file 'bar' - end - end - - it { expect { subject }.to raise_error NoMethodError } - end # /describe #response_file - - describe '#response_file_variables' do - recipe do - python_package 'foo' do - response_file_variables 'bar' - end - end - - it { expect { subject }.to raise_error NoMethodError } - end # /describe #response_file_variables - - describe '#source' do - recipe do - python_package 'foo' do - source 'bar' - end - end - - it { expect { subject }.to raise_error NoMethodError } - end # /describe #source - end # /describe PoisePython::Resources::PythonPackage::Resource - - describe PoisePython::Resources::PythonPackage::Provider do - let(:test_resource) { PoisePython::Resources::PythonPackage::Resource.new('package', chef_run.run_context) } - let(:test_provider) { described_class.new(test_resource, chef_run.run_context) } - def stub_cmd(cmd, **options) - options = options.dup - array_13 = options.delete(:array_13) - if array_13 && Gem::Requirement.create('>= 13').satisfied_by?(Gem::Version.create(Chef::VERSION)) - cmd = Shellwords.split(cmd) - end - output_options = {error?: options.delete(:error?) || false, stdout: options.delete(:stdout) || '', stderr: options.delete(:stderr) || ''} - expect(test_provider).to receive(:python_shell_out!).with(cmd, options).and_return(double("python #{cmd} return", **output_options)) - end - - describe '#load_current_resource' do - let(:package_name) { nil } - let(:package_version) { nil } - let(:test_resource) { PoisePython::Resources::PythonPackage::Resource.new(package_name, chef_run.run_context).tap {|r| r.version(package_version) if package_version } } - let(:candidate_version) { subject; test_provider.candidate_version } - subject { test_provider.load_current_resource } - - context 'with package_name foo' do - let(:package_name) { 'foo' } - before do - stub_cmd(%w{-m pip.__main__ list}, environment: {'PIP_FORMAT' => 'json'}, stdout: '') - stub_cmd(%w{- foo}, input: kind_of(String), stdout: '{"foo":"1.0.0"}') - end - - its(:version) { is_expected.to be nil } - it { expect(candidate_version).to eq '1.0.0' } - end # /context with package_name foo - - context 'with package_name ["foo", "bar"]' do - let(:package_name) { %w{foo bar} } - before do - stub_cmd(%w{-m pip.__main__ list}, environment: {'PIP_FORMAT' => 'json'}, stdout: '') - stub_cmd(%w{- foo bar}, input: kind_of(String), stdout: '{"foo":"1.0.0","bar":"2.0.0"}') - end - - its(:version) { is_expected.to eq [nil, nil] } - it { expect(candidate_version).to eq %w{1.0.0 2.0.0} } - end # /context with package_name ["foo", "bar"] - - context 'with a package with extras' do - let(:package_name) { 'foo[bar]' } - before do - stub_cmd(%w{-m pip.__main__ list}, environment: {'PIP_FORMAT' => 'json'}, stdout: '') - stub_cmd(%w{- foo}, input: kind_of(String), stdout: '{"foo":"1.0.0"}') - end - - its(:version) { is_expected.to be nil } - it { expect(candidate_version).to eq '1.0.0' } - end # /context with a package with extras - - context 'with a package with underscores' do - let(:package_name) { 'cx_foo' } - before do - stub_cmd(%w{-m pip.__main__ list}, environment: {'PIP_FORMAT' => 'json'}, stdout: '') - stub_cmd(%w{- cx-foo}, input: kind_of(String), stdout: '{"cx-foo":"1.0.0"}') - end - - its(:version) { is_expected.to be nil } - it { expect(candidate_version).to eq '1.0.0' } - end # /context with a package with underscores - - context 'with options' do - let(:package_name) { 'foo' } - before do - test_resource.options('--index-url=http://example') - stub_cmd("-m pip.__main__ list --index-url=http://example ", environment: {'PIP_FORMAT' => 'json'}, stdout: '', array_13: true) - stub_cmd("- --index-url=http://example foo", input: kind_of(String), stdout: '{"foo":"1.0.0"}', array_13: true) - end - - its(:version) { is_expected.to be nil } - it { expect(candidate_version).to eq '1.0.0' } - end # /context with options - - context 'with list options' do - let(:package_name) { 'foo' } - before do - test_resource.list_options('--index-url=http://example') - stub_cmd("-m pip.__main__ list --index-url=http://example ", environment: {'PIP_FORMAT' => 'json'}, stdout: '') - stub_cmd("- --index-url=http://example foo", input: kind_of(String), stdout: '{"foo":"1.0.0"}') - end - - its(:version) { is_expected.to be nil } - it { expect(candidate_version).to eq '1.0.0' } - end # /context with list options - - context 'with array list options' do - let(:package_name) { 'foo' } - before do - test_resource.list_options(%w{--index-url=http://example}) - stub_cmd(%w{-m pip.__main__ list --index-url=http://example}, environment: {'PIP_FORMAT' => 'json'}, stdout: '') - stub_cmd(%w{- --index-url=http://example foo}, input: kind_of(String), stdout: '{"foo":"1.0.0"}') - end - - its(:version) { is_expected.to be nil } - it { expect(candidate_version).to eq '1.0.0' } - end # /context with array list options - end # /describe #load_current_resource - - describe 'actions' do - let(:package_name) { nil } - let(:current_version) { nil } - let(:candidate_version) { nil } - let(:test_resource) { PoisePython::Resources::PythonPackage::Resource.new(package_name, chef_run.run_context) } - subject { test_provider.run_action } - before do - current_version = self.current_version - candidate_version = self.candidate_version - allow(test_provider).to receive(:load_current_resource) do - current_resource = double('current_resource', package_name: package_name, version: current_version) - test_provider.instance_eval do - @current_resource = current_resource - @candidate_version = candidate_version - end - end - end - - describe 'action :install' do - before { test_provider.action = :install } - - context 'with package_name foo' do - let(:package_name) { 'foo' } - let(:candidate_version) { '1.0.0' } - it do - stub_cmd(%w{-m pip.__main__ install foo==1.0.0}) - subject - end - end # /context with package_name foo - - context 'with package_name ["foo", "bar"]' do - let(:package_name) { %w{foo bar} } - let(:candidate_version) { %w{1.0.0 2.0.0} } - it do - stub_cmd(%w{-m pip.__main__ install foo==1.0.0 bar==2.0.0}) - subject - end - end # /context with package_name ["foo", "bar"] - - context 'with options' do - let(:package_name) { 'foo' } - let(:candidate_version) { '1.0.0' } - before { test_resource.options('--editable') } - it do - stub_cmd('-m pip.__main__ install --editable foo\\=\\=1.0.0', array_13: true) - subject - end - end # /context with options - - context 'with install options' do - let(:package_name) { 'foo' } - let(:candidate_version) { '1.0.0' } - before { test_resource.install_options('--editable') } - it do - stub_cmd('-m pip.__main__ install --editable foo\\=\\=1.0.0') - subject - end - end # /context with install options - - context 'with array install options' do - let(:package_name) { 'foo' } - let(:candidate_version) { '1.0.0' } - before { test_resource.install_options(%w{--editable}) } - it do - stub_cmd(%w{-m pip.__main__ install --editable foo==1.0.0}) - subject - end - end # /context with array install options - - context 'with a package with extras' do - let(:package_name) { 'foo[bar]' } - let(:candidate_version) { '1.0.0' } - it do - stub_cmd(%w{-m pip.__main__ install foo[bar]==1.0.0}) - subject - end - end # /context with a package with extras - - context 'with a package with underscores' do - let(:package_name) { 'cx_foo' } - let(:candidate_version) { '1.0.0' } - it do - stub_cmd(%w{-m pip.__main__ install cx_foo==1.0.0}) - subject - end - end # /context with a package with underscores - end # /describe action :install - - describe 'action :upgrade' do - before { test_provider.action = :upgrade } - - context 'with package_name foo' do - let(:package_name) { 'foo' } - let(:candidate_version) { '1.0.0' } - it do - stub_cmd(%w{-m pip.__main__ install --upgrade foo==1.0.0}) - subject - end - end # /context with package_name foo - - context 'with package_name ["foo", "bar"]' do - let(:package_name) { %w{foo bar} } - let(:candidate_version) { %w{1.0.0 2.0.0} } - it do - stub_cmd(%w{-m pip.__main__ install --upgrade foo==1.0.0 bar==2.0.0}) - subject - end - end # /context with package_name ["foo", "bar"] - end # /describe action :upgrade - - describe 'action :remove' do - before { test_provider.action = :remove } - - context 'with package_name foo' do - let(:package_name) { 'foo' } - let(:current_version) { '1.0.0' } - it do - stub_cmd(%w{-m pip.__main__ uninstall --yes foo}) - subject - end - end # /context with package_name foo - - context 'with package_name ["foo", "bar"]' do - let(:package_name) { %w{foo bar} } - let(:current_version) { %w{1.0.0 2.0.0} } - it do - stub_cmd(%w{-m pip.__main__ uninstall --yes foo bar}) - subject - end - end # /context with package_name ["foo", "bar"] - end # /describe action :remove - end # /describe actions - - describe '#parse_pip_list' do - let(:text) { '' } - subject { test_provider.send(:parse_pip_list, text) } - - context 'with no content' do - it { is_expected.to eq({}) } - end # /context with no content - - context 'with standard content' do - let(:text) { <<-EOH } -eventlet (0.12.1) -Fabric (1.9.1) -fabric-rundeck (1.2, /Users/coderanger/src/bal/fabric-rundeck) -flake8 (2.1.0.dev0) -cx-Freeze (4.3.4) -EOH - it { is_expected.to eq({'eventlet' => '0.12.1', 'fabric' => '1.9.1', 'fabric-rundeck' => '1.2', 'flake8' => '2.1.0.dev0', 'cx-freeze' => '4.3.4'}) } - end # /context with standard content - - context 'with JSON content' do - let(:text) { <<-EOH.strip } -[{"name":"eventlet","version":"0.12.1"}, {"name":"Fabric","version":"1.9.1"}, {"name":"fabric-rundeck","version":"1.2"}, {"name":"flake8","version":"2.1.0.dev0"}, {"name":"cx-Freeze","version":"4.3.4"}] -EOH - it { is_expected.to eq({'eventlet' => '0.12.1', 'fabric' => '1.9.1', 'fabric-rundeck' => '1.2', 'flake8' => '2.1.0.dev0', 'cx-freeze' => '4.3.4'}) } - end # /context with JSON content - - context 'with malformed content' do - let(:text) { <<-EOH } -eventlet (0.12.1) -Fabric (1.9.1) -fabric-rundeck (1.2, /Users/coderanger/src/bal/fabric-rundeck) -flake 8 (2.1.0.dev0) -cx_Freeze (4.3.4) -EOH - it { is_expected.to eq({'eventlet' => '0.12.1', 'fabric' => '1.9.1', 'fabric-rundeck' => '1.2', 'cx-freeze' => '4.3.4'}) } - end # /context with malformed content - end # /describe #parse_pip_list - end # /describe PoisePython::Resources::PythonPackage::Provider -end diff --git a/test/spec/resources/python_runtime_pip_spec.rb b/test/spec/resources/python_runtime_pip_spec.rb deleted file mode 100644 index 811c735..0000000 --- a/test/spec/resources/python_runtime_pip_spec.rb +++ /dev/null @@ -1,35 +0,0 @@ -# -# Copyright 2015-2017, Noah Kantrowitz -# -# 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. -# - -require 'spec_helper' - -describe PoisePython::Resources::PythonRuntimePip do - step_into(:python_runtime_pip) - recipe do - python_runtime 'test' - python_runtime_pip 'test' do - get_pip_url 'http://example.com/' - end - end - before do - provider = PoisePython::Resources::PythonRuntimePip::Provider - allow_any_instance_of(provider).to receive(:pip_version).and_return(nil) - allow_any_instance_of(provider).to receive(:bootstrap_pip) - end - - # Make sure it can at least vaguely run. - it { chef_run } -end diff --git a/test/spec/resources/python_runtime_spec.rb b/test/spec/resources/python_runtime_spec.rb deleted file mode 100644 index dbe9528..0000000 --- a/test/spec/resources/python_runtime_spec.rb +++ /dev/null @@ -1,83 +0,0 @@ -# -# Copyright 2015-2017, Noah Kantrowitz -# -# 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. -# - -require 'spec_helper' - -class PythonRuntimeTestProvider < PoisePython::PythonProviders::Base - provides(:test) - def self.provides_auto?(*args) - true - end - def python_binary - '/python' - end - def install_python - end - def uninstall_python - end -end - -describe PoisePython::Resources::PythonRuntime do - step_into(:python_runtime) - let(:venv_installed) { false } - before do - allow_any_instance_of(PythonRuntimeTestProvider).to receive(:poise_shell_out).with(%w{/python -m venv -h}, environment: {}).and_return(double(error?: !venv_installed)) - end - - context 'with defaults' do - recipe do - python_runtime 'test' do - provider :test - end - end - - it { is_expected.to install_python_runtime_pip('test').with(version: nil, get_pip_url: 'https://bootstrap.pypa.io/get-pip.py') } - end # /context with defaults - - context 'with a pip_version' do - recipe do - python_runtime 'test' do - provider :test - pip_version '1.2.3' - end - end - - it { is_expected.to install_python_runtime_pip('test').with(version: '1.2.3', get_pip_url: 'https://bootstrap.pypa.io/get-pip.py') } - end # /context with a pip_version - - context 'with a pip_version URL' do - recipe do - python_runtime 'test' do - provider :test - pip_version 'http://example.com/get-pip.py' - end - end - - it { is_expected.to install_python_runtime_pip('test').with(version: nil, get_pip_url: 'http://example.com/get-pip.py') } - end # /context with a pip_version URL - - context 'with a pip_version and a get_pip_url' do - recipe do - python_runtime 'test' do - provider :test - pip_version '1.2.3' - get_pip_url 'http://example.com/get-pip.py' - end - end - - it { is_expected.to install_python_runtime_pip('test').with(version: '1.2.3', get_pip_url: 'http://example.com/get-pip.py') } - end # /context with a pip_version and a get_pip_url -end diff --git a/test/spec/resources/python_virtualenv_spec.rb b/test/spec/resources/python_virtualenv_spec.rb deleted file mode 100644 index 36d9d99..0000000 --- a/test/spec/resources/python_virtualenv_spec.rb +++ /dev/null @@ -1,121 +0,0 @@ -# -# Copyright 2015-2017, Noah Kantrowitz -# -# 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. -# - -require 'spec_helper' - -describe PoisePython::Resources::PythonVirtualenv do - step_into(:python_virtualenv) - let(:expect_cmd) { nil } - let(:has_venv) { false } - let(:venv_help_output) { ' --without-pip Skips installing or upgrading pip in the virtual' } - let(:expect_user) { nil } - before do - if expect_cmd - expect_any_instance_of(PoisePython::Resources::PythonVirtualenv::Provider).to receive(:python_shell_out).with(%w{-m venv -h}).and_return(double(error?: !has_venv, stdout: venv_help_output)) - expect_any_instance_of(PoisePython::Resources::PythonVirtualenv::Provider).to receive(:python_shell_out!).with(expect_cmd, environment: be_a(Hash), user: expect_user, group: expect_user) - end - end - - context 'without venv' do - let(:expect_cmd) { %w{-m virtualenv /test} } - recipe do - python_virtualenv '/test' - end - - it { is_expected.to create_python_virtualenv('/test') } - it { expect(chef_run.python_virtualenv('/test').python_binary).to eq '/test/bin/python' } - it { expect(chef_run.python_virtualenv('/test').python_environment).to eq({}) } - it { is_expected.to install_python_package('wheel').with(parent_python: chef_run.python_virtualenv('/test')) } - it { is_expected.to install_python_package('setuptools').with(parent_python: chef_run.python_virtualenv('/test')) } - it { is_expected.to_not install_python_package('virtualenv') } - it { is_expected.to install_python_runtime_pip('/test').with(parent: chef_run.python_virtualenv('/test')) } - end # /context without venv - - context 'with venv' do - let(:has_venv) { true } - let(:expect_cmd) { %w{-m venv --without-pip /test} } - recipe do - python_virtualenv '/test' - end - - it { is_expected.to create_python_virtualenv('/test') } - end # /context with venv - - context 'with venv on python 3.3' do - let(:has_venv) { true } - let(:venv_help_output) { '' } - let(:expect_cmd) { %w{-m venv /test} } - recipe do - python_virtualenv '/test' - end - - it { is_expected.to create_python_virtualenv('/test') } - end # /context with venv on python 3.3 - - context 'with system_site_packages' do - let(:expect_cmd) { %w{-m virtualenv --system-site-packages /test} } - recipe do - python_virtualenv '/test' do - system_site_packages true - end - end - - it { is_expected.to create_python_virtualenv('/test') } - end # /context with system_site_packages - - context 'with a user and group' do - let(:expect_cmd) { %w{-m virtualenv /test} } - let(:expect_user) { 'me' } - recipe do - python_virtualenv '/test' do - user 'me' - group 'me' - end - end - - it { is_expected.to create_python_virtualenv('/test') } - it { is_expected.to install_python_package('wheel').with(group: 'me', user: 'me') } - it { is_expected.to install_python_package('setuptools').with(group: 'me', user: 'me') } - end # /context with a user and group - - - context 'with action :delete' do - recipe do - python_virtualenv '/test' do - action :delete - end - end - - it { is_expected.to delete_python_virtualenv('/test') } - it { is_expected.to delete_directory('/test') } - end # /context with action :delete - - context 'with a parent Python' do - let(:expect_cmd) { %w{-m virtualenv /test} } - recipe do - python_runtime '2' do - def self.python_environment - {'KEY' => 'VALUE'} - end - end - python_virtualenv '/test' - end - - it { is_expected.to create_python_virtualenv('/test') } - it { expect(chef_run.python_virtualenv('/test').python_binary).to eq '/test/bin/python' } - it { expect(chef_run.python_virtualenv('/test').python_environment).to eq({'KEY' => 'VALUE'}) } - end # /context with a parent Python -end diff --git a/test/spec/spec_helper.rb b/test/spec/spec_helper.rb deleted file mode 100644 index 89f9c22..0000000 --- a/test/spec/spec_helper.rb +++ /dev/null @@ -1,19 +0,0 @@ -# -# Copyright 2015-2017, Noah Kantrowitz -# -# 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. -# - -require 'poise_boiler/spec_helper' -require 'poise_python' -require 'poise_python/cheftie' diff --git a/test/spec/utils/python_encoder_spec.rb b/test/spec/utils/python_encoder_spec.rb deleted file mode 100644 index 4411269..0000000 --- a/test/spec/utils/python_encoder_spec.rb +++ /dev/null @@ -1,79 +0,0 @@ -# -# Copyright 2015-2017, Noah Kantrowitz -# -# 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. -# - -require 'spec_helper' - -describe PoisePython::Utils::PythonEncoder do - let(:obj) { nil } - subject { described_class.new(obj).encode } - - context 'with a string' do - let(:obj) { 'foobar' } - it { is_expected.to eq '"foobar"' } - end # /context with a string - - context 'with a complicated string' do - let(:obj) { "im\nalittle\"teapot'" } - it { is_expected.to eq '"im\\nalittle\\"teapot\'"' } - end # /context with a complicated string - - context 'with an integer' do - let(:obj) { 123 } - it { is_expected.to eq '123' } - end # /context with an integer - - context 'with a float' do - let(:obj) { 1.3 } - it { is_expected.to eq '1.3' } - end # /context with a float - - context 'with a hash' do - let(:obj) { {foo: 'bar'} } - it { is_expected.to eq '{"foo":"bar"}' } - end # /context with a hash - - context 'with an array' do - let(:obj) { ['foo', 1, 'bar'] } - it { is_expected.to eq '["foo",1,"bar"]' } - end # /context with an array - - context 'with true' do - let(:obj) { true } - it { is_expected.to eq 'True' } - end # /context with true - - context 'with false' do - let(:obj) { false } - it { is_expected.to eq 'False' } - end # /context with false - - context 'with nil' do - let(:obj) { nil } - it { is_expected.to eq 'None' } - end # /context with nil - - context 'with a broken object' do - let(:obj) do - {}.tap {|obj| obj[:x] = obj } - end - it { expect { subject }.to raise_error ArgumentError } - end # /context with a broken object - - context 'with a complex object' do - let(:obj) { {a: [1, "2", true], b: false, c: {d: nil}} } - it { is_expected.to eq '{"a":[1,"2",True],"b":False,"c":{"d":None}}' } - end # /context with a complex object -end diff --git a/test/spec/utils_spec.rb b/test/spec/utils_spec.rb deleted file mode 100644 index f1cf70b..0000000 --- a/test/spec/utils_spec.rb +++ /dev/null @@ -1,86 +0,0 @@ -# -# Copyright 2015-2017, Noah Kantrowitz -# -# 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. -# - -require 'spec_helper' - -describe PoisePython::Utils do - describe '.to_python' do - subject { described_class.to_python(1) } - it { is_expected.to eq '1' } - # More detailed encoder specs in python_encoder_spec.rb - end # /describe .to_python - - describe '.path_to_module' do - let(:path) { '' } - let(:base) { nil } - subject { described_class.path_to_module(path, base) } - - context 'with a relative path' do - let(:path) { 'foo.py' } - it { is_expected.to eq 'foo' } - end # /context with a relative path - - context 'with a nested relative path' do - let(:path) { File.join('foo', 'bar', 'baz.py') } - it { is_expected.to eq 'foo.bar.baz' } - end # /context with a nested relative path - - context 'with a non-.py file' do - let(:path) { File.join('foo', 'bar', 'baz') } - it { is_expected.to eq 'foo.bar.baz' } - end # /context with a non-.py file - - context 'with a base path' do - let(:path) { File.join('', 'foo', 'bar', 'baz.py') } - let(:base) { File.join('', 'foo') } - it { is_expected.to eq 'bar.baz' } - end # /context with a base path - - context 'with a base path that does not match the path' do - let(:path) { File.join('', 'foo', 'bar', 'baz.py') } - let(:base) { File.join('', 'bar') } - it { expect { subject }.to raise_error PoisePython::Error } - end # /context with a base path that does not match the path - - context 'with a base and relative path' do - let(:path) { File.join('bar', 'baz.py') } - let(:base) { File.join('', 'foo') } - it { is_expected.to eq 'bar.baz' } - end # /context with a base and relative path - end # /describe .path_to_module - - describe '.module_to_path' do - let(:mod) { '' } - let(:base) { nil } - subject { described_class.module_to_path(mod, base) } - - context 'with a module' do - let(:mod) { 'foo' } - it { is_expected.to eq 'foo.py' } - end # /context with a module - - context 'with a nested module' do - let(:mod) { 'foo.bar.baz' } - it { is_expected.to eq File.join('foo', 'bar', 'baz.py') } - end # /context with a nested module - - context 'with a base path' do - let(:mod) { 'bar.baz' } - let(:base) { File.join('', 'foo') } - it { is_expected.to eq File.join('', 'foo', 'bar', 'baz.py') } - end # /context with a base path - end # /describe .module_to_path -end