Skip to content

Commit c318df3

Browse files
committed
Add mass Julia refactor.
1 parent f65dd6a commit c318df3

File tree

35 files changed

+287
-266
lines changed

35 files changed

+287
-266
lines changed

.circleci/config.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
version: 2.1
33
orbs:
4-
kitchen: sous-chefs/[email protected]
4+
kitchen: jlenv/[email protected]
55

66
workflows:
77
kitchen:
@@ -57,13 +57,13 @@ workflows:
5757
platform: centos-7
5858
requires: [lint, danger]
5959
- kitchen/dokken-single:
60-
name: gem
61-
suite: gem
60+
name: pkg
61+
suite: pkg
6262
platform: centos-7
6363
requires: [lint, danger]
6464
- kitchen/dokken-single:
65-
name: ruby-uninstall
66-
suite: ruby-uninstall
65+
name: julia-uninstall
66+
suite: julia-uninstall
6767
platform: ubuntu-1804
6868
requires: [lint, danger]
6969
- kitchen/dokken-single:

.github/CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
* sous-chefs/ruby_rbenv
1+
* jlenv/jlenv-cookbook

.gitignore

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ _Store
2121
*.bk
2222
*.bkup
2323

24-
# ruby/bundler files
25-
.ruby-version
26-
.ruby-gemset
24+
# julia/bundler files
25+
.julia-version
26+
.julia-gemset
2727
.rvmrc
2828
Gemfile.lock
2929
.bundle

.kitchen.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ suites:
2626
includes: [centos-7]
2727
- name: global
2828
run_list: recipe[test::global]
29-
- name: ruby_uninstall
30-
run_list: recipe[test::ruby_uninstall]
29+
- name: julia_uninstall
30+
run_list: recipe[test::julia_uninstall]
3131
includes: [ubuntu-18.04]
3232
- name: system_install
3333
run_list: recipe[test::system_install]

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22

33
This file is used to list changes made in each version of the ruby_rbenv cookbook.
44

5+
## 0.1.0 (2019-07-03)
6+
7+
### NOTICE: Cookbook has been ported to Julia
8+
9+
- Renamed to jlenv-cookbook and uploaded to Supermarket.
10+
- Updated Circle-CI config to run integration tests using kitchen-docker
11+
12+
513
## 2.1.2 (2018-11-09)
614

715
- Fix `TypeError: no implicit conversion of nil into String` for `mac_os_x` platforms

README.md

