itamae-plugin-recipe-rtn_rbenv 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: fa4583dde9dc934b2554a177935bd02c6e81ef38
4
+ data.tar.gz: cb925ce3e789c05a3a60ba148f95f1f0c806fdb5
5
+ SHA512:
6
+ metadata.gz: 766f509bfb25475476e88b135387a70ca51b80c0f1dbd7b8a50c68b0f00b6b1ee3bf8f13a9591290f5be9c2e31651afe4c56d8cf0209b4c2e83526ea8800a9fd
7
+ data.tar.gz: 3bda76b006981ae7da8ed240f7848b76abef535b638cf1b8945ac211163164f6c2bff49d12874f845d0b5fe21151f993d27173a6bd445ae69af7925ab410f2ff
data/.gitignore ADDED
@@ -0,0 +1,293 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.bundle
11
+ *.so
12
+ *.o
13
+ *.a
14
+ mkmf.log
15
+
16
+ .vagrant
17
+
18
+ # Created by https://www.gitignore.io
19
+
20
+ ### OSX ###
21
+ .DS_Store
22
+ .AppleDouble
23
+ .LSOverride
24
+
25
+ # Icon must end with two \r
26
+ Icon
27
+
28
+
29
+ # Thumbnails
30
+ ._*
31
+
32
+ # Files that might appear on external disk
33
+ .Spotlight-V100
34
+ .Trashes
35
+
36
+ # Directories potentially created on remote AFP share
37
+ .AppleDB
38
+ .AppleDesktop
39
+ Network Trash Folder
40
+ Temporary Items
41
+ .apdisk
42
+
43
+
44
+ ### Windows ###
45
+ # Windows image file caches
46
+ Thumbs.db
47
+ ehthumbs.db
48
+
49
+ # Folder config file
50
+ Desktop.ini
51
+
52
+ # Recycle Bin used on file shares
53
+ $RECYCLE.BIN/
54
+
55
+ # Windows Installer files
56
+ *.cab
57
+ *.msi
58
+ *.msm
59
+ *.msp
60
+
61
+ # Windows shortcuts
62
+ *.lnk
63
+
64
+
65
+ ### Linux ###
66
+ *~
67
+
68
+ # KDE directory preferences
69
+ .directory
70
+
71
+
72
+ ### vim ###
73
+ [._]*.s[a-w][a-z]
74
+ [._]s[a-w][a-z]
75
+ *.un~
76
+ Session.vim
77
+ .netrwhist
78
+ *~
79
+
80
+
81
+ ### Emacs ###
82
+ # -*- mode: gitignore; -*-
83
+ *~
84
+ \#*\#
85
+ /.emacs.desktop
86
+ /.emacs.desktop.lock
87
+ *.elc
88
+ auto-save-list
89
+ tramp
90
+ .\#*
91
+
92
+ # Org-mode
93
+ .org-id-locations
94
+ *_archive
95
+
96
+ # flymake-mode
97
+ *_flymake.*
98
+
99
+ # eshell files
100
+ /eshell/history
101
+ /eshell/lastdir
102
+
103
+ # elpa packages
104
+ /elpa/
105
+
106
+ # reftex files
107
+ *.rel
108
+
109
+ # AUCTeX auto folder
110
+ /auto/
111
+
112
+
113
+ ### SublimeText ###
114
+ # cache files for sublime text
115
+ *.tmlanguage.cache
116
+ *.tmPreferences.cache
117
+ *.stTheme.cache
118
+
119
+ # workspace files are user-specific
120
+ *.sublime-workspace
121
+
122
+ # project files should be checked into the repository, unless a significant
123
+ # proportion of contributors will probably not be using SublimeText
124
+ # *.sublime-project
125
+
126
+ # sftp configuration file
127
+ sftp-config.json
128
+
129
+
130
+ ### Intellij ###
131
+ # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm
132
+
133
+ /*.iml
134
+
135
+ ## Directory-based project format:
136
+ .idea/
137
+ # if you remove the above rule, at least ignore the follwing:
138
+
139
+ # User-specific stuff:
140
+ # .idea/workspace.xml
141
+ # .idea/tasks.xml
142
+ # .idea/dictionaries
143
+
144
+ # Sensitive or high-churn files:
145
+ # .idea/dataSources.ids
146
+ # .idea/dataSources.xml
147
+ # .idea/sqlDataSources.xml
148
+ # .idea/dynamic.xml
149
+ # .idea/uiDesigner.xml
150
+
151
+ # Gradle:
152
+ # .idea/gradle.xml
153
+ # .idea/libraries
154
+
155
+ # Mongo Explorer plugin:
156
+ # .idea/mongoSettings.xml
157
+
158
+ ## File-based project format:
159
+ *.ipr
160
+ *.iws
161
+
162
+ ## Plugin-specific files:
163
+
164
+ # IntelliJ
165
+ out/
166
+
167
+ # mpeltonen/sbt-idea plugin
168
+ .idea_modules/
169
+
170
+ # JIRA plugin
171
+ atlassian-ide-plugin.xml
172
+
173
+ # Crashlytics plugin (for Android Studio and IntelliJ)
174
+ com_crashlytics_export_strings.xml
175
+
176
+
177
+ ### RubyMine ###
178
+ # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm
179
+
180
+ /*.iml
181
+
182
+ ## Directory-based project format:
183
+ .idea/
184
+ # if you remove the above rule, at least ignore the follwing:
185
+
186
+ # User-specific stuff:
187
+ # .idea/workspace.xml
188
+ # .idea/tasks.xml
189
+ # .idea/dictionaries
190
+
191
+ # Sensitive or high-churn files:
192
+ # .idea/dataSources.ids
193
+ # .idea/dataSources.xml
194
+ # .idea/sqlDataSources.xml
195
+ # .idea/dynamic.xml
196
+ # .idea/uiDesigner.xml
197
+
198
+ # Gradle:
199
+ # .idea/gradle.xml
200
+ # .idea/libraries
201
+
202
+ # Mongo Explorer plugin:
203
+ # .idea/mongoSettings.xml
204
+
205
+ ## File-based project format:
206
+ *.ipr
207
+ *.iws
208
+
209
+ ## Plugin-specific files:
210
+
211
+ # IntelliJ
212
+ out/
213
+
214
+ # mpeltonen/sbt-idea plugin
215
+ .idea_modules/
216
+
217
+ # JIRA plugin
218
+ atlassian-ide-plugin.xml
219
+
220
+ # Crashlytics plugin (for Android Studio and IntelliJ)
221
+ com_crashlytics_export_strings.xml
222
+
223
+
224
+ ### Ruby ###
225
+ *.gem
226
+ *.rbc
227
+ /.config
228
+ /coverage/
229
+ /InstalledFiles
230
+ /pkg/
231
+ /spec/reports/
232
+ /test/tmp/
233
+ /test/version_tmp/
234
+ /tmp/
235
+
236
+ ## Specific to RubyMotion:
237
+ .dat*
238
+ .repl_history
239
+ build/
240
+
241
+ ## Documentation cache and generated files:
242
+ /.yardoc/
243
+ /_yardoc/
244
+ /doc/
245
+ /rdoc/
246
+
247
+ ## Environment normalisation:
248
+ /.bundle/
249
+ /lib/bundler/man/
250
+
251
+ # for a library or gem, you might want to ignore these files since the code is
252
+ # intended to run in multiple environments; otherwise, check them in:
253
+ # Gemfile.lock
254
+ # .ruby-version
255
+ # .ruby-gemset
256
+
257
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
258
+ .rvmrc
259
+
260
+
261
+ ### Rails ###
262
+ *.rbc
263
+ capybara-*.html
264
+ .rspec
265
+ /log
266
+ /tmp
267
+ /db/*.sqlite3
268
+ /public/system
269
+ /coverage/
270
+ /spec/tmp
271
+ **.orig
272
+ rerun.txt
273
+ pickle-email-*.html
274
+
275
+ # TODO Comment out these rules if you are OK with secrets being uploaded to the repo
276
+ config/initializers/secret_token.rb
277
+ config/secrets.yml
278
+
279
+ ## Environment normalisation:
280
+ /.bundle
281
+ /vendor/bundle
282
+
283
+ # these should all be checked in to normalise the environment:
284
+ # Gemfile.lock, .ruby-version, .ruby-gemset
285
+
286
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
287
+ .rvmrc
288
+
289
+ # if using bower-rails ignore default bower_components path bower.json files
290
+ /vendor/assets/bower_components
291
+ *.bowerrc
292
+ bower.json
293
+
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in itamae-plugin-recipe-rtn_rbenv.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Ru/MuckRu
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,60 @@
1
+ # Itamae::Plugin::Recipe::RtnRbenv
2
+
3
+ Installs rbenv and ruby_build.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'itamae-plugin-recipe-rtn_rbenv'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install itamae-plugin-recipe-rtn_rbenv
18
+
19
+ ## Usage
20
+
21
+ ### install for single user
22
+
23
+ ```ruby
24
+ include_recipe 'rtn_rbenv::user'
25
+ ```
26
+
27
+ ### install for system
28
+
29
+ ```ruby
30
+ include_recipe 'rtn_rbenv::system'
31
+ ```
32
+
33
+ ### node.json
34
+
35
+ ```json
36
+ {
37
+ "rtn_rbenv": {
38
+ "user": "vagrant",
39
+ "versions": {
40
+ "2.1.3": [
41
+ "bundler": {
42
+ "version": "1.7.3",
43
+ "force": true
44
+ },
45
+ "sinatra"
46
+ ],
47
+ "2.1.0": []
48
+ },
49
+ "global": "2.1.3"
50
+ }
51
+ }
52
+ ```
53
+
54
+ ## Contributing
55
+
56
+ 1. Fork it ( https://github.com/rutan/itamae-plugin-recipe-rtn_rbenv/fork )
57
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
58
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
59
+ 4. Push to the branch (`git push origin my-new-feature`)
60
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,25 @@
1
+ require 'rake'
2
+ require "bundler/gem_tasks"
3
+ require 'rspec/core/rake_task'
4
+
5
+ task :spec => 'spec:all'
6
+ task :default => :spec
7
+
8
+ namespace :spec do
9
+ targets = []
10
+ Dir.glob('./spec/*').each do |dir|
11
+ next unless File.directory?(dir)
12
+ targets << File.basename(dir)
13
+ end
14
+
15
+ task :all => targets
16
+ task :default => :all
17
+
18
+ targets.each do |target|
19
+ desc "Run serverspec tests to #{target}"
20
+ RSpec::Core::RakeTask.new(target.to_sym) do |t|
21
+ ENV['TARGET_HOST'] = target
22
+ t.pattern = "spec/#{target}/*_spec.rb"
23
+ end
24
+ end
25
+ end
data/Vagrantfile ADDED
@@ -0,0 +1,16 @@
1
+ # -*- mode: ruby -*-
2
+ # vi: set ft=ruby :
3
+
4
+ VAGRANTFILE_API_VERSION = "2"
5
+
6
+ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
7
+ config.vm.box = "sl6"
8
+ config.vm.box_url = 'http://files.rutan.info/box/scientific-6-5-x64-virtualbox.box'
9
+
10
+ config.vm.define :user do |c|
11
+ c.vm.network :private_network, ip: '192.168.33.11'
12
+ end
13
+ config.vm.define :system do |c|
14
+ c.vm.network :private_network, ip: '192.168.33.12'
15
+ end
16
+ end
@@ -0,0 +1,27 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'itamae/plugin/recipe/rtn_rbenv/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "itamae-plugin-recipe-rtn_rbenv"
8
+ spec.version = Itamae::Plugin::Recipe::RtnRbenv::VERSION
9
+ spec.authors = ["Ru/MuckRu"]
10
+ spec.email = ["ru_shalm@hazimu.com"]
11
+ spec.summary = %q{Itamae Recipe 'rbenv'}
12
+ spec.description = %q{Itamae Recipe 'rbenv'}
13
+ spec.homepage = "https://github.com/rutan/itamae-plugin-recipe-rtn_rbenv"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_dependency "itamae", "~> 1.0"
22
+
23
+ spec.add_development_dependency "bundler", "~> 1.7"
24
+ spec.add_development_dependency "rake", "~> 10.0"
25
+ spec.add_development_dependency "serverspec", "~> 2.0"
26
+ end
27
+
@@ -0,0 +1,3 @@
1
+ # encoding: utf-8
2
+
3
+ include_recipe 'rtn_rbenv::user'
@@ -0,0 +1,20 @@
1
+ # encoding: utf-8
2
+
3
+ node[:rtn_rbenv] ||= {}
4
+
5
+ packages = []
6
+ packages << 'gcc'
7
+ packages << 'git'
8
+
9
+ case os[:family]
10
+ when %r(debian|ubuntu)
11
+ packages << 'zlib-dev'
12
+ packages << 'openssl-dev'
13
+ packages << 'readline-dev'
14
+ when %r(redhat|fedora)
15
+ packages << 'zlib-devel'
16
+ packages << 'openssl-devel'
17
+ packages << 'readline-devel'
18
+ end
19
+
20
+ packages.each { |package_name| package package_name }
@@ -0,0 +1,59 @@
1
+ # encoding: utf-8
2
+ include_recipe 'rtn_rbenv::common'
3
+
4
+ # load setting
5
+ RBENV_ROOT = '/usr/local/rbenv'
6
+ RBENV_PROFILE_PATH = '/etc/profile.d/rbenv.sh'
7
+
8
+ RBENV_BASH_SETTING = <<"EOS"
9
+ export RBENV_ROOT=#{RBENV_ROOT}
10
+ export PATH="$RBENV_ROOT/bin:$RBENV_ROOT/shims:$PATH"
11
+ eval "$(rbenv init -)"
12
+ EOS
13
+
14
+ # define
15
+ def ruby_install(version)
16
+ execute "ruby install #{version}" do
17
+ command "source #{RBENV_PROFILE_PATH} && rbenv install #{version}"
18
+ not_if "test `source #{RBENV_PROFILE_PATH} && rbenv versions | grep '#{version}' -c` != 0"
19
+ end
20
+ end
21
+
22
+ def gem_install(ruby_version, name, options = {})
23
+ execute "gem install #{name}" do
24
+ command "source #{RBENV_PROFILE_PATH} && rbenv shell #{ruby_version} && gem install #{name} #{options[:version] ? "-v #{options[:version]}" : ''} #{options[:force] ? '--force' : ''}"
25
+ end
26
+ end
27
+
28
+ # install rbenv and ruby_build
29
+ git "#{RBENV_ROOT}" do
30
+ repository 'https://github.com/sstephenson/rbenv.git'
31
+ end
32
+
33
+ git "#{RBENV_ROOT}/plugins/ruby_build" do
34
+ repository 'https://github.com/sstephenson/ruby-build.git'
35
+ end
36
+
37
+ execute 'add rbenv settings to /etc/profile.d/rbenv.sh' do
38
+ command "echo '#{RBENV_BASH_SETTING}' >> #{RBENV_PROFILE_PATH}"
39
+ not_if "test `touch #{RBENV_PROFILE_PATH} && cat #{RBENV_PROFILE_PATH} | grep 'rbenv' -c` != 0"
40
+ end
41
+
42
+ # install Ruby and Gems
43
+ (node['rtn_rbenv']['versions'] || {}).each do |ruby_version, gems|
44
+ ruby_install ruby_version
45
+ gems.each do |gem|
46
+ if gem.kind_of?(Hash)
47
+ gem_install ruby_version, gem['name'], :version => gem['version'], :force => gem['force']
48
+ else
49
+ gem_install ruby_version, gem
50
+ end
51
+ end
52
+ end
53
+
54
+ # set global
55
+ if node['rtn_rbenv']['global']
56
+ execute "rbenv global #{node['rtn_rbenv']['global']}" do
57
+ command "source #{RBENV_PROFILE_PATH} && rbenv global #{node['rtn_rbenv']['global']}"
58
+ end
59
+ end
@@ -0,0 +1,67 @@
1
+ # encoding: utf-8
2
+ include_recipe 'rtn_rbenv::common'
3
+
4
+ # load setting
5
+ RBENV_USER = (node['rtn_rbenv']['user'] || 'vagrant')
6
+ RBENV_USER_HOME = "/home/#{RBENV_USER}"
7
+ RBENV_ROOT = "#{RBENV_USER_HOME}/.rbenv"
8
+ RBENV_PROFILE_PATH = "#{RBENV_USER_HOME}/.bash_profile"
9
+
10
+ RBENV_BASH_SETTING = <<"EOS"
11
+ export RBENV_ROOT=#{RBENV_ROOT}
12
+ export PATH="$RBENV_ROOT/bin:$RBENV_ROOT/shims:$PATH"
13
+ eval "$(rbenv init -)"
14
+ EOS
15
+
16
+ # define
17
+ def ruby_install(version)
18
+ execute "ruby install #{version}" do
19
+ command "source #{RBENV_PROFILE_PATH} && rbenv install #{version}"
20
+ user RBENV_USER
21
+ not_if "test `source #{RBENV_PROFILE_PATH} && rbenv versions | grep '#{version}' -c` != 0"
22
+ end
23
+ end
24
+
25
+ def gem_install(ruby_version, name, options = {})
26
+ execute "gem install #{name}" do
27
+ command "source #{RBENV_PROFILE_PATH} && rbenv shell #{ruby_version} && gem install #{name} #{options[:version] ? "-v #{options[:version]}" : ''} #{options[:force] ? '--force' : ''}"
28
+ user RBENV_USER
29
+ end
30
+ end
31
+
32
+ # install rbenv and ruby_build
33
+ git "#{RBENV_ROOT}" do
34
+ repository 'https://github.com/sstephenson/rbenv.git'
35
+ user RBENV_USER
36
+ end
37
+
38
+ git "#{RBENV_ROOT}/plugins/ruby_build" do
39
+ repository 'https://github.com/sstephenson/ruby-build.git'
40
+ user RBENV_USER
41
+ end
42
+
43
+ execute 'add rbenv settings to .bash_profile' do
44
+ command "echo '#{RBENV_BASH_SETTING}' >> #{RBENV_PROFILE_PATH}"
45
+ user RBENV_USER
46
+ not_if "test `touch #{RBENV_PROFILE_PATH} && cat #{RBENV_PROFILE_PATH} | grep 'rbenv' -c` != 0"
47
+ end
48
+
49
+ # install Ruby and Gems
50
+ (node['rtn_rbenv']['versions'] || {}).each do |ruby_version, gems|
51
+ ruby_install ruby_version
52
+ gems.each do |gem|
53
+ if gem.kind_of?(Hash)
54
+ gem_install ruby_version, gem['name'], :version => gem['version'], :force => gem['force']
55
+ else
56
+ gem_install ruby_version, gem
57
+ end
58
+ end
59
+ end
60
+
61
+ # set global
62
+ if node['rtn_rbenv']['global']
63
+ execute "rbenv global #{node['rtn_rbenv']['global']}" do
64
+ command "source #{RBENV_PROFILE_PATH} && rbenv global #{node['rtn_rbenv']['global']}"
65
+ user RBENV_USER
66
+ end
67
+ end
@@ -0,0 +1,9 @@
1
+ module Itamae
2
+ module Plugin
3
+ module Recipe
4
+ module RtnRbenv
5
+ VERSION = "0.0.1"
6
+ end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,41 @@
1
+ require 'serverspec'
2
+ require 'net/ssh'
3
+ require 'tempfile'
4
+
5
+ set :backend, :ssh
6
+
7
+ if ENV['ASK_SUDO_PASSWORD']
8
+ begin
9
+ require 'highline/import'
10
+ rescue LoadError
11
+ fail "highline is not available. Try installing it."
12
+ end
13
+ set :sudo_password, ask("Enter sudo password: ") { |q| q.echo = false }
14
+ else
15
+ set :sudo_password, ENV['SUDO_PASSWORD']
16
+ end
17
+
18
+ host = ENV['TARGET_HOST']
19
+
20
+ `vagrant up #{host}`
21
+ system("bundle exec itamae ssh -h #{host} --vagrant '#{File.expand_path("../#{host}/role.rb", __FILE__)}' -j '#{File.expand_path("../#{host}/node.json", __FILE__)}'")
22
+
23
+ config = Tempfile.new('', Dir.tmpdir)
24
+ `vagrant ssh-config #{host} > #{config.path}`
25
+
26
+ options = Net::SSH::Config.for(host, [config.path])
27
+
28
+ options[:user] ||= Etc.getlogin
29
+
30
+ set :host, options[:host_name] || host
31
+ set :ssh_options, options
32
+
33
+ # Disable sudo
34
+ # set :disable_sudo, true
35
+
36
+
37
+ # Set environment variables
38
+ # set :env, :LANG => 'C', :LC_MESSAGES => 'C'
39
+
40
+ # Set PATH
41
+ # set :path, '/sbin:/usr/local/sbin:$PATH'
@@ -0,0 +1,17 @@
1
+ {
2
+ "rtn_rbenv": {
3
+ "versions": {
4
+ "2.1.3": [
5
+ "sinatra"
6
+ ],
7
+ "2.1.0": [
8
+ {
9
+ "name": "rake",
10
+ "version": "10.2.0",
11
+ "force": true
12
+ }
13
+ ]
14
+ },
15
+ "global": "2.1.0"
16
+ }
17
+ }
@@ -0,0 +1,28 @@
1
+ require 'spec_helper'
2
+
3
+ describe command('which rbenv') do
4
+ let(:disable_sudo) { true }
5
+ its(:stdout) { should match '/usr/local/rbenv/bin/rbenv' }
6
+ end
7
+
8
+ %w[2.1.3 2.1.0].each do |ruby_version|
9
+ describe command("source /etc/profile && rbenv versions | grep '#{ruby_version}'") do
10
+ let(:disable_sudo) { true }
11
+ its(:stdout) { should match /#{Regexp.escape(ruby_version)}/ }
12
+ end
13
+ end
14
+
15
+ describe command("source /etc/profile && rbenv shell 2.1.3 && gem list") do
16
+ let(:disable_sudo) { true }
17
+ its(:stdout) { should match /sinatra/ }
18
+ end
19
+
20
+ describe command("source /etc/profile && rbenv shell 2.1.0 && gem list | grep 'rake'") do
21
+ let(:disable_sudo) { true }
22
+ its(:stdout) { should match /10\.2\.0/ }
23
+ end
24
+
25
+ describe command("source /etc/profile && ruby -v") do
26
+ let(:disable_sudo) { true }
27
+ its(:stdout) { should match /2\.1\.0/ }
28
+ end
@@ -0,0 +1,2 @@
1
+ # encoding: utf-8
2
+ include_recipe 'rtn_rbenv::system'
@@ -0,0 +1,18 @@
1
+ {
2
+ "rtn_rbenv": {
3
+ "user": "vagrant",
4
+ "versions": {
5
+ "2.1.3": [
6
+ "sinatra"
7
+ ],
8
+ "2.1.0": [
9
+ {
10
+ "name": "rake",
11
+ "version": "10.2.0",
12
+ "force": true
13
+ }
14
+ ]
15
+ },
16
+ "global": "2.1.3"
17
+ }
18
+ }
@@ -0,0 +1,29 @@
1
+ require 'spec_helper'
2
+
3
+ describe command('source /home/vagrant/.bash_profile; which rbenv') do
4
+ let(:disable_sudo) { true }
5
+ its(:stdout) { should match '/home/vagrant/.rbenv/bin/rbenv' }
6
+ end
7
+
8
+ %w[2.1.3 2.1.0].each do |ruby_version|
9
+ describe command("source /home/vagrant/.bash_profile; rbenv versions | grep '#{ruby_version}'") do
10
+ let(:disable_sudo) { true }
11
+ its(:stdout) { should match /#{Regexp.escape(ruby_version)}/ }
12
+ end
13
+ end
14
+
15
+ describe command("source /home/vagrant/.bash_profile; rbenv shell 2.1.3; gem list | grep 'sinatra'") do
16
+ let(:disable_sudo) { true }
17
+ its(:stdout) { should match /sinatra/ }
18
+ end
19
+
20
+ describe command("source /home/vagrant/.bash_profile; rbenv shell 2.1.0; gem list | grep 'rake'") do
21
+ let(:disable_sudo) { true }
22
+ its(:stdout) { should match /10\.2\.0/ }
23
+ end
24
+
25
+ describe command("source /home/vagrant/.bash_profile; ruby -v") do
26
+ let(:disable_sudo) { true }
27
+ its(:stdout) { should match /2\.1\.3/ }
28
+ end
29
+
data/spec/user/role.rb ADDED
@@ -0,0 +1,2 @@
1
+ # encoding: utf-8
2
+ include_recipe 'rtn_rbenv::user'
metadata ADDED
@@ -0,0 +1,126 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: itamae-plugin-recipe-rtn_rbenv
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Ru/MuckRu
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-10-11 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: itamae
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.7'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.7'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '10.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '10.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: '2.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '2.0'
69
+ description: Itamae Recipe 'rbenv'
70
+ email:
71
+ - ru_shalm@hazimu.com
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - ".gitignore"
77
+ - Gemfile
78
+ - LICENSE.txt
79
+ - README.md
80
+ - Rakefile
81
+ - Vagrantfile
82
+ - itamae-plugin-recipe-rtn_rbenv.gemspec
83
+ - lib/itamae/plugin/recipe/rtn_rbenv.rb
84
+ - lib/itamae/plugin/recipe/rtn_rbenv/common.rb
85
+ - lib/itamae/plugin/recipe/rtn_rbenv/system.rb
86
+ - lib/itamae/plugin/recipe/rtn_rbenv/user.rb
87
+ - lib/itamae/plugin/recipe/rtn_rbenv/version.rb
88
+ - spec/spec_helper.rb
89
+ - spec/system/node.json
90
+ - spec/system/rbenv_spec.rb
91
+ - spec/system/role.rb
92
+ - spec/user/node.json
93
+ - spec/user/rbenv_spec.rb
94
+ - spec/user/role.rb
95
+ homepage: https://github.com/rutan/itamae-plugin-recipe-rtn_rbenv
96
+ licenses:
97
+ - MIT
98
+ metadata: {}
99
+ post_install_message:
100
+ rdoc_options: []
101
+ require_paths:
102
+ - lib
103
+ required_ruby_version: !ruby/object:Gem::Requirement
104
+ requirements:
105
+ - - ">="
106
+ - !ruby/object:Gem::Version
107
+ version: '0'
108
+ required_rubygems_version: !ruby/object:Gem::Requirement
109
+ requirements:
110
+ - - ">="
111
+ - !ruby/object:Gem::Version
112
+ version: '0'
113
+ requirements: []
114
+ rubyforge_project:
115
+ rubygems_version: 2.2.2
116
+ signing_key:
117
+ specification_version: 4
118
+ summary: Itamae Recipe 'rbenv'
119
+ test_files:
120
+ - spec/spec_helper.rb
121
+ - spec/system/node.json
122
+ - spec/system/rbenv_spec.rb
123
+ - spec/system/role.rb
124
+ - spec/user/node.json
125
+ - spec/user/rbenv_spec.rb
126
+ - spec/user/role.rb