evm 0.3.1 → 0.3.2
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 +7 -0
- data/bin/emacs +3 -3
- data/lib/evm/builder.rb +38 -6
- data/lib/evm/cli.rb +10 -3
- data/lib/evm/command/install.rb +4 -0
- data/lib/evm/git.rb +29 -0
- data/lib/evm/package.rb +17 -5
- data/lib/evm/progress_bar.rb +37 -0
- data/lib/evm/remote_file.rb +61 -0
- data/lib/evm/tar_file.rb +7 -40
- data/lib/evm.rb +3 -0
- data/recipes/emacs-23.4-bin.rb +2 -2
- data/recipes/emacs-23.4.rb +2 -2
- data/recipes/emacs-24.1-bin.rb +2 -2
- data/recipes/emacs-24.1.rb +1 -1
- data/recipes/emacs-24.2-bin.rb +2 -2
- data/recipes/emacs-24.2.rb +1 -1
- data/recipes/emacs-24.3-bin.rb +2 -2
- data/recipes/emacs-24.3.rb +1 -1
- data/recipes/emacs-git-snapshot.rb +24 -0
- metadata +36 -28
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA512:
|
3
|
+
metadata.gz: d4a8494ee071fee5509d4692b9bb84bb8e39c6be61cb3a683d1afd5a94b8482ffa6c739c7ee3800806c32286f0058b57e0371462b0756b7cf46104b8d2515215
|
4
|
+
data.tar.gz: cac76fa89278a8dfcd185c9e58e3ed7c4feef5ad559653eea438dc8247d6c820914d108b34d797c316352f74a1157301070f1d3221edce6e98af8f174358e7cc
|
5
|
+
SHA1:
|
6
|
+
metadata.gz: 716a9ceae8fe0ae1edf1aba9f5e4a39457e280be
|
7
|
+
data.tar.gz: adf61af29e3016845aba38c72a2eeaadcd4d2627
|
data/bin/emacs
CHANGED
@@ -4,7 +4,7 @@ $: << File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib'))
|
|
4
4
|
|
5
5
|
require 'evm'
|
6
6
|
|
7
|
-
|
7
|
+
arguments = ARGV.map { |argument| "'#{argument}'" }
|
8
8
|
|
9
|
-
system = Evm::System.new(
|
10
|
-
system.run(
|
9
|
+
system = Evm::System.new(Evm::Package.current.bin.to_s)
|
10
|
+
system.run(*arguments)
|
data/lib/evm/builder.rb
CHANGED
@@ -14,10 +14,26 @@ module Evm
|
|
14
14
|
yield
|
15
15
|
end
|
16
16
|
|
17
|
-
def
|
18
|
-
|
19
|
-
|
20
|
-
|
17
|
+
def git(url)
|
18
|
+
git_repo = Evm::Git.new(build_path)
|
19
|
+
if git_repo.exist?
|
20
|
+
git_repo.pull
|
21
|
+
else
|
22
|
+
git_repo.clone(url)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def tar_gz(url)
|
27
|
+
tar_file_path = builds_path.join(@name + '.tar.gz')
|
28
|
+
|
29
|
+
remote_file = Evm::RemoteFile.new(url)
|
30
|
+
remote_file.download(tar_file_path) do |progress|
|
31
|
+
progress_bar.set(progress)
|
32
|
+
end
|
33
|
+
progress_bar.done
|
34
|
+
|
35
|
+
tar_file = Evm::TarFile.new(tar_file_path)
|
36
|
+
tar_file.extract(builds_path)
|
21
37
|
end
|
22
38
|
|
23
39
|
def osx(&block)
|
@@ -37,6 +53,10 @@ module Evm
|
|
37
53
|
yield
|
38
54
|
end
|
39
55
|
|
56
|
+
def autogen
|
57
|
+
run_command './autogen.sh'
|
58
|
+
end
|
59
|
+
|
40
60
|
def configure
|
41
61
|
run_command './configure', *@options
|
42
62
|
end
|
@@ -45,12 +65,20 @@ module Evm
|
|
45
65
|
run_command 'make', target
|
46
66
|
end
|
47
67
|
|
68
|
+
def builds_path
|
69
|
+
Evm.local.join('tmp')
|
70
|
+
end
|
71
|
+
|
48
72
|
def build_path
|
49
|
-
|
73
|
+
builds_path.join(@name)
|
74
|
+
end
|
75
|
+
|
76
|
+
def installations_path
|
77
|
+
Evm.local
|
50
78
|
end
|
51
79
|
|
52
80
|
def installation_path
|
53
|
-
|
81
|
+
installations_path.join(@name)
|
54
82
|
end
|
55
83
|
|
56
84
|
def platform_name
|
@@ -63,6 +91,10 @@ module Evm
|
|
63
91
|
|
64
92
|
private
|
65
93
|
|
94
|
+
def progress_bar
|
95
|
+
@progress_bar ||= Evm::ProgressBar.new
|
96
|
+
end
|
97
|
+
|
66
98
|
def run_command(command, *args)
|
67
99
|
Dir.chdir(build_path) do
|
68
100
|
system = Evm::System.new(command)
|
data/lib/evm/cli.rb
CHANGED
@@ -7,6 +7,10 @@ module Evm
|
|
7
7
|
options[:force] = !!argv.delete('--force')
|
8
8
|
end
|
9
9
|
|
10
|
+
if argv.include?('--use')
|
11
|
+
options[:use] = !!argv.delete('--use')
|
12
|
+
end
|
13
|
+
|
10
14
|
if argv.include?('--help') || argv.include?('-h')
|
11
15
|
Evm.print_usage_and_die
|
12
16
|
end
|
@@ -15,10 +19,13 @@ module Evm
|
|
15
19
|
|
16
20
|
begin
|
17
21
|
const = Evm::Command.const_get(command.capitalize)
|
18
|
-
|
19
|
-
rescue NameError
|
22
|
+
rescue NameError => exception
|
20
23
|
Evm.die "No such command: #{command}"
|
21
|
-
|
24
|
+
end
|
25
|
+
|
26
|
+
begin
|
27
|
+
const.new(argument, options)
|
28
|
+
rescue => exception
|
22
29
|
Evm.die exception.message
|
23
30
|
end
|
24
31
|
end
|
data/lib/evm/command/install.rb
CHANGED
data/lib/evm/git.rb
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
module Evm
|
2
|
+
class Git
|
3
|
+
def initialize(path)
|
4
|
+
@path = path
|
5
|
+
end
|
6
|
+
|
7
|
+
def exist?
|
8
|
+
@path.exist?
|
9
|
+
end
|
10
|
+
|
11
|
+
def clone(url)
|
12
|
+
git 'clone', url, @path.to_s
|
13
|
+
end
|
14
|
+
|
15
|
+
def pull
|
16
|
+
Dir.chdir(@path.to_s) do
|
17
|
+
git 'pull'
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
def git(*args)
|
25
|
+
@git ||= Evm::System.new('git')
|
26
|
+
@git.run(*args)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
data/lib/evm/package.rb
CHANGED
@@ -14,10 +14,6 @@ module Evm
|
|
14
14
|
path.exist?
|
15
15
|
end
|
16
16
|
|
17
|
-
def path
|
18
|
-
Evm.local.join(@name)
|
19
|
-
end
|
20
|
-
|
21
17
|
def bin
|
22
18
|
if Evm::Os.osx? && path.join('Emacs.app').exist?
|
23
19
|
path.join('Emacs.app', 'Contents', 'MacOS', 'Emacs')
|
@@ -33,11 +29,19 @@ module Evm
|
|
33
29
|
end
|
34
30
|
|
35
31
|
def install!
|
32
|
+
unless path.exist?
|
33
|
+
path.mkdir
|
34
|
+
end
|
35
|
+
|
36
|
+
unless tmp_path.exist?
|
37
|
+
tmp_path.mkdir
|
38
|
+
end
|
39
|
+
|
36
40
|
Evm::Builder.new(recipe).build!
|
37
41
|
end
|
38
42
|
|
39
43
|
def uninstall!
|
40
|
-
path.rmtree
|
44
|
+
path.rmtree if path.exist?
|
41
45
|
|
42
46
|
if current?
|
43
47
|
Package.current_file.delete
|
@@ -52,6 +56,14 @@ module Evm
|
|
52
56
|
Evm::Recipe.find(@name)
|
53
57
|
end
|
54
58
|
|
59
|
+
def path
|
60
|
+
Evm.local.join(@name)
|
61
|
+
end
|
62
|
+
|
63
|
+
def tmp_path
|
64
|
+
Evm.local.join('tmp')
|
65
|
+
end
|
66
|
+
|
55
67
|
class << self
|
56
68
|
def current_file
|
57
69
|
Evm.local.join('current')
|
@@ -0,0 +1,37 @@
|
|
1
|
+
module Evm
|
2
|
+
class ProgressBar
|
3
|
+
COLUMNS = 100
|
4
|
+
|
5
|
+
def initialize
|
6
|
+
@started = false
|
7
|
+
end
|
8
|
+
|
9
|
+
def set(progress)
|
10
|
+
progress = progress.to_i
|
11
|
+
|
12
|
+
if progress < 0 || progress > 100
|
13
|
+
raise "Invalid progress #{progress}, must be between 0 and 100"
|
14
|
+
end
|
15
|
+
|
16
|
+
unless @started
|
17
|
+
puts
|
18
|
+
@started = true
|
19
|
+
end
|
20
|
+
|
21
|
+
print "\e[1A"
|
22
|
+
print "\e[K"
|
23
|
+
print '['
|
24
|
+
print '-' * progress
|
25
|
+
print ' ' * (COLUMNS - progress)
|
26
|
+
print ']'
|
27
|
+
print ' '
|
28
|
+
print progress
|
29
|
+
print '%'
|
30
|
+
puts
|
31
|
+
end
|
32
|
+
|
33
|
+
def done
|
34
|
+
set 100
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
require 'uri'
|
2
|
+
require 'thread'
|
3
|
+
require 'net/http'
|
4
|
+
|
5
|
+
module Evm
|
6
|
+
class RemoteFile
|
7
|
+
def initialize(url)
|
8
|
+
@url = url
|
9
|
+
end
|
10
|
+
|
11
|
+
def download(path, &block)
|
12
|
+
return if path.exist?
|
13
|
+
|
14
|
+
file = File.open(path, 'w')
|
15
|
+
|
16
|
+
thread = Thread.new do
|
17
|
+
this = Thread.current
|
18
|
+
body = this[:body] = []
|
19
|
+
|
20
|
+
request @url do |response|
|
21
|
+
length = this[:length] = response['Content-Length'].to_i
|
22
|
+
|
23
|
+
response.read_body do |fragment|
|
24
|
+
body << fragment
|
25
|
+
|
26
|
+
this[:done] = (this[:done] || 0) + fragment.length
|
27
|
+
this[:progress] = this[:done].quo(length) * 100
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
file.write(body.join)
|
32
|
+
end
|
33
|
+
|
34
|
+
until thread.join(1)
|
35
|
+
yield thread[:progress]
|
36
|
+
end
|
37
|
+
|
38
|
+
file.close
|
39
|
+
end
|
40
|
+
|
41
|
+
private
|
42
|
+
|
43
|
+
def request(url, &block)
|
44
|
+
uri = URI.parse(url)
|
45
|
+
|
46
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
47
|
+
http.request_get(uri.path) do |response|
|
48
|
+
case response
|
49
|
+
when Net::HTTPSuccess
|
50
|
+
block.call(response)
|
51
|
+
when Net::HTTPRedirection
|
52
|
+
request response['location'] do |response|
|
53
|
+
block.call(response)
|
54
|
+
end
|
55
|
+
else
|
56
|
+
response.error!
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
data/lib/evm/tar_file.rb
CHANGED
@@ -1,51 +1,18 @@
|
|
1
|
-
require 'open-uri'
|
2
|
-
|
3
1
|
module Evm
|
4
2
|
class TarFile
|
5
|
-
def initialize(
|
6
|
-
@
|
7
|
-
end
|
8
|
-
|
9
|
-
def download!
|
10
|
-
unless tars_path.exist?
|
11
|
-
tars_path.mkdir
|
12
|
-
end
|
13
|
-
|
14
|
-
unless tar_path.exist?
|
15
|
-
File.open(tar_path, 'wb') do |write_file|
|
16
|
-
open(url, 'rb') do |read_file|
|
17
|
-
write_file.write(read_file.read)
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
3
|
+
def initialize(tar_file)
|
4
|
+
@tar_file = tar_file
|
21
5
|
end
|
22
6
|
|
23
|
-
def extract
|
24
|
-
|
25
|
-
builds_path.mkdir
|
26
|
-
end
|
27
|
-
|
28
|
-
system = Evm::System.new('tar')
|
29
|
-
system.run('-xzf', tar_path.to_s, '-C', builds_path.to_s)
|
7
|
+
def extract(extract_to)
|
8
|
+
tar '-xzf', @tar_file.to_s, '-C', extract_to.to_s
|
30
9
|
end
|
31
10
|
|
32
|
-
|
33
11
|
private
|
34
12
|
|
35
|
-
def
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
def tars_path
|
40
|
-
Evm.local.join('tars')
|
41
|
-
end
|
42
|
-
|
43
|
-
def tar_path
|
44
|
-
tars_path.join(@name)
|
45
|
-
end
|
46
|
-
|
47
|
-
def builds_path
|
48
|
-
Evm.local.join('tmp')
|
13
|
+
def tar(*args)
|
14
|
+
@tar ||= Evm::System.new('tar')
|
15
|
+
@tar.run(*args)
|
49
16
|
end
|
50
17
|
end
|
51
18
|
end
|
data/lib/evm.rb
CHANGED
data/recipes/emacs-23.4-bin.rb
CHANGED
data/recipes/emacs-23.4.rb
CHANGED
data/recipes/emacs-24.1-bin.rb
CHANGED
data/recipes/emacs-24.1.rb
CHANGED
data/recipes/emacs-24.2-bin.rb
CHANGED
data/recipes/emacs-24.2.rb
CHANGED
data/recipes/emacs-24.3-bin.rb
CHANGED
data/recipes/emacs-24.3.rb
CHANGED
@@ -0,0 +1,24 @@
|
|
1
|
+
recipe 'emacs-git-snapshot' do
|
2
|
+
git 'http://git.savannah.gnu.org/r/emacs.git'
|
3
|
+
|
4
|
+
osx do
|
5
|
+
option '--with-ns'
|
6
|
+
option '--without-x'
|
7
|
+
option '--without-dbus'
|
8
|
+
end
|
9
|
+
|
10
|
+
linux do
|
11
|
+
option '--prefix', installation_path
|
12
|
+
end
|
13
|
+
|
14
|
+
install do
|
15
|
+
autogen
|
16
|
+
configure
|
17
|
+
make 'bootstrap'
|
18
|
+
make 'install'
|
19
|
+
|
20
|
+
osx do
|
21
|
+
copy build_path.join('nextstep', 'Emacs.app'), installation_path
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
metadata
CHANGED
@@ -1,40 +1,45 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: evm
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
5
|
-
prerelease:
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.3.2
|
6
5
|
platform: ruby
|
7
|
-
authors:
|
6
|
+
authors:
|
8
7
|
- Johan Andersson
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
|
11
|
+
|
12
|
+
date: 2013-12-07 00:00:00 Z
|
13
13
|
dependencies: []
|
14
|
-
|
15
|
-
|
14
|
+
|
15
|
+
description: EVM is a command-line tool that allows you to install multiple Emacs versions.
|
16
16
|
email: johan.rejeep@gmail.com
|
17
|
-
executables:
|
17
|
+
executables:
|
18
18
|
- evm
|
19
19
|
- emacs
|
20
20
|
extensions: []
|
21
|
+
|
21
22
|
extra_rdoc_files: []
|
22
|
-
|
23
|
+
|
24
|
+
files:
|
25
|
+
- lib/evm.rb
|
23
26
|
- lib/evm/builder.rb
|
24
27
|
- lib/evm/cli.rb
|
28
|
+
- lib/evm/command.rb
|
25
29
|
- lib/evm/command/bin.rb
|
26
30
|
- lib/evm/command/install.rb
|
27
31
|
- lib/evm/command/list.rb
|
28
32
|
- lib/evm/command/uninstall.rb
|
29
33
|
- lib/evm/command/use.rb
|
30
|
-
- lib/evm/command.rb
|
31
34
|
- lib/evm/exception.rb
|
35
|
+
- lib/evm/git.rb
|
32
36
|
- lib/evm/os.rb
|
33
37
|
- lib/evm/package.rb
|
38
|
+
- lib/evm/progress_bar.rb
|
34
39
|
- lib/evm/recipe.rb
|
40
|
+
- lib/evm/remote_file.rb
|
35
41
|
- lib/evm/system.rb
|
36
42
|
- lib/evm/tar_file.rb
|
37
|
-
- lib/evm.rb
|
38
43
|
- recipes/emacs-23.4-bin.rb
|
39
44
|
- recipes/emacs-23.4.rb
|
40
45
|
- recipes/emacs-24.1-bin.rb
|
@@ -43,31 +48,34 @@ files:
|
|
43
48
|
- recipes/emacs-24.2.rb
|
44
49
|
- recipes/emacs-24.3-bin.rb
|
45
50
|
- recipes/emacs-24.3.rb
|
51
|
+
- recipes/emacs-git-snapshot.rb
|
46
52
|
- bin/evm
|
47
53
|
- bin/emacs
|
48
54
|
homepage: http://github.com/rejeep/evm
|
49
|
-
licenses:
|
55
|
+
licenses:
|
50
56
|
- MIT
|
57
|
+
metadata: {}
|
58
|
+
|
51
59
|
post_install_message:
|
52
60
|
rdoc_options: []
|
53
|
-
|
61
|
+
|
62
|
+
require_paths:
|
54
63
|
- lib
|
55
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
- !ruby/object:Gem::Version
|
60
|
-
version:
|
61
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
62
|
-
|
63
|
-
|
64
|
-
- - ! '>='
|
65
|
-
- !ruby/object:Gem::Version
|
66
|
-
version: '0'
|
64
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- &id001
|
67
|
+
- ">="
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: "0"
|
70
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- *id001
|
67
73
|
requirements: []
|
74
|
+
|
68
75
|
rubyforge_project:
|
69
|
-
rubygems_version:
|
76
|
+
rubygems_version: 2.0.14
|
70
77
|
signing_key:
|
71
|
-
specification_version:
|
78
|
+
specification_version: 4
|
72
79
|
summary: Emacs Version Manager
|
73
80
|
test_files: []
|
81
|
+
|