Lines changed: 45 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,16 @@
1-
# Chef ruby_rbenv Cookbook
2-
[![All Contributors](https://img.shields.io/badge/all_contributors-1-orange.svg?style=flat-square)](#contributors)
1+
# Chef Jlenv Cookbook
32

4-
[![Cookbook Version](https://img.shields.io/cookbook/v/ruby_rbenv.svg)](https://supermarket.chef.io/cookbooks/ruby_rbenv)
5-
[![Build Status](https://img.shields.io/circleci/project/github/sous-chefs/ruby_rbenv/master.svg)](https://circleci.com/gh/sous-chefs/ruby_rbenv)
6-
[![OpenCollective](https://opencollective.com/sous-chefs/backers/badge.svg)](#backers)
7-
[![OpenCollective](https://opencollective.com/sous-chefs/sponsors/badge.svg)](#sponsors)
3+
[![Cookbook Version](https://img.shields.io/cookbook/v/jlenv-cookbook.svg)](https://supermarket.chef.io/cookbooks/jlenv-cookbook)
4+
[![Build Status](https://img.shields.io/circleci/project/github/jlenv/jlenv-cookbook/master.svg)](https://circleci.com/gh/jlenv/jlenv-cookbook)
85
[![License](https://img.shields.io/badge/License-Apache%202.0-green.svg)](https://opensource.org/licenses/Apache-2.0)
96

107
## Description
118

12-
Manages [rbenv][rbenv_site] and its installed Rubies.
9+
Manages [jlenv][https://github.com/jlenv] and its installed Julias.
1310

1411
## Maintainers
1512

16-
This cookbook is maintained by the Sous Chefs. The Sous Chefs are a community of Chef cookbook maintainers working together to maintain important cookbooks. If you’d like to know more please visit [sous-chefs.org](https://sous-chefs.org/) or come chat with us on the Chef Community Slack in [#sous-chefs](https://chefcommunity.slack.com/messages/C2V7B88SF).
13+
This cookbook is maintained by volunteers. Contributions and bug reports are welcome.
1714

1815
## Requirements
1916

@@ -35,57 +32,57 @@ This cookbook requires Chef 13.0+.
3532

3633
Example installations are provided in `test/fixtures/cookbooks/test/recipes/`.
3734

38-
A `rbenv_system_install` or `rbenv_user_install` is required to be set so that rbenv knows which version you want to use, and is installed on the system.
35+
A `jlenv_system_install` or `jlenv_user_install` is required to be set so that jlenv knows which version you want to use, and is installed on the system.
3936

40-
System wide installations of rbenv are supported by this cookbook, but discouraged by the rbenv maintainer, see [these][rbenv_issue_38] [two][rbenv_issue_306] issues in the rbenv repository.
37+
System wide installations of jlenv are supported by this cookbook, but discouraged by the jlenv maintainer, see [these][https://github.com/rbenv/rbenv/issues/38] [two][https://github.com/rbenv/rbenv/issues/306] issues in the rbenv repository.
4138

4239
## Gem
4340

44-
Used to install a gem into the selected rbenv environment.
41+
Used to install a package into the selected jlenv environment.
4542

46-
```ruby
47-
rbenv_gem 'gem_name' do
48-
options # Optional: Options to pass to the gem command e.g. '--no-rdoc --no-ri'
43+
```julia
44+
jlenv_package 'pkg_name' do
45+
options # Optional: Options to pass to the packagecommand e.g. '--no-rdoc --no-ri'
4946
source # Optional: source URL/location for gem.
5047
timeout # Optional: Gem install timeout
5148
version # Optional: Gem version to install
5249
response_file # Optional: response file to reconfigure a gem
53-
rbenv_version # Required: Which rbenv version to install the gem to.
54-
user # Which user to install gem to. REQUIRED if you're using rbenv_user_install
50+
jlenv_version # Required: Which jlenv version to install the packageto.
51+
user # Which user to install packageto. REQUIRED if you're using jlenv_user_install
5552
end
5653
```
5754

5855
## Global
5956

60-
Sets the global ruby version. The name of the resource is the version to set.
57+
Sets the global julia version. The name of the resource is the version to set.
6158

62-
```ruby
63-
rbenv_global '2.5.1' do
59+
```julia
60+
jlenv_global '2.5.1' do
6461
user # Optional: if passed sets the users global version. Leave unset, to set the system global version
6562
end
6663
```
6764

68-
If a user is passed in to this resource it sets the global version for the user, under the users `root_path` (usually `~/.rbenv/version`), otherwise it sets the system global version.
65+
If a user is passed in to this resource it sets the global version for the user, under the users `root_path` (usually `~/.jlenv/version`), otherwise it sets the system global version.
6966

7067
## Plugin
7168

72-
Installs a rbenv plugin.
69+
Installs a jlenv plugin.
7370

74-
```ruby
75-
rbenv_plugin 'ruby-build' do
71+
```julia
72+
jlenv_plugin 'julia-build' do
7673
git_url # Git URL of the plugin
7774
git_ref # Git reference of the plugin
78-
user # Optional: if passed installs to the users rbenv. Do not set, to set installs to the system rbenv.
75+
user # Optional: if passed installs to the users jlenv. Do not set, to set installs to the system jlenv.
7976
end
8077
```
8178

82-
If user is passed in, the plugin is installed to the users install of rbenv.
79+
If user is passed in, the plugin is installed to the users install of jlenv.
8380

8481
## Rehash
8582

86-
```ruby
87-
rbenv_rehash 'rehash' do
88-
user 'vagrant' # Optional: if passed rehashes the user Ruby otherwise rehashes the system rbenv
83+
```julia
84+
jlenv_rehash 'rehash' do
85+
user 'vagrant' # Optional: if passed rehashes the user Ruby otherwise rehashes the system jlenv
8986
end
9087
```
9188

@@ -95,22 +92,22 @@ If user is passed in, the user Ruby is rehashed rather than the system Ruby.
9592

9693
Installs a given Ruby version to the system or user location.
9794

98-
```ruby
99-
rbenv_ruby '2.5.1' do
100-
user # Optional, but recommended: If passed, the user to install rbenv to
101-
rbenv_action # Optional: the action to perform, 'install' (default), 'uninstall' etc
95+
```julia
96+
jlenv_julia '2.5.1' do
97+
user # Optional, but recommended: If passed, the user to install jlenv to
98+
jlenv_action # Optional: the action to perform, 'install' (default), 'uninstall' etc
10299
end
103100
```
104101

105-
Shorter example `rbenv_ruby '2.5.1'`
102+
Shorter example `jlenv_julia '2.5.1'`
106103

107104
## Script
108105

109-
Runs a rbenv aware script.
106+
Runs a jlenv aware script.
110107

111-
```ruby
112-
rbenv_script 'foo' do
113-
rbenv_version #rbenv version to run the script against
108+
```julia
109+
jlenv_script 'foo' do
110+
jlenv_version #jlenv version to run the script against
114111
environment # Optional: A Hash of environment variables in the form of ({"ENV_VARIABLE" => "VALUE"}).
115112
user # Optional: User to run as
116113
group # Optional: Group to run as
@@ -120,10 +117,10 @@ end
120117
```
121118
Note that environment overwrites the entire variable.
122119
For example. setting the `$PATH` variable can be done like this:
123-
```ruby
124-
rbenv_script 'bundle package' do
120+
```julia
121+
jlenv_script 'bundle package' do
125122
cwd node["bundle_dir"]
126-
environment ({"PATH" => "/usr/local/rbenv/shims:/usr/local/rbenv/bin:#{ENV["PATH"]}"})
123+
environment ({"PATH" => "/usr/local/jlenv/shims:/usr/local/jlenv/bin:#{ENV["PATH"]}"})
127124
code "bundle package --all"
128125
end
129126
```
@@ -132,10 +129,10 @@ Where `#{ENV["PATH"]}` appends the existing PATH to the end of the newly set PAT
132129

133130
## System_install
134131

135-
Installs rbenv to the system location, by default `/usr/local/rbenv`
132+
Installs jlenv to the system location, by default `/usr/local/jlenv`
136133

137-
```ruby
138-
rbenv_system_install 'foo' do
134+
```julia
135+
jlenv_system_install 'foo' do
139136
git_url # URL of the plugin repo you want to checkout
140137
git_ref # Optional: Git reference to checkout
141138
update_rbenv # Optional: Keeps the git repo up to date
@@ -144,13 +141,13 @@ end
144141

145142
## User_install
146143

147-
Installs rbenv to the user path, making rbenv available to that user only.
144+
Installs jlenv to the user path, making jlenv available to that user only.
148145

149-
```ruby
150-
rbenv_user_install 'vagrant' do
151-
git_url # Optional: Git URL to checkout rbenv from.
146+
```julia
147+
jlenv_user_install 'vagrant' do
148+
git_url # Optional: Git URL to checkout jlenv from.
152149
git_ref # Optional: Git reference to checkout e.g. 'master'
153-
user # Which user to install rbenv to (also specified in the resources name above)
150+
user # Which user to install jlenv to (also specified in the resources name above)
154151
end
155152
```
156153

libraries/helpers.rb

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#
2-
# Cookbook:: ruby_rbenv
3-
# Library:: Chef::Rbenv::ShellHelpers
2+
# Cookbook:: jlenv-cookbook
3+
# Library:: Chef::Jlenv::ShellHelpers
44
#
55
# Author:: Fletcher Nichol <[email protected]>
66
#
@@ -20,13 +20,13 @@
2020
#
2121

2222
class Chef
23-
module Rbenv
23+
module Jlenv
2424
module Helpers
2525
def wrap_shim_cmd(cmd)
26-
[%(export RBENV_ROOT="#{rbenv_root}"),
27-
%(export PATH="$RBENV_ROOT/bin:$RBENV_ROOT/shims:$PATH"),
28-
%(export RBENV_VERSION="#{new_resource.rbenv_version}"),
29-
%($RBENV_ROOT/shims/#{cmd}),
26+
[%(export JLENV_ROOT="#{jlenv_root}"),
27+
%(export PATH="$JLENV_ROOT/bin:$JLENV_ROOT/shims:$PATH"),
28+
%(export JLENV_VERSION="#{new_resource.jlenv_version}"),
29+
%($JLENV_ROOT/shims/#{cmd}),
3030
].join(' && ')
3131
end
3232

@@ -46,23 +46,23 @@ def which_rbenv
4646

4747
def binary
4848
prefix = new_resource.user ? "sudo -u #{new_resource.user} " : ''
49-
"#{prefix}#{root_path}/versions/#{new_resource.rbenv_version}/bin/gem"
49+
"#{prefix}#{root_path}/versions/#{new_resource.jlenv_version}/bin/gem"
5050
end
5151

5252
def script_code
5353
script = []
54-
script << %(export RBENV_ROOT="#{root_path}")
55-
script << %(export PATH="${RBENV_ROOT}/bin:$PATH")
56-
script << %{eval "$(rbenv init -)"}
57-
if new_resource.rbenv_version
58-
script << %(export RBENV_VERSION="#{new_resource.rbenv_version}")
54+
script << %(export JLENV_ROOT="#{root_path}")
55+
script << %(export PATH="${JLENV_ROOT}/bin:$PATH")
56+
script << %{eval "$(jlenv init -)"}
57+
if new_resource.jlenv_version
58+
script << %(export JLENV_VERSION="#{new_resource.jlenv_version}")
5959
end
6060
script << new_resource.code
6161
script.join("\n").concat("\n")
6262
end
6363

6464
def script_environment
65-
script_env = { 'RBENV_ROOT' => root_path }
65+
script_env = { 'JLENV_ROOT' => root_path }
6666

6767
script_env.merge!(new_resource.environment) if new_resource.environment
6868

@@ -93,7 +93,7 @@ def package_prerequisites
9393
end
9494
end
9595

96-
def ruby_installed?
96+
def julia_installed?
9797
if Array(new_resource.action).include?(:reinstall)
9898
return false
9999
elsif ::File.directory?(::File.join(root_path, 'versions', new_resource.version))

libraries/package_deps.rb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
11
class Chef
2-
module Rbenv
2+
module Jlenv
33
module PackageDeps
4-
def install_ruby_dependencies
4+
def install_julia_dependencies
55
case ::File.basename(new_resource.version)
6-
when /^jruby-/
7-
package jruby_package_deps
6+
when /^jjulia-/
7+
package jjulia_package_deps
88
else
99
package_deps.each do |deps|
1010
package deps
1111
end
1212
end
1313

14-
ensure_java_environment if new_resource.version =~ /^jruby-/
14+
ensure_java_environment if new_resource.version =~ /^jjulia-/
1515
end
1616

1717
def ensure_java_environment
1818
resource_collection.find(
19-
'ruby_block[update-java-alternatives]'
19+
'julia_block[update-java-alternatives]'
2020
).run_action(:create)
2121
rescue Chef::Exceptions::ResourceNotFound
2222
# have pity on my soul
2323
Chef::Log.info 'The java cookbook does not appear to in the run_list.'
2424
end
2525

26-
def jruby_package_deps
26+
def jjulia_package_deps
2727
case node['platform_family']
2828
when 'rhel', 'fedora', 'amazon'
2929
%w(make gcc-c++)

metadata.rb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
name 'ruby_rbenv'
2-
maintainer 'Sous Chefs'
3-
maintainer_email '[email protected]'
4-
issues_url 'https://github.com/sous-chefs/ruby_rbenv/issues'
5-
source_url 'https://github.com/sous-chefs/ruby_rbenv'
1+
name 'jlenv-cookbook'
2+
maintainer 'Mark Van de Vyver'
3+
maintainer_email '[email protected]'
4+
issues_url 'https://github.com/jlenv/jlenv-cookbook/issues'
5+
source_url 'https://github.com/jlenv/jlenv-cookbook'
66
license 'Apache-2.0'
7-
description 'Manages rbenv and installs Rbenv based Rubies'
7+
description 'Manages jlenv and plugins for Julia installations.'
88
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
9-
version '2.1.2'
9+
version '0.1.0'
1010
chef_version '>= 13.0'
1111

1212
supports 'ubuntu'

0 commit comments

Comments
 (0)