evm 0.6.1 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +278 -0
- data/bin/evm +12 -0
- data/lib/evm.rb +7 -28
- data/lib/evm/builder.rb +18 -17
- data/lib/evm/cli.rb +43 -18
- data/lib/evm/command.rb +2 -1
- data/lib/evm/command/bin.rb +2 -2
- data/lib/evm/command/config.rb +19 -0
- data/lib/evm/command/disuse.rb +15 -0
- data/lib/evm/command/install.rb +3 -1
- data/lib/evm/command/list.rb +1 -1
- data/lib/evm/command/uninstall.rb +3 -1
- data/lib/evm/command/use.rb +3 -1
- data/lib/evm/config.rb +43 -0
- data/lib/evm/git.rb +1 -1
- data/lib/evm/package.rb +26 -11
- data/lib/evm/remote_file.rb +9 -55
- data/lib/evm/tar_file.rb +1 -1
- data/spec/evm/builder_spec.rb +209 -0
- data/spec/evm/cli_spec.rb +53 -0
- data/spec/evm/command/bin_spec.rb +32 -0
- data/spec/evm/command/config_spec.rb +34 -0
- data/spec/evm/command/disuse_spec.rb +19 -0
- data/spec/evm/command/install_spec.rb +103 -0
- data/spec/evm/command/list_spec.rb +36 -0
- data/spec/evm/command/uninstall_spec.rb +35 -0
- data/spec/evm/command/use_spec.rb +32 -0
- data/spec/evm/config_spec.rb +36 -0
- data/spec/evm/evm_spec.rb +11 -0
- data/spec/evm/git_spec.rb +39 -0
- data/spec/evm/os_spec.rb +47 -0
- data/spec/evm/package_spec.rb +274 -0
- data/spec/evm/recipe_spec.rb +47 -0
- data/spec/evm/remote_file_spec.rb +47 -0
- data/spec/evm/system_spec.rb +36 -0
- data/spec/evm/tar_file_spec.rb +21 -0
- data/spec/spec_helper.rb +13 -0
- metadata +29 -17
- data/lib/evm/exception.rb +0 -4
- data/lib/evm/progress_bar.rb +0 -37
- data/recipes/emacs-23.4-bin.rb +0 -7
- data/recipes/emacs-23.4.rb +0 -27
- data/recipes/emacs-24.1-bin.rb +0 -7
- data/recipes/emacs-24.1.rb +0 -24
- data/recipes/emacs-24.2-bin.rb +0 -7
- data/recipes/emacs-24.2.rb +0 -24
- data/recipes/emacs-24.3-bin.rb +0 -7
- data/recipes/emacs-24.3.rb +0 -24
- data/recipes/emacs-24.4-bin.rb +0 -7
- data/recipes/emacs-24.4.rb +0 -24
- data/recipes/emacs-git-snapshot.rb +0 -25
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c5392493424325795161d08251f378a299d56cc3
|
4
|
+
data.tar.gz: f604f55213ea59e47e5b22922a084ad60ae65566
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f0c77cbc74d367fddd3fc4e177090321633962f66312019f4ca3c7aba3c27234cbdcfb22b9113cbed735ba3973fac1621245e5933e5d2c2b4f617a332dd42c9d
|
7
|
+
data.tar.gz: 324f07d326f8326d907173dd48d229168c93d034133099f0514bc650e75ac49a2afa4f301f78dd6f2e92dfb7fb3ff6fbd92874443449c5d19ddc94eca097f598
|
data/README.md
ADDED
@@ -0,0 +1,278 @@
|
|
1
|
+
# Emacs Version Manager
|
2
|
+
|
3
|
+
## Deprecation Warning!
|
4
|
+
|
5
|
+
As Travis is moving towards a container-based infrastructure, hence
|
6
|
+
sudo is not possible, EVM added support for Travis specific binaries
|
7
|
+
(ends with `-travis`), which will be installed in `/tmp`.
|
8
|
+
|
9
|
+
All `-bin` versions will are deprecated and will be removed. Do not use them!
|
10
|
+
|
11
|
+
To run EVM on Travis, set the EVM path to `/tmp`:
|
12
|
+
|
13
|
+
```bash
|
14
|
+
$ evm config path /tmp
|
15
|
+
```
|
16
|
+
|
17
|
+
See https://gist.github.com/rejeep/ebcd57c3af83b049833b for more
|
18
|
+
information on how to use EVM on Travis.
|
19
|
+
|
20
|
+
## Why EVM?
|
21
|
+
|
22
|
+
* Did you ever wonder how to install Emacs? Homebrew, apt-get, Emacs
|
23
|
+
for OSX, Compile from scratch, etc...
|
24
|
+
|
25
|
+
* Are you currently maintaining an Emacs package? How do you know it
|
26
|
+
works? Because you have tests of course. Ok, so you know it works on
|
27
|
+
your platform and with your Emacs version. But what about all other
|
28
|
+
versions that people are using? Does your package work for them?
|
29
|
+
|
30
|
+
* EVM provides pre compiled binaries to allow for quick installation
|
31
|
+
on CI systems.
|
32
|
+
|
33
|
+
## Platform Support
|
34
|
+
|
35
|
+
### OSX
|
36
|
+
|
37
|
+
Supported!
|
38
|
+
|
39
|
+
### GNU/Linux
|
40
|
+
|
41
|
+
Supported!
|
42
|
+
|
43
|
+
### Windows
|
44
|
+
|
45
|
+
Not supported. Need help from someone running Windows.
|
46
|
+
|
47
|
+
## Installation
|
48
|
+
|
49
|
+
Default installation directory for EVM Emacs versions is
|
50
|
+
`/usr/local/evm`. This can be changed with the `config` command:
|
51
|
+
|
52
|
+
```sh
|
53
|
+
$ evm config path /foo/bar
|
54
|
+
```
|
55
|
+
|
56
|
+
No matter what installation approach you choose, create the
|
57
|
+
installation directory and give your user access rights, for example:
|
58
|
+
|
59
|
+
```sh
|
60
|
+
$ sudo mkdir /usr/local/evm
|
61
|
+
$ sudo chown $USER: /usr/local/evm
|
62
|
+
```
|
63
|
+
|
64
|
+
### Automatic
|
65
|
+
|
66
|
+
```sh
|
67
|
+
$ curl -fsSkL https://raw.github.com/rejeep/evm/master/go | bash
|
68
|
+
```
|
69
|
+
|
70
|
+
Add EVM's `bin` directory to your `PATH`.
|
71
|
+
|
72
|
+
```sh
|
73
|
+
$ export PATH="$HOME/.evm/bin:$PATH"
|
74
|
+
```
|
75
|
+
|
76
|
+
### Homebrew
|
77
|
+
|
78
|
+
_NOT ADDED YET_
|
79
|
+
|
80
|
+
```sh
|
81
|
+
$ brew install evm
|
82
|
+
```
|
83
|
+
|
84
|
+
### Ruby gem
|
85
|
+
|
86
|
+
```sh
|
87
|
+
$ gem install evm
|
88
|
+
```
|
89
|
+
|
90
|
+
### Manual
|
91
|
+
|
92
|
+
```sh
|
93
|
+
$ git clone https://github.com/rejeep/evm.git ~/.evm
|
94
|
+
```
|
95
|
+
|
96
|
+
Add EVM's `bin` directory to your `PATH`.
|
97
|
+
|
98
|
+
```sh
|
99
|
+
$ export PATH="$HOME/.evm/bin:$PATH"
|
100
|
+
```
|
101
|
+
|
102
|
+
## Usage
|
103
|
+
|
104
|
+
In the Evm `bin` directory, there are a few commands:
|
105
|
+
|
106
|
+
* `evm` - Manage Emacs packages
|
107
|
+
* `emacs/evm-emacs` - Emacs shim with currently selected Emacs package
|
108
|
+
|
109
|
+
### list
|
110
|
+
|
111
|
+
To list all available Emacs versions you can install, run:
|
112
|
+
|
113
|
+
```sh
|
114
|
+
$ evm list
|
115
|
+
```
|
116
|
+
|
117
|
+
The output will look something like this:
|
118
|
+
|
119
|
+
```
|
120
|
+
emacs-23.4
|
121
|
+
emacs-24.1 [I]
|
122
|
+
emacs-24.2
|
123
|
+
* emacs-24.3 [I]
|
124
|
+
emacs-24.3-travis [I]
|
125
|
+
...
|
126
|
+
```
|
127
|
+
|
128
|
+
The `[I]` shows what versions are currently installed and the `*`
|
129
|
+
shows what version is currently selected.
|
130
|
+
|
131
|
+
### install <name>
|
132
|
+
|
133
|
+
To install a version, run:
|
134
|
+
|
135
|
+
```sh
|
136
|
+
$ evm install version
|
137
|
+
```
|
138
|
+
|
139
|
+
Example:
|
140
|
+
|
141
|
+
```sh
|
142
|
+
$ evm install emacs-24.3
|
143
|
+
```
|
144
|
+
|
145
|
+
### use <name>
|
146
|
+
|
147
|
+
To start using a specific package, run:
|
148
|
+
|
149
|
+
```sh
|
150
|
+
$ evm use name
|
151
|
+
```
|
152
|
+
|
153
|
+
Example:
|
154
|
+
|
155
|
+
```sh
|
156
|
+
$ evm use emacs-24.2
|
157
|
+
```
|
158
|
+
|
159
|
+
The Evm binary will update and use that Emacs package.
|
160
|
+
|
161
|
+
### disuse
|
162
|
+
|
163
|
+
To stop using an EVM binary and restore your personal or system defaults:
|
164
|
+
|
165
|
+
```sh
|
166
|
+
$ evm disuse
|
167
|
+
```
|
168
|
+
|
169
|
+
### uninstall <name>
|
170
|
+
|
171
|
+
To uninstall a version, run:
|
172
|
+
|
173
|
+
```sh
|
174
|
+
$ evm uninstall emacs-24.2
|
175
|
+
```
|
176
|
+
|
177
|
+
### bin [name]
|
178
|
+
|
179
|
+
Prints the full path to `name`'s Emacs executable. If no name is
|
180
|
+
specified, use currently selected.
|
181
|
+
|
182
|
+
```sh
|
183
|
+
$ evm bin # /usr/local/evm/emacs-24.5/Emacs.app/Contents/MacOS/Emacs
|
184
|
+
$ evm bin emacs-24.2 # /usr/local/evm/emacs-24.2/Emacs.app/Contents/MacOS/Emacs
|
185
|
+
```
|
186
|
+
|
187
|
+
### help
|
188
|
+
|
189
|
+
For more information, run:
|
190
|
+
|
191
|
+
```sh
|
192
|
+
$ evm --help
|
193
|
+
```
|
194
|
+
|
195
|
+
## Contribution
|
196
|
+
|
197
|
+
Be sure to!
|
198
|
+
|
199
|
+
Implement the features and don't forget to test it. Run the tests
|
200
|
+
with:
|
201
|
+
|
202
|
+
```sh
|
203
|
+
$ rspec spec
|
204
|
+
```
|
205
|
+
|
206
|
+
If all passes, send us a
|
207
|
+
[pull request](https://github.com/rejeep/evm/pulls) with the changes.
|
208
|
+
|
209
|
+
### Adding a new Emacs version
|
210
|
+
|
211
|
+
Copy an existing recipe in the [recipes](/recipes) directory and make
|
212
|
+
modifications for the new version. Also add the new version to the
|
213
|
+
[Travis configuration](/.travis.yml).
|
214
|
+
|
215
|
+
### Adding Travis binary
|
216
|
+
|
217
|
+
If you want to contribute a Travis binary, these instructions will help.
|
218
|
+
|
219
|
+
* Install [Vagrant](https://www.vagrantup.com/)
|
220
|
+
|
221
|
+
* Install Vagrant SCP (https://github.com/invernizzi/vagrant-scp)
|
222
|
+
|
223
|
+
* Clone https://github.com/travis-ci/travis-cookbooks
|
224
|
+
|
225
|
+
* Enter `travis-cookbooks` and run `vagrant init hashicorp/precise64` then `vagrant up`
|
226
|
+
|
227
|
+
* SSH into the VM: `$ vagrant ssh ID`
|
228
|
+
|
229
|
+
* Install necessary tools
|
230
|
+
|
231
|
+
```bash
|
232
|
+
$ sudo apt-get install build-essential
|
233
|
+
$ sudo apt-get install libncurses-dev
|
234
|
+
$ sudo apt-get install autoconf
|
235
|
+
$ sudo apt-get install automake
|
236
|
+
$ sudo apt-get install autogen
|
237
|
+
$ sudo apt-get install git
|
238
|
+
$ sudo apt-get install texinfo
|
239
|
+
$ sudo apt-get install libtool
|
240
|
+
```
|
241
|
+
|
242
|
+
* Download Emacs source
|
243
|
+
|
244
|
+
```bash
|
245
|
+
$ wget http://ftpmirror.gnu.org/emacs/emacs-MAJOR.MINOR.tar.gz
|
246
|
+
```
|
247
|
+
|
248
|
+
* Unzip it
|
249
|
+
|
250
|
+
```bash
|
251
|
+
$ tar -xvzf emacs-MAJOR-MINOR.tar.gz
|
252
|
+
```
|
253
|
+
|
254
|
+
* Compile and Install Emacs
|
255
|
+
|
256
|
+
```bash
|
257
|
+
$ ./autogen.sh # for snapshot
|
258
|
+
$ ./configure --without-all --prefix=/tmp/emacs-MAJOR.MINOR-travis
|
259
|
+
$ make bootstrap
|
260
|
+
$ make install
|
261
|
+
```
|
262
|
+
|
263
|
+
* Tar it
|
264
|
+
|
265
|
+
```bash
|
266
|
+
$ cd /tmp
|
267
|
+
$ tar -cvzf emacs-MAJOR.MINOR-travis.tar.gz emacs-MAJOR.MINOR-travis
|
268
|
+
```
|
269
|
+
|
270
|
+
* Copy from VM
|
271
|
+
|
272
|
+
```bash
|
273
|
+
$ vagrant scp ID:/tmp/emacs-MAJOR.MINOR-travis.tar.gz .
|
274
|
+
```
|
275
|
+
|
276
|
+
* Create a new recipe and make a pull request.
|
277
|
+
|
278
|
+
* Ask maintainer to add a new release and add the binary.
|
data/bin/evm
ADDED
data/lib/evm.rb
CHANGED
@@ -1,37 +1,17 @@
|
|
1
1
|
require 'fileutils'
|
2
2
|
|
3
3
|
module Evm
|
4
|
+
class Exception < StandardError; end
|
5
|
+
|
4
6
|
ROOT_PATH = File.expand_path('..', File.dirname(__FILE__))
|
5
7
|
LOCAL_PATH = File.join('/', 'usr', 'local', 'evm')
|
6
8
|
EMACS_PATH = File.join(ROOT_PATH, 'bin', 'emacs')
|
7
9
|
EVM_EMACS_PATH = File.join(ROOT_PATH, 'bin', 'evm-emacs')
|
10
|
+
CONFIG_FILE = File.join(ROOT_PATH, '.config')
|
11
|
+
CONFIG_TYPES = [:path]
|
8
12
|
|
9
|
-
def self.
|
10
|
-
|
11
|
-
|
12
|
-
exit 1
|
13
|
-
end
|
14
|
-
|
15
|
-
def self.print_usage_and_exit
|
16
|
-
Evm.abort <<-EOS
|
17
|
-
USAGE: evm COMMAND [OPTIONS]
|
18
|
-
|
19
|
-
Emacs Version Manager
|
20
|
-
|
21
|
-
COMMANDS:
|
22
|
-
install <name> Install package name
|
23
|
-
uninstall <name> Uninstall package name
|
24
|
-
bin [name] Show path to Emacs binary for package name
|
25
|
-
list List all available packages
|
26
|
-
use <name> Select name as current package
|
27
|
-
help Display this help message
|
28
|
-
|
29
|
-
OPTIONS:
|
30
|
-
--force Force install even when already installed
|
31
|
-
--use Select as current package after installing
|
32
|
-
--skip Ignore if already installed
|
33
|
-
--help, -h Display this help message
|
34
|
-
EOS
|
13
|
+
def self.config
|
14
|
+
Evm::Config.new(CONFIG_FILE, path: LOCAL_PATH)
|
35
15
|
end
|
36
16
|
end
|
37
17
|
|
@@ -40,10 +20,9 @@ require 'evm/cli'
|
|
40
20
|
require 'evm/recipe'
|
41
21
|
require 'evm/package'
|
42
22
|
require 'evm/command'
|
43
|
-
require 'evm/exception'
|
44
23
|
require 'evm/builder'
|
45
24
|
require 'evm/tar_file'
|
46
25
|
require 'evm/remote_file'
|
47
26
|
require 'evm/system'
|
48
|
-
require 'evm/progress_bar'
|
49
27
|
require 'evm/git'
|
28
|
+
require 'evm/config'
|
data/lib/evm/builder.rb
CHANGED
@@ -23,19 +23,12 @@ module Evm
|
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
26
|
-
def
|
27
|
-
|
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
|
-
FileUtils.mkdir(build_path)
|
26
|
+
def tar_xz(url)
|
27
|
+
tar_packaged(url, 'xz')
|
28
|
+
end
|
36
29
|
|
37
|
-
|
38
|
-
|
30
|
+
def tar_gz(url)
|
31
|
+
tar_packaged(url, 'gz')
|
39
32
|
end
|
40
33
|
|
41
34
|
def osx(&block)
|
@@ -68,7 +61,7 @@ module Evm
|
|
68
61
|
end
|
69
62
|
|
70
63
|
def builds_path
|
71
|
-
File.join(Evm
|
64
|
+
File.join(Evm.config[:path], 'tmp')
|
72
65
|
end
|
73
66
|
|
74
67
|
def build_path
|
@@ -76,7 +69,7 @@ module Evm
|
|
76
69
|
end
|
77
70
|
|
78
71
|
def installations_path
|
79
|
-
Evm
|
72
|
+
Evm.config[:path]
|
80
73
|
end
|
81
74
|
|
82
75
|
def installation_path
|
@@ -88,13 +81,21 @@ module Evm
|
|
88
81
|
end
|
89
82
|
|
90
83
|
def copy(from, to)
|
91
|
-
|
84
|
+
run_command "cp -a #{from} #{to}"
|
92
85
|
end
|
93
86
|
|
94
87
|
private
|
95
88
|
|
96
|
-
def
|
97
|
-
@
|
89
|
+
def tar_packaged(url,extension)
|
90
|
+
tar_file_path = File.join(builds_path, @name + '.tar.' + extension)
|
91
|
+
|
92
|
+
remote_file = Evm::RemoteFile.new(url)
|
93
|
+
remote_file.download(tar_file_path)
|
94
|
+
|
95
|
+
FileUtils.mkdir(build_path)
|
96
|
+
|
97
|
+
tar_file = Evm::TarFile.new(tar_file_path)
|
98
|
+
tar_file.extract(builds_path, @name)
|
98
99
|
end
|
99
100
|
|
100
101
|
def run_command(command, *args)
|
data/lib/evm/cli.rb
CHANGED
@@ -1,37 +1,62 @@
|
|
1
|
+
require 'optparse'
|
2
|
+
|
1
3
|
module Evm
|
2
4
|
module Cli
|
3
5
|
def self.parse(argv)
|
4
6
|
options = {}
|
5
7
|
|
6
|
-
|
7
|
-
|
8
|
-
end
|
8
|
+
optparse = OptionParser.new do |opts|
|
9
|
+
opts.banner += ' command'
|
9
10
|
|
10
|
-
|
11
|
-
|
12
|
-
|
11
|
+
opts.separator ''
|
12
|
+
opts.separator 'Emacs Version Manager.'
|
13
|
+
opts.separator ''
|
14
|
+
opts.separator 'Commands:'
|
15
|
+
opts.separator ' install Install package name'
|
16
|
+
opts.separator ' uninstall Uninstall package name'
|
17
|
+
opts.separator ' bin [name] Show path to Emacs binary for package name'
|
18
|
+
opts.separator ' list List all available packages'
|
19
|
+
opts.separator ' use <name> Select name as current package'
|
20
|
+
opts.separator ' disuse Stop using the current package (remove binary from path but leave installed)'
|
21
|
+
opts.separator ' config <var> <value> Set the value of a configuration variable (like path)'
|
22
|
+
opts.separator ' help Display this help message'
|
23
|
+
opts.separator ''
|
24
|
+
opts.separator 'Options:'
|
25
|
+
|
26
|
+
opts.on('--force', 'Force install even when already installed') do
|
27
|
+
options[:force] = true
|
28
|
+
end
|
29
|
+
|
30
|
+
opts.on('--skip', 'Ignore if already installed') do
|
31
|
+
options[:skip] = true
|
32
|
+
end
|
13
33
|
|
14
|
-
|
15
|
-
|
34
|
+
opts.on('--use', 'Select as current package after installing') do
|
35
|
+
options[:use] = true
|
36
|
+
end
|
37
|
+
|
38
|
+
opts.on_tail('--help', '-h', 'Display this help message') do
|
39
|
+
puts opts
|
40
|
+
exit
|
41
|
+
end
|
16
42
|
end
|
17
43
|
|
18
|
-
|
44
|
+
optparse.parse!(argv)
|
45
|
+
|
46
|
+
command = argv.shift
|
19
47
|
|
20
|
-
if
|
21
|
-
|
48
|
+
if command == 'help' || !command
|
49
|
+
puts optparse
|
50
|
+
exit
|
22
51
|
end
|
23
52
|
|
24
53
|
begin
|
25
54
|
const = Evm::Command.const_get(command.capitalize)
|
26
|
-
rescue NameError
|
27
|
-
Evm
|
55
|
+
rescue NameError
|
56
|
+
raise Evm::Exception, "No such command: #{command}"
|
28
57
|
end
|
29
58
|
|
30
|
-
|
31
|
-
const.new(argument, options)
|
32
|
-
rescue Evm::Exception => exception
|
33
|
-
Evm.abort exception.message
|
34
|
-
end
|
59
|
+
const.new(argv, options)
|
35
60
|
end
|
36
61
|
end
|
37
62
|
end
|