vagrant-layout 0.0.4 → 0.0.5

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 74e1776f2d37300f362631aa10c18abbcca88a44
4
- data.tar.gz: a21a58fa879fba940359b3b89eef9bb86637b40c
3
+ metadata.gz: 2852387e8df22703fd65a71dc3194a8c817bf1af
4
+ data.tar.gz: dee5f017bee57fb699658e33d978da3181ee88c0
5
5
  SHA512:
6
- metadata.gz: 5e7d8ad1dbcfdc927f9498043db535f615aa16f2052e118cd5b83f0e3f84e1b656b1872610ff877ac77bfbf22ffac98c8f47e1547d868bad9a472fc47345cd68
7
- data.tar.gz: db584ca1921540abb5b89e032b97aabea18d52c5310b9b2f8daaec9ed70fd11b875f27ede877578d43adfc8aa029d8e0ee951a1b9ba02947a00a3e7a14456715
6
+ metadata.gz: f8c1d1c4e3b4166cab1750a7b36cc967922c076efe2d456e1c89f73e11d0e51aaacbd270d6a2b5280339f7e50282500008602b346d4ccda487651423fe91a35b
7
+ data.tar.gz: f2e9020c888f981a26b7b0ba62d3da7cec27d25d33f2a0c23feabd3daa1e9c9295f284b1360899e89bbdb7a6eda138469ed8b95c84cef4e199177b16ecc68d6d
@@ -39,7 +39,8 @@ module VagrantPlugins
39
39
  end
40
40
 
41
41
  puts @opts.help unless result == 0
42
- return result
42
+
43
+ result
43
44
  end
44
45
  end
45
46
  end
@@ -6,8 +6,7 @@ module VagrantPlugins
6
6
  # init command
7
7
  #
8
8
  class CommandInit
9
-
10
- DEFAULT_REPOSITORY = ['koseki', 'vagrant-layout', 'master']
9
+ DEFAULT_REPOSITORY = %w{koseki vagrant-layout master}
11
10
 
12
11
  def initialize(argv)
13
12
  @argv = argv
@@ -26,9 +25,7 @@ module VagrantPlugins
26
25
  end
27
26
 
28
27
  def parse_target(target)
29
- unless target
30
- return github_target(DEFAULT_REPOSITORY)
31
- end
28
+ return github_target(DEFAULT_REPOSITORY) unless target
32
29
 
33
30
  if target =~ %r{\A(https://gist\.github\.com/[^/]+/[0-9a-f]+)(/(download)?)?}
34
31
  url = Regexp.last_match[1]
@@ -41,7 +38,7 @@ module VagrantPlugins
41
38
  url += path
42
39
  end
43
40
 
44
- return [:gist, url]
41
+ [:gist, url]
45
42
  end
46
43
 
47
44
  target = target.split('/')
@@ -53,12 +50,12 @@ module VagrantPlugins
53
50
  target = target[0..3]
54
51
  end
55
52
 
56
- return github_target(target)
53
+ github_target(target)
57
54
  end
58
55
 
59
56
  def github_target(target)
60
57
  url = "https://github.com/#{ target[0] }/#{ target[1] }/archive/#{ target[2] }.tar.gz"
61
- return [:github, url]
58
+ [:github, url]
62
59
  end
63
60
 
64
61
  def download_layout(root, target)
@@ -114,7 +111,7 @@ module VagrantPlugins
114
111
  else
115
112
  msg = 'Illegal base url. Base URL must be like '
116
113
  msg += 'https://github.com/{user}/{repos}/tree/[0-9a-f]{40}'
117
- raise Exception.new(msg)
114
+ fail msg
118
115
  end
119
116
  end
120
117
  end
@@ -129,13 +126,17 @@ module VagrantPlugins
129
126
 
130
127
  def copy_gist_files(gist_dir, github_dir)
131
128
  Dir.chdir(gist_dir) do
132
- Dir.glob('*').each do |file|
133
- if file == 'patch'
134
- apply_patch(File.join(gist_dir, 'patch'), github_dir)
135
- next
136
- end
137
- dest_file = File.join(github_dir, file.gsub('__', '/'))
138
- FileUtils.copy_entry(File.join(gist_dir, file), dest_file)
129
+ files = Dir.glob('*')
130
+ if files.include?('patch')
131
+ apply_patch(File.join(gist_dir, 'patch'), github_dir)
132
+ files.delete('patch')
133
+ end
134
+ files.each do |file|
135
+ dest_path = file.gsub('__', '/').gsub('//', '/')
136
+ next if dest_path =~ /\.\.|\r|\n/
137
+ dest_file = File.join(github_dir, dest_path)
138
+ FileUtils.mkdir_p(File.dirname(dest_file))
139
+ FileUtils.cp(File.join(gist_dir, file), dest_file, preserve: true)
139
140
  end
140
141
  end
141
142
  end
@@ -3,6 +3,6 @@ module VagrantPlugins
3
3
  # Vagrant Layout Plugin
4
4
  #
5
5
  module Layout
6
- VERSION = '0.0.4'
6
+ VERSION = '0.0.5'
7
7
  end
8
8
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-layout
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
  - KOSEKI Kengo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-13 00:00:00.000000000 Z
11
+ date: 2014-12-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler