evm 0.3.3 → 0.3.4

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
  SHA512:
3
- data.tar.gz: 4ad3add1192b42406f85dd12af112b3d28e063b038002bcd4bf44459c81cb2fe54359e6f91417c93b958a43a62ac305af5a1f1db37411a48fe7ac39d8c6745db
4
- metadata.gz: f617730f648c069120615ef2d0bec2e8c990c30dfc2d2d3c5e76d10d8f6dc236c913a5d34d70589d4d85eb5ba467a1ec069a8bbdfec3e1f22a9a45f023a446da
3
+ metadata.gz: 5c19e7ab6e93b6890668373889e4b95f8a770ad2fb9b1fe6d46c3e397fee76b4d866a5a5c873051f40fc2630c701142f890f1a69463c801cc1c3f3d2937e1622
4
+ data.tar.gz: 70d68f0c0f4d0f8037b86b6e0f50967c48395998227a9677212ee9e697203e1ca50ef5676ece268964be38a0fc61e167441933e2efe09d8b6349bac2b72dd1d3
5
5
  SHA1:
6
- data.tar.gz: 5c51b5b35973cc9307d4787358f95a251a9b5c56
7
- metadata.gz: 8a405130221823886838ae414788cf016126c592
6
+ metadata.gz: 73e49dcdb060f4b283993c8aa3bcad6cb4c97128
7
+ data.tar.gz: 0af6f5750c6045bbd6110e54fe98f09fab4b5898
data/bin/emacs CHANGED
@@ -4,5 +4,8 @@ $: << File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib'))
4
4
 
5
5
  require 'evm'
6
6
 
7
- system = Evm::System.new(Evm::Package.current.bin.to_s)
8
- system.run(*ARGV)
7
+ if current = Evm::Package.current
8
+ exec current.bin, *ARGV
9
+ else
10
+ abort 'EVM: No Emacs selected. Select one using "evm use".'
11
+ end
data/lib/evm/builder.rb CHANGED
@@ -24,7 +24,7 @@ module Evm
24
24
  end
25
25
 
26
26
  def tar_gz(url)
27
- tar_file_path = builds_path.join(@name + '.tar.gz')
27
+ tar_file_path = File.join(builds_path, @name + '.tar.gz')
28
28
 
29
29
  remote_file = Evm::RemoteFile.new(url)
30
30
  remote_file.download(tar_file_path) do |progress|
@@ -66,19 +66,19 @@ module Evm
66
66
  end
67
67
 
68
68
  def builds_path
69
- Evm.local.join('tmp')
69
+ File.join(Evm::LOCAL_PATH, 'tmp')
70
70
  end
71
71
 
72
72
  def build_path
73
- builds_path.join(@name)
73
+ File.join(builds_path, @name)
74
74
  end
75
75
 
76
76
  def installations_path
77
- Evm.local
77
+ Evm::LOCAL_PATH
78
78
  end
79
79
 
80
80
  def installation_path
81
- installations_path.join(@name)
81
+ File.join(installations_path, @name)
82
82
  end
83
83
 
84
84
  def platform_name
@@ -98,7 +98,7 @@ module Evm
98
98
  def run_command(command, *args)
99
99
  Dir.chdir(build_path) do
100
100
  system = Evm::System.new(command)
101
- system.run(args)
101
+ system.run(*args)
102
102
  end
103
103
  end
104
104
  end
data/lib/evm/cli.rb CHANGED
@@ -12,7 +12,7 @@ module Evm
12
12
  end
13
13
 
14
14
  if argv.include?('--help') || argv.include?('-h')
15
- Evm.print_usage_and_die
15
+ Evm.print_usage_and_exit
16
16
  end
17
17
 
18
18
  command, argument = argv
@@ -20,13 +20,13 @@ module Evm
20
20
  begin
21
21
  const = Evm::Command.const_get(command.capitalize)
22
22
  rescue NameError => exception
23
- Evm.die "No such command: #{command}"
23
+ Evm.abort 'No such command:', command
24
24
  end
25
25
 
26
26
  begin
27
27
  const.new(argument, options)
28
- rescue => exception
29
- Evm.die exception.message
28
+ rescue Evm::Exception => exception
29
+ Evm.abort exception.message
30
30
  end
31
31
  end
32
32
  end
data/lib/evm/git.rb CHANGED
@@ -5,15 +5,15 @@ module Evm
5
5
  end
6
6
 
7
7
  def exist?
8
- @path.exist?
8
+ File.exist?(@path)
9
9
  end
10
10
 
11
11
  def clone(url)
12
- git 'clone', url, @path.to_s
12
+ git 'clone', url, @path
13
13
  end
14
14
 
15
15
  def pull
16
- Dir.chdir(@path.to_s) do
16
+ Dir.chdir(@path) do
17
17
  git 'pull'
18
18
  end
19
19
  end
data/lib/evm/package.rb CHANGED
@@ -11,14 +11,14 @@ module Evm
11
11
  end
12
12
 
13
13
  def installed?
14
- path.exist?
14
+ File.exist?(path)
15
15
  end
16
16
 
17
17
  def bin
18
- if Evm::Os.osx? && path.join('Emacs.app').exist?
19
- path.join('Emacs.app', 'Contents', 'MacOS', 'Emacs')
18
+ if Evm::Os.osx? && File.exist?(File.join(path, 'Emacs.app'))
19
+ File.join(path, 'Emacs.app', 'Contents', 'MacOS', 'Emacs')
20
20
  else
21
- path.join('bin', 'emacs')
21
+ File.join(path, 'bin', 'emacs')
22
22
  end
23
23
  end
24
24
 
@@ -29,22 +29,24 @@ module Evm
29
29
  end
30
30
 
31
31
  def install!
32
- unless path.exist?
33
- path.mkdir
32
+ unless File.exist?(path)
33
+ Dir.mkdir(path)
34
34
  end
35
35
 
36
- unless tmp_path.exist?
37
- tmp_path.mkdir
36
+ unless File.exist?(tmp_path)
37
+ Dir.mkdir(tmp_path)
38
38
  end
39
39
 
40
40
  Evm::Builder.new(recipe).build!
41
41
  end
42
42
 
43
43
  def uninstall!
44
- path.rmtree if path.exist?
44
+ if File.exist?(path)
45
+ FileUtils.rm_r(path)
46
+ end
45
47
 
46
48
  if current?
47
- Package.current_file.delete
49
+ File.delete(Package.current_file)
48
50
  end
49
51
  end
50
52
 
@@ -57,21 +59,21 @@ module Evm
57
59
  end
58
60
 
59
61
  def path
60
- Evm.local.join(@name)
62
+ File.join(Evm::LOCAL_PATH, @name)
61
63
  end
62
64
 
63
65
  def tmp_path
64
- Evm.local.join('tmp')
66
+ File.join(Evm::LOCAL_PATH, 'tmp')
65
67
  end
66
68
 
67
69
  class << self
68
70
  def current_file
69
- Evm.local.join('current')
71
+ File.join(Evm::LOCAL_PATH, 'current')
70
72
  end
71
73
 
72
74
  def current
73
- if current_file.exist?
74
- find(current_file.read)
75
+ if File.exist?(current_file)
76
+ find File.read(current_file)
75
77
  end
76
78
  end
77
79
 
data/lib/evm/recipe.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  module Evm
2
2
  class Recipe
3
- RECIPE_PATH = Evm.root.join('recipes')
3
+ RECIPES_PATH = File.join(Evm::ROOT_PATH, 'recipes')
4
4
 
5
5
  attr_reader :name
6
6
 
@@ -31,7 +31,7 @@ module Evm
31
31
  end
32
32
 
33
33
  def all
34
- Dir.glob(RECIPE_PATH.join('*.rb')).map do |recipe_file|
34
+ Dir.glob(File.join(RECIPES_PATH, '*.rb')).map do |recipe_file|
35
35
  Recipe.new(recipe_file)
36
36
  end
37
37
  end
@@ -9,7 +9,7 @@ module Evm
9
9
  end
10
10
 
11
11
  def download(path, &block)
