rhoconnect 3.1.1 → 3.1.2
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/CHANGELOG.md +7 -0
- data/Gemfile +3 -3
- data/Gemfile.lock +26 -45
- data/Rakefile +2 -3
- data/bench/bench_runner.rb +37 -37
- data/bench/benchapp/Gemfile.lock +4 -5
- data/bench/benchapp/config.ru +1 -5
- data/bench/benchapp/spec/spec_helper.rb +0 -13
- data/bench/blobapp/Gemfile.lock +8 -9
- data/bench/blobapp/config.ru +1 -2
- data/bench/blobapp/spec/spec_helper.rb +0 -13
- data/bench/lib/bench/aws_utils.rb +0 -1
- data/bench/spec/bench_spec_helper.rb +1 -1
- data/doc/java-plugin.txt +176 -49
- data/doc/net-plugin.txt +150 -70
- data/doc/plugin-intro.txt +2 -2
- data/doc/supported-platforms.txt +12 -11
- data/generators/templates/application/config.ru +1 -2
- data/generators/templates/application/spec/spec_helper.rb +0 -15
- data/install.sh +3 -3
- data/installer/unix-like/create_texts.rb +2 -2
- data/installer/unix-like/rho_connect_install_constants.rb +3 -3
- data/installer/unix-like/rho_connect_install_utilities.rb +0 -1
- data/installer/utils/constants.rb +5 -5
- data/installer/utils/create_sha1.rb +26 -0
- data/installer/utils/delete_from_s3.rb +32 -0
- data/installer/utils/download_from_s3.rb +55 -0
- data/installer/utils/nix_install_test.rb +29 -19
- data/installer/utils/package_upload/repos.rake +52 -40
- data/installer/utils/package_upload/s3_upload.rb +7 -28
- data/installer/utils/verify_checksum.rb +33 -0
- data/installer/windows/rhosync.nsi +5 -5
- data/lib/rhoconnect.rb +1 -1
- data/lib/rhoconnect/app.rb +0 -3
- data/lib/rhoconnect/predefined_adapters/bench_adapter.rb +6 -0
- data/lib/rhoconnect/server.rb +27 -24
- data/lib/rhoconnect/stats/middleware.rb +13 -8
- data/lib/rhoconnect/store.rb +12 -10
- data/lib/rhoconnect/version.rb +1 -1
- data/rhoconnect.gemspec +2 -2
- data/spec/api/admin/api_token_spec.rb +0 -1
- data/spec/api/admin/stats_spec.rb +3 -0
- data/spec/api/api_helper.rb +2 -2
- data/spec/api/user/list_users_spec.rb +2 -2
- data/spec/api_token_spec.rb +0 -1
- data/spec/app_spec.rb +0 -1
- data/spec/bulk_data/bulk_data_spec.rb +0 -1
- data/spec/client_spec.rb +0 -1
- data/spec/client_sync_spec.rb +0 -2
- data/spec/document_spec.rb +0 -1
- data/spec/dynamic_adapter_spec.rb +0 -2
- data/spec/jobs/bulk_data_job_spec.rb +0 -1
- data/spec/jobs/ping_job_spec.rb +0 -1
- data/spec/jobs/source_job_spec.rb +0 -1
- data/spec/license_spec.rb +0 -1
- data/spec/perf/perf_spec_helper.rb +0 -1
- data/spec/ping/android_spec.rb +0 -1
- data/spec/ping/apple_spec.rb +0 -1
- data/spec/ping/blackberry_spec.rb +0 -1
- data/spec/read_state_spec.rb +0 -1
- data/spec/rhoconnect_spec.rb +0 -1
- data/spec/server/server_spec.rb +1 -12
- data/spec/source_adapter_spec.rb +0 -1
- data/spec/source_spec.rb +0 -1
- data/spec/source_sync_spec.rb +0 -1
- data/spec/spec_helper.rb +8 -19
- data/spec/stats/middleware_spec.rb +9 -0
- data/spec/stats/record_spec.rb +1 -0
- data/spec/store_spec.rb +6 -1
- data/spec/sync_states_spec.rb +0 -1
- data/spec/test_methods_spec.rb +0 -1
- data/spec/user_spec.rb +0 -1
- data/tasks/redis.rake +4 -2
- metadata +421 -436
- data/bin/thorhoconnect +0 -79
- data/installer/utils/package_upload/auto-repo.rb +0 -136
data/doc/plugin-intro.txt
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
RhoConnect Plugins Introduction
|
2
2
|
===
|
3
3
|
|
4
|
-
Rhoconnect Plugins allow you to connect your backend apps seamlessly with rhoconnect. You can write the source (query, create, update and delete operations) into a backend application, and
|
4
|
+
Rhoconnect Plugins allow you to connect your backend apps seamlessly with rhoconnect. You can write the source (query, create, update and delete operations) into a backend application, and use a RhoConnect plugin in the language that matchs your backend application, such as Java or .NET.
|
5
5
|
|
6
6
|
<img src='https://s3.amazonaws.com/rhodocs/rhoconnect-service/intro-plugin.png' alt='image' height='467' width='800' />
|
7
7
|
|
8
|
-
**NOTE
|
8
|
+
**NOTE: Another way to connect particular backend applications (such as for Salesforce or Oracle) is to generate a [RhoConnect source adapter](/rhoconnect/source-adapters) which contains the query, create, update and delete operations.**
|
data/doc/supported-platforms.txt
CHANGED
@@ -15,22 +15,22 @@ Supported Platforms
|
|
15
15
|
</tr>
|
16
16
|
<tr>
|
17
17
|
<td class='cap'>Linux</td>
|
18
|
-
<td> CentOS 5 & 6,<br/>Ubuntu 11,<br/>Amazon Linux</td>
|
19
|
-
<td> ruby-1.8.7-
|
20
|
-
<td> ree-1.8.7-
|
18
|
+
<td> CentOS / RHEL 5 & 6,<br/>Ubuntu 11,<br/>Amazon Linux</td>
|
19
|
+
<td> ruby-1.8.7-p358 </td>
|
20
|
+
<td> ree-1.8.7-2012.02 </td>
|
21
21
|
<td> ruby-1.9.2-p290 </td>
|
22
|
-
<td> ruby-1.9.3-
|
23
|
-
<td> jruby-1.6.
|
22
|
+
<td> ruby-1.9.3-p125 </td>
|
23
|
+
<td> jruby-1.6.7 </td>
|
24
24
|
<td>Development &<br/>Production</td>
|
25
25
|
</tr>
|
26
26
|
<tr>
|
27
27
|
<td class='cap'>Mac OS </td>
|
28
28
|
<td> Mac OS X 10.6/10.7 </td>
|
29
|
-
<td> ruby-1.8.7-
|
30
|
-
<td> ree-1.8.7-
|
29
|
+
<td> ruby-1.8.7-p358 </td>
|
30
|
+
<td> ree-1.8.7-2012.02 </td>
|
31
31
|
<td> ruby-1.9.2-p290 </td>
|
32
|
-
<td> ruby-1.9.3-
|
33
|
-
<td> jruby-1.6.
|
32
|
+
<td> ruby-1.9.3-p125 </td>
|
33
|
+
<td> jruby-1.6.7 </td>
|
34
34
|
<td>Development &<br/>Production</td>
|
35
35
|
</tr>
|
36
36
|
<tr>
|
@@ -69,5 +69,6 @@ RhoConnect for Linux and Mac OS X is supported for both development and producti
|
|
69
69
|
## Known Issues
|
70
70
|
|
71
71
|
* Windows platform: only pre-release (~> 1.0.0.beta) of <b>eventmachine</b> is working on Windows
|
72
|
-
* Examples for <b>RSpec</b> (~> 2.8.0) fail for Ruby 1.8.7, gemset locked to ver. >= 2.6.0
|
73
|
-
*
|
72
|
+
* Examples for <b>RSpec</b> (~> 2.8.0) fail for Ruby 1.8.7, gemset locked to ver. >= 2.6.0. <b>Issue is fixed in v. 3.1.2.</b>
|
73
|
+
* Rack is locked to version 1.3.6 due to issues with RhoConnect applications deployed on Heroku (502 server error if rhoconnect bundled with rake 1.4.1). <b>Fixed in v. 3.1.2.</b>
|
74
|
+
|
@@ -33,8 +33,7 @@ Rhoconnect::Server.set :root, ROOT_PATH
|
|
33
33
|
Rhoconnect::Server.use Rack::Static, :urls => ["/data"], :root => Rhoconnect::Server.root
|
34
34
|
|
35
35
|
# Load our rhoconnect application
|
36
|
-
|
37
|
-
require 'application'
|
36
|
+
require "#{ROOT_PATH}/application"
|
38
37
|
|
39
38
|
# Setup the url map
|
40
39
|
run Rack::URLMap.new \
|
@@ -19,21 +19,6 @@ include Rhoconnect
|
|
19
19
|
|
20
20
|
require 'rhoconnect/test_methods'
|
21
21
|
|
22
|
-
# Monkey patch to fix the following issue:
|
23
|
-
# /usr/local/rvm/gems/ruby-1.8.7-p352/gems/rspec-core-2.6.4/lib/rspec/core/shared_example_group.rb:59:
|
24
|
-
# in `ensure_shared_example_group_name_not_taken': Shared example group 'SharedRhoconnectHelper' already exists (ArgumentError)
|
25
|
-
if RUBY_VERSION =~ /1.8/
|
26
|
-
module RSpec
|
27
|
-
module Core
|
28
|
-
module SharedExampleGroup
|
29
|
-
private
|
30
|
-
def ensure_shared_example_group_name_not_taken(name)
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
22
|
shared_examples_for "SpecHelper" do
|
38
23
|
include Rhoconnect::TestMethods
|
39
24
|
|
data/install.sh
CHANGED
@@ -201,7 +201,7 @@ setRubyVars ()
|
|
201
201
|
{
|
202
202
|
if [[ $rubyVersion == "" || $rubyVersion =~ ruby'ee'|'enterprise' ]]; then
|
203
203
|
rubyVersion="rubyee"
|
204
|
-
rubyDir="ruby-enterprise-1.8.7-2012.
|
204
|
+
rubyDir="ruby-enterprise-1.8.7-2012.02"
|
205
205
|
rubyTar="${rubyDir}.tar.gz"
|
206
206
|
rubyURL="http://rubyenterpriseedition.googlecode.com/files/${rubyTar}"
|
207
207
|
elif [$rubyVersion == "ruby187"]; then
|
@@ -351,7 +351,7 @@ else
|
|
351
351
|
fi
|
352
352
|
|
353
353
|
# Construct the string with which to call the ruby installation script.
|
354
|
-
callruby="
|
354
|
+
callruby="${prefix}/bin/ruby ${INSTALL_DIR}/unix-like/rhoinstaller.rb ${opts}"
|
355
355
|
# Call the ruby script
|
356
356
|
$callruby
|
357
357
|
rho_status=$?
|
@@ -372,7 +372,7 @@ if [[ $installedSoftware -eq ${#INSTALL_ARRAY[@]} ]]; then
|
|
372
372
|
echo "Installation failed. For troubleshooting see file $log ..." | tee -a $log
|
373
373
|
else
|
374
374
|
opts=" -d $dist"
|
375
|
-
|
375
|
+
${prefix}/bin/ruby ${INSTALL_DIR}/unix-like/create_texts.rb ${opts}
|
376
376
|
fi
|
377
377
|
# timeFinal=`date +%H%M%S`
|
378
378
|
# getTime $timeFinal
|
@@ -151,8 +151,8 @@ redis_stop() {
|
|
151
151
|
while [[ -x /proc/${pid} ]] ; do
|
152
152
|
echo -n '.' ; sleep 1
|
153
153
|
done
|
154
|
-
else # Darwin, etc...
|
155
|
-
while [[ ! -z "$(ps auxww | grep [r]edis | grep "$config" | awk '{print $2}')" ]] ; do
|
154
|
+
else # Darwin, etc ...
|
155
|
+
while [[ ! -z "$(ps auxww | grep [r]edis | grep "$config" | grep -v grep | awk '{print $2}')" ]] ; do
|
156
156
|
echo -n '.' ; sleep 1
|
157
157
|
done
|
158
158
|
fi
|
@@ -8,11 +8,11 @@ module Constants
|
|
8
8
|
"libaprutil1-dev",
|
9
9
|
"dtach"]
|
10
10
|
|
11
|
-
REDIS = "redis-2.4.
|
11
|
+
REDIS = "redis-2.4.10"
|
12
12
|
SQLITE3 = "sqlite-autoconf-3071000"
|
13
13
|
|
14
|
-
RUBY = "ruby-enterprise-1.8.7-2012.
|
15
|
-
Nginx = "nginx-1.0.
|
14
|
+
RUBY = "ruby-enterprise-1.8.7-2012.02"
|
15
|
+
Nginx = "nginx-1.0.14"
|
16
16
|
|
17
17
|
SOFTWARE = [ REDIS, SQLITE3, RUBY, Nginx ]
|
18
18
|
|
@@ -9,18 +9,18 @@ module Constants
|
|
9
9
|
SLEEP = 60
|
10
10
|
HOME_DIR = `echo ~/`.strip.chomp("/")
|
11
11
|
REMOTE_HOME = '/home/ubuntu'
|
12
|
-
PEM_FILE = '
|
12
|
+
PEM_FILE = 'jenkinskey.pem'
|
13
13
|
SSH_KEY = "#{HOME_DIR}/.ssh/#{PEM_FILE}"
|
14
14
|
ACCESS_KEY_FILE = "#{HOME_DIR}/.ec2"
|
15
|
-
UBUNTU_STACK = { :image_id => 'ami-
|
16
|
-
:flavor_id => 'c1.
|
17
|
-
:key_name => '
|
15
|
+
UBUNTU_STACK = { :image_id => 'ami-6da8f128',
|
16
|
+
:flavor_id => 'c1.xlarge',
|
17
|
+
:key_name => 'jenkinskey',
|
18
18
|
:groups => 'load-test',
|
19
19
|
:user => 'ubuntu'}
|
20
20
|
|
21
21
|
CENTOS_STACK = { :image_id => 'ami-13346656',
|
22
22
|
:flavor_id => 'c1.medium',
|
23
|
-
:key_name => '
|
23
|
+
:key_name => 'jenkinskey',
|
24
24
|
:groups => 'load-test',
|
25
25
|
:user => 'root'}
|
26
26
|
|
@@ -0,0 +1,26 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'digest/sha1'
|
5
|
+
require 'find'
|
6
|
+
|
7
|
+
if ARGV.length != 2 ||
|
8
|
+
!File.directory?(ARGV[0])
|
9
|
+
puts "Usage: #{$0} directory_to_use location_for_SHA1_file"
|
10
|
+
exit 1
|
11
|
+
end #if
|
12
|
+
|
13
|
+
dir = ARGV[0]
|
14
|
+
dest_dir = ARGV[1]
|
15
|
+
|
16
|
+
dir_digest = Digest::SHA1.new
|
17
|
+
|
18
|
+
Find.find(dir) do |path|
|
19
|
+
if !File.directory?(path)
|
20
|
+
file_sha1 = Digest::SHA1.file(path).to_s
|
21
|
+
dir_digest << file_sha1
|
22
|
+
end #if
|
23
|
+
end #do
|
24
|
+
|
25
|
+
Dir.mkdir(dest_dir) unless File.directory?(dest_dir)
|
26
|
+
File.open("#{dest_dir}/checksum", 'w') { |f| f.write(dir_digest) }
|
@@ -0,0 +1,32 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'aws/s3'
|
5
|
+
|
6
|
+
include AWS::S3
|
7
|
+
|
8
|
+
USER_DATA = `wget -q -O - http://169.254.169.254/latest/user-data`.split("\n")
|
9
|
+
|
10
|
+
bucket_name = ARGV[0].strip
|
11
|
+
channel = ARGV[1].strip
|
12
|
+
files = []
|
13
|
+
|
14
|
+
def get_access_keys
|
15
|
+
access_key = USER_DATA[0].to_s.strip
|
16
|
+
secret_access_key = USER_DATA[1].to_s.strip
|
17
|
+
keys = { :access_key_id => access_key,
|
18
|
+
:secret_access_key => secret_access_key}
|
19
|
+
end #get_access_keys
|
20
|
+
|
21
|
+
AWS::S3::Base.establish_connection!(get_access_keys)
|
22
|
+
|
23
|
+
objects = Bucket.objects(bucket_name)
|
24
|
+
|
25
|
+
objects.each do |obj|
|
26
|
+
files << "#{obj.key}" if obj.key =~ /^#{channel}/
|
27
|
+
end
|
28
|
+
|
29
|
+
files.each do |file|
|
30
|
+
puts "Deleting #{file}"
|
31
|
+
S3Object.delete file, bucket_name
|
32
|
+
end #do
|
@@ -0,0 +1,55 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'aws/s3'
|
5
|
+
|
6
|
+
include AWS::S3
|
7
|
+
|
8
|
+
USER_DATA = `wget -q -O - http://169.254.169.254/latest/user-data`.split("\n")
|
9
|
+
|
10
|
+
bucket_name = 'rhoconnect'
|
11
|
+
channel = ARGV[0]
|
12
|
+
files = []
|
13
|
+
|
14
|
+
exit if ARGV.length != 1
|
15
|
+
|
16
|
+
def cmd(cmd)
|
17
|
+
puts cmd
|
18
|
+
system(cmd)
|
19
|
+
end #cmd
|
20
|
+
|
21
|
+
def get_access_keys
|
22
|
+
access_key = USER_DATA[0].to_s.strip
|
23
|
+
secret_access_key = USER_DATA[1].to_s.strip
|
24
|
+
keys = { :access_key_id => access_key,
|
25
|
+
:secret_access_key => secret_access_key}
|
26
|
+
end #get_access_keys
|
27
|
+
|
28
|
+
AWS::S3::Base.establish_connection!(get_access_keys)
|
29
|
+
|
30
|
+
objects = Bucket.objects(bucket_name)
|
31
|
+
|
32
|
+
objects.each do |obj|
|
33
|
+
files << "#{obj.key}" if obj.key =~ /^#{channel}/
|
34
|
+
end
|
35
|
+
|
36
|
+
# Remove the files before downloading new in case they already exist
|
37
|
+
cmd "rm -rf #{channel}" if File.directory? channel
|
38
|
+
cmd "rm -f #{channel}/SHA1/checksum" if File.exists?("#{channel}/SHA1/checksum")
|
39
|
+
|
40
|
+
puts "Downloading S3 files"
|
41
|
+
files.each do |file|
|
42
|
+
cmd = "wget -qx -P #{channel} \"http://#{bucket_name}.s3.amazonaws.com/#{file}\""
|
43
|
+
puts cmd
|
44
|
+
system(cmd)
|
45
|
+
end #do
|
46
|
+
|
47
|
+
# The download increases the depth of the files by two folders.
|
48
|
+
# Remove exess directory levels.
|
49
|
+
cmd "mv -f #{channel}/#{bucket_name}.s3.amazonaws.com/#{channel}/* #{channel}"
|
50
|
+
cmd "rm -rf #{channel}/#{bucket_name}.s3.amazonaws.com"
|
51
|
+
|
52
|
+
# Pull the SHA1 checksum out
|
53
|
+
cmd "mv -f #{channel}/SHA1/checksum ."
|
54
|
+
cmd "mv -f checksum old_checksum"
|
55
|
+
cmd "rm -rf #{channel}/SHA1"
|
@@ -3,12 +3,12 @@
|
|
3
3
|
$:.unshift File.expand_path(File.dirname(__FILE__))
|
4
4
|
$:.unshift File.expand_path(File.join(File.dirname(__FILE__), 'installer', 'utils'))
|
5
5
|
|
6
|
-
require 'rhoconnect'
|
7
6
|
require 'rubygems'
|
8
|
-
require 'fog'
|
9
7
|
require 'net/http'
|
10
8
|
require 'constants'
|
11
|
-
require '
|
9
|
+
require 'fog'
|
10
|
+
|
11
|
+
BUCKET = 'rhoconnect'
|
12
12
|
|
13
13
|
# METHODS
|
14
14
|
|
@@ -29,11 +29,19 @@ def ssh_cmd(cmd)
|
|
29
29
|
exit 1 if exit_code.to_i != 0
|
30
30
|
end #ssh_cmd
|
31
31
|
|
32
|
-
#
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
32
|
+
# build_type
|
33
|
+
def build_type
|
34
|
+
case ARGV[0]
|
35
|
+
when 'test'
|
36
|
+
'test-packages'
|
37
|
+
when 'beta'
|
38
|
+
'beta-packages'
|
39
|
+
when 'release'
|
40
|
+
'release-packages'
|
41
|
+
else
|
42
|
+
'nightly-packages'
|
43
|
+
end #case
|
44
|
+
end #build_type
|
37
45
|
|
38
46
|
# compile_stack_info
|
39
47
|
# Fills in all necessary information which is stack specific
|
@@ -46,11 +54,8 @@ def compile_stack_info
|
|
46
54
|
# This part of the package name will always be the same
|
47
55
|
local_file = "#{`pwd`.strip}/pkg/"
|
48
56
|
|
49
|
-
# Determine
|
50
|
-
|
51
|
-
|
52
|
-
# Determine which folder in the bucket to grab files from
|
53
|
-
packages = Rhoconnect::VERSION.include?('beta') ? 'beta-packages' : 'packages'
|
57
|
+
# Determine what channel to pull the packages from
|
58
|
+
channel = build_type
|
54
59
|
|
55
60
|
# Append the rest of the file name according to distribution
|
56
61
|
if @user == 'ubuntu'
|
@@ -65,7 +70,7 @@ def compile_stack_info
|
|
65
70
|
:repo_src_file => '/etc/apt/sources.list',
|
66
71
|
:repo_str => '\n' +
|
67
72
|
'# This is the repository for rhoconnect packages\n' +
|
68
|
-
"deb http://#{
|
73
|
+
"deb http://#{BUCKET}.s3.amazonaws.com/#{channel}/deb rhoconnect main" }
|
69
74
|
elsif @user == 'root'
|
70
75
|
@dist = { :flavor => "centos",
|
71
76
|
:package => "rhoconnect-#{Constants::RC_VERSION}.noarch.rpm",
|
@@ -77,7 +82,7 @@ def compile_stack_info
|
|
77
82
|
:repo_src_file => '/etc/yum.repos.d/rhoconnect.repo',
|
78
83
|
:repo_str => '[rhoconnect]\n' +
|
79
84
|
'name=Rhoconnect\n' +
|
80
|
-
"baseurl=http://#{
|
85
|
+
"baseurl=http://#{BUCKET}.s3.amazonaws.com/#{channel}/rpm" +
|
81
86
|
'\nenabled=1\n' +
|
82
87
|
'gpgcheck=0\n' }
|
83
88
|
|
@@ -210,12 +215,19 @@ def start_servers
|
|
210
215
|
end #do
|
211
216
|
end # start_servers
|
212
217
|
|
213
|
-
#
|
218
|
+
# check_rc_service
|
214
219
|
# Makes an HTTP request to check that the rhoconnect service is working
|
215
220
|
def check_rc_service
|
216
|
-
request = Net::HTTP.get_response(@host, '/console')
|
217
221
|
puts "Host: #{@host}"
|
222
|
+
|
223
|
+
puts "Checking RC service."
|
224
|
+
request = nil #Defined outside block as to not limit the scope of request to the do block.
|
225
|
+
2.times do
|
226
|
+
request = Net::HTTP.get_response(@host, '/')
|
227
|
+
end #do
|
228
|
+
|
218
229
|
puts "Code: #{request.code} Message: #{request.message}"
|
230
|
+
|
219
231
|
if request.code == '200'
|
220
232
|
puts "Rhoconnect service up!"
|
221
233
|
else
|
@@ -247,8 +259,6 @@ end #compute_time
|
|
247
259
|
# Test Package installations
|
248
260
|
Constants::STACKS.each do |stack|
|
249
261
|
start_time = Time.now
|
250
|
-
|
251
|
-
|
252
262
|
|
253
263
|
begin
|
254
264
|
@stack = stack
|
@@ -1,27 +1,39 @@
|
|
1
|
+
require 'rubygems'
|
1
2
|
require 'rake'
|
3
|
+
require 'find'
|
4
|
+
require 'fileutils'
|
5
|
+
|
2
6
|
|
3
7
|
desc 'Creates and uploads apt and rpm repos.'
|
4
|
-
task "build:repos", :build_type do |t, args|
|
8
|
+
task "build:repos", :build_type, :build_number do |t, args|
|
5
9
|
# Run dependent rake jobs first
|
6
10
|
Rake::Task['build:deb'].invoke
|
7
11
|
Rake::Task['build:rpm'].invoke
|
8
|
-
args.with_defaults :build_type
|
12
|
+
args.with_defaults :build_type => 'nightly'
|
13
|
+
args.with_defaults :build_number => ''
|
9
14
|
puts args
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
require 'find'
|
14
|
-
require 'fileutils'
|
15
|
+
|
16
|
+
build_type = args[:build_type]
|
17
|
+
build_number = args[:build_number]
|
15
18
|
|
16
19
|
# CONSTANTS
|
17
20
|
|
18
|
-
PKG_DIR
|
19
|
-
|
20
|
-
|
21
|
+
PKG_DIR = case build_type
|
22
|
+
when 'release'
|
23
|
+
'/packages'
|
24
|
+
when 'test'
|
25
|
+
'/test-packages'
|
26
|
+
when 'beta'
|
27
|
+
'/beta-packages'
|
28
|
+
else 'nightly'
|
29
|
+
'/nightly-packages'
|
30
|
+
end #case
|
31
|
+
|
32
|
+
BUCKET = 'rhoconnect'
|
21
33
|
|
22
34
|
def cmd(cmd)
|
23
|
-
puts cmd
|
24
|
-
|
35
|
+
puts cmd
|
36
|
+
puts `#{cmd}`
|
25
37
|
end #cmd
|
26
38
|
|
27
39
|
# METHODS
|
@@ -29,15 +41,7 @@ task "build:repos", :build_type do |t, args|
|
|
29
41
|
def prepare_destination
|
30
42
|
# Prompt to remove the /deb directory if it exists
|
31
43
|
if File.directory?("#{PKG_DIR}/deb")
|
32
|
-
|
33
|
-
puts "Remove #{PKG_DIR}/deb?"
|
34
|
-
remove = STDIN.gets.strip.downcase.chars.first
|
35
|
-
else
|
36
|
-
remove = 'y'
|
37
|
-
end #if
|
38
|
-
if remove == 'y'
|
39
|
-
cmd "sudo rm -rf #{PKG_DIR}/deb"
|
40
|
-
end #if
|
44
|
+
cmd "sudo rm -rf #{PKG_DIR}/deb"
|
41
45
|
end #if
|
42
46
|
|
43
47
|
# Create deb directory if it does not already exist
|
@@ -70,7 +74,8 @@ task "build:repos", :build_type do |t, args|
|
|
70
74
|
Find.find('./pkg') do |file|
|
71
75
|
if !FileTest.directory?(file)
|
72
76
|
dest_dir = File.extname(file)
|
73
|
-
|
77
|
+
# get rid of '.' before extension name
|
78
|
+
dest_dir[0] = ''
|
74
79
|
if dest_dir == 'deb' || dest_dir == 'rpm'
|
75
80
|
if dest_dir == 'deb'
|
76
81
|
@deb_pkg = File.basename(file)
|
@@ -82,31 +87,38 @@ task "build:repos", :build_type do |t, args|
|
|
82
87
|
end #do
|
83
88
|
end #copy_files
|
84
89
|
|
85
|
-
@raked = true
|
86
|
-
|
87
90
|
prepare_destination
|
88
91
|
|
89
92
|
copy_files
|
93
|
+
|
94
|
+
if build_type != "release" &&
|
95
|
+
build_type != "test"
|
96
|
+
# Change name of packages to include build number
|
97
|
+
['deb', 'rpm'].each do |arch|
|
98
|
+
Find.find("#{PKG_DIR}") do |file|
|
99
|
+
if !File.directory?(file) &&
|
100
|
+
file =~ /#{arch}$/
|
101
|
+
file_to_rename = File.open(file, 'r')
|
102
|
+
old_name = File.expand_path(file)
|
103
|
+
puts "Old Name:\t#{old_name}"
|
104
|
+
new_name = old_name.gsub(/(#{arch})$/, "build-#{build_number.to_s}.\\1" )
|
105
|
+
File.rename(old_name, new_name)
|
106
|
+
end #if
|
107
|
+
end #do
|
108
|
+
end #do
|
109
|
+
end #if
|
90
110
|
|
91
111
|
# REPOIFY!
|
92
112
|
cmd "sudo reprepro -b #{PKG_DIR}/deb includedeb rhoconnect #{PKG_DIR}/deb/#{@deb_pkg}"
|
93
113
|
cmd "sudo createrepo #{PKG_DIR}/rpm"
|
114
|
+
|
115
|
+
# Create SHA1 checksum of repo dirs
|
116
|
+
checksum_dest = "#{PKG_DIR}/SHA1/"
|
117
|
+
cmd "sudo ./installer/utils/create_sha1.rb #{PKG_DIR} #{PKG_DIR}/SHA1"
|
94
118
|
|
95
|
-
# Call
|
119
|
+
# Call s3_upload.rb
|
96
120
|
['deb', 'rpm'].each do |dir|
|
97
|
-
|
98
|
-
pkg_dir = PKG_DIR
|
99
|
-
Find.find("#{PKG_DIR}/#{dir}") do |file|
|
100
|
-
if File.extname(file) =~ /deb|rpm/
|
101
|
-
beta = file.include?('beta') ? true : false
|
102
|
-
pkg_dir = BETA_PKG_DIR if beta
|
103
|
-
cmd "sudo mkdir #{BETA_PKG_DIR}" unless File.directory? BETA_PKG_DIR
|
104
|
-
cmd "sudo chmod 777 #{BETA_PKG_DIR}"
|
105
|
-
# If one beta pkg is found, break.
|
106
|
-
break if beta
|
107
|
-
end #if
|
108
|
-
end #do
|
109
|
-
cmd "sudo cp -rf #{PKG_DIR}/#{dir} #{BETA_PKG_DIR}/#{dir}" if pkg_dir == BETA_PKG_DIR
|
110
|
-
cmd "sudo ruby ./installer/utils/package_upload/s3_upload.rb #{pkg_dir}/#{dir} #{BUCKET} #{@raked}"
|
121
|
+
cmd "sudo ruby ./installer/utils/package_upload/s3_upload.rb #{PKG_DIR}/#{dir} #{BUCKET}"
|
111
122
|
end #do
|
112
|
-
|
123
|
+
cmd "sudo ruby ./installer/utils/package_upload/s3_upload.rb #{PKG_DIR}/SHA1 #{BUCKET}"
|
124
|
+
end #build:repos
|