fig 0.1.26 → 0.1.27
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.
- data/bin/fig +1 -1
- data/lib/fig/options.rb +3 -0
- data/lib/fig/os.rb +27 -3
- metadata +12 -2
data/bin/fig
CHANGED
@@ -57,7 +57,7 @@ if options[:publish]
|
|
57
57
|
# end
|
58
58
|
end
|
59
59
|
|
60
|
-
os = OS.new
|
60
|
+
os = OS.new(options[:login])
|
61
61
|
repos = Repository.new(os, File.expand_path(File.join(options[:home], 'repos')), remote_url, remote_user, options[:update], options[:update_if_missing])
|
62
62
|
env = Environment.new(os, repos, vars)
|
63
63
|
|
data/lib/fig/options.rb
CHANGED
@@ -55,6 +55,9 @@ module Fig
|
|
55
55
|
options[:archives] << Archive.new(path)
|
56
56
|
end
|
57
57
|
|
58
|
+
options[:login] = false
|
59
|
+
opts.on('-l', '--login', 'login into the FTP server as a non-anonymous user') { options[:login] = true }
|
60
|
+
|
58
61
|
options[:list] = false
|
59
62
|
opts.on('--list', 'list packages in local repository') { options[:list] = true }
|
60
63
|
|
data/lib/fig/os.rb
CHANGED
@@ -7,12 +7,35 @@ require 'net/http'
|
|
7
7
|
require 'net/ssh'
|
8
8
|
require 'net/sftp'
|
9
9
|
require 'tempfile'
|
10
|
+
require 'highline/import'
|
10
11
|
|
11
12
|
module Fig
|
12
13
|
class NotFoundException < Exception
|
13
14
|
end
|
14
15
|
|
15
16
|
class OS
|
17
|
+
def initialize(login)
|
18
|
+
@login = login
|
19
|
+
@username = ENV["FIG_USERNAME"]
|
20
|
+
@password = ENV["FIG_PASSWORD"]
|
21
|
+
end
|
22
|
+
|
23
|
+
def get_username()
|
24
|
+
@username ||= ask("Username: ") { |q| q.echo = true }
|
25
|
+
end
|
26
|
+
|
27
|
+
def get_password()
|
28
|
+
@password ||= ask("Password: ") { |q| q.echo = false }
|
29
|
+
end
|
30
|
+
|
31
|
+
def ftp_login(ftp)
|
32
|
+
if @login
|
33
|
+
ftp.login(get_username, get_password)
|
34
|
+
else
|
35
|
+
ftp.login()
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
16
39
|
def list(dir)
|
17
40
|
Dir.entries(dir) - ['.','..']
|
18
41
|
end
|
@@ -47,7 +70,8 @@ module Fig
|
|
47
70
|
case uri.scheme
|
48
71
|
when "ftp"
|
49
72
|
ftp = Net::FTP.new(uri.host)
|
50
|
-
ftp
|
73
|
+
ftp_login(ftp)
|
74
|
+
puts(uri.path)
|
51
75
|
ftp.chdir(uri.path)
|
52
76
|
packages = []
|
53
77
|
ftp.retrlines('LIST -R .') do |line|
|
@@ -81,7 +105,7 @@ module Fig
|
|
81
105
|
case uri.scheme
|
82
106
|
when "ftp"
|
83
107
|
ftp = Net::FTP.new(uri.host)
|
84
|
-
ftp
|
108
|
+
ftp_login(ftp)
|
85
109
|
begin
|
86
110
|
if File.exist?(path) && ftp.mtime(uri.path) <= File.mtime(path)
|
87
111
|
return false
|
@@ -157,7 +181,7 @@ module Fig
|
|
157
181
|
# i.e. [1,2,3] - [2,3,4] = [1]
|
158
182
|
remote_project_dirs = remote_publish_dirs - ftp_root_dirs
|
159
183
|
Net::FTP.open(uri.host) do |ftp|
|
160
|
-
ftp
|
184
|
+
ftp_login(ftp)
|
161
185
|
# Assume that the FIG_REMOTE_URL path exists.
|
162
186
|
ftp.chdir(ftp_root_path)
|
163
187
|
remote_project_dirs.each do |dir|
|
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.27
|
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-05-25 00:00:00 -05:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -62,6 +62,16 @@ dependencies:
|
|
62
62
|
- !ruby/object:Gem::Version
|
63
63
|
version: 1.4.2
|
64
64
|
version:
|
65
|
+
- !ruby/object:Gem::Dependency
|
66
|
+
name: highline
|
67
|
+
type: :runtime
|
68
|
+
version_requirement:
|
69
|
+
version_requirements: !ruby/object:Gem::Requirement
|
70
|
+
requirements:
|
71
|
+
- - ">="
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
version: 1.6.2
|
74
|
+
version:
|
65
75
|
- !ruby/object:Gem::Dependency
|
66
76
|
name: rspec
|
67
77
|
type: :development
|