capistrano-sbt 0.0.7 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +20 -20
- data/capistrano-sbt.gemspec +7 -3
- data/lib/capistrano-sbt.rb +381 -168
- data/lib/capistrano-sbt/version.rb +2 -2
- data/test/centos6-64/.gitignore +5 -0
- data/test/centos6-64/Capfile +2 -0
- data/test/centos6-64/Gemfile +2 -0
- data/test/centos6-64/Vagrantfile +99 -0
- data/test/centos6-64/run.sh +7 -0
- data/test/config/deploy.rb +429 -0
- data/test/config/templates/global.sbt.erb +1 -0
- data/test/precise64/.gitignore +5 -0
- data/test/precise64/Capfile +2 -0
- data/test/precise64/Gemfile +2 -0
- data/test/precise64/Vagrantfile +99 -0
- data/test/precise64/run.sh +7 -0
- data/test/project/.gitignore +4 -0
- data/test/project/build.sbt +7 -0
- data/test/project/project/build.properties +1 -0
- data/test/project/src/main/scala/com/github/yyuu/Main.scala +7 -0
- metadata +103 -8
- data/lib/templates/global.sbt +0 -2
@@ -0,0 +1,99 @@
|
|
1
|
+
# -*- mode: ruby -*-
|
2
|
+
# vi: set ft=ruby :
|
3
|
+
|
4
|
+
Vagrant::Config.run do |config|
|
5
|
+
# All Vagrant configuration is done here. The most common configuration
|
6
|
+
# options are documented and commented below. For a complete reference,
|
7
|
+
# please see the online documentation at vagrantup.com.
|
8
|
+
|
9
|
+
# Every Vagrant virtual environment requires a box to build off of.
|
10
|
+
config.vm.box = "centos6-64"
|
11
|
+
|
12
|
+
# The url from where the 'config.vm.box' box will be fetched if it
|
13
|
+
# doesn't already exist on the user's system.
|
14
|
+
config.vm.box_url = "http://developer.nrel.gov/downloads/vagrant-boxes/CentOS-6.3-x86_64-v20130101.box"
|
15
|
+
|
16
|
+
# Boot with a GUI so you can see the screen. (Default is headless)
|
17
|
+
# config.vm.boot_mode = :gui
|
18
|
+
|
19
|
+
# Assign this VM to a host-only network IP, allowing you to access it
|
20
|
+
# via the IP. Host-only networks can talk to the host machine as well as
|
21
|
+
# any other machines on the same network, but cannot be accessed (through this
|
22
|
+
# network interface) by any external networks.
|
23
|
+
config.vm.network :hostonly, "192.168.33.10"
|
24
|
+
|
25
|
+
# Assign this VM to a bridged network, allowing you to connect directly to a
|
26
|
+
# network using the host's network device. This makes the VM appear as another
|
27
|
+
# physical device on your network.
|
28
|
+
# config.vm.network :bridged
|
29
|
+
|
30
|
+
# Forward a port from the guest to the host, which allows for outside
|
31
|
+
# computers to access the VM, whereas host only networking does not.
|
32
|
+
# config.vm.forward_port 80, 8080
|
33
|
+
|
34
|
+
# Share an additional folder to the guest VM. The first argument is
|
35
|
+
# an identifier, the second is the path on the guest to mount the
|
36
|
+
# folder, and the third is the path on the host to the actual folder.
|
37
|
+
# config.vm.share_folder "v-data", "/vagrant_data", "../data"
|
38
|
+
|
39
|
+
# Enable provisioning with Puppet stand alone. Puppet manifests
|
40
|
+
# are contained in a directory path relative to this Vagrantfile.
|
41
|
+
# You will need to create the manifests directory and a manifest in
|
42
|
+
# the file precise-amd64.pp in the manifests_path directory.
|
43
|
+
#
|
44
|
+
# An example Puppet manifest to provision the message of the day:
|
45
|
+
#
|
46
|
+
# # group { "puppet":
|
47
|
+
# # ensure => "present",
|
48
|
+
# # }
|
49
|
+
# #
|
50
|
+
# # File { owner => 0, group => 0, mode => 0644 }
|
51
|
+
# #
|
52
|
+
# # file { '/etc/motd':
|
53
|
+
# # content => "Welcome to your Vagrant-built virtual machine!
|
54
|
+
# # Managed by Puppet.\n"
|
55
|
+
# # }
|
56
|
+
#
|
57
|
+
# config.vm.provision :puppet do |puppet|
|
58
|
+
# puppet.manifests_path = "manifests"
|
59
|
+
# puppet.manifest_file = "precise-amd64.pp"
|
60
|
+
# end
|
61
|
+
|
62
|
+
# Enable provisioning with chef solo, specifying a cookbooks path, roles
|
63
|
+
# path, and data_bags path (all relative to this Vagrantfile), and adding
|
64
|
+
# some recipes and/or roles.
|
65
|
+
#
|
66
|
+
# config.vm.provision :chef_solo do |chef|
|
67
|
+
# chef.cookbooks_path = "../my-recipes/cookbooks"
|
68
|
+
# chef.roles_path = "../my-recipes/roles"
|
69
|
+
# chef.data_bags_path = "../my-recipes/data_bags"
|
70
|
+
# chef.add_recipe "mysql"
|
71
|
+
# chef.add_role "web"
|
72
|
+
#
|
73
|
+
# # You may also specify custom JSON attributes:
|
74
|
+
# chef.json = { :mysql_password => "foo" }
|
75
|
+
# end
|
76
|
+
|
77
|
+
# Enable provisioning with chef server, specifying the chef server URL,
|
78
|
+
# and the path to the validation key (relative to this Vagrantfile).
|
79
|
+
#
|
80
|
+
# The Opscode Platform uses HTTPS. Substitute your organization for
|
81
|
+
# ORGNAME in the URL and validation key.
|
82
|
+
#
|
83
|
+
# If you have your own Chef Server, use the appropriate URL, which may be
|
84
|
+
# HTTP instead of HTTPS depending on your configuration. Also change the
|
85
|
+
# validation key to validation.pem.
|
86
|
+
#
|
87
|
+
# config.vm.provision :chef_client do |chef|
|
88
|
+
# chef.chef_server_url = "https://api.opscode.com/organizations/ORGNAME"
|
89
|
+
# chef.validation_key_path = "ORGNAME-validator.pem"
|
90
|
+
# end
|
91
|
+
#
|
92
|
+
# If you're using the Opscode platform, your validator client is
|
93
|
+
# ORGNAME-validator, replacing ORGNAME with your organization name.
|
94
|
+
#
|
95
|
+
# IF you have your own Chef Server, the default validation client name is
|
96
|
+
# chef-validator, unless you changed the configuration.
|
97
|
+
#
|
98
|
+
# chef.validation_client_name = "ORGNAME-validator"
|
99
|
+
end
|
@@ -0,0 +1,429 @@
|
|
1
|
+
set :application, "capistrano-sbt"
|
2
|
+
set :repository, File.expand_path("../project", File.dirname(__FILE__))
|
3
|
+
set :deploy_to do
|
4
|
+
File.join("/home", user, application)
|
5
|
+
end
|
6
|
+
set :deploy_via, :copy
|
7
|
+
set :scm, :none
|
8
|
+
set :use_sudo, false
|
9
|
+
set :user, "vagrant"
|
10
|
+
set :password, "vagrant"
|
11
|
+
set :ssh_options, {:user_known_hosts_file => "/dev/null"}
|
12
|
+
|
13
|
+
## java ##
|
14
|
+
require "capistrano-jdk-installer"
|
15
|
+
set(:java_version_name, "7u15")
|
16
|
+
set(:java_oracle_username) { ENV["JAVA_ORACLE_USERNAME"] || abort("java_oracle_username was not set") }
|
17
|
+
set(:java_oracle_password) { ENV["JAVA_ORACLE_PASSWORD"] || abort("java_oracle_password was not set") }
|
18
|
+
set(:java_tools_path_local) { File.expand_path("tmp/java") }
|
19
|
+
set(:java_accept_license, true)
|
20
|
+
set(:java_license_title, "Oracle Binary Code License Agreement for Java SE")
|
21
|
+
set(:java_setup_remotely, true)
|
22
|
+
set(:java_setup_locally, true)
|
23
|
+
|
24
|
+
## sbt ##
|
25
|
+
set(:sbt_tools_path_local, File.expand_path("tmp/sbt"))
|
26
|
+
set(:sbt_project_path) { release_path }
|
27
|
+
set(:sbt_project_path_local, repository)
|
28
|
+
set(:sbt_settings_path_local, File.expand_path("tmp/sbt/global.base"))
|
29
|
+
|
30
|
+
role :web, "192.168.33.10"
|
31
|
+
role :app, "192.168.33.10"
|
32
|
+
role :db, "192.168.33.10", :primary => true
|
33
|
+
|
34
|
+
$LOAD_PATH.push(File.expand_path("../../lib", File.dirname(__FILE__)))
|
35
|
+
require "capistrano-sbt"
|
36
|
+
|
37
|
+
def _invoke_command(cmdline, options={})
|
38
|
+
if options[:via] == :run_locally
|
39
|
+
run_locally(cmdline)
|
40
|
+
else
|
41
|
+
invoke_command(cmdline, options)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def assert_file_exists(file, options={})
|
46
|
+
begin
|
47
|
+
_invoke_command("test -f #{file.dump}", options)
|
48
|
+
rescue
|
49
|
+
logger.debug("assert_file_exists(#{file}) failed.")
|
50
|
+
_invoke_command("ls #{File.dirname(file).dump}", options)
|
51
|
+
raise
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
def assert_file_not_exists(file, options={})
|
56
|
+
begin
|
57
|
+
_invoke_command("test \! -f #{file.dump}", options)
|
58
|
+
rescue
|
59
|
+
logger.debug("assert_file_not_exists(#{file}) failed.")
|
60
|
+
_invoke_command("ls #{File.dirname(file).dump}", options)
|
61
|
+
raise
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
def assert_command(cmdline, options={})
|
66
|
+
begin
|
67
|
+
_invoke_command(cmdline, options)
|
68
|
+
rescue
|
69
|
+
logger.debug("assert_command(#{cmdline}) failed.")
|
70
|
+
raise
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
def assert_command_fails(cmdline, options={})
|
75
|
+
failed = false
|
76
|
+
begin
|
77
|
+
_invoke_command(cmdline, options)
|
78
|
+
rescue
|
79
|
+
logger.debug("assert_command_fails(#{cmdline}) failed.")
|
80
|
+
failed = true
|
81
|
+
ensure
|
82
|
+
abort unless failed
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
def reset_sbt!
|
87
|
+
variables.each_key do |key|
|
88
|
+
reset!(key) if /^sbt_/ =~ key
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
def uninstall_sbt!
|
93
|
+
run("rm -rf #{sbt_path.dump}")
|
94
|
+
run("rm -f #{sbt_settings.map { |x| File.join(sbt_settings_path, x).dump }.join(" ")}") unless sbt_settings.empty?
|
95
|
+
run_locally("rm -f #{sbt_settings_local.map { |x| File.join(sbt_settings_path_local, x).dump }.join(" ")}") unless sbt_settings_local.empty?
|
96
|
+
run("rm -rf #{sbt_target_path.dump}")
|
97
|
+
run_locally("rm -rf #{sbt_target_path_local.dump}")
|
98
|
+
reset_sbt!
|
99
|
+
end
|
100
|
+
|
101
|
+
task(:test_all) {
|
102
|
+
find_and_execute_task("test_default")
|
103
|
+
find_and_execute_task("test_with_remote")
|
104
|
+
find_and_execute_task("test_with_local")
|
105
|
+
find_and_execute_task("test_with_release_build")
|
106
|
+
find_and_execute_task("test_with_launch_jar")
|
107
|
+
}
|
108
|
+
|
109
|
+
on(:start) {
|
110
|
+
run("rm -rf #{deploy_to.dump}")
|
111
|
+
}
|
112
|
+
|
113
|
+
namespace(:test_default) {
|
114
|
+
task(:default) {
|
115
|
+
methods.grep(/^test_/).each do |m|
|
116
|
+
send(m)
|
117
|
+
end
|
118
|
+
}
|
119
|
+
before "test_default", "test_default:setup"
|
120
|
+
after "test_default", "test_default:teardown"
|
121
|
+
|
122
|
+
task(:setup) {
|
123
|
+
uninstall_sbt!
|
124
|
+
# set(:sbt_version, "0.12.2")
|
125
|
+
set(:sbt_use_extras, true)
|
126
|
+
set(:sbt_setup_remotely, true)
|
127
|
+
set(:sbt_setup_locally, true)
|
128
|
+
set(:sbt_update_remotely, true)
|
129
|
+
set(:sbt_update_locally, true)
|
130
|
+
set(:sbt_template_path, File.join(File.dirname(__FILE__), "templates"))
|
131
|
+
set(:sbt_settings, %w(global.sbt))
|
132
|
+
set(:sbt_release_build, false)
|
133
|
+
find_and_execute_task("sbt:setup_default_environment")
|
134
|
+
find_and_execute_task("deploy:setup")
|
135
|
+
find_and_execute_task("deploy")
|
136
|
+
}
|
137
|
+
|
138
|
+
task(:teardown) {
|
139
|
+
uninstall_sbt!
|
140
|
+
}
|
141
|
+
|
142
|
+
task(:test_run_sbt) {
|
143
|
+
assert_file_exists(sbt_bin)
|
144
|
+
assert_file_exists(File.join(sbt_settings_path, "global.sbt"))
|
145
|
+
assert_command("cd #{sbt_project_path.dump} && #{sbt_cmd} --version")
|
146
|
+
}
|
147
|
+
|
148
|
+
# task(:test_run_sbt_via_sudo) {
|
149
|
+
# assert_command("cd #{sbt_project_path.dump} && #{sbt_cmd} --version", :via => :sudo)
|
150
|
+
# }
|
151
|
+
|
152
|
+
task(:test_run_sbt_without_path) {
|
153
|
+
assert_command("cd #{sbt_project_path.dump} && sbt --version")
|
154
|
+
}
|
155
|
+
|
156
|
+
task(:test_run_sbt_via_run_locally) {
|
157
|
+
assert_file_exists(sbt_bin_local, :via => :run_locally)
|
158
|
+
assert_file_exists(File.join(sbt_settings_path_local, "global.sbt"), :via => :run_locally)
|
159
|
+
assert_command("cd #{sbt_project_path_local.dump} && #{sbt_cmd_local} --version", :via => :run_locally)
|
160
|
+
}
|
161
|
+
|
162
|
+
task(:test_sbt_exec) {
|
163
|
+
sbt.exec("--version")
|
164
|
+
}
|
165
|
+
|
166
|
+
task(:test_sbt_exec_locally) {
|
167
|
+
sbt.exec_locally("--version")
|
168
|
+
}
|
169
|
+
|
170
|
+
task(:test_sbt_artifact) {
|
171
|
+
assert_file_exists(File.join(sbt_target_path, "scala-2.10", "capistrano-sbt_2.10-0.0.1-SNAPSHOT.jar"))
|
172
|
+
}
|
173
|
+
|
174
|
+
task(:test_sbt_artifact_locally) {
|
175
|
+
assert_file_exists(File.join(sbt_target_path_local, "scala-2.10", "capistrano-sbt_2.10-0.0.1-SNAPSHOT.jar"), :via => :run_locally)
|
176
|
+
}
|
177
|
+
}
|
178
|
+
|
179
|
+
namespace(:test_with_remote) {
|
180
|
+
task(:default) {
|
181
|
+
methods.grep(/^test_/).each do |m|
|
182
|
+
send(m)
|
183
|
+
end
|
184
|
+
}
|
185
|
+
before "test_with_remote", "test_with_remote:setup"
|
186
|
+
after "test_with_remote", "test_with_remote:teardown"
|
187
|
+
|
188
|
+
task(:setup) {
|
189
|
+
uninstall_sbt!
|
190
|
+
# set(:sbt_version, "0.12.2")
|
191
|
+
set(:sbt_use_extras, true)
|
192
|
+
set(:sbt_setup_remotely, true)
|
193
|
+
set(:sbt_setup_locally, false)
|
194
|
+
set(:sbt_update_remotely, true)
|
195
|
+
set(:sbt_update_locally, false)
|
196
|
+
set(:sbt_template_path, File.join(File.dirname(__FILE__), "templates"))
|
197
|
+
set(:sbt_settings, %w(global.sbt))
|
198
|
+
set(:sbt_release_build, false)
|
199
|
+
find_and_execute_task("sbt:setup_default_environment")
|
200
|
+
find_and_execute_task("deploy:setup")
|
201
|
+
find_and_execute_task("deploy")
|
202
|
+
}
|
203
|
+
|
204
|
+
task(:teardown) {
|
205
|
+
uninstall_sbt!
|
206
|
+
}
|
207
|
+
|
208
|
+
task(:test_run_sbt) {
|
209
|
+
assert_file_exists(sbt_bin)
|
210
|
+
assert_file_exists(File.join(sbt_settings_path, "global.sbt"))
|
211
|
+
assert_command("cd #{sbt_project_path.dump} && #{sbt_cmd} --version")
|
212
|
+
}
|
213
|
+
|
214
|
+
# task(:test_run_sbt_via_sudo) {
|
215
|
+
# assert_command("cd #{sbt_project_path.dump} && #{sbt_cmd} --version", :via => :sudo)
|
216
|
+
# }
|
217
|
+
|
218
|
+
task(:test_run_sbt_without_path) {
|
219
|
+
assert_command("cd #{sbt_project_path.dump} && sbt --version")
|
220
|
+
}
|
221
|
+
|
222
|
+
task(:test_run_sbt_via_run_locally) {
|
223
|
+
# assert_file_not_exists(sbt_bin_local, :via => :run_locally)
|
224
|
+
assert_file_not_exists(File.join(sbt_settings_path_local, "global.sbt"), :via => :run_locally)
|
225
|
+
# assert_command_fails("cd #{sbt_project_path_local.dump} && #{sbt_cmd_local} --version", :via => :run_locally)
|
226
|
+
}
|
227
|
+
|
228
|
+
task(:test_sbt_exec) {
|
229
|
+
sbt.exec("--version")
|
230
|
+
}
|
231
|
+
|
232
|
+
# task(:test_sbt_exec_locally) {
|
233
|
+
# sbt.exec_locally("--version")
|
234
|
+
# }
|
235
|
+
|
236
|
+
task(:test_sbt_artifact) {
|
237
|
+
assert_file_exists(File.join(sbt_target_path, "scala-2.10", "capistrano-sbt_2.10-0.0.1-SNAPSHOT.jar"))
|
238
|
+
}
|
239
|
+
|
240
|
+
task(:test_sbt_artifact_locally) {
|
241
|
+
assert_file_not_exists(File.join(sbt_target_path_local, "scala-2.10", "capistrano-sbt_2.10-0.0.1-SNAPSHOT.jar"), :via => :run_locally)
|
242
|
+
}
|
243
|
+
}
|
244
|
+
|
245
|
+
namespace(:test_with_local) {
|
246
|
+
task(:default) {
|
247
|
+
methods.grep(/^test_/).each do |m|
|
248
|
+
send(m)
|
249
|
+
end
|
250
|
+
}
|
251
|
+
before "test_with_local", "test_with_local:setup"
|
252
|
+
after "test_with_local", "test_with_local:teardown"
|
253
|
+
|
254
|
+
task(:setup) {
|
255
|
+
uninstall_sbt!
|
256
|
+
# set(:sbt_version, "0.12.2")
|
257
|
+
set(:sbt_use_extras, true)
|
258
|
+
set(:sbt_setup_remotely, false)
|
259
|
+
set(:sbt_setup_locally, true)
|
260
|
+
set(:sbt_update_remotely, false)
|
261
|
+
set(:sbt_update_locally, true)
|
262
|
+
set(:sbt_template_path, File.join(File.dirname(__FILE__), "templates"))
|
263
|
+
set(:sbt_settings, %w(global.sbt))
|
264
|
+
set(:sbt_release_build, false)
|
265
|
+
find_and_execute_task("sbt:setup_default_environment")
|
266
|
+
find_and_execute_task("deploy:setup")
|
267
|
+
find_and_execute_task("deploy")
|
268
|
+
}
|
269
|
+
|
270
|
+
task(:teardown) {
|
271
|
+
uninstall_sbt!
|
272
|
+
}
|
273
|
+
|
274
|
+
task(:test_run_sbt) {
|
275
|
+
assert_file_not_exists(sbt_bin)
|
276
|
+
assert_file_not_exists(File.join(sbt_settings_path, "global.sbt"))
|
277
|
+
assert_command_fails("cd #{sbt_project_path.dump} && #{sbt_cmd} --version")
|
278
|
+
}
|
279
|
+
|
280
|
+
# task(:test_run_sbt_via_sudo) {
|
281
|
+
# assert_command_fails("cd #{sbt_project_path.dump} && #{sbt_cmd} --version", :via => :sudo)
|
282
|
+
# }
|
283
|
+
|
284
|
+
task(:test_run_sbt_without_path) {
|
285
|
+
assert_command_fails("cd #{sbt_project_path.dump} && sbt --version")
|
286
|
+
}
|
287
|
+
|
288
|
+
task(:test_run_sbt_via_run_locally) {
|
289
|
+
assert_file_exists(sbt_bin_local, :via => :run_locally)
|
290
|
+
assert_file_exists(File.join(sbt_settings_path_local, "global.sbt"), :via => :run_locally)
|
291
|
+
assert_command("cd #{sbt_project_path_local.dump} && #{sbt_cmd_local} --version", :via => :run_locally)
|
292
|
+
}
|
293
|
+
|
294
|
+
# task(:test_sbt_exec) {
|
295
|
+
# sbt.exec("--version")
|
296
|
+
# }
|
297
|
+
|
298
|
+
task(:test_sbt_exec_locally) {
|
299
|
+
sbt.exec_locally("--version")
|
300
|
+
}
|
301
|
+
|
302
|
+
task(:test_sbt_artifact) {
|
303
|
+
assert_file_exists(File.join(sbt_target_path, "scala-2.10", "capistrano-sbt_2.10-0.0.1-SNAPSHOT.jar"))
|
304
|
+
}
|
305
|
+
|
306
|
+
task(:test_sbt_artifact_locally) {
|
307
|
+
assert_file_exists(File.join(sbt_target_path_local, "scala-2.10", "capistrano-sbt_2.10-0.0.1-SNAPSHOT.jar"), :via => :run_locally)
|
308
|
+
}
|
309
|
+
}
|
310
|
+
|
311
|
+
namespace(:test_with_release_build) {
|
312
|
+
task(:default) {
|
313
|
+
methods.grep(/^test_/).each do |m|
|
314
|
+
send(m)
|
315
|
+
end
|
316
|
+
}
|
317
|
+
before "test_with_release_build", "test_with_release_build:setup"
|
318
|
+
after "test_with_release_build", "test_with_release_build:teardown"
|
319
|
+
|
320
|
+
task(:setup) {
|
321
|
+
uninstall_sbt!
|
322
|
+
# set(:sbt_version, "0.12.2")
|
323
|
+
set(:sbt_use_extras, true)
|
324
|
+
set(:sbt_setup_remotely, true)
|
325
|
+
set(:sbt_setup_locally, true)
|
326
|
+
set(:sbt_update_remotely, true)
|
327
|
+
set(:sbt_update_locally, true)
|
328
|
+
set(:sbt_template_path, File.join(File.dirname(__FILE__), "templates"))
|
329
|
+
set(:sbt_settings, %w(global.sbt))
|
330
|
+
set(:sbt_release_build, true)
|
331
|
+
find_and_execute_task("sbt:setup_default_environment")
|
332
|
+
find_and_execute_task("deploy:setup")
|
333
|
+
# find_and_execute_task("deploy")
|
334
|
+
}
|
335
|
+
|
336
|
+
task(:teardown) {
|
337
|
+
uninstall_sbt!
|
338
|
+
}
|
339
|
+
|
340
|
+
task(:test_build_release) {
|
341
|
+
reset_sbt!
|
342
|
+
begin
|
343
|
+
File.write(File.join(sbt_project_path_local, "version.sbt"), %q{version := "0.0.1"})
|
344
|
+
find_and_execute_task("deploy")
|
345
|
+
ensure
|
346
|
+
run_locally("rm -f #{File.join(sbt_project_path_local, "version.sbt").dump}")
|
347
|
+
end
|
348
|
+
}
|
349
|
+
|
350
|
+
task(:test_build_snapshot) {
|
351
|
+
reset_sbt!
|
352
|
+
begin
|
353
|
+
find_and_execute_task("deploy")
|
354
|
+
rescue SystemExit
|
355
|
+
aborted = true
|
356
|
+
ensure
|
357
|
+
run_locally("rm -f #{File.join(sbt_project_path_local, "version.sbt").dump}")
|
358
|
+
abort("must fail with SNAPSHOT version") unless aborted
|
359
|
+
end
|
360
|
+
}
|
361
|
+
}
|
362
|
+
|
363
|
+
namespace(:test_with_launch_jar) {
|
364
|
+
task(:default) {
|
365
|
+
methods.grep(/^test_/).each do |m|
|
366
|
+
send(m)
|
367
|
+
end
|
368
|
+
}
|
369
|
+
before "test_with_launch_jar", "test_with_launch_jar:setup"
|
370
|
+
after "test_with_launch_jar", "test_with_launch_jar:teardown"
|
371
|
+
|
372
|
+
task(:setup) {
|
373
|
+
uninstall_sbt!
|
374
|
+
# set(:sbt_version, "0.12.2")
|
375
|
+
set(:sbt_use_extras, false)
|
376
|
+
set(:sbt_setup_remotely, true)
|
377
|
+
set(:sbt_setup_locally, true)
|
378
|
+
set(:sbt_update_remotely, true)
|
379
|
+
set(:sbt_update_locally, true)
|
380
|
+
set(:sbt_template_path, File.join(File.dirname(__FILE__), "templates"))
|
381
|
+
set(:sbt_settings, %w(global.sbt))
|
382
|
+
set(:sbt_release_build, false)
|
383
|
+
find_and_execute_task("sbt:setup_default_environment")
|
384
|
+
find_and_execute_task("deploy:setup")
|
385
|
+
find_and_execute_task("deploy")
|
386
|
+
}
|
387
|
+
|
388
|
+
task(:teardown) {
|
389
|
+
uninstall_sbt!
|
390
|
+
}
|
391
|
+
|
392
|
+
task(:test_run_sbt) {
|
393
|
+
assert_file_exists(sbt_bin)
|
394
|
+
assert_file_exists(File.join(sbt_settings_path, "global.sbt"))
|
395
|
+
assert_command("cd #{sbt_project_path.dump} && #{sbt_cmd} --version")
|
396
|
+
}
|
397
|
+
|
398
|
+
# task(:test_run_sbt_via_sudo) {
|
399
|
+
# assert_command("cd #{sbt_project_path.dump} && #{sbt_cmd} --version", :via => :sudo)
|
400
|
+
# }
|
401
|
+
|
402
|
+
task(:test_run_sbt_without_path) {
|
403
|
+
assert_command("cd #{sbt_project_path.dump} && sbt --version")
|
404
|
+
}
|
405
|
+
|
406
|
+
task(:test_run_sbt_via_run_locally) {
|
407
|
+
assert_file_exists(sbt_bin_local, :via => :run_locally)
|
408
|
+
assert_file_exists(File.join(sbt_settings_path_local, "global.sbt"), :via => :run_locally)
|
409
|
+
assert_command("cd #{sbt_project_path_local.dump} && #{sbt_cmd_local} --version", :via => :run_locally)
|
410
|
+
}
|
411
|
+
|
412
|
+
task(:test_sbt_exec) {
|
413
|
+
sbt.exec("--version")
|
414
|
+
}
|
415
|
+
|
416
|
+
task(:test_sbt_exec_locally) {
|
417
|
+
sbt.exec_locally("--version")
|
418
|
+
}
|
419
|
+
|
420
|
+
task(:test_sbt_artifact) {
|
421
|
+
assert_file_exists(File.join(sbt_target_path, "scala-2.10", "capistrano-sbt_2.10-0.0.1-SNAPSHOT.jar"))
|
422
|
+
}
|
423
|
+
|
424
|
+
task(:test_sbt_artifact_locally) {
|
425
|
+
assert_file_exists(File.join(sbt_target_path_local, "scala-2.10", "capistrano-sbt_2.10-0.0.1-SNAPSHOT.jar"), :via => :run_locally)
|
426
|
+
}
|
427
|
+
}
|
428
|
+
|
429
|
+
# vim:set ft=ruby sw=2 ts=2 :
|