12
- return if path.exist?
12
+ return if File.exist?(path)
13
13
 
14
14
  file = File.open(path, 'w')
15
15
 
data/lib/evm/system.rb CHANGED
@@ -5,7 +5,7 @@ module Evm
5
5
  end
6
6
 
7
7
  def run(*args)
8
- Kernel.exec(@executable, *args)
8
+ Kernel.system(@executable, *args)
9
9
  end
10
10
  end
11
11
  end
data/lib/evm/tar_file.rb CHANGED
@@ -5,7 +5,7 @@ module Evm
5
5
  end
6
6
 
7
7
  def extract(extract_to)
8
- tar '-xzf', @tar_file.to_s, '-C', extract_to.to_s
8
+ tar '-xzf', @tar_file, '-C', extract_to
9
9
  end
10
10
 
11
11
  private
data/lib/evm.rb CHANGED
@@ -1,25 +1,17 @@
1
- require 'pathname'
1
+ require 'fileutils'
2
2
 
3
3
  module Evm
4
- def self.root
5
- Pathname.new(__FILE__).parent.parent.expand_path
6
- end
7
-
8
- def self.local
9
- Pathname.new('/').join('usr', 'local', 'evm')
10
- end
4
+ ROOT_PATH = File.expand_path('..', File.dirname(__FILE__))
5
+ LOCAL_PATH = File.join('/', 'usr', 'local', 'evm')
11
6
 
12
- def self.die(*args)
13
- args.each do |arg|
14
- STDERR.print(arg)
15
- STDERR.puts
16
- end
7
+ def self.abort(*args)
8
+ STDERR.puts args.join(' ')
17
9
 
18
10
  exit 1
19
11
  end
20
12
 
21
- def self.print_usage_and_die
22
- die <<-EOS
13
+ def self.print_usage_and_exit
14
+ Evm.abort <<-EOS
23
15
  USAGE: evm COMMAND [OPTIONS]
24
16
 
25
17
  Emacs Version Manager
@@ -20,7 +20,7 @@ recipe 'emacs-23.4' do
20
20
  make 'install'
21
21
 
22
22
  osx do
23
- copy build_path.join('nextstep', 'Emacs.app'), installation_path
23
+ copy File.join(build_path, 'nextstep', 'Emacs.app'), installation_path
24
24
  end
25
25
  end
26
26
  end
@@ -17,7 +17,7 @@ recipe 'emacs-24.1' do
17
17
  make 'install'
18
18
 
19
19
  osx do
20
- copy build_path.join('nextstep', 'Emacs.app'), installation_path
20
+ copy File.join(build_path, 'nextstep', 'Emacs.app'), installation_path
21
21
  end
22
22
  end
23
23
  end
@@ -17,7 +17,7 @@ recipe 'emacs-24.2' do
17
17
  make 'install'
18
18
 
19
19
  osx do
20
- copy build_path.join('nextstep', 'Emacs.app'), installation_path
20
+ copy File.join(build_path, 'nextstep', 'Emacs.app'), installation_path
21
21
  end
22
22
  end
23
23
  end
@@ -17,7 +17,7 @@ recipe 'emacs-24.3' do
17
17
  make 'install'
18
18
 
19
19
  osx do
20
- copy build_path.join('nextstep', 'Emacs.app'), installation_path
20
+ copy File.join(build_path, 'nextstep', 'Emacs.app'), installation_path
21
21
  end
22
22
  end
23
23
  end
@@ -18,7 +18,7 @@ recipe 'emacs-git-snapshot' do
18
18
  make 'install'
19
19
 
20
20
  osx do
21
- copy build_path.join('nextstep', 'Emacs.app'), installation_path
21
+ copy File.join(build_path, 'nextstep', 'Emacs.app'), installation_path
22
22
  end
23
23
  end
24
24
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: evm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
4
+ version: 0.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Johan Andersson
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2013-12-07 00:00:00 Z
12
+ date: 2013-12-08 00:00:00 Z
13
13
  dependencies: []
14
14
 
15
15
  description: EVM is a command-line tool that allows you to install multiple Emacs versions.