build-tool 0.5.7 → 0.6.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/.rvmrc +1 -0
- data/.yardopts +1 -0
- data/Gemfile +5 -0
- data/Gemfile.lock +56 -0
- data/History.txt +64 -0
- data/README.txt +0 -7
- data/Rakefile +8 -56
- data/bin/build-tool +4 -1
- data/build-tool.gemspec +62 -0
- data/db/migrations/20110703074000_add_command_logs.rb +17 -0
- data/db/migrations/20110703075000_add_module_logs.rb +20 -0
- data/db/migrations/20110815170000_add_features.rb +17 -0
- data/db/migrations/20120103204700_add_modules.rb +17 -0
- data/db/migrations/20120106181200_add_settings.rb +18 -0
- data/lib/build-tool.rb +3 -4
- data/lib/build-tool/application.rb +127 -37
- data/lib/build-tool/build-system/autoconf.rb +2 -8
- data/lib/build-tool/build-system/base.rb +12 -4
- data/lib/build-tool/build-system/cmake.rb +2 -0
- data/lib/build-tool/build-system/custom.rb +2 -0
- data/lib/build-tool/build-system/kdel10n.rb +2 -0
- data/lib/build-tool/build-system/make.rb +2 -0
- data/lib/build-tool/build-system/none.rb +2 -0
- data/lib/build-tool/build-system/qmake.rb +2 -0
- data/lib/build-tool/build-system/qt.rb +4 -0
- data/lib/build-tool/cfg/lexer.rex +40 -8
- data/lib/build-tool/cfg/lexer_base.rb +3 -1
- data/lib/build-tool/cfg/node.rb +17 -1
- data/lib/build-tool/cfg/parser.y +92 -10
- data/lib/build-tool/cfg/visitor.rb +202 -78
- data/lib/build-tool/command_actions.rb +26 -10
- data/lib/build-tool/commands.rb +289 -197
- data/lib/build-tool/commands/build.rb +13 -9
- data/lib/build-tool/commands/configuration.rb +25 -0
- data/lib/build-tool/commands/configuration/edit.rb +42 -0
- data/lib/build-tool/commands/configuration/list.rb +48 -0
- data/lib/build-tool/commands/configure.rb +9 -5
- data/lib/build-tool/commands/ctags.rb +8 -3
- data/lib/build-tool/commands/environments.rb +2 -4
- data/lib/build-tool/commands/environments/list.rb +13 -10
- data/lib/build-tool/commands/environments/set.rb +5 -1
- data/lib/build-tool/commands/features.rb +24 -0
- data/lib/build-tool/commands/features/disable.rb +70 -0
- data/lib/build-tool/commands/features/enable.rb +66 -0
- data/lib/build-tool/commands/features/list.rb +92 -0
- data/lib/build-tool/commands/fetch.rb +9 -3
- data/lib/build-tool/commands/files.rb +9 -5
- data/lib/build-tool/commands/gc.rb +48 -15
- data/lib/build-tool/commands/history.rb +21 -16
- data/lib/build-tool/commands/info.rb +16 -13
- data/lib/build-tool/commands/install.rb +8 -4
- data/lib/build-tool/commands/modules.rb +2 -4
- data/lib/build-tool/commands/modules/cleanup.rb +52 -0
- data/lib/build-tool/commands/modules/disable.rb +95 -0
- data/lib/build-tool/commands/modules/enable.rb +52 -0
- data/lib/build-tool/commands/modules/info.rb +44 -35
- data/lib/build-tool/commands/modules/list.rb +67 -15
- data/lib/build-tool/commands/modules/shell.rb +8 -2
- data/lib/build-tool/commands/rebase.rb +15 -7
- data/lib/build-tool/commands/recipes.rb +2 -4
- data/lib/build-tool/commands/recipes/add.rb +16 -2
- data/lib/build-tool/commands/recipes/edit.rb +72 -0
- data/lib/build-tool/commands/recipes/incoming.rb +11 -7
- data/lib/build-tool/commands/recipes/info.rb +12 -8
- data/lib/build-tool/commands/recipes/install.rb +37 -42
- data/lib/build-tool/commands/recipes/list.rb +6 -2
- data/lib/build-tool/configuration.rb +88 -3
- data/lib/build-tool/environment.rb +2 -0
- data/lib/build-tool/errors.rb +5 -0
- data/lib/build-tool/history.rb +3 -181
- data/lib/build-tool/model/command_log.rb +93 -0
- data/lib/build-tool/model/feature.rb +80 -0
- data/lib/build-tool/{module.rb → model/module.rb} +110 -29
- data/lib/build-tool/model/module_log.rb +64 -0
- data/lib/build-tool/model/setting.rb +84 -0
- data/lib/build-tool/recipe.rb +40 -18
- data/lib/build-tool/repository.rb +39 -33
- data/lib/build-tool/server.rb +27 -3
- data/lib/build-tool/singleton.rb +2 -0
- data/lib/build-tool/sshkey.rb +2 -0
- data/lib/build-tool/state_helper.rb +64 -0
- data/lib/build-tool/vcs/archive.rb +3 -1
- data/lib/build-tool/vcs/base.rb +13 -0
- data/lib/build-tool/vcs/git-svn.rb +36 -14
- data/lib/build-tool/vcs/git.rb +180 -44
- data/lib/build-tool/vcs/mercurial.rb +25 -13
- data/lib/build-tool/vcs/svn.rb +20 -15
- data/lib/build-tool/version.rb +30 -0
- data/lib/mj/error.rb +2 -0
- data/lib/mj/logging.rb +2 -0
- data/lib/mj/mixins/inherited_attributes.rb +73 -0
- data/lib/mj/tools/editor.rb +34 -0
- data/lib/mj/tools/ssh.rb +2 -0
- data/lib/mj/tools/subprocess.rb +2 -1
- data/lib/mj/vcs/git.rb +14 -2
- data/lib/mj/visitor.rb +22 -0
- data/tasks/db.rake +36 -0
- data/tasks/racc.rake +14 -0
- data/tasks/rdoc.rake +8 -0
- data/tasks/rexical.rake +14 -0
- data/tasks/test.rake +21 -0
- data/test/integration/history_test.rb +88 -0
- data/test/integration/parser_configuration.rb +36 -0
- data/test/integration/parser_environment_parser.rb +156 -0
- data/test/integration/parser_feature_test.rb +75 -0
- data/test/integration/parser_git-svn_test.rb +92 -0
- data/test/integration/parser_git_test.rb +97 -0
- data/test/integration/parser_mercurial_test.rb +77 -0
- data/test/integration/parser_module_test.rb +103 -0
- data/test/integration/parser_svn_test.rb +92 -0
- data/test/integration/parser_test.rb +73 -0
- data/test/test_helper.rb +61 -0
- data/test/unit/configuration_test.rb +36 -0
- data/test/unit/git_configuration_test.rb +163 -0
- data/test/unit/git_svn_configuration_test.rb +240 -0
- data/test/unit/mercurial_configuration_test.rb +64 -0
- data/test/unit/model/command_log_test.rb +103 -0
- data/test/unit/model/feature_test.rb +29 -0
- data/test/unit/model/module_log_test.rb +70 -0
- data/test/unit/model/module_test.rb +32 -0
- data/test/unit/repository_test.rb +110 -0
- data/test/unit/server_test.rb +66 -0
- data/test/unit/svn_configuration_test.rb +90 -0
- metadata +134 -93
- data/Manifest.txt +0 -80
- data/db/migrations/001_command_histories.rb +0 -20
- data/db/migrations/002_module_events.rb +0 -24
- data/db/migrations/003_command_histories_add_logfile.rb +0 -19
- data/lib/build-tool/GUI.rb +0 -360
- data/lib/build-tool/commands/help.rb +0 -22
- data/lib/build-tool/commands/lsfeatures.rb +0 -76
- data/lib/build-tool/feature.rb +0 -47
@@ -0,0 +1,156 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
setup_database()
|
4
|
+
|
5
|
+
require 'build-tool/cfg/parser'
|
6
|
+
|
7
|
+
class TestParser < ActiveSupport::TestCase
|
8
|
+
|
9
|
+
def setup
|
10
|
+
create_parser()
|
11
|
+
end
|
12
|
+
|
13
|
+
def create_parser
|
14
|
+
@configuration = BuildTool::Configuration.new()
|
15
|
+
@configuration.truncate()
|
16
|
+
@parser = BuildTool::Cfg::Parser.new( @configuration )
|
17
|
+
@localparser = BuildTool::Cfg::Parser.new( @configuration, false )
|
18
|
+
end
|
19
|
+
|
20
|
+
test "Parses an empty environment" do
|
21
|
+
assert_nothing_raised() do
|
22
|
+
@parser.parse_string <<-EOF
|
23
|
+
environment empty
|
24
|
+
end
|
25
|
+
EOF
|
26
|
+
end
|
27
|
+
|
28
|
+
assert( @configuration.environment( 'empty' ) )
|
29
|
+
empty = @configuration.environment( 'empty' )
|
30
|
+
assert_equal( 'empty', empty.name )
|
31
|
+
assert_nil( empty.parent )
|
32
|
+
|
33
|
+
end
|
34
|
+
|
35
|
+
test "Parses inheritance" do
|
36
|
+
assert_nothing_raised() do
|
37
|
+
@parser.parse_string <<-EOF
|
38
|
+
environment empty
|
39
|
+
end
|
40
|
+
environment based_on_empty < empty
|
41
|
+
end
|
42
|
+
EOF
|
43
|
+
end
|
44
|
+
|
45
|
+
assert( @configuration.environment( 'empty' ) )
|
46
|
+
empty = @configuration.environment( 'empty' )
|
47
|
+
assert_equal( 'empty', empty.name )
|
48
|
+
assert_nil( empty.parent )
|
49
|
+
|
50
|
+
assert( @configuration.environment( 'based_on_empty' ) )
|
51
|
+
based_on_empty = @configuration.environment( 'based_on_empty' )
|
52
|
+
assert_equal( 'based_on_empty', based_on_empty.name )
|
53
|
+
assert_equal( empty, based_on_empty.parent )
|
54
|
+
end
|
55
|
+
|
56
|
+
test "Handles environment correctly" do
|
57
|
+
assert_nothing_raised() do
|
58
|
+
@parser.parse_string <<-EOF
|
59
|
+
environment base
|
60
|
+
var PATH "/usr/bin"
|
61
|
+
var MANPATH set "/usr/man"
|
62
|
+
var LD_LIBRARY_PATH append "/usr/lib"
|
63
|
+
var PKG_CONFIG_PATH prepend "/usr/lib/pkgconfig"
|
64
|
+
end
|
65
|
+
EOF
|
66
|
+
end
|
67
|
+
|
68
|
+
env = @configuration.environment( 'base' )
|
69
|
+
assert_equal( '/usr/bin', env['PATH'] )
|
70
|
+
assert_equal( '/usr/man', env['MANPATH'] )
|
71
|
+
assert_equal( '/usr/lib', env['LD_LIBRARY_PATH'] )
|
72
|
+
assert_equal( '/usr/lib/pkgconfig', env['PKG_CONFIG_PATH'] )
|
73
|
+
|
74
|
+
end
|
75
|
+
|
76
|
+
test "Handles environment with parent correctly" do
|
77
|
+
assert_nothing_raised() do
|
78
|
+
@parser.parse_string <<-EOF
|
79
|
+
environment base
|
80
|
+
var PATH "/usr/bin"
|
81
|
+
var MANPATH set "/usr/man"
|
82
|
+
var LD_LIBRARY_PATH append "/usr/lib"
|
83
|
+
var PKG_CONFIG_PATH prepend "/usr/lib/pkgconfig"
|
84
|
+
end
|
85
|
+
environment child < base
|
86
|
+
var PATH "/bin"
|
87
|
+
var MANPATH set "/man"
|
88
|
+
var LD_LIBRARY_PATH append "/lib"
|
89
|
+
var PKG_CONFIG_PATH prepend "/lib/pkgconfig"
|
90
|
+
end
|
91
|
+
EOF
|
92
|
+
|
93
|
+
end
|
94
|
+
|
95
|
+
env = @configuration.environment( 'base' )
|
96
|
+
assert_equal( '/usr/bin', env['PATH'] )
|
97
|
+
assert_equal( '/usr/man', env['MANPATH'] )
|
98
|
+
assert_equal( '/usr/lib', env['LD_LIBRARY_PATH'] )
|
99
|
+
assert_equal( '/usr/lib/pkgconfig', env['PKG_CONFIG_PATH'] )
|
100
|
+
|
101
|
+
env = @configuration.environment( 'child' )
|
102
|
+
assert_equal( '/bin', env['PATH'] )
|
103
|
+
assert_equal( '/man', env['MANPATH'] )
|
104
|
+
assert_equal( '/usr/lib:/lib', env['LD_LIBRARY_PATH'] )
|
105
|
+
assert_equal( '/lib/pkgconfig:/usr/lib/pkgconfig', env['PKG_CONFIG_PATH'] )
|
106
|
+
|
107
|
+
env = @configuration.environment( 'base' )
|
108
|
+
assert_equal( '/usr/bin', env['PATH'] )
|
109
|
+
assert_equal( '/usr/man', env['MANPATH'] )
|
110
|
+
|
111
|
+
end
|
112
|
+
|
113
|
+
test "Handles environment in respect to features correctly" do
|
114
|
+
assert_nothing_raised() do
|
115
|
+
@parser.parse_string <<-EOF
|
116
|
+
feature "test"
|
117
|
+
environment test1
|
118
|
+
end
|
119
|
+
feature "test-child"
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
123
|
+
feature "test"
|
124
|
+
feature "test-child"
|
125
|
+
environment "test-child"
|
126
|
+
end
|
127
|
+
end
|
128
|
+
environment test2
|
129
|
+
end
|
130
|
+
end
|
131
|
+
environment outer
|
132
|
+
end
|
133
|
+
EOF
|
134
|
+
|
135
|
+
end
|
136
|
+
|
137
|
+
env = @configuration.environment( 'test1' )
|
138
|
+
assert( env.feature )
|
139
|
+
assert_equal( 'test', env.feature.name )
|
140
|
+
|
141
|
+
env = @configuration.environment( 'test2' )
|
142
|
+
assert( env.feature )
|
143
|
+
assert_equal( 'test', env.feature.name )
|
144
|
+
|
145
|
+
env = @configuration.environment( 'test-child' )
|
146
|
+
assert( env.feature )
|
147
|
+
assert_equal( 'test-child', env.feature.name )
|
148
|
+
assert_equal( 'test/test-child', env.feature.path )
|
149
|
+
|
150
|
+
env = @configuration.environment( 'outer' )
|
151
|
+
assert_nil( env.feature )
|
152
|
+
|
153
|
+
end
|
154
|
+
|
155
|
+
end
|
156
|
+
|
@@ -0,0 +1,75 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
setup_database()
|
4
|
+
|
5
|
+
require 'build-tool/cfg/parser'
|
6
|
+
|
7
|
+
class ParserFeatureTest < ActiveSupport::TestCase
|
8
|
+
|
9
|
+
def setup
|
10
|
+
@configuration = BuildTool::Configuration.new()
|
11
|
+
@configuration.truncate()
|
12
|
+
@parser = BuildTool::Cfg::Parser.new( @configuration )
|
13
|
+
@localparser = BuildTool::Cfg::Parser.new( @configuration, false )
|
14
|
+
end
|
15
|
+
|
16
|
+
test 'Parses a valid feature declaration' do
|
17
|
+
assert_nothing_raised() { @parser.parse_string <<-EOF }
|
18
|
+
feature "test_default"
|
19
|
+
end
|
20
|
+
feature "test_disabled"
|
21
|
+
end
|
22
|
+
disable feature "test_disabled"
|
23
|
+
EOF
|
24
|
+
# Now check the parsed configuration
|
25
|
+
assert( @configuration.feature( 'test_default' ).default_active? )
|
26
|
+
assert( @configuration.feature( 'test_default' ).active? )
|
27
|
+
assert( !@configuration.feature( 'test_disabled' ).default_active? )
|
28
|
+
assert( !@configuration.feature( 'test_disabled' ).active? )
|
29
|
+
|
30
|
+
# Parse a local config file
|
31
|
+
@localparser.parse_string <<-EOF
|
32
|
+
disable feature "test_default"
|
33
|
+
enable feature "test_disabled"
|
34
|
+
EOF
|
35
|
+
|
36
|
+
# Now check the parsed configuration
|
37
|
+
assert( !@configuration.feature( 'test_default' ).active? )
|
38
|
+
assert( @configuration.feature( 'test_disabled' ).active? )
|
39
|
+
# But the defaults are the same
|
40
|
+
assert( @configuration.feature( 'test_default' ).default_active? )
|
41
|
+
assert( !@configuration.feature( 'test_disabled' ).default_active? )
|
42
|
+
@configuration.save()
|
43
|
+
end
|
44
|
+
|
45
|
+
test 'Keeps settings over reloads' do
|
46
|
+
assert_nothing_raised() { @parser.parse_string <<-EOF }
|
47
|
+
feature "test_default"
|
48
|
+
end
|
49
|
+
feature "test_disabled"
|
50
|
+
end
|
51
|
+
disable feature "test_disabled"
|
52
|
+
EOF
|
53
|
+
@configuration.feature( 'test_disabled' ).active = true
|
54
|
+
@configuration.feature( 'test_default' ).active = false
|
55
|
+
@configuration.save()
|
56
|
+
|
57
|
+
@configuration = BuildTool::Configuration.new()
|
58
|
+
@configuration.load()
|
59
|
+
@parser = BuildTool::Cfg::Parser.new( @configuration )
|
60
|
+
@localparser = BuildTool::Cfg::Parser.new( @configuration, false )
|
61
|
+
assert_nothing_raised() { @parser.parse_string <<-EOF }
|
62
|
+
feature "test_default"
|
63
|
+
end
|
64
|
+
feature "test_disabled"
|
65
|
+
end
|
66
|
+
disable feature "test_disabled"
|
67
|
+
EOF
|
68
|
+
|
69
|
+
# Now check the parsed configuration.
|
70
|
+
assert( !@configuration.feature( 'test_default' ).active? )
|
71
|
+
assert( @configuration.feature( 'test_disabled' ).active? )
|
72
|
+
|
73
|
+
end
|
74
|
+
|
75
|
+
end # class TestParserFeatureTest
|
@@ -0,0 +1,92 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
setup_database()
|
4
|
+
|
5
|
+
require 'build-tool/cfg/parser'
|
6
|
+
|
7
|
+
class TestParserGitSvn < ActiveSupport::TestCase
|
8
|
+
|
9
|
+
def setup
|
10
|
+
@configuration = BuildTool::Configuration.new()
|
11
|
+
@configuration.truncate()
|
12
|
+
@parser = BuildTool::Cfg::Parser.new( @configuration )
|
13
|
+
end
|
14
|
+
|
15
|
+
test "Parses a valid git-svn repository declation." do
|
16
|
+
@configuration.add_server( BuildTool::Server.new( 'svn.kde.org', 'svn://anonsvn.kde.org/home/kde' ) )
|
17
|
+
@configuration.add_repository( BuildTool::Repository.new( 'kde' ) )
|
18
|
+
@configuration.repository( 'kde' ).server = @configuration.server( 'svn.kde.org' )
|
19
|
+
assert_nothing_raised() { @parser.parse_string <<-EOF }
|
20
|
+
module "oxygen-icons"
|
21
|
+
vcs git-svn
|
22
|
+
remote-path "kdesupport/oxygen"
|
23
|
+
use repository "kde"
|
24
|
+
end # vcs
|
25
|
+
end # module
|
26
|
+
EOF
|
27
|
+
# Now check the parsed configuration
|
28
|
+
assert_not_nil( @configuration.module('oxygen-icons') )
|
29
|
+
assert_attributes(
|
30
|
+
@configuration.module('oxygen-icons'),
|
31
|
+
{
|
32
|
+
:vcs =>
|
33
|
+
{
|
34
|
+
:name => 'git-svn',
|
35
|
+
:config =>
|
36
|
+
{
|
37
|
+
:repository =>
|
38
|
+
{
|
39
|
+
:name => 'kde',
|
40
|
+
:url => 'svn://anonsvn.kde.org/home/kde'
|
41
|
+
},
|
42
|
+
:remote_path => "kdesupport/oxygen"
|
43
|
+
}
|
44
|
+
}
|
45
|
+
|
46
|
+
}
|
47
|
+
)
|
48
|
+
end
|
49
|
+
|
50
|
+
test "Git-SVN Repository inheritance works." do
|
51
|
+
@configuration.add_server( BuildTool::Server.new( 'svn.kde.org', 'svn://anonsvn.kde.org/home/kde' ) )
|
52
|
+
@configuration.add_repository( BuildTool::Repository.new( 'kde' ) )
|
53
|
+
@configuration.repository( 'kde' ).server = @configuration.server( 'svn.kde.org' )
|
54
|
+
assert_nothing_raised() { @parser.parse_string <<-EOF }
|
55
|
+
module "oxygen-icons"
|
56
|
+
vcs git-svn
|
57
|
+
remote-path "kdesupport/oxygen"
|
58
|
+
use repository "kde"
|
59
|
+
end # vcs
|
60
|
+
end # module
|
61
|
+
module "oxygen-icons"
|
62
|
+
vcs git-svn <
|
63
|
+
remote-path "kdesupport/oxygen-neu"
|
64
|
+
end # vcs
|
65
|
+
end # module
|
66
|
+
EOF
|
67
|
+
# Now check the parsed configuration
|
68
|
+
assert_not_nil( @configuration.module('oxygen-icons') )
|
69
|
+
assert_attributes(
|
70
|
+
@configuration.module('oxygen-icons'),
|
71
|
+
{
|
72
|
+
:vcs =>
|
73
|
+
{
|
74
|
+
:name => 'git-svn',
|
75
|
+
:config =>
|
76
|
+
{
|
77
|
+
:repository =>
|
78
|
+
{
|
79
|
+
:name => 'kde',
|
80
|
+
:url => 'svn://anonsvn.kde.org/home/kde'
|
81
|
+
},
|
82
|
+
:remote_path => "kdesupport/oxygen-neu"
|
83
|
+
}
|
84
|
+
}
|
85
|
+
|
86
|
+
}
|
87
|
+
)
|
88
|
+
end
|
89
|
+
|
90
|
+
end
|
91
|
+
|
92
|
+
|
@@ -0,0 +1,97 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
setup_database()
|
4
|
+
|
5
|
+
require 'build-tool/cfg/parser'
|
6
|
+
|
7
|
+
class TestParserGit < ActiveSupport::TestCase
|
8
|
+
|
9
|
+
def setup
|
10
|
+
@configuration = BuildTool::Configuration.new()
|
11
|
+
@configuration.truncate()
|
12
|
+
@parser = BuildTool::Cfg::Parser.new( @configuration )
|
13
|
+
end
|
14
|
+
|
15
|
+
test "Parses a valid git repository declation." do
|
16
|
+
@configuration.add_server( BuildTool::Server.new( 'anongit.gitorious.org', 'git://gitorious.org' ) )
|
17
|
+
assert_nothing_raised() { @parser.parse_string <<-EOF }
|
18
|
+
module "qt"
|
19
|
+
vcs git
|
20
|
+
|
21
|
+
remote "kde-qt"
|
22
|
+
url "anongit.gitorious.org" "+kde-developers/qt/kde-qt"
|
23
|
+
end
|
24
|
+
|
25
|
+
url "anongit.gitorious.org" "qt/qt"
|
26
|
+
|
27
|
+
# The remote branch we rebase against.
|
28
|
+
track "origin/4.8"
|
29
|
+
end # vcs
|
30
|
+
end # module
|
31
|
+
EOF
|
32
|
+
# Now check the parsed configuration
|
33
|
+
assert_not_nil( @configuration.module('qt') )
|
34
|
+
assert_attributes(
|
35
|
+
@configuration.module('qt'),
|
36
|
+
{
|
37
|
+
:vcs =>
|
38
|
+
{
|
39
|
+
:name => 'git',
|
40
|
+
:config => lambda { |x|
|
41
|
+
assert_not_nil( x.remote['origin'] )
|
42
|
+
assert_equal( 'git://gitorious.org/qt/qt' , x.remote['origin'].url )
|
43
|
+
assert_equal( 'origin/4.8', x.track )
|
44
|
+
}
|
45
|
+
}
|
46
|
+
|
47
|
+
}
|
48
|
+
)
|
49
|
+
end
|
50
|
+
|
51
|
+
test "Git Repository inheritance works." do
|
52
|
+
@configuration.add_server( BuildTool::Server.new( 'anongit.gitorious.org', 'git://anongit.gitorious.org' ) )
|
53
|
+
assert_nothing_raised() { @parser.parse_string <<-EOF }
|
54
|
+
module "qt"
|
55
|
+
vcs git
|
56
|
+
remote "kde-qt"
|
57
|
+
url "anongit.gitorious.org" "+kde-developers/qt/kde-qt"
|
58
|
+
end
|
59
|
+
url "anongit.gitorious.org" "qt/qt"
|
60
|
+
# The remote branch we rebase against.
|
61
|
+
track "origin/4.8"
|
62
|
+
end # vcs
|
63
|
+
end # module
|
64
|
+
|
65
|
+
module "qt"
|
66
|
+
vcs git <
|
67
|
+
remote "qt"
|
68
|
+
url "git://myurl"
|
69
|
+
end
|
70
|
+
track "origin/4.7"
|
71
|
+
end # vcs
|
72
|
+
end # module
|
73
|
+
EOF
|
74
|
+
# Now check the parsed configuration
|
75
|
+
assert_not_nil( @configuration.module('qt') )
|
76
|
+
assert_attributes(
|
77
|
+
@configuration.module('qt'),
|
78
|
+
{
|
79
|
+
:vcs =>
|
80
|
+
{
|
81
|
+
:name => 'git'
|
82
|
+
}
|
83
|
+
}
|
84
|
+
)
|
85
|
+
config = @configuration.module('qt').vcs.config
|
86
|
+
assert_not_nil( config.parent, 'has a parent' )
|
87
|
+
assert_equal( 'origin/4.7', config.track )
|
88
|
+
assert_not_nil( config.merged_remote['origin'], 'origin still set' )
|
89
|
+
assert_equal( 'git://anongit.gitorious.org/qt/qt' , config.merged_remote['origin'].url )
|
90
|
+
assert_not_nil( config.merged_remote['kde-qt'], 'kde-qt still set' )
|
91
|
+
assert_equal( 'git://anongit.gitorious.org/+kde-developers/qt/kde-qt' , config.merged_remote['kde-qt'].url )
|
92
|
+
assert_not_nil( config.merged_remote['qt'], 'qt there too' )
|
93
|
+
assert_equal( 'git://myurl' , config.merged_remote['qt'].url )
|
94
|
+
end
|
95
|
+
|
96
|
+
end
|
97
|
+
|
@@ -0,0 +1,77 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
require 'build-tool/cfg/parser'
|
4
|
+
|
5
|
+
class TestParserMercurial < ActiveSupport::TestCase
|
6
|
+
|
7
|
+
def setup
|
8
|
+
@configuration = BuildTool::Configuration.new()
|
9
|
+
@configuration.truncate()
|
10
|
+
@parser = BuildTool::Cfg::Parser.new( @configuration )
|
11
|
+
end
|
12
|
+
|
13
|
+
test "Parses a valid mercurial repository declation." do
|
14
|
+
assert_nothing_raised() { @parser.parse_string <<-EOF }
|
15
|
+
module "oxygen-icons"
|
16
|
+
vcs mercurial
|
17
|
+
url "https://mercurial.url/test"
|
18
|
+
track "branch"
|
19
|
+
end # vcs
|
20
|
+
end # module
|
21
|
+
EOF
|
22
|
+
# Now check the parsed configuration
|
23
|
+
assert_not_nil( @configuration.module('oxygen-icons') )
|
24
|
+
assert_attributes(
|
25
|
+
@configuration.module('oxygen-icons'),
|
26
|
+
{
|
27
|
+
:vcs =>
|
28
|
+
{
|
29
|
+
:name => 'mercurial',
|
30
|
+
:config =>
|
31
|
+
{
|
32
|
+
:url => 'https://mercurial.url/test',
|
33
|
+
:track => 'branch'
|
34
|
+
}
|
35
|
+
}
|
36
|
+
|
37
|
+
}
|
38
|
+
)
|
39
|
+
end
|
40
|
+
|
41
|
+
test "Git-SVN Repository inheritance works." do
|
42
|
+
assert_nothing_raised() { @parser.parse_string <<-EOF }
|
43
|
+
module "oxygen-icons"
|
44
|
+
vcs mercurial
|
45
|
+
url "https://mercurial.url/test"
|
46
|
+
track "branch"
|
47
|
+
end # vcs
|
48
|
+
end # module
|
49
|
+
module "oxygen-icons"
|
50
|
+
vcs mercurial <
|
51
|
+
track "other_branch"
|
52
|
+
end
|
53
|
+
end # module
|
54
|
+
EOF
|
55
|
+
# Now check the parsed configuration
|
56
|
+
assert_not_nil( @configuration.module('oxygen-icons') )
|
57
|
+
assert_attributes(
|
58
|
+
@configuration.module('oxygen-icons'),
|
59
|
+
{
|
60
|
+
:vcs =>
|
61
|
+
{
|
62
|
+
:name => 'mercurial',
|
63
|
+
:config =>
|
64
|
+
{
|
65
|
+
:url => 'https://mercurial.url/test',
|
66
|
+
:track => 'other_branch'
|
67
|
+
}
|
68
|
+
}
|
69
|
+
|
70
|
+
}
|
71
|
+
)
|
72
|
+
end
|
73
|
+
|
74
|
+
end
|
75
|
+
|
76
|
+
|
77
|
+
|