from-scratch 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.chef/knife.rb +6 -0
- data/.gitignore +9 -0
- data/.rspec +2 -0
- data/.travis.yml +4 -0
- data/Berksfile +17 -0
- data/Berksfile.lock +19 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +58 -0
- data/Rakefile +6 -0
- data/Thorfile +5 -0
- data/bin/scratchify +6 -0
- data/chefignore +101 -0
- data/cookbooks/chef_gem/CHANGELOG.md +24 -0
- data/cookbooks/chef_gem/README.md +38 -0
- data/cookbooks/chef_gem/libraries/chef_gem.rb +72 -0
- data/cookbooks/chef_gem/metadata.json +29 -0
- data/cookbooks/chef_gem/recipes/default.rb +0 -0
- data/cookbooks/java/.gitignore +21 -0
- data/cookbooks/java/.kitchen.docker.yml +15 -0
- data/cookbooks/java/.kitchen.yml +126 -0
- data/cookbooks/java/.travis.yml +6 -0
- data/cookbooks/java/Berksfile +10 -0
- data/cookbooks/java/CHANGELOG.md +398 -0
- data/cookbooks/java/CONTRIBUTING.md +12 -0
- data/cookbooks/java/Gemfile +15 -0
- data/cookbooks/java/ISSUES.md +43 -0
- data/cookbooks/java/LICENSE +201 -0
- data/cookbooks/java/README.md +402 -0
- data/cookbooks/java/Rakefile +60 -0
- data/cookbooks/java/TESTING.md +41 -0
- data/cookbooks/java/attributes/default.rb +146 -0
- data/cookbooks/java/libraries/helpers.rb +120 -0
- data/cookbooks/java/libraries/matchers.rb +5 -0
- data/cookbooks/java/metadata.json +69 -0
- data/cookbooks/java/providers/alternatives.rb +94 -0
- data/cookbooks/java/providers/ark.rb +255 -0
- data/cookbooks/java/recipes/default.rb +22 -0
- data/cookbooks/java/recipes/default_java_symlink.rb +19 -0
- data/cookbooks/java/recipes/homebrew.rb +3 -0
- data/cookbooks/java/recipes/ibm.rb +76 -0
- data/cookbooks/java/recipes/ibm_tar.rb +70 -0
- data/cookbooks/java/recipes/openjdk.rb +74 -0
- data/cookbooks/java/recipes/oracle.rb +74 -0
- data/cookbooks/java/recipes/oracle_i386.rb +73 -0
- data/cookbooks/java/recipes/oracle_jce.rb +75 -0
- data/cookbooks/java/recipes/oracle_rpm.rb +60 -0
- data/cookbooks/java/recipes/purge_packages.rb +20 -0
- data/cookbooks/java/recipes/set_attributes_from_version.rb +55 -0
- data/cookbooks/java/recipes/set_java_home.rb +44 -0
- data/cookbooks/java/recipes/windows.rb +82 -0
- data/cookbooks/java/resources/alternatives.rb +30 -0
- data/cookbooks/java/resources/ark.rb +58 -0
- data/cookbooks/java/templates/default/ibm_jdk.installer.properties.erb +3 -0
- data/cookbooks/java/templates/default/oracle.jinfo.erb +6 -0
- data/cookbooks/rvm/.foodcritic +1 -0
- data/cookbooks/rvm/.gitignore +7 -0
- data/cookbooks/rvm/.kitchen.yml +66 -0
- data/cookbooks/rvm/.travis.yml +9 -0
- data/cookbooks/rvm/Berksfile +10 -0
- data/cookbooks/rvm/CHANGELOG.md +253 -0
- data/cookbooks/rvm/CODE_OF_CONDUCT.md +12 -0
- data/cookbooks/rvm/CONTRIBUTING.md +26 -0
- data/cookbooks/rvm/Gemfile +20 -0
- data/cookbooks/rvm/Guardfile +12 -0
- data/cookbooks/rvm/README.md +1459 -0
- data/cookbooks/rvm/Rakefile +18 -0
- data/cookbooks/rvm/attributes/.gitkeep +0 -0
- data/cookbooks/rvm/attributes/default.rb +68 -0
- data/cookbooks/rvm/attributes/gem_package.rb +23 -0
- data/cookbooks/rvm/attributes/vagrant.rb +23 -0
- data/cookbooks/rvm/libraries/chef_rvm_environment_helpers.rb +55 -0
- data/cookbooks/rvm/libraries/chef_rvm_gemset_helpers.rb +67 -0
- data/cookbooks/rvm/libraries/chef_rvm_recipe_helpers.rb +80 -0
- data/cookbooks/rvm/libraries/chef_rvm_ruby_helpers.rb +95 -0
- data/cookbooks/rvm/libraries/chef_rvm_set_helpers.rb +16 -0
- data/cookbooks/rvm/libraries/chef_rvm_shell_helpers.rb +57 -0
- data/cookbooks/rvm/libraries/chef_rvm_string_cache.rb +104 -0
- data/cookbooks/rvm/libraries/chef_rvm_string_helpers.rb +61 -0
- data/cookbooks/rvm/libraries/chef_rvm_version_helpers.rb +45 -0
- data/cookbooks/rvm/libraries/gem_package_monkeypatch.rb +34 -0
- data/cookbooks/rvm/libraries/provider_rvm_installation.rb +185 -0
- data/cookbooks/rvm/libraries/resource_rvm_installation.rb +103 -0
- data/cookbooks/rvm/libraries/rvm_chef_user_environment.rb +55 -0
- data/cookbooks/rvm/libraries/rvm_rubygems_package.rb +189 -0
- data/cookbooks/rvm/libraries/rvm_shell_chef_wrapper.rb +99 -0
- data/cookbooks/rvm/metadata.json +51 -0
- data/cookbooks/rvm/providers/default_ruby.rb +63 -0
- data/cookbooks/rvm/providers/environment.rb +78 -0
- data/cookbooks/rvm/providers/gemset.rb +118 -0
- data/cookbooks/rvm/providers/global_gem.rb +97 -0
- data/cookbooks/rvm/providers/ruby.rb +178 -0
- data/cookbooks/rvm/providers/shell.rb +121 -0
- data/cookbooks/rvm/providers/wrapper.rb +73 -0
- data/cookbooks/rvm/recipes/.gitkeep +0 -0
- data/cookbooks/rvm/recipes/default.rb +40 -0
- data/cookbooks/rvm/recipes/gem_package.rb +33 -0
- data/cookbooks/rvm/recipes/system.rb +37 -0
- data/cookbooks/rvm/recipes/system_install.rb +42 -0
- data/cookbooks/rvm/recipes/user.rb +43 -0
- data/cookbooks/rvm/recipes/user_install.rb +58 -0
- data/cookbooks/rvm/recipes/vagrant.rb +37 -0
- data/cookbooks/rvm/resources/default_ruby.rb +31 -0
- data/cookbooks/rvm/resources/environment.rb +31 -0
- data/cookbooks/rvm/resources/gem.rb +37 -0
- data/cookbooks/rvm/resources/gemset.rb +32 -0
- data/cookbooks/rvm/resources/global_gem.rb +34 -0
- data/cookbooks/rvm/resources/ruby.rb +32 -0
- data/cookbooks/rvm/resources/shell.rb +41 -0
- data/cookbooks/rvm/resources/wrapper.rb +34 -0
- data/cookbooks/rvm/templates/default/rvmrc.erb +14 -0
- data/cookbooks/rvm/templates/default/vagrant-chef-client-wrapper.erb +23 -0
- data/cookbooks/rvm/templates/default/vagrant-chef-solo-wrapper.erb +23 -0
- data/cookbooks/rvm/test/integration/data_bags/users/virgil1.json +4 -0
- data/cookbooks/rvm/test/integration/data_bags/users/virgil2.json +4 -0
- data/cookbooks/rvm/test/integration/data_bags/users/wigglebottom.json +3 -0
- data/cookbooks/rvm/test/integration/installs/bats/version_pinning.bats +13 -0
- data/cookbooks/rvm/test/integration/rubies/bats/_common.bash +16 -0
- data/cookbooks/rvm/test/integration/rubies/bats/verify_1.9.3.bats +9 -0
- data/cookbooks/rvm/test/integration/rubies/bats/verify_jruby.bats +12 -0
- data/cookbooks/rvm/test/integration/rubies/bats/verify_patch_support.bats +19 -0
- data/cookbooks/rvm/test/integration/rubies/bats/verify_ree.bats +9 -0
- data/cookbooks/rvm/test/integration/rubies/bats/verify_rubygems_version_support.bats +15 -0
- data/cookbooks/rvm/test/integration/stock_system_and_user/bats/system.bats +45 -0
- data/cookbooks/rvm/test/unit/libraries/provider_rvm_installation_spec.rb +220 -0
- data/cookbooks/rvm/test/unit/libraries/resource_rvm_installation_spec.rb +139 -0
- data/cookbooks/rvm/test/unit/spec_helper.rb +23 -0
- data/cookbooks/scratchify/.chef/knife.rb +9 -0
- data/cookbooks/scratchify/Berksfile +16 -0
- data/cookbooks/scratchify/Berksfile.lock +19 -0
- data/cookbooks/scratchify/LICENSE.txt +21 -0
- data/cookbooks/scratchify/README.md +41 -0
- data/cookbooks/scratchify/Thorfile +5 -0
- data/cookbooks/scratchify/bin/console +14 -0
- data/cookbooks/scratchify/bin/scratchify +6 -0
- data/cookbooks/scratchify/bin/setup +7 -0
- data/cookbooks/scratchify/chefignore +101 -0
- data/cookbooks/scratchify/data_bags/users/deploy.json +6 -0
- data/cookbooks/scratchify/environments/.gitkeep +0 -0
- data/cookbooks/scratchify/from-scratch.gemspec +36 -0
- data/cookbooks/scratchify/lib/from/scratch.rb +31 -0
- data/cookbooks/scratchify/lib/from/scratch/interviewer.rb +35 -0
- data/cookbooks/scratchify/lib/from/scratch/version.rb +3 -0
- data/cookbooks/scratchify/metadata.json +36 -0
- data/cookbooks/scratchify/nodes/normfood.ru.json +75 -0
- data/cookbooks/scratchify/recipes/default.rb +0 -0
- data/cookbooks/scratchify/roles/.gitkeep +0 -0
- data/cookbooks/scratchify/spec/from/scratch_spec.rb +11 -0
- data/cookbooks/scratchify/spec/spec_helper.rb +2 -0
- data/cookbooks/user/.gitignore +5 -0
- data/cookbooks/user/.kitchen.yml +46 -0
- data/cookbooks/user/.travis.yml +4 -0
- data/cookbooks/user/Berksfile +7 -0
- data/cookbooks/user/CHANGELOG.md +101 -0
- data/cookbooks/user/Gemfile +14 -0
- data/cookbooks/user/README.md +447 -0
- data/cookbooks/user/Rakefile +21 -0
- data/cookbooks/user/attributes/default.rb +50 -0
- data/cookbooks/user/libraries/matchers.rb +26 -0
- data/cookbooks/user/metadata.json +46 -0
- data/cookbooks/user/providers/account.rb +212 -0
- data/cookbooks/user/recipes/data_bag.rb +59 -0
- data/cookbooks/user/recipes/default.rb +18 -0
- data/cookbooks/user/resources/account.rb +41 -0
- data/cookbooks/user/templates/default/authorized_keys.erb +7 -0
- data/from-scratch.gemspec +33 -0
- data/lib/from-scratch.rb +25 -0
- data/lib/from-scratch/version.rb +3 -0
- data/metadata.rb +15 -0
- data/recipes/default.rb +0 -0
- data/templates/node.json.erb +31 -0
- data/templates/user.json.erb +6 -0
- metadata +330 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: 5b496c570f495a440506371b464e4533fb5470bb
|
|
4
|
+
data.tar.gz: 33954a19f5906d5b5c8af4d27cc0f95793084488
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: c7fdbec146ed46a5ddd7eb85ed9f6888400074903d09484959665a242331490704cf6a17d2e6b728b87de8e7876294b99a5e8a47cd0d7a6ba9a0bb637722a680
|
|
7
|
+
data.tar.gz: d390f3867386c55f06e2e4ad61c06acbe9c85c24529ac7125583b1fb2fb7b923fc673f6ef85ebd24fb5fd625cd634c18dfbf0c290ddd982647d5b70bd0afa2f4
|
data/.chef/knife.rb
ADDED
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Berksfile
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
#^syntax detection
|
|
3
|
+
|
|
4
|
+
source "https://supermarket.chef.io"
|
|
5
|
+
|
|
6
|
+
metadata
|
|
7
|
+
|
|
8
|
+
cookbook 'user'
|
|
9
|
+
cookbook 'rvm', github: 'fnichol/chef-rvm'
|
|
10
|
+
cookbook 'postgresql'
|
|
11
|
+
|
|
12
|
+
# cookbook 'dpkg_packages', git: "https://gitlab.acid.cl/acidlabs/chef-dpkg-packages.git"
|
|
13
|
+
# cookbook 'nginx', git: "https://gitlab.acid.cl/acidlabs/chef-nginx.git"
|
|
14
|
+
# cookbook 'postgresql', git: "https://github.com/phlipper/chef-postgresql.git"
|
|
15
|
+
# cookbook 'rvm'
|
|
16
|
+
# cookbook 'ssh-hardening'
|
|
17
|
+
# cookbook 'sudo'
|
data/Berksfile.lock
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
DEPENDENCIES
|
|
2
|
+
rvm
|
|
3
|
+
git: git://github.com/fnichol/chef-rvm.git
|
|
4
|
+
revision: 08ec265f277e112a5a2e4b201bd32ddfe1bb968c
|
|
5
|
+
scratchify
|
|
6
|
+
path: .
|
|
7
|
+
metadata: true
|
|
8
|
+
user
|
|
9
|
+
|
|
10
|
+
GRAPH
|
|
11
|
+
chef_gem (0.1.0)
|
|
12
|
+
java (1.35.0)
|
|
13
|
+
rvm (0.10.1)
|
|
14
|
+
chef_gem (>= 0.0.0)
|
|
15
|
+
java (>= 0.0.0)
|
|
16
|
+
scratchify (0.1.0)
|
|
17
|
+
rvm (>= 0.0.0)
|
|
18
|
+
user (>= 0.0.0)
|
|
19
|
+
user (0.4.2)
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2015 Andrew Shaydurov
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# FromScratch
|
|
2
|
+
|
|
3
|
+
I'm sick and tired of thousands of articles "How to setup Rails app server". Here is your last command to do that.
|
|
4
|
+
|
|
5
|
+
No configs, no questions. Just ~~one ring to rule them all~~ one command to get fully functional server with best security practices ready for first `cap production deploy`.
|
|
6
|
+
|
|
7
|
+
## Usage
|
|
8
|
+
|
|
9
|
+
$ gem install from-scratch
|
|
10
|
+
$ scratchify your_app_name your.host.com
|
|
11
|
+
|
|
12
|
+
And everything is done. Then add following to your `config/deploy.rb` or `config/deploy/production.rb` for Capistrano:
|
|
13
|
+
|
|
14
|
+
```ruby
|
|
15
|
+
server 'your.host.com', user: 'deploy', roles: %w(app db web)
|
|
16
|
+
set :deploy_to, "/home/deploy/your_app_name"
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Supports
|
|
20
|
+
|
|
21
|
+
OS:
|
|
22
|
+
|
|
23
|
+
- APT-based Linux (Ubuntu, Debian)
|
|
24
|
+
- YUM-based Linux (RedHat, CentOS)
|
|
25
|
+
|
|
26
|
+
## It's a kind of magic!
|
|
27
|
+
|
|
28
|
+
Not actully. Just preconfigured [Chef](https://www.chef.io/). Here are the things done with the command:
|
|
29
|
+
|
|
30
|
+
- Install system-wide RVM with latest MRI (2.2.3)
|
|
31
|
+
- Install PostgreSQL, create database with user, pg_tune a little
|
|
32
|
+
- Add _deploy_ non-admin user to system specially for your app, upload your SSH pub key to it
|
|
33
|
+
- Install nginx and replace it's default site config with one prepared for rails app
|
|
34
|
+
- Generate app folder inside _deploy_'s home and generate `database.yml` and `secrets.yml`
|
|
35
|
+
|
|
36
|
+
## Things you need to know
|
|
37
|
+
|
|
38
|
+
Nginx config is set up to connect to unix socket placed at `/home/deploy/your_app_name/shared/tmp/sockets/application.sock`. Change it manually or config your favorite app server (Puma, Unicorn, Thin etc) to place it's socket there.
|
|
39
|
+
|
|
40
|
+
You can just `ssh deploy@your.host.com` because your SSH pub key is already there.
|
|
41
|
+
|
|
42
|
+
Both `postgres` and `your_app_name` DB users get (different) randomly generated passwords. You can see app-user password inside `config/database.yml`, but `postgres` password is not saved anywhere. If you need admin access to your PostgreSQL, then you should SSH as root and:
|
|
43
|
+
|
|
44
|
+
# su - postgres
|
|
45
|
+
$ psql
|
|
46
|
+
|
|
47
|
+
## Development
|
|
48
|
+
|
|
49
|
+
TODO
|
|
50
|
+
|
|
51
|
+
## Contributing
|
|
52
|
+
|
|
53
|
+
TODO
|
|
54
|
+
|
|
55
|
+
## License
|
|
56
|
+
|
|
57
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
|
58
|
+
|
data/Rakefile
ADDED
data/Thorfile
ADDED
data/bin/scratchify
ADDED
data/chefignore
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
# Put files/directories that should be ignored in this file when uploading
|
|
2
|
+
# or sharing to the community site.
|
|
3
|
+
# Lines that start with '# ' are comments.
|
|
4
|
+
|
|
5
|
+
# OS generated files #
|
|
6
|
+
######################
|
|
7
|
+
.DS_Store
|
|
8
|
+
Icon?
|
|
9
|
+
nohup.out
|
|
10
|
+
ehthumbs.db
|
|
11
|
+
Thumbs.db
|
|
12
|
+
|
|
13
|
+
# SASS #
|
|
14
|
+
########
|
|
15
|
+
.sass-cache
|
|
16
|
+
|
|
17
|
+
# EDITORS #
|
|
18
|
+
###########
|
|
19
|
+
\#*
|
|
20
|
+
.#*
|
|
21
|
+
*~
|
|
22
|
+
*.sw[a-z]
|
|
23
|
+
*.bak
|
|
24
|
+
REVISION
|
|
25
|
+
TAGS*
|
|
26
|
+
tmtags
|
|
27
|
+
*_flymake.*
|
|
28
|
+
*_flymake
|
|
29
|
+
*.tmproj
|
|
30
|
+
.project
|
|
31
|
+
.settings
|
|
32
|
+
mkmf.log
|
|
33
|
+
|
|
34
|
+
## COMPILED ##
|
|
35
|
+
##############
|
|
36
|
+
a.out
|
|
37
|
+
*.o
|
|
38
|
+
*.pyc
|
|
39
|
+
*.so
|
|
40
|
+
*.com
|
|
41
|
+
*.class
|
|
42
|
+
*.dll
|
|
43
|
+
*.exe
|
|
44
|
+
*/rdoc/
|
|
45
|
+
|
|
46
|
+
# Testing #
|
|
47
|
+
###########
|
|
48
|
+
.watchr
|
|
49
|
+
.rspec
|
|
50
|
+
spec/*
|
|
51
|
+
spec/fixtures/*
|
|
52
|
+
test/*
|
|
53
|
+
features/*
|
|
54
|
+
Guardfile
|
|
55
|
+
Procfile
|
|
56
|
+
|
|
57
|
+
# SCM #
|
|
58
|
+
#######
|
|
59
|
+
.git
|
|
60
|
+
*/.git
|
|
61
|
+
.gitignore
|
|
62
|
+
.gitmodules
|
|
63
|
+
.gitconfig
|
|
64
|
+
.gitattributes
|
|
65
|
+
.svn
|
|
66
|
+
*/.bzr/*
|
|
67
|
+
*/.hg/*
|
|
68
|
+
*/.svn/*
|
|
69
|
+
|
|
70
|
+
# Berkshelf #
|
|
71
|
+
#############
|
|
72
|
+
cookbooks/*
|
|
73
|
+
tmp
|
|
74
|
+
|
|
75
|
+
# Cookbooks #
|
|
76
|
+
#############
|
|
77
|
+
CONTRIBUTING
|
|
78
|
+
CHANGELOG*
|
|
79
|
+
|
|
80
|
+
# Strainer #
|
|
81
|
+
############
|
|
82
|
+
Colanderfile
|
|
83
|
+
Strainerfile
|
|
84
|
+
.colander
|
|
85
|
+
.strainer
|
|
86
|
+
|
|
87
|
+
# Vagrant #
|
|
88
|
+
###########
|
|
89
|
+
.vagrant
|
|
90
|
+
Vagrantfile
|
|
91
|
+
|
|
92
|
+
# Travis #
|
|
93
|
+
##########
|
|
94
|
+
.travis.yml
|
|
95
|
+
|
|
96
|
+
# Gem files #
|
|
97
|
+
Gemfile
|
|
98
|
+
Gemfile.lock
|
|
99
|
+
Rakefile
|
|
100
|
+
lib/*
|
|
101
|
+
bin/*
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
v0.1.0
|
|
2
|
+
------
|
|
3
|
+
* Add name to metadata.rb (thanks [Eli Klein](https://github.com/eklein))
|
|
4
|
+
|
|
5
|
+
v0.0.5
|
|
6
|
+
------
|
|
7
|
+
* Applies backport of CHEF-3164 to _all_ versions under 10.14.0 (thanks [cgriego](https://github.com/cgriego))
|
|
8
|
+
|
|
9
|
+
v0.0.4
|
|
10
|
+
------
|
|
11
|
+
* Backports CHEF-3164 (thanks [cgriego](https://github.com/cgriego))
|
|
12
|
+
|
|
13
|
+
v0.0.3
|
|
14
|
+
------
|
|
15
|
+
* Default node in overrides if it is unavailable
|
|
16
|
+
|
|
17
|
+
v0.0.2
|
|
18
|
+
------
|
|
19
|
+
* Add omnibus fixes for installs < 0.10.12
|
|
20
|
+
* Add conditional patching based on chef version
|
|
21
|
+
|
|
22
|
+
v0.0.1
|
|
23
|
+
------
|
|
24
|
+
* Initial release
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
ChefGem
|
|
2
|
+
=======
|
|
3
|
+
|
|
4
|
+
This cookbook is a transition cookbook aimed at helping move from the
|
|
5
|
+
pre-chef_gem era to the post chef_gem era. The chef_gem resource was
|
|
6
|
+
introducde in Chef 0.10.9, providing an easy mechanism for installing
|
|
7
|
+
and using gems required by Chef internally. When used within an omnibus
|
|
8
|
+
installation, chef_gems are installed within the embedded Ruby.
|
|
9
|
+
|
|
10
|
+
What this cookbook provides
|
|
11
|
+
----------------------------
|
|
12
|
+
|
|
13
|
+
For pre 0.10.9 Chef installations, it provides a chef_gem compatible resouce
|
|
14
|
+
allowing cookbooks to be updated but not requiring full conversions. For installations
|
|
15
|
+
under 0.10.12, some patches are added to aid in proper omnibus functionality allowing
|
|
16
|
+
chef_gem to work as expected. For Chef installations of 0.10.12 and beyond, this
|
|
17
|
+
cookbook provides nothing. This means you will get consistent and expected behavior
|
|
18
|
+
across Chef versions.
|
|
19
|
+
|
|
20
|
+
Configuration
|
|
21
|
+
-------------
|
|
22
|
+
|
|
23
|
+
Notable attributes (note that these should only be required for special cases):
|
|
24
|
+
|
|
25
|
+
* `node[:gem_binary] = '/usr/local/bin/gem'`
|
|
26
|
+
* `node[:chef_gem_binary] = '/opt/opscode/embedded/bin/gem'`
|
|
27
|
+
|
|
28
|
+
Notes
|
|
29
|
+
-----
|
|
30
|
+
|
|
31
|
+
With the release of 0.10.12 this cookbook should be considered deprecated and used
|
|
32
|
+
only for compatibility with older installations.
|
|
33
|
+
|
|
34
|
+
Repository
|
|
35
|
+
----------
|
|
36
|
+
|
|
37
|
+
* https://github.com/hw-cookbooks/chef_gem
|
|
38
|
+
* IRC: Freenode @ #heavywater
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
current_version = Gem::Version.new(Chef::VERSION)
|
|
2
|
+
|
|
3
|
+
if(current_version < Gem::Version.new('10.12.0'))
|
|
4
|
+
|
|
5
|
+
if(current_version < Gem::Version.new('0.10.9'))
|
|
6
|
+
Chef::Log.info '*** Adding ChefGem Resource ***'
|
|
7
|
+
else
|
|
8
|
+
Chef::Log.info '*** Adding fixes to ChefGem Resource ***'
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
require 'chef/resource/gem_package'
|
|
12
|
+
|
|
13
|
+
class Chef::Resource::GemPackage
|
|
14
|
+
def gem_binary(*args)
|
|
15
|
+
node ||= {}
|
|
16
|
+
node[:gem_binary] || 'gem'
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
class Chef::Resource::ChefGem < Chef::Resource::GemPackage
|
|
21
|
+
|
|
22
|
+
# provides :chef_gem, :on_platforms => :all
|
|
23
|
+
|
|
24
|
+
def initialize(name, run_context=nil)
|
|
25
|
+
super
|
|
26
|
+
@resource_name = :chef_gem
|
|
27
|
+
@provider = Chef::Provider::Package::Rubygems
|
|
28
|
+
after_created
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def gem_binary(*args)
|
|
32
|
+
node ||= {}
|
|
33
|
+
node[:chef_gem_binary] || ::File.join(Gem.bindir, 'gem')
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def after_created
|
|
37
|
+
Array(@action).flatten.compact.each do |action|
|
|
38
|
+
self.run_action(action)
|
|
39
|
+
end
|
|
40
|
+
Gem.clear_paths
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
if(Chef::VERSION.to_s.start_with?('0.10.10'))
|
|
46
|
+
Chef::Log.info '** Patching Chef::Provider::Package::Rubygems#is_omnibus? to properly find all omnibus installs **'
|
|
47
|
+
class Chef::Provider::Package::Rubygems
|
|
48
|
+
def is_omnibus?
|
|
49
|
+
if RbConfig::CONFIG['bindir'] =~ %r!/opt/(opscode|chef)/embedded/bin!
|
|
50
|
+
Chef::Log.debug("#{@new_resource} detected omnibus installation in #{RbConfig::CONFIG['bindir']}")
|
|
51
|
+
# Omnibus installs to a static path because of linking on unix, find it.
|
|
52
|
+
true
|
|
53
|
+
elsif RbConfig::CONFIG['bindir'].sub(/^[\w]:/, '') == "/opscode/chef/embedded/bin"
|
|
54
|
+
Chef::Log.debug("#{@new_resource} detected omnibus installation in #{RbConfig::CONFIG['bindir']}")
|
|
55
|
+
# windows, with the drive letter removed
|
|
56
|
+
true
|
|
57
|
+
else
|
|
58
|
+
false
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
if(current_version < Gem::Version.new('10.14.0'))
|
|
65
|
+
module Chef3164
|
|
66
|
+
def after_created(*)
|
|
67
|
+
Gem.clear_paths # NOTE: Related to CHEF-3164
|
|
68
|
+
super
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
Chef::Resource::ChefGem.send(:include, Chef3164)
|
|
72
|
+
end
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "chef_gem",
|
|
3
|
+
"description": "Provides proper chef_gem resource support for Chef versions < 0.10.12",
|
|
4
|
+
"long_description": "ChefGem\n=======\n\nThis cookbook is a transition cookbook aimed at helping move from the\npre-chef_gem era to the post chef_gem era. The chef_gem resource was\nintroducde in Chef 0.10.9, providing an easy mechanism for installing\nand using gems required by Chef internally. When used within an omnibus\ninstallation, chef_gems are installed within the embedded Ruby.\n\nWhat this cookbook provides\n----------------------------\n\nFor pre 0.10.9 Chef installations, it provides a chef_gem compatible resouce\nallowing cookbooks to be updated but not requiring full conversions. For installations\nunder 0.10.12, some patches are added to aid in proper omnibus functionality allowing\nchef_gem to work as expected. For Chef installations of 0.10.12 and beyond, this\ncookbook provides nothing. This means you will get consistent and expected behavior\nacross Chef versions.\n\nConfiguration\n-------------\n\nNotable attributes (note that these should only be required for special cases):\n\n* `node[:gem_binary] = '/usr/local/bin/gem'`\n* `node[:chef_gem_binary] = '/opt/opscode/embedded/bin/gem'`\n\nNotes\n-----\n\nWith the release of 0.10.12 this cookbook should be considered deprecated and used\nonly for compatibility with older installations.\n\nRepository\n----------\n\n* https://github.com/hw-cookbooks/chef_gem\n* IRC: Freenode @ #heavywater",
|
|
5
|
+
"maintainer": "Chris Roberts",
|
|
6
|
+
"maintainer_email": "chrisroberts.code@gmail.com",
|
|
7
|
+
"license": "Apache 2.0",
|
|
8
|
+
"platforms": {
|
|
9
|
+
},
|
|
10
|
+
"dependencies": {
|
|
11
|
+
},
|
|
12
|
+
"recommendations": {
|
|
13
|
+
},
|
|
14
|
+
"suggestions": {
|
|
15
|
+
},
|
|
16
|
+
"conflicting": {
|
|
17
|
+
},
|
|
18
|
+
"providing": {
|
|
19
|
+
},
|
|
20
|
+
"replacing": {
|
|
21
|
+
},
|
|
22
|
+
"attributes": {
|
|
23
|
+
},
|
|
24
|
+
"groupings": {
|
|
25
|
+
},
|
|
26
|
+
"recipes": {
|
|
27
|
+
},
|
|
28
|
+
"version": "0.1.0"
|
|
29
|
+
}
|