itamae-plugin-recipe-minecraft 0.0.4 → 0.0.5

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
2
  SHA1:
3
- metadata.gz: 23072ea0dcb673908d1cdd8eb2aa99621408985b
4
- data.tar.gz: 103549f882e66d92fb5e003b828a2eda0aa1cd1e
3
+ metadata.gz: 9fe29c7f414eaf2863a9d342a181fc40ce79b402
4
+ data.tar.gz: 833e1bdd7ad907cc80c5b357dd1bf33ea7b96a81
5
5
  SHA512:
6
- metadata.gz: a51ae1226a5ba34c8f5c78f10ef2872c39bd84a2db71e73de91d04ae7d0a33019f00b660e4b205ccb24462e24dbe4cae9e822dcaac381a4db4ced1a81c7548e1
7
- data.tar.gz: 40ca32e14079cf20cfa9505ac83572d357393a461760d438715748e47aee08d719d7e349e416947219fbe6f0d63bf99efede908c7db4a0149ec26170a3a778fd
6
+ metadata.gz: 6176673f2b2ead945143e8008198078624264ad14fd71ee8252e20e980ae35d38bce646fecd94a0289131a716b09d71e693193f6f7ffd530d81f75bac2776eed
7
+ data.tar.gz: 8b92919760d257b0d2bf52621bfa8e1a64ebf0f11d609415d9764ec42524618fb6ed6c4aad143fb90b0bf6819dba949b660b10a4029ff7576c837fe330722dea
@@ -1,3 +1,16 @@
1
+ require 'json'
2
+ require 'open-uri'
3
+
4
+ minecraft_versions_url = 'http://s3.amazonaws.com/Minecraft.Download/versions/versions.json'
5
+ minecraft_version = node[:minecraft][:version] || JSON.parse(open(minecraft_versions_url).read)['latest']['release']
6
+
7
+ minecraft_dir = "/opt/minecraft/.minecraft/versions/#{minecraft_version}"
8
+ minecraft_client_url = "https://s3.amazonaws.com/Minecraft.Download/versions/#{minecraft_version}/#{minecraft_version}.jar"
9
+ filename = File.basename(minecraft_client_url)
10
+ minecraft_path = "#{minecraft_dir}/#{filename}"
11
+
12
+ minecraft_user = node[:minecraft][:user] || 'minecraft'
13
+
1
14
  execute 'add overviewer to apt sources.list' do
2
15
  command 'echo "deb http://overviewer.org/debian ./" >> /etc/apt/sources.list'
3
16
  not_if 'cat /etc/apt/sources.list | grep http://overviewer.org/debian'
@@ -13,3 +26,13 @@ execute 'apt-get update' do
13
26
  end
14
27
 
15
28
  package 'minecraft-overviewer'
29
+
30
+ directory "/opt/minecraft/.minecraft/versions/#{node[:minecraft][:version]}" do
31
+ owner minecraft_user
32
+ group minecraft_user
33
+ end
34
+
35
+ execute 'download minecraft client' do
36
+ command "wget #{minecraft_client_url} -O #{minecraft_path}"
37
+ not_if "test -f #{minecraft_path}"
38
+ end
@@ -2,7 +2,7 @@ module Itamae
2
2
  module Plugin
3
3
  module Recipe
4
4
  module Minecraft
5
- VERSION = "0.0.4"
5
+ VERSION = "0.0.5"
6
6
  end
7
7
  end
8
8
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: itamae-plugin-recipe-minecraft
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Seiei Higa