autobuild 1.7.8 → 1.7.9
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/Manifest.txt +1 -0
- data/lib/autobuild.rb +1 -0
- data/lib/autobuild/environment.rb +22 -4
- data/lib/autobuild/import/hg.rb +79 -0
- data/lib/autobuild/version.rb +1 -1
- metadata +6 -5
data/Manifest.txt
CHANGED
data/lib/autobuild.rb
CHANGED
@@ -13,6 +13,7 @@ require 'autobuild/import/cvs'
|
|
13
13
|
require 'autobuild/import/darcs'
|
14
14
|
require 'autobuild/importer'
|
15
15
|
require 'autobuild/import/git'
|
16
|
+
require 'autobuild/import/hg'
|
16
17
|
require 'autobuild/import/svn'
|
17
18
|
require 'autobuild/import/archive'
|
18
19
|
require 'autobuild/import/tar'
|
@@ -206,11 +206,27 @@ module Autobuild
|
|
206
206
|
env_update_var(name)
|
207
207
|
end
|
208
208
|
|
209
|
-
def self.
|
209
|
+
def self.env_value(name)
|
210
210
|
if !environment[name] && !inherited_environment[name] && !SYSTEM_ENV[name]
|
211
|
-
|
211
|
+
nil
|
212
|
+
else
|
213
|
+
value = []
|
214
|
+
[environment[name], inherited_environment[name], SYSTEM_ENV[name]].each do |paths|
|
215
|
+
(paths || []).each do |p|
|
216
|
+
if !value.include?(p)
|
217
|
+
value << p
|
218
|
+
end
|
219
|
+
end
|
220
|
+
end
|
221
|
+
value
|
222
|
+
end
|
223
|
+
end
|
224
|
+
|
225
|
+
def self.env_update_var(name)
|
226
|
+
if value = env_value(name)
|
227
|
+
ENV[name] = value.join(ENV_LIST_SEPARATOR)
|
212
228
|
else
|
213
|
-
ENV
|
229
|
+
ENV.delete(name)
|
214
230
|
end
|
215
231
|
end
|
216
232
|
|
@@ -274,8 +290,10 @@ module Autobuild
|
|
274
290
|
end
|
275
291
|
|
276
292
|
variables = []
|
277
|
-
Autobuild.environment.each do |name,
|
293
|
+
Autobuild.environment.each do |name, _|
|
278
294
|
variables << name
|
295
|
+
value = env_value(name)
|
296
|
+
|
279
297
|
if value
|
280
298
|
shell_line = SHELL_SET_COMMAND % [name, value.join(ENV_LIST_SEPARATOR)]
|
281
299
|
else
|
@@ -0,0 +1,79 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
require 'autobuild/subcommand'
|
3
|
+
require 'autobuild/importer'
|
4
|
+
require 'utilrb/kernel/options'
|
5
|
+
|
6
|
+
module Autobuild
|
7
|
+
class Hg < Importer
|
8
|
+
# Creates an importer which tracks the given repository
|
9
|
+
# and (optionally) a branch.
|
10
|
+
#
|
11
|
+
# This importer uses the 'hg' tool to perform the
|
12
|
+
# import. It defaults to 'hg' and can be configured by
|
13
|
+
# doing
|
14
|
+
# Autobuild.programs['hg'] = 'my_git_tool'
|
15
|
+
#
|
16
|
+
# @param [String] repository the repository URL
|
17
|
+
# @option options [String] :branch (default) the branch to track
|
18
|
+
def initialize(repository, options = {})
|
19
|
+
@repository = repository.to_str
|
20
|
+
|
21
|
+
hgopts, common = Kernel.filter_options options, :branch => 'default'
|
22
|
+
@branch = hgopts[:branch]
|
23
|
+
super(common)
|
24
|
+
end
|
25
|
+
|
26
|
+
# Returns a string that identifies the remote repository uniquely
|
27
|
+
#
|
28
|
+
# This is meant for display purposes
|
29
|
+
def repository_id
|
30
|
+
"hg:#{repository}"
|
31
|
+
end
|
32
|
+
|
33
|
+
# The remote repository URL.
|
34
|
+
attr_accessor :repository
|
35
|
+
|
36
|
+
# The tip this importer is tracking
|
37
|
+
attr_accessor :branch
|
38
|
+
|
39
|
+
# Raises ConfigException if the current directory is not a hg
|
40
|
+
# repository
|
41
|
+
def validate_importdir(package)
|
42
|
+
if !File.directory?(File.join(package.importdir, '.hg'))
|
43
|
+
raise ConfigException.new(package, 'import'), "while importing #{package.name}, #{package.importdir} is not a hg repository"
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
def update(package)
|
48
|
+
validate_importdir(package)
|
49
|
+
Dir.chdir(package.importdir) do
|
50
|
+
Subprocess.run(package, :import, Autobuild.tool('hg'), 'pull', repository)
|
51
|
+
Subprocess.run(package, :import, Autobuild.tool('hg'), 'update', branch)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
def checkout(package)
|
56
|
+
base_dir = File.expand_path('..', package.importdir)
|
57
|
+
if !File.directory?(base_dir)
|
58
|
+
FileUtils.mkdir_p base_dir
|
59
|
+
end
|
60
|
+
|
61
|
+
Subprocess.run(package, :import,
|
62
|
+
Autobuild.tool('hg'), 'clone', '-u', branch, repository, package.importdir)
|
63
|
+
end
|
64
|
+
|
65
|
+
# Changes the repository this importer is pointing to
|
66
|
+
def relocate(repository)
|
67
|
+
@repository = repository
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
# Creates a hg importer which gets the source for the given repository and branch
|
72
|
+
# URL +source+.
|
73
|
+
#
|
74
|
+
# @param (see Hg#initialize)
|
75
|
+
def self.hg(repository, options = {})
|
76
|
+
Hg.new(repository, options)
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
data/lib/autobuild/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: autobuild
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.7.
|
4
|
+
version: 1.7.9
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-11-14 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
@@ -120,6 +120,7 @@ files:
|
|
120
120
|
- lib/autobuild/import/cvs.rb
|
121
121
|
- lib/autobuild/import/darcs.rb
|
122
122
|
- lib/autobuild/import/git.rb
|
123
|
+
- lib/autobuild/import/hg.rb
|
123
124
|
- lib/autobuild/import/svn.rb
|
124
125
|
- lib/autobuild/import/tar.rb
|
125
126
|
- lib/autobuild/importer.rb
|
@@ -177,8 +178,8 @@ signing_key:
|
|
177
178
|
specification_version: 3
|
178
179
|
summary: Library to handle build systems and import mechanisms
|
179
180
|
test_files:
|
180
|
-
- test/
|
181
|
-
- test/test_reporting.rb
|
181
|
+
- test/test_import_tar.rb
|
182
182
|
- test/test_subcommand.rb
|
183
|
+
- test/test_reporting.rb
|
183
184
|
- test/test_import_svn.rb
|
184
|
-
- test/
|
185
|
+
- test/test_import_cvs.rb
|