fig 0.1.31 → 0.1.32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/README.md +18 -10
  2. data/lib/fig/os.rb +11 -5
  3. data/lib/fig/repository.rb +1 -0
  4. 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. You give it a list of packages and a shell command to run; it creates an environment that includes those packages, then executes the shell command in it (the caller's environment is not affected).
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. This ensures that all developers on a team are using the same environemnts.
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 server somewhere that is shared by a team. Fig will automatically download packages from the remote repository and install them in the local repository, when needed.
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/dependnency 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 meant to be cross platform (Windows support is coming) and project-oriented.
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, [libarchive](http://libarchive.rubyforge.org/). Libarchive is easily available
23
- via most package management systems on Linux, FreeBSD, and OS X. Libarchive versions greater than 2.6.0 are preferred. If you are on Windows, the gem will install the libarchive binaries for you.
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 prompt for a username and password and use them
52
- to authentication against the remote server. If either the `FIG_REMOTE_USER` or `FIG_REMOTE_PASSWORD`
53
- environment variables are defined, fig will use those values instead of prompting the user. Even if
54
- both environment variables are defined, fig will not use them unless the `--login` option is supplied.
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|
@@ -116,6 +116,7 @@ module Fig
116
116
  end
117
117
  rescue NotFoundException
118
118
  $stderr.puts "Package not found in remote repository: #{package_name}/#{version_name}"
119
+ delete_local_package(package_name, version_name)
119
120
  exit 1
120
121
  end
121
122
  end
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.31
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-05-27 00:00:00 -05:00
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-sftp
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: 2.0.2
43
+ version: 0.2.2
44
44
  version:
45
45
  - !ruby/object:Gem::Dependency
46
46
  name: polyglot