docker-env 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/VERSION +1 -1
  3. data/bin/docker-env +18 -16
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f80475bc0268796101ce3daa47d31f65e1683f53
4
- data.tar.gz: a3e6df30b2c4c5b41aef432d7d5cda80fa8b260a
3
+ metadata.gz: 2236ba069cbf37b173d7c7bc7c9bc35edec96c61
4
+ data.tar.gz: e704b52d70738ee3fbb6aa81c77088a2a453f60d
5
5
  SHA512:
6
- metadata.gz: a9246fd45fca6f9e45b82b7a076347d8be2fb59ed30e12a06824615f77e1f01528ea9c27f9fc0aac9079dceaac4842ee8b8a8355bc15ee69574ece2d5047fb62
7
- data.tar.gz: 290642b66307a88bf883da5bbfdffe43961dc0aa89d5ce0170c2ff0e6be6f40854890f20df7ce5d3193afe05c76c12d3d9c290e31d4e6c4f6489d4166a0db44f
6
+ metadata.gz: e01e16356664b5ffbcb3ffc5a032b71ec3e5af17e43b81719c018971b7de7f1033da8e9a606d7ed0a927a662b1b073f30ff93608d7842219ae9ba2445adf3f3e
7
+ data.tar.gz: 8af770816efb333a0b3366375414bb0d81f2836ec9c833a12754a8c2c19ad62ddac66fc15d5c6f1df05372c41d2a0e41b25576b7b99d19443a6349f49812f038
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.0
1
+ 1.1.0
@@ -25,16 +25,16 @@ def current(options)
25
25
  end
26
26
 
27
27
  def running?
28
- if `ps ax` =~ %r[/[D]ocker.app]
29
- $stderr.puts "Please quit Docker.app before using this script!"
30
- exit 1
31
- end
28
+ return unless `ps ax` =~ %r[/[D]ocker.app]
29
+
30
+ $stderr.puts 'Please quit Docker.app before using this script!'
31
+ exit 1
32
32
  end
33
33
 
34
34
  desc 'setup by moving Docker.qcow2 to "image_name" and linking back'
35
35
  arg 'image_name'
36
36
  command :init do |c|
37
- c.action do |global_options,options,args|
37
+ c.action do |global_options, _options, args|
38
38
  running?
39
39
  if File.symlink?(SYMLINK)
40
40
  $stderr.puts "Already setup. Current is: #{current(global_options)}"
@@ -45,15 +45,17 @@ command :init do |c|
45
45
  File.rename(SYMLINK, file)
46
46
  File.symlink(file, SYMLINK)
47
47
 
48
- puts "Current is now: " + current(global_options)
48
+ puts 'Current is now: ' + current(global_options)
49
49
  end
50
50
  end
51
51
 
52
52
  desc 'list available qcow images (.../Docker.qcow2.{name})'
53
53
  command [:list, :ls] do |c|
54
- c.action do |global_options,options,args|
54
+ c.action do |global_options, _options, _args|
55
+ cur = current(global_options)
55
56
  puts Dir.glob("#{SYMLINK}.*").map { |f|
56
- f.split('.').last
57
+ img = f.split('.').last
58
+ sprintf '%-2s%s', img == cur ? '*' : '', img
57
59
  }
58
60
  end
59
61
  end
@@ -71,7 +73,7 @@ Removes current link so that the next time docker starts, it will create a
71
73
  create the symlink
72
74
  EOF
73
75
  command :new do |c|
74
- c.action do |global_options,options,args|
76
+ c.action do |_global_options, _options, _args|
75
77
  running?
76
78
  if File.exist?(SYMLINK) || !File.symlink?(SYMLINK)
77
79
  $stderr.puts "Please use '--force' to force delete current image!"
@@ -80,16 +82,16 @@ command :new do |c|
80
82
 
81
83
  begin
82
84
  File.unlink(SYMLINK)
83
- rescue Errno::ENOENT
85
+ rescue Errno::ENOENT # rubocop:disable Lint/HandleExceptions
84
86
  end
85
- help(["new"])
87
+ help(['new'])
86
88
  end
87
89
  end
88
90
 
89
91
  desc 'Delete "image"'
90
92
  arg 'image'
91
93
  command :rm do |c|
92
- c.action do |global_options,options,args|
94
+ c.action do |_global_options, _options, args|
93
95
  file = "#{SYMLINK}.#{args[0]}"
94
96
  unless File.exist?(file)
95
97
  $stderr.puts "Image #{args[0]} doesnt exist!"
@@ -107,14 +109,14 @@ end
107
109
  desc 'Link to "image"'
108
110
  arg 'image'
109
111
  command :use do |c|
110
- c.action do |global_options,options,args|
112
+ c.action do |_global_options, _options, args|
111
113
  running?
112
114
  file = "#{SYMLINK}.#{args[0]}"
113
115
  File.exist?(file) or raise "Image #{file} does not exist"
114
116
 
115
117
  begin
116
118
  File.unlink(SYMLINK)
117
- rescue Errno::ENOENT
119
+ rescue Errno::ENOENT # rubocop:disable Lint/HandleExceptions
118
120
  end
119
121
  File.symlink(file, SYMLINK)
120
122
  end
@@ -122,12 +124,12 @@ end
122
124
 
123
125
  desc 'Show current image'
124
126
  command :current do |c|
125
- c.action do |global_options,options,args|
127
+ c.action do |global_options, _options, args|
126
128
  puts current(global_options)
127
129
  end
128
130
  end
129
131
 
130
- on_error do |exception|
132
+ on_error do |_exception|
131
133
  true
132
134
  end
133
135
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: docker-env
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rick Frankel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-12-24 00:00:00.000000000 Z
11
+ date: 2016-12-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake