fig 0.1.31 → 0.1.32
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +18 -10
- data/lib/fig/os.rb +11 -5
- data/lib/fig/repository.rb +1 -0
- metadata +4 -4
data/README.md
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
Description
|
2
2
|
===========
|
3
3
|
|
4
|
-
Fig is a utility for configuring environments and managing dependencies across a team of developers.
|
4
|
+
Fig is a utility for configuring environments and managing dependencies across a team of developers. Fig takes a list of packages and a shell command to run, creates an environment that includes those packages, then executes the shell command in that environment. The caller's environment is not affected.
|
5
5
|
|
6
6
|
An "environment" in fig is just a set of environment variables. A "package" is a collection of files, plus some metadata describing what environment variables should be modified when the package is included.
|
7
7
|
|
8
|
-
Developers can use package files to specify the list of dependencies to use for different tasks. This file will typically be versioned along with the rest of the source files
|
8
|
+
Developers can use package files to specify the list of dependencies to use for different tasks. This file will typically be versioned along with the rest of the source files, ensuring that all developers on a team are using the same environemnts.
|
9
9
|
|
10
|
-
Packages exist in two places: a "local" repository in the user's home directory, and a "remote" repository on a
|
10
|
+
Packages exist in two places: a "local" repository in the user's home directory, and a "remote" repository on a shared server. Fig will automatically download packages from the remote repository and install them in the local repository as needed.
|
11
11
|
|
12
|
-
Fig is similar to a lot of other package/
|
12
|
+
Fig is similar to a lot of other package/dependency managment tools. In particular, it steals a lot of ideas from Apache Ivy and Debian APT. However, unlike Ivy, fig is meant to be lightweight (no XML, no JVM startup time), language agnostic (Java doesn't get preferential treatment), and work with executables as well as libraries. And unlike APT, fig is cross platform and project-oriented.
|
13
13
|
|
14
14
|
Installation
|
15
15
|
============
|
@@ -19,8 +19,11 @@ Fig can be installed via rubygems. The gems are hosted at [Gemcutter](http://gem
|
|
19
19
|
$ gem install gemcutter
|
20
20
|
$ gem tumble
|
21
21
|
|
22
|
-
Fig also depends on a third-party library named
|
23
|
-
|
22
|
+
Fig also depends on a third-party library named
|
23
|
+
[libarchive](http://libarchive.rubyforge.org/). Libarchive is easily available
|
24
|
+
via most package management systems on Linux, FreeBSD, and OS X. Libarchive
|
25
|
+
versions greater than 2.6.0 are preferred. If you are on Windows (not Cygwin Ruby), the gem will
|
26
|
+
install the libarchive binaries for you.
|
24
27
|
|
25
28
|
[Linux - Debian / Ubuntu]
|
26
29
|
apt-get libarchive-dev
|
@@ -48,10 +51,15 @@ Fig recognizes the following options (not all are implemented yet):
|
|
48
51
|
-m, --update-if-missing Download/install packages from remote repository, if not already installed
|
49
52
|
-l, --login Authenticate with remote server using username/password (default is anonymous)
|
50
53
|
|
51
|
-
If the `--login` option is supplied, fig will
|
52
|
-
|
53
|
-
|
54
|
-
|
54
|
+
If the `--login` option is supplied, fig will look for credentials. If
|
55
|
+
environment variables `FIG_REMOTE_USER` and/or `FIG_REMOTE_PASSWORD` are
|
56
|
+
defined, fig will use them instead of prompting the user. If ~/.netrc exists,
|
57
|
+
with an entry corresponding to the host parsed from `FIG_REMOTE_URL`, that
|
58
|
+
entry will take precedence over `FIG_REMOTE_USER` and `FIG_REMOTE_PASSWORD`.
|
59
|
+
If sufficient credentials are still not found, fig will prompt for whatever is
|
60
|
+
still missing, and use the accumulated credentials to authenticate against the
|
61
|
+
remote server. Even if both environment variables are defined, fig will only
|
62
|
+
use them if `--login` is given.
|
55
63
|
|
56
64
|
### Environment Modifiers ###
|
57
65
|
|
data/lib/fig/os.rb
CHANGED
@@ -6,6 +6,7 @@ require 'uri'
|
|
6
6
|
require 'net/http'
|
7
7
|
require 'net/ssh'
|
8
8
|
require 'net/sftp'
|
9
|
+
require 'net/netrc'
|
9
10
|
require 'tempfile'
|
10
11
|
require 'highline/import'
|
11
12
|
|
@@ -28,8 +29,13 @@ module Fig
|
|
28
29
|
@password ||= ask("Password: ") { |q| q.echo = false }
|
29
30
|
end
|
30
31
|
|
31
|
-
def ftp_login(ftp)
|
32
|
+
def ftp_login(ftp, host)
|
32
33
|
if @login
|
34
|
+
rc = Net::Netrc.locate(host)
|
35
|
+
if rc
|
36
|
+
@username = rc.login
|
37
|
+
@password = rc.password
|
38
|
+
end
|
33
39
|
ftp.login(get_username, get_password)
|
34
40
|
else
|
35
41
|
ftp.login()
|
@@ -71,7 +77,7 @@ module Fig
|
|
71
77
|
case uri.scheme
|
72
78
|
when "ftp"
|
73
79
|
ftp = Net::FTP.new(uri.host)
|
74
|
-
ftp_login(ftp)
|
80
|
+
ftp_login(ftp, uri.host)
|
75
81
|
ftp.chdir(uri.path)
|
76
82
|
dirs = ftp.nlst
|
77
83
|
ftp.close
|
@@ -106,7 +112,7 @@ module Fig
|
|
106
112
|
threads << Thread.new do
|
107
113
|
packages = all_packages[num]
|
108
114
|
ftp = Net::FTP.new(uri.host)
|
109
|
-
ftp_login(ftp)
|
115
|
+
ftp_login(ftp, uri.host)
|
110
116
|
ftp.chdir(uri.path)
|
111
117
|
pos = num
|
112
118
|
while pos < dirs.length
|
@@ -133,7 +139,7 @@ module Fig
|
|
133
139
|
case uri.scheme
|
134
140
|
when "ftp"
|
135
141
|
ftp = Net::FTP.new(uri.host)
|
136
|
-
ftp_login(ftp)
|
142
|
+
ftp_login(ftp, uri.host)
|
137
143
|
begin
|
138
144
|
if File.exist?(path) && ftp.mtime(uri.path) <= File.mtime(path)
|
139
145
|
return false
|
@@ -209,7 +215,7 @@ module Fig
|
|
209
215
|
# i.e. [1,2,3] - [2,3,4] = [1]
|
210
216
|
remote_project_dirs = remote_publish_dirs - ftp_root_dirs
|
211
217
|
Net::FTP.open(uri.host) do |ftp|
|
212
|
-
ftp_login(ftp)
|
218
|
+
ftp_login(ftp, uri.host)
|
213
219
|
# Assume that the FIG_REMOTE_URL path exists.
|
214
220
|
ftp.chdir(ftp_root_path)
|
215
221
|
remote_project_dirs.each do |dir|
|
data/lib/fig/repository.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fig
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.32
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matthew Foemmel
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2011-
|
12
|
+
date: 2011-06-01 00:00:00 -05:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -33,14 +33,14 @@ dependencies:
|
|
33
33
|
version: 2.0.15
|
34
34
|
version:
|
35
35
|
- !ruby/object:Gem::Dependency
|
36
|
-
name: net-
|
36
|
+
name: net-netrc
|
37
37
|
type: :runtime
|
38
38
|
version_requirement:
|
39
39
|
version_requirements: !ruby/object:Gem::Requirement
|
40
40
|
requirements:
|
41
41
|
- - ">="
|
42
42
|
- !ruby/object:Gem::Version
|
43
|
-
version:
|
43
|
+
version: 0.2.2
|
44
44
|
version:
|
45
45
|
- !ruby/object:Gem::Dependency
|
46
46
|
name: polyglot
|