itamae-plugin-resource-pip 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: ce7f115766e4005ac824399c3d9825d2864663a7
4
- data.tar.gz: ed9a1594bfe82fd27b86ad7ea50a519990d6d976
2
+ SHA256:
3
+ metadata.gz: 3471fb7176cc80ee5126c134bc64249287c6f484eb51ca5dbb7895413bfe496b
4
+ data.tar.gz: c925fa949ca3f6deb35f3fb75d19331df3ca77c1b5d9a57bb3a42232f960e5b4
5
5
  SHA512:
6
- metadata.gz: 968fb21ac7e683a93c99c7204a1db231ba93025510ef73f7f6aafaf1175293946159e2e69107dfc362563582932769cdb855f72ddf927b2aec54da5d3ccf1192
7
- data.tar.gz: 92c4685c5815b17a25645aed52dca76f0d8811b1d3266d2c7f065f5b0cd232656be292e7da01ebd5bd34433cbd5fbfccdbbb4513aa35375cbc8bb78293d9d1fe
6
+ metadata.gz: 3c0275e361233d42e5cb84971035a7827ccd3d920a2d2abe94630479bd14f5755bc3aec02207c3f9f60ece1cdcdcfb6f4b66eca7af2bcff4b3285838398d7252
7
+ data.tar.gz: 1a5df8e3722cc6db88c26c0f217f05f6a872facb39a6b7379c865516ec8899a5530bb58dcfc37cd0cefcad5aa92920b70a1dab2709ed9c4448857749f94f0577
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --format documentation
@@ -0,0 +1,12 @@
1
+ sudo: required
2
+
3
+ language: ruby
4
+
5
+ services:
6
+ - docker
7
+
8
+ before_install:
9
+ - docker build -t katsyoshi/itamae-plugin-resource-pip .
10
+
11
+ script:
12
+ - docker run katsyoshi/itamae-plugin-resource-pip /bin/sh -c "bundle exec rspec"
@@ -0,0 +1,10 @@
1
+ FROM ruby
2
+
3
+ RUN echo 'gem: --no-rdoc --no-ri' >> /.gemrc
4
+ RUN apt-get update
5
+ RUN apt-get install -y python3-pip
6
+ RUN gem install bundler
7
+ ADD . /itamae-plugin-resource-pip
8
+ WORKDIR /itamae-plugin-resource-pip
9
+ RUN bundle install --path .bundle/gems
10
+ RUN bundle exec itamae local ./samples/recipe.rb
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Itamae::Plugin::Resource::Pip
1
+ # Itamae::Plugin::Resource::Pip [![Build Status](https://travis-ci.org/katsyoshi/itamae-plugin-resource-pip.svg?branch=master)](https://travis-ci.org/katsyoshi/itamae-plugin-resource-pip)
2
2
 
3
3
  Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/itamae/plugin/resource/pip`. To experiment with that code, run `bin/console` for an interactive prompt.
4
4
 
@@ -28,6 +28,7 @@ require 'itamae/plugin/resource/pip'
28
28
  pip "tornado" do
29
29
  pip_binary "/home/user/.pyenv/shims/pip"
30
30
  version "4.1"
31
+ options '--user'
31
32
  end
32
33
  ```
33
34
 
@@ -46,3 +47,15 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
46
47
 
47
48
  Bug reports and pull requests are welcome on GitHub at https://github.com/katyoshi/itamae-plugin-resource-pip. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](contributor-covenant.org) code of conduct.
48
49
 
