fig 0.1.34 → 0.1.35
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/fig/os.rb +2 -2
- metadata +116 -43
- data/spec/fig_spec.rb +0 -331
- data/spec/spec_helper.rb +0 -9
- data/spec/win_spec.rb +0 -21
data/lib/fig/os.rb
CHANGED
@@ -88,7 +88,7 @@ module Fig
|
|
88
88
|
Net::SSH.start(uri.host, uri.user) do |ssh|
|
89
89
|
ls = ssh.exec!("[ -d #{uri.path} ] && find #{uri.path}")
|
90
90
|
if not ls.nil?
|
91
|
-
ls = ls.gsub(uri.path + "/", "").gsub(uri.path, "")
|
91
|
+
ls = ls.gsub(uri.path + "/", "").gsub(uri.path, "").split("\n")
|
92
92
|
ls.each do |line|
|
93
93
|
parts = line.gsub(/\\/, '/').sub(/^\.\//, '').sub(/:$/, '').chomp().split('/')
|
94
94
|
packages << parts.join('/') if parts.size == 2
|
@@ -255,7 +255,7 @@ module Fig
|
|
255
255
|
end
|
256
256
|
end
|
257
257
|
else
|
258
|
-
if !FileUtils.uptodate?(target, source)
|
258
|
+
if !FileUtils.uptodate?(target, [source])
|
259
259
|
log_info "#{msg} #{target}" if msg
|
260
260
|
FileUtils.mkdir_p(File.dirname(target))
|
261
261
|
FileUtils.cp(source, target)
|
metadata
CHANGED
@@ -1,7 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fig
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
hash: 93
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 1
|
9
|
+
- 35
|
10
|
+
version: 0.1.35
|
5
11
|
platform: ruby
|
6
12
|
authors:
|
7
13
|
- Matthew Foemmel
|
@@ -9,89 +15,152 @@ autorequire:
|
|
9
15
|
bindir: bin
|
10
16
|
cert_chain: []
|
11
17
|
|
12
|
-
date: 2011-06-
|
18
|
+
date: 2011-06-20 00:00:00 -05:00
|
13
19
|
default_executable:
|
14
20
|
dependencies:
|
15
21
|
- !ruby/object:Gem::Dependency
|
16
22
|
name: libarchive
|
17
|
-
|
18
|
-
|
19
|
-
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
20
26
|
requirements:
|
21
27
|
- - ">="
|
22
28
|
- !ruby/object:Gem::Version
|
29
|
+
hash: 25
|
30
|
+
segments:
|
31
|
+
- 0
|
32
|
+
- 1
|
33
|
+
- 1
|
23
34
|
version: 0.1.1
|
24
|
-
|
35
|
+
type: :runtime
|
36
|
+
version_requirements: *id001
|
25
37
|
- !ruby/object:Gem::Dependency
|
26
38
|
name: net-ssh
|
27
|
-
|
28
|
-
|
29
|
-
|
39
|
+
prerelease: false
|
40
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
30
42
|
requirements:
|
31
43
|
- - ">="
|
32
44
|
- !ruby/object:Gem::Version
|
45
|
+
hash: 17
|
46
|
+
segments:
|
47
|
+
- 2
|
48
|
+
- 0
|
49
|
+
- 15
|
33
50
|
version: 2.0.15
|
34
|
-
|
51
|
+
type: :runtime
|
52
|
+
version_requirements: *id002
|
35
53
|
- !ruby/object:Gem::Dependency
|
36
|
-
name: net-
|
54
|
+
name: net-sftp
|
55
|
+
prerelease: false
|
56
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
hash: 5
|
62
|
+
segments:
|
63
|
+
- 2
|
64
|
+
- 0
|
65
|
+
- 5
|
66
|
+
version: 2.0.5
|
37
67
|
type: :runtime
|
38
|
-
|
39
|
-
|
68
|
+
version_requirements: *id003
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: net-netrc
|
71
|
+
prerelease: false
|
72
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
40
74
|
requirements:
|
41
75
|
- - ">="
|
42
76
|
- !ruby/object:Gem::Version
|
77
|
+
hash: 19
|
78
|
+
segments:
|
79
|
+
- 0
|
80
|
+
- 2
|
81
|
+
- 2
|
43
82
|
version: 0.2.2
|
44
|
-
|
83
|
+
type: :runtime
|
84
|
+
version_requirements: *id004
|
45
85
|
- !ruby/object:Gem::Dependency
|
46
86
|
name: polyglot
|
47
|
-
|
48
|
-
|
49
|
-
|
87
|
+
prerelease: false
|
88
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
50
90
|
requirements:
|
51
91
|
- - ">="
|
52
92
|
- !ruby/object:Gem::Version
|
93
|
+
hash: 5
|
94
|
+
segments:
|
95
|
+
- 0
|
96
|
+
- 2
|
97
|
+
- 9
|
53
98
|
version: 0.2.9
|
54
|
-
|
99
|
+
type: :runtime
|
100
|
+
version_requirements: *id005
|
55
101
|
- !ruby/object:Gem::Dependency
|
56
102
|
name: treetop
|
57
|
-
|
58
|
-
|
59
|
-
|
103
|
+
prerelease: false
|
104
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
60
106
|
requirements:
|
61
107
|
- - ">="
|
62
108
|
- !ruby/object:Gem::Version
|
109
|
+
hash: 3
|
110
|
+
segments:
|
111
|
+
- 1
|
112
|
+
- 4
|
113
|
+
- 2
|
63
114
|
version: 1.4.2
|
64
|
-
|
115
|
+
type: :runtime
|
116
|
+
version_requirements: *id006
|
65
117
|
- !ruby/object:Gem::Dependency
|
66
118
|
name: highline
|
67
|
-
|
68
|
-
|
69
|
-
|
119
|
+
prerelease: false
|
120
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
121
|
+
none: false
|
70
122
|
requirements:
|
71
123
|
- - ">="
|
72
124
|
- !ruby/object:Gem::Version
|
125
|
+
hash: 11
|
126
|
+
segments:
|
127
|
+
- 1
|
128
|
+
- 6
|
129
|
+
- 2
|
73
130
|
version: 1.6.2
|
74
|
-
|
131
|
+
type: :runtime
|
132
|
+
version_requirements: *id007
|
75
133
|
- !ruby/object:Gem::Dependency
|
76
134
|
name: rspec
|
77
|
-
|
78
|
-
|
79
|
-
|
135
|
+
prerelease: false
|
136
|
+
requirement: &id008 !ruby/object:Gem::Requirement
|
137
|
+
none: false
|
80
138
|
requirements:
|
81
139
|
- - ~>
|
82
140
|
- !ruby/object:Gem::Version
|
141
|
+
hash: 9
|
142
|
+
segments:
|
143
|
+
- 1
|
144
|
+
- 3
|
83
145
|
version: "1.3"
|
84
|
-
|
146
|
+
type: :development
|
147
|
+
version_requirements: *id008
|
85
148
|
- !ruby/object:Gem::Dependency
|
86
149
|
name: open4
|
87
|
-
|
88
|
-
|
89
|
-
|
150
|
+
prerelease: false
|
151
|
+
requirement: &id009 !ruby/object:Gem::Requirement
|
152
|
+
none: false
|
90
153
|
requirements:
|
91
154
|
- - ">="
|
92
155
|
- !ruby/object:Gem::Version
|
156
|
+
hash: 21
|
157
|
+
segments:
|
158
|
+
- 1
|
159
|
+
- 0
|
160
|
+
- 1
|
93
161
|
version: 1.0.1
|
94
|
-
|
162
|
+
type: :development
|
163
|
+
version_requirements: *id009
|
95
164
|
description: 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).
|
96
165
|
email: git@foemmel.com
|
97
166
|
executables:
|
@@ -121,30 +190,34 @@ homepage: http://github.com/mfoemmel/fig
|
|
121
190
|
licenses: []
|
122
191
|
|
123
192
|
post_install_message:
|
124
|
-
rdoc_options:
|
125
|
-
|
193
|
+
rdoc_options: []
|
194
|
+
|
126
195
|
require_paths:
|
127
196
|
- lib
|
128
197
|
required_ruby_version: !ruby/object:Gem::Requirement
|
198
|
+
none: false
|
129
199
|
requirements:
|
130
200
|
- - ">="
|
131
201
|
- !ruby/object:Gem::Version
|
202
|
+
hash: 3
|
203
|
+
segments:
|
204
|
+
- 0
|
132
205
|
version: "0"
|
133
|
-
version:
|
134
206
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
207
|
+
none: false
|
135
208
|
requirements:
|
136
209
|
- - ">="
|
137
210
|
- !ruby/object:Gem::Version
|
211
|
+
hash: 3
|
212
|
+
segments:
|
213
|
+
- 0
|
138
214
|
version: "0"
|
139
|
-
version:
|
140
215
|
requirements: []
|
141
216
|
|
142
217
|
rubyforge_project:
|
143
|
-
rubygems_version: 1.
|
218
|
+
rubygems_version: 1.4.2
|
144
219
|
signing_key:
|
145
220
|
specification_version: 3
|
146
221
|
summary: Fig is a utility for configuring environments and managing dependencies across a team of developers..
|
147
|
-
test_files:
|
148
|
-
|
149
|
-
- spec/spec_helper.rb
|
150
|
-
- spec/win_spec.rb
|
222
|
+
test_files: []
|
223
|
+
|
data/spec/fig_spec.rb
DELETED
@@ -1,331 +0,0 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
-
|
3
|
-
require 'rubygems'
|
4
|
-
require 'fig/os'
|
5
|
-
require 'rake'
|
6
|
-
require 'fileutils'
|
7
|
-
|
8
|
-
class Popen
|
9
|
-
if Fig::OS.windows?
|
10
|
-
require 'win32/open3'
|
11
|
-
def self.popen(*cmd)
|
12
|
-
Open3.popen3(*cmd) { |stdin,stdout,stderr|
|
13
|
-
yield stdin, stdout, stderr
|
14
|
-
}
|
15
|
-
end
|
16
|
-
elsif Fig::OS.java?
|
17
|
-
require 'open3'
|
18
|
-
def self.popen(*cmd)
|
19
|
-
Open3.popen3(*cmd) { |stdin,stdout,stderr|
|
20
|
-
yield stdin, stdout, stderr
|
21
|
-
}
|
22
|
-
end
|
23
|
-
else
|
24
|
-
require 'open4'
|
25
|
-
def self.popen(*cmd)
|
26
|
-
Open4::popen4(*cmd) { |pid, stdin, stdout, stderr|
|
27
|
-
yield stdin, stdout, stderr
|
28
|
-
}
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
FIG_HOME = File.expand_path(File.dirname(__FILE__) + '/../tmp/fighome')
|
34
|
-
FileUtils.mkdir_p(FIG_HOME)
|
35
|
-
ENV['FIG_HOME'] = FIG_HOME
|
36
|
-
|
37
|
-
FIG_REMOTE_DIR = File.expand_path(File.dirname(__FILE__) + '/../tmp/remote')
|
38
|
-
FileUtils.mkdir_p(FIG_REMOTE_DIR)
|
39
|
-
ENV['FIG_REMOTE_URL'] = "ssh://#{ENV['USER']}@localhost#{FIG_REMOTE_DIR}"
|
40
|
-
|
41
|
-
FIG_EXE = File.expand_path(File.dirname(__FILE__) + '/../bin/fig')
|
42
|
-
|
43
|
-
def fig(args, input=nil)
|
44
|
-
args = "--file - #{args}" if input
|
45
|
-
out = nil
|
46
|
-
err = nil
|
47
|
-
Popen.popen("#{RUBY} #{FIG_EXE} #{args}") do |stdin, stdout, stderr|
|
48
|
-
if input
|
49
|
-
stdin.puts input
|
50
|
-
stdin.close
|
51
|
-
end
|
52
|
-
err = stderr.read.strip
|
53
|
-
out = stdout.read.strip
|
54
|
-
if err != ""
|
55
|
-
$stderr.puts err
|
56
|
-
end
|
57
|
-
end
|
58
|
-
return out, err, $?.exitstatus
|
59
|
-
end
|
60
|
-
|
61
|
-
describe "Fig" do
|
62
|
-
it "set environment variable from command line" do
|
63
|
-
fig('-s FOO=BAR -g FOO')[0].should == 'BAR'
|
64
|
-
fig('--set FOO=BAR -g FOO')[0].should == 'BAR'
|
65
|
-
end
|
66
|
-
|
67
|
-
it "set environment variable from fig file" do
|
68
|
-
input = <<-END
|
69
|
-
config default
|
70
|
-
set FOO=BAR
|
71
|
-
end
|
72
|
-
END
|
73
|
-
fig('-g FOO', input)[0].should == 'BAR'
|
74
|
-
end
|
75
|
-
|
76
|
-
it "append environment variable from command line" do
|
77
|
-
fig('-p PATH=foo -g PATH').should == ["foo#{File::PATH_SEPARATOR}#{ENV['PATH']}","",0]
|
78
|
-
end
|
79
|
-
|
80
|
-
it "append environment variable from fig file" do
|
81
|
-
input = <<-END
|
82
|
-
config default
|
83
|
-
add PATH=foo
|
84
|
-
end
|
85
|
-
END
|
86
|
-
fig('-g PATH', input).should == ["foo#{File::PATH_SEPARATOR}#{ENV['PATH']}","",0]
|
87
|
-
end
|
88
|
-
|
89
|
-
it "append empty environment variable" do
|
90
|
-
fig('-p XYZZY=foo -g XYZZY').should == ["foo","",0]
|
91
|
-
end
|
92
|
-
|
93
|
-
it "should ignore comments" do
|
94
|
-
input = <<-END
|
95
|
-
#/usr/bin/env fig
|
96
|
-
|
97
|
-
# Some comment
|
98
|
-
config default
|
99
|
-
set FOO=BAR # Another comment
|
100
|
-
end
|
101
|
-
END
|
102
|
-
fig('-g FOO', input)[0].should == 'BAR'
|
103
|
-
end
|
104
|
-
|
105
|
-
it "publish to remote repository" do
|
106
|
-
FileUtils.rm_rf(FIG_HOME)
|
107
|
-
FileUtils.rm_rf(FIG_REMOTE_DIR)
|
108
|
-
input = <<-END
|
109
|
-
config default
|
110
|
-
set FOO=BAR
|
111
|
-
end
|
112
|
-
END
|
113
|
-
fig('--publish foo/1.2.3', input)
|
114
|
-
fail unless File.exists? FIG_HOME + "/repos/foo/1.2.3/.fig"
|
115
|
-
fail unless File.exists? FIG_REMOTE_DIR + "/foo/1.2.3/.fig"
|
116
|
-
fig('-u -i foo/1.2.3 -g FOO')[0].should == 'BAR'
|
117
|
-
end
|
118
|
-
|
119
|
-
it "publish resource to remote repository" do
|
120
|
-
FileUtils.rm_rf(FIG_HOME)
|
121
|
-
FileUtils.rm_rf(FIG_REMOTE_DIR)
|
122
|
-
FileUtils.mkdir_p("tmp/bin")
|
123
|
-
File.open("tmp/bin/hello", "w") { |f| f << "echo bar" }
|
124
|
-
fail unless system "chmod +x tmp/bin/hello"
|
125
|
-
input = <<-END
|
126
|
-
resource tmp/bin/hello
|
127
|
-
config default
|
128
|
-
append PATH=@/tmp/bin
|
129
|
-
end
|
130
|
-
END
|
131
|
-
fig('--publish foo/1.2.3', input)
|
132
|
-
fail unless File.exists? FIG_HOME + "/repos/foo/1.2.3/.fig"
|
133
|
-
fail unless File.exists? FIG_REMOTE_DIR + "/foo/1.2.3/.fig"
|
134
|
-
fig('-u -i foo/1.2.3 -- hello')[0].should == 'bar'
|
135
|
-
end
|
136
|
-
|
137
|
-
it "publish resource to remote repository using command line" do
|
138
|
-
FileUtils.rm_rf(FIG_HOME)
|
139
|
-
FileUtils.rm_rf(FIG_REMOTE_DIR)
|
140
|
-
FileUtils.mkdir_p("tmp/bin")
|
141
|
-
File.open("tmp/bin/hello", "w") { |f| f << "echo bar" }
|
142
|
-
fail unless system "chmod +x tmp/bin/hello"
|
143
|
-
fig('--publish foo/1.2.3 --resource tmp/bin/hello --append PATH=@/tmp/bin')
|
144
|
-
fail unless File.exists? FIG_HOME + "/repos/foo/1.2.3/.fig"
|
145
|
-
fail unless File.exists? FIG_REMOTE_DIR + "/foo/1.2.3/.fig"
|
146
|
-
fig('-u -i foo/1.2.3 -- hello')[0].should == 'bar'
|
147
|
-
end
|
148
|
-
|
149
|
-
it "refuses to overwrite existing version in remote repository without being forced" do
|
150
|
-
FileUtils.rm_rf(FIG_HOME)
|
151
|
-
FileUtils.rm_rf(FIG_REMOTE_DIR)
|
152
|
-
input = <<-END
|
153
|
-
config default
|
154
|
-
set FOO=SHEEP
|
155
|
-
end
|
156
|
-
END
|
157
|
-
fig('--publish foo/1.2.3', input)
|
158
|
-
fail unless File.exists? FIG_HOME + "/repos/foo/1.2.3/.fig"
|
159
|
-
fail unless File.exists? FIG_REMOTE_DIR + "/foo/1.2.3/.fig"
|
160
|
-
fig('-u -i foo/1.2.3 -g FOO')[0].should == 'SHEEP'
|
161
|
-
|
162
|
-
input = <<-END
|
163
|
-
config default
|
164
|
-
set FOO=CHEESE
|
165
|
-
end
|
166
|
-
END
|
167
|
-
(out, err, exitstatus) = fig('--publish foo/1.2.3', input)
|
168
|
-
exitstatus.should == 1
|
169
|
-
fig('-u -i foo/1.2.3 -g FOO')[0].should == 'SHEEP'
|
170
|
-
|
171
|
-
(out, err, exitstatus) = fig('--publish foo/1.2.3 --force', input)
|
172
|
-
exitstatus.should == 0
|
173
|
-
fig('-u -i foo/1.2.3 -g FOO')[0].should == 'CHEESE'
|
174
|
-
end
|
175
|
-
|
176
|
-
it "publishes to the local repo only when told to" do
|
177
|
-
FileUtils.rm_rf(FIG_HOME)
|
178
|
-
FileUtils.rm_rf(FIG_REMOTE_DIR)
|
179
|
-
FileUtils.mkdir_p("tmp/bin")
|
180
|
-
File.open("tmp/bin/hello", "w") { |f| f << "echo bar" }
|
181
|
-
fail unless system "chmod +x tmp/bin/hello"
|
182
|
-
fig('--publish-local foo/1.2.3 --resource tmp/bin/hello --append PATH=@/tmp/bin')
|
183
|
-
fail if File.exists? FIG_REMOTE_DIR + "/foo/1.2.3/.fig"
|
184
|
-
fig('-m -i foo/1.2.3 -- hello')[0].should == 'bar'
|
185
|
-
end
|
186
|
-
|
187
|
-
it "retrieve resource" do
|
188
|
-
FileUtils.rm_rf(FIG_HOME)
|
189
|
-
FileUtils.rm_rf(FIG_REMOTE_DIR)
|
190
|
-
FileUtils.rm_rf("tmp")
|
191
|
-
FileUtils.mkdir_p("tmp/lib")
|
192
|
-
File.open("tmp/lib/hello", "w") { |f| f << "some library" }
|
193
|
-
input = <<-END
|
194
|
-
resource tmp/lib/hello
|
195
|
-
config default
|
196
|
-
append FOOPATH=@/tmp/lib/hello
|
197
|
-
end
|
198
|
-
END
|
199
|
-
fig('--publish foo/1.2.3', input)
|
200
|
-
input = <<-END
|
201
|
-
retrieve FOOPATH->tmp/lib2/[package]
|
202
|
-
config default
|
203
|
-
include foo/1.2.3
|
204
|
-
end
|
205
|
-
END
|
206
|
-
fig('-m', input)
|
207
|
-
File.read("tmp/lib2/foo/hello").should == "some library"
|
208
|
-
end
|
209
|
-
|
210
|
-
it "retrieves resource that is a directory" do
|
211
|
-
FileUtils.rm_rf(FIG_HOME)
|
212
|
-
FileUtils.rm_rf(FIG_REMOTE_DIR)
|
213
|
-
FileUtils.rm_rf("tmp")
|
214
|
-
FileUtils.mkdir_p("tmp/lib")
|
215
|
-
File.open("tmp/lib/hello", "w") { |f| f << "some library" }
|
216
|
-
# To copy the contents of a directory, instead of the directory itself,
|
217
|
-
# use '/.' as a suffix to the directory name in 'append'.
|
218
|
-
input = <<-END
|
219
|
-
resource tmp/lib/hello
|
220
|
-
config default
|
221
|
-
append FOOPATH=@/tmp/lib/.
|
222
|
-
end
|
223
|
-
END
|
224
|
-
fig('--publish foo/1.2.3', input)
|
225
|
-
input = <<-END
|
226
|
-
retrieve FOOPATH->tmp/lib2/[package]
|
227
|
-
config default
|
228
|
-
include foo/1.2.3
|
229
|
-
end
|
230
|
-
END
|
231
|
-
fig('-m', input)
|
232
|
-
File.read("tmp/lib2/foo/hello").should == "some library"
|
233
|
-
end
|
234
|
-
|
235
|
-
it "retrieve preserves the path after '//' when copying files into your project directory" do
|
236
|
-
FileUtils.rm_rf(FIG_HOME)
|
237
|
-
FileUtils.rm_rf(FIG_REMOTE_DIR)
|
238
|
-
FileUtils.rm_rf("tmp")
|
239
|
-
FileUtils.mkdir_p("tmp/include")
|
240
|
-
File.open("tmp/include/hello.h", "w") { |f| f << "a header file" }
|
241
|
-
File.open("tmp/include/hello2.h", "w") { |f| f << "another header file" }
|
242
|
-
input = <<-END
|
243
|
-
resource tmp/include/hello.h
|
244
|
-
resource tmp/include/hello2.h
|
245
|
-
config default
|
246
|
-
append INCLUDE=@/tmp//include/hello.h
|
247
|
-
append INCLUDE=@/tmp//include/hello2.h
|
248
|
-
end
|
249
|
-
END
|
250
|
-
fig('--publish foo/1.2.3', input)
|
251
|
-
|
252
|
-
input = <<-END
|
253
|
-
retrieve INCLUDE->tmp/include2/[package]
|
254
|
-
config default
|
255
|
-
include foo/1.2.3
|
256
|
-
end
|
257
|
-
END
|
258
|
-
fig('-u', input)
|
259
|
-
|
260
|
-
File.read("tmp/include2/foo/include/hello.h").should == "a header file"
|
261
|
-
File.read("tmp/include2/foo/include/hello2.h").should == "another header file"
|
262
|
-
end
|
263
|
-
|
264
|
-
it "package multiple resources" do
|
265
|
-
FileUtils.rm_rf(FIG_HOME)
|
266
|
-
FileUtils.rm_rf(FIG_REMOTE_DIR)
|
267
|
-
FileUtils.rm_rf("tmp")
|
268
|
-
FileUtils.mkdir_p("tmp/lib")
|
269
|
-
File.open("tmp/lib/hello", "w") { |f| f << "some library" }
|
270
|
-
File.open("tmp/lib/hello2", "w") { |f| f << "some other library" }
|
271
|
-
input = <<-END
|
272
|
-
resource tmp/lib/hello
|
273
|
-
resource tmp/lib/hello2
|
274
|
-
config default
|
275
|
-
append FOOPATH=@/tmp/lib/hello
|
276
|
-
append FOOPATH=@/tmp/lib/hello2
|
277
|
-
end
|
278
|
-
END
|
279
|
-
fig('--publish foo/1.2.3', input)
|
280
|
-
input = <<-END
|
281
|
-
retrieve FOOPATH->tmp/lib2/[package]
|
282
|
-
config default
|
283
|
-
include foo/1.2.3
|
284
|
-
end
|
285
|
-
END
|
286
|
-
fig('-m', input)
|
287
|
-
File.read("tmp/lib2/foo/hello").should == "some library"
|
288
|
-
File.read("tmp/lib2/foo/hello2").should == "some other library"
|
289
|
-
end
|
290
|
-
|
291
|
-
it "packages multiple resources with wildcards" do
|
292
|
-
FileUtils.rm_rf(FIG_HOME)
|
293
|
-
FileUtils.rm_rf(FIG_REMOTE_DIR)
|
294
|
-
FileUtils.rm_rf("tmp")
|
295
|
-
FileUtils.mkdir_p("tmp/lib")
|
296
|
-
File.open("tmp/lib/foo.jar", "w") { |f| f << "some library" }
|
297
|
-
File.open("tmp/lib/bar.jar", "w") { |f| f << "some other library" }
|
298
|
-
input = <<-END
|
299
|
-
resource tmp/**/*.jar
|
300
|
-
config default
|
301
|
-
append FOOPATH=@/tmp/lib/foo.jar
|
302
|
-
end
|
303
|
-
END
|
304
|
-
fig('--publish foo/1.2.3', input)
|
305
|
-
input = <<-END
|
306
|
-
retrieve FOOPATH->tmp/lib2/[package]
|
307
|
-
config default
|
308
|
-
include foo/1.2.3
|
309
|
-
end
|
310
|
-
END
|
311
|
-
fig('-m', input)
|
312
|
-
File.read("tmp/lib2/foo/foo.jar").should == "some library"
|
313
|
-
end
|
314
|
-
|
315
|
-
it "update local packages if they already exist" do
|
316
|
-
FileUtils.rm_rf(FIG_HOME)
|
317
|
-
FileUtils.rm_rf(FIG_REMOTE_DIR)
|
318
|
-
FileUtils.mkdir_p("tmp/bin")
|
319
|
-
File.open("tmp/bin/hello", "w") { |f| f << "echo sheep" }
|
320
|
-
fail unless system "chmod +x tmp/bin/hello"
|
321
|
-
fig('--publish-local foo/1.2.3 --resource tmp/bin/hello --append PATH=@/tmp/bin')
|
322
|
-
fail if File.exists? FIG_REMOTE_DIR + "/foo/1.2.3/.fig"
|
323
|
-
fig('-m -i foo/1.2.3 -- hello')[0].should == 'sheep'
|
324
|
-
|
325
|
-
File.open("tmp/bin/hello", "w") { |f| f << "echo cheese" }
|
326
|
-
fail unless system "chmod +x tmp/bin/hello"
|
327
|
-
fig('--publish-local foo/1.2.3 --resource tmp/bin/hello --append PATH=@/tmp/bin')
|
328
|
-
fail if File.exists? FIG_REMOTE_DIR + "/foo/1.2.3/.fig"
|
329
|
-
fig('-m -i foo/1.2.3 -- hello')[0].should == 'cheese'
|
330
|
-
end
|
331
|
-
end
|
data/spec/spec_helper.rb
DELETED
data/spec/win_spec.rb
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
-
require 'fig/os'
|
3
|
-
require 'fig/windows'
|
4
|
-
|
5
|
-
|
6
|
-
# Only run on Windows...
|
7
|
-
if Fig::OS.windows?
|
8
|
-
describe "Fig on Windows" do
|
9
|
-
it "batch script should exist" do
|
10
|
-
Fig::Windows.with_generated_batch_script(["echo", "Hello World"]) do |filename|
|
11
|
-
File.exist?(filename).should == true
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
it "batch script should say 'Hello World' when executed" do
|
16
|
-
Fig::Windows.with_generated_batch_script(["echo", "Hello World"]) do |filename|
|
17
|
-
%x[#{filename}].should == "Hello World\n"
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|