50
+
51
+ ### Contributors
52
+
53
+ [@n0ts](https://github.com/n0ts): [#1](https://github.com/katsyoshi/itamae-plugin-resource-pip/pull/1) delete included version newline code
54
+
55
+ [@mystelynx](https://github.com/mystelynx): [#2](https://github.com/katsyoshi/itamae-plugin-resource-pip/pull/2) support mitamae
56
+
57
+ [@ta1kt0me](https://github.com/ta1kt0me): [#3](https://github.com/katsyoshi/itamae-plugin-resource-pip/pull/3) :bug: fixed mitamae
58
+
59
+ [@citystar](https://github.com/citystar): [#4](https://github.com/katsyoshi/itamae-plugin-resource-pip/pull/4) ignore pip version
60
+
61
+ [@moritzheiber](https://github.com/moritzheiber): [#5](https://github.com/katsyoshi/itamae-plugin-resource-pip/pull/6) support pip option
data/Rakefile CHANGED
@@ -1,10 +1,6 @@
1
1
  require "bundler/gem_tasks"
2
- require "rake/testtask"
2
+ require "rspec/core/rake_task"
3
3
 
4
- Rake::TestTask.new(:test) do |t|
5
- t.libs << "test"
6
- t.libs << "lib"
7
- t.test_files = FileList['test/**/*_test.rb']
8
- end
4
+ RSpec::Core::RakeTask.new("test")
9
5
 
10
- task :default => :test
6
+ task default: :test
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = "itamae-plugin-resource-pip"
7
- spec.version = "1.0.0"
7
+ spec.version = "1.1.0"
8
8
  spec.authors = ["MATSUMOTO, Katsuyoshi"]
9
9
  spec.email = ["github@katsyoshi.org"]
10
10
 
@@ -13,14 +13,6 @@ Gem::Specification.new do |spec|
13
13
  spec.license = "MIT"
14
14
  spec.homepage = "https://github.com/katsyoshi/itamae-plugin-resource-pip"
15
15
 
16
- # Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
17
- # delete this section to allow pushing this gem to any host.
18
- if spec.respond_to?(:metadata)
19
- spec.metadata['allowed_push_host'] = "https://rubygems.org"
20
- else
21
- raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
22
- end
23
-
24
16
  spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
25
17
  spec.bindir = "exe"
26
18
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
@@ -28,6 +20,7 @@ Gem::Specification.new do |spec|
28
20
 
29
21
  spec.add_dependency "itamae", "~> 1.2"
30
22
 
31
- spec.add_development_dependency "bundler", "~> 1.10"
32
- spec.add_development_dependency "rake", "~> 10.0"
23
+ spec.add_development_dependency "bundler"
24
+ spec.add_development_dependency "rake"
25
+ spec.add_development_dependency "serverspec"
33
26
  end
@@ -5,8 +5,9 @@ module Itamae
5
5
  module Resource
6
6
  class Pip < Itamae::Resource::Base
7
7
  define_attribute :action, default: :install
8
- define_attribute :pip_binary, type: [String, Array], default: 'pip'
8
+ define_attribute :pip_binary, type: [String, Array], default: ['pip', '--disable-pip-version-check']
9
9
  define_attribute :package_name, type: String, default_name: true
10
+ define_attribute :options, type: [String, Array], default: :auto
10
11
  define_attribute :version, type: String, default: false
11
12
 
12
13
  def pre_action
@@ -66,6 +67,8 @@ module Itamae
66
67
 
67
68
  def build_pip_install_command
68
69
  cmd = [*Array(attributes.pip_binary), 'install']
70
+ cmd << attributes.options if attributes.options
71
+
69
72
  if attributes.version
70
73
  cmd << "#{attributes.package_name}==#{attributes.version}"
71
74
  else
@@ -1,10 +1,11 @@
1
- module MItamae
1
+ module ::MItamae
2
2
  module Plugin
3
3
  module Resource
4
- class Pip < MItamae::Resource::Base
4
+ class Pip < ::MItamae::Resource::Base
5
5
  define_attribute :action, default: :install
6
6
  define_attribute :pip_binary, type: [String, Array], default: 'pip'
7
7
  define_attribute :package_name, type: String, default_name: true
8
+ define_attribute :options, type: [String, Array], default: :auto
8
9
  define_attribute :version, type: String, default: false
9
10
 
10
11
  self.available_actions = [:install, :uninstall, :upgrade]
@@ -1,8 +1,8 @@
1
- module MItamae
1
+ module ::MItamae
2
2
  module Plugin
3
3
  module ResourceExecutor
4
- class Pip < MItamae::ResourceExecutor::Base
5
- def apply(current, desired)
4
+ class Pip < ::MItamae::ResourceExecutor::Base
5
+ def apply
6
6
  if desired.installed
7
7
  if current.installed
8
8
  if desired.version && current.version != desired.version
@@ -55,6 +55,8 @@ module MItamae
55
55
 
56
56
  def install!
57
57
  cmd = [*Array(attributes.pip_binary), 'install']
58
+ cmd << attributes.options if attributes.options
59
+
58
60
  if attributes.version
59
61
  cmd << "#{attributes.package_name}==#{attributes.version}"
60
62
  else
@@ -66,6 +68,8 @@ module MItamae
66
68
 
67
69
  def uninstall!
68
70
  cmd = [*Array(attributes.pip_binary), 'uninstall']
71
+ cmd << attributes.options if attributes.options
72
+
69
73
  if attributes.version
70
74
  cmd << "#{attributes.package_name}==#{attributes.version}"
71
75
  else
@@ -0,0 +1,7 @@
1
+ require "itamae/plugin/resource/pip"
2
+
3
+ pip "tornado" do
4
+ pip_binary "pip3"
5
+ version "4.1"
6
+ options "--prefix=/.pip"
7
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: itamae-plugin-resource-pip
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - MATSUMOTO, Katsuyoshi
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-11-25 00:00:00.000000000 Z
11
+ date: 2018-08-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: itamae
@@ -28,30 +28,44 @@ dependencies:
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '1.10'
33
+ version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: '1.10'
40
+ version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: '10.0'
47
+ version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: serverspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
53
67
  - !ruby/object:Gem::Version
54
- version: '10.0'
68
+ version: '0'
55
69
  description: itamae plugin resource pip
56
70
  email:
57
71
  - github@katsyoshi.org
@@ -60,7 +74,10 @@ extensions: []
60
74
  extra_rdoc_files: []
61
75
  files:
62
76
  - ".gitignore"
77
+ - ".rspec"
78
+ - ".travis.yml"
63
79
  - CODE_OF_CONDUCT.md
80
+ - Dockerfile
64
81
  - Gemfile
65
82
  - README.md
66
83
  - Rakefile
@@ -68,11 +85,11 @@ files:
68
85
  - lib/itamae/plugin/resource/pip.rb
69
86
  - mrblib/itamae/plugin/resource/pip.rb
70
87
  - mrblib/itamae/plugin/resource_executor/pip.rb
88
+ - samples/recipe.rb
71
89
  homepage: https://github.com/katsyoshi/itamae-plugin-resource-pip
72
90
  licenses:
73
91
  - MIT
74
- metadata:
75
- allowed_push_host: https://rubygems.org
92
+ metadata: {}
76
93
  post_install_message:
77
94
  rdoc_options: []
78
95
  require_paths:
@@ -89,7 +106,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
89
106
  version: '0'
90
107
  requirements: []
91
108
  rubyforge_project:
92
- rubygems_version: 2.5.2
109
+ rubygems_version: 2.7.6
93
110
  signing_key:
94
111
  specification_version: 4
95
112
  summary: itamae plugin resource pip