rhoconnect 3.1.0 → 3.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ ## 3.1.1 (2012-02-07)
2
+ * Fix Zendesk issue: Rack 1.4.1 and Sinatra 1.3.2 produce 502 error with Heroku deployment (tickets 2147, 2155, 2153)
3
+
1
4
  ## 3.1.0 (2012-01-31)
2
5
  * #23977723 - Bug fix (Rspec examples fails for both Ruby 1.8.7 and ree-2011.12 (p357))
3
6
  * #23982399 - Add to RhoConnect installer support for ree 2012.01
data/Gemfile.lock CHANGED
@@ -1,10 +1,10 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rhoconnect (3.1.0)
4
+ rhoconnect (3.1.1)
5
5
  bundler (~> 1.0)
6
6
  json (~> 1.6.0)
7
- rack (~> 1.4.1)
7
+ rack (~> 1.3.6)
8
8
  rake (~> 0.9.2)
9
9
  redis (>= 2.2.0)
10
10
  resque (~> 1.19.0)
@@ -49,7 +49,7 @@ GEM
49
49
  json
50
50
  highline (1.6.11)
51
51
  jdbc-sqlite3 (3.7.2)
52
- jruby-jars (1.6.5.1)
52
+ jruby-jars (1.6.6)
53
53
  jruby-openssl (0.7.5)
54
54
  bouncy-castle-java (>= 1.5.0146.1)
55
55
  jruby-rack (1.1.3)
@@ -62,7 +62,7 @@ GEM
62
62
  net-ssh (2.3.0)
63
63
  nokogiri (1.5.0)
64
64
  nokogiri (1.5.0-java)
65
- rack (1.4.1)
65
+ rack (1.3.6)
66
66
  rack-protection (1.2.0)
67
67
  rack
68
68
  rack-test (0.6.1)
@@ -1,10 +1,11 @@
1
1
  #!/usr/bin/env ruby
2
-
3
- #LOG_FILE = '/var/log/bench_runner.log'
4
- # orig_stdout = $stdout # redirect stdout to LOG_FILE
5
- # $stdout = File.new(LOG_FILE, 'a')
6
-
2
+ #
7
3
  RHOCONNECT_PATH = ARGV[0]
4
+ LOG_FILE = ARGV[1]
5
+ orig_stdout = $stdout # redirect stdout to LOG_FILE
6
+ orig_stderr = $sdterr
7
+ $stdout = $sdterr = File.new(LOG_FILE, 'a')
8
+
8
9
  puts "Script #{$0} is started at #{Time.now.to_s}"
9
10
 
10
11
  begin
@@ -32,7 +33,7 @@ begin
32
33
 
33
34
  puts "Starting bench application ..."
34
35
  t = Thread.new do
35
- log = `bundle exec rackup -D -P /tmp/benchapp.pid -s thin config.ru`
36
+ log = `bundle exec rackup -D -P /tmp/benchapp.pid -s thin config.ru 2>&1`
36
37
  puts log
37
38
  end
38
39
  t.join
@@ -55,19 +56,27 @@ begin
55
56
  end
56
57
  =end
57
58
 
58
- sleep 5
59
- raise "Error: Bench application failed to start. File /tmp/benchapp.pid does not exist." unless File.exist? '/tmp/benchapp.pid'
59
+ count = 0
60
+ unless File.exist? '/tmp/benchapp.pid'
61
+ sleep 1
62
+ count += 1
63
+ # Throw exception after waiting at least 20 sec.
64
+ raise "Error: Bench application failed to start. File /tmp/benchapp.pid does not exist." if count >= 10
65
+ end
60
66
 
61
67
  pid = `cat /tmp/benchapp.pid`
62
68
  puts "Bench application is up and running with pid #{pid}"
63
69
  puts
64
70
 
71
+ # puts `echo 'yes' | rake rhoconnect:reset 2>&1`
72
+ # puts
73
+
65
74
  Dir.chdir "../"
66
75
  bench_errors = {}
67
76
  puts "Running bench scripts ..."
68
77
  %w[ cud_script query_only_script query_script query_md_script ].each do |script|
69
78
  puts "Script #{script} ..."
70
- log = `"./run_#{script}.sh"`
79
+ log = `"./run_#{script}.sh" 2>&1`
71
80
 
72
81
  count = 0
73
82
  stats_found = nil
@@ -95,18 +104,21 @@ begin
95
104
  puts "#{script}:"
96
105
  errors.each { |err| puts " #{err}" }
97
106
  end
107
+ exit -1
98
108
  end
99
-
109
+
100
110
  rescue Exception => e
101
111
  puts e.message
112
+ exit -1
102
113
  ensure
103
114
  if File.exist? '/tmp/benchapp.pid'
104
115
  pid = `cat /tmp/benchapp.pid`
105
116
  res = `kill -9 #{pid}` if pid.to_i > 0 # `kill -s SIGINT #{pid}`
106
117
  File.delete '/tmp/benchapp.pid'
118
+ puts "Bench application killed ..."
107
119
  end
120
+ puts "Script #{$0} is finished at #{Time.now.to_s}"
121
+ puts ""
122
+ $stdout = orig_stdout #restore stdout
123
+ $sdterr = orig_stderr #restore stderr
108
124
  end
109
-
110
- puts "Script #{$0} is finished at #{Time.now.to_s}"
111
- puts ""
112
- # $stdout = orig_stdout #restore stdout
@@ -1,6 +1,6 @@
1
1
  source 'http://rubygems.org'
2
2
 
3
- gem 'rhoconnect', '~> 3.1.0.beta' #FIXME: replace by '~> 3.1.0'
3
+ gem 'rhoconnect', '~> 3.1.0'
4
4
 
5
5
  # Helps with some of the limitations of green threads, not needed in ruby 1.9.x
6
6
  gem 'SystemTimer', '~> 1.2.3', :platforms => :ruby_18
@@ -2,7 +2,7 @@ GEM
2
2
  remote: http://rubygems.org/
3
3
  specs:
4
4
  SystemTimer (1.2.3)
5
- daemons (1.1.6)
5
+ daemons (1.1.8)
6
6
  diff-lcs (1.1.3)
7
7
  eventmachine (0.12.10)
8
8
  extlib (0.9.15)
@@ -10,7 +10,7 @@ GEM
10
10
  json (1.6.5)
11
11
  mime-types (1.17.2)
12
12
  multi_json (1.0.4)
13
- rack (1.4.1)
13
+ rack (1.3.6)
14
14
  rack-protection (1.2.0)
15
15
  rack
16
16
  rack-test (0.6.1)
@@ -26,10 +26,10 @@ GEM
26
26
  vegas (~> 0.1.2)
27
27
  rest-client (1.6.7)
28
28
  mime-types (>= 1.16)
29
- rhoconnect (3.1.0.beta2)
29
+ rhoconnect (3.1.1)
30
30
  bundler (~> 1.0)
31
31
  json (~> 1.6.0)
32
- rack (~> 1.4.1)
32
+ rack (~> 1.3.6)
33
33
  rake (~> 0.9.2)
34
34
  redis (>= 2.2.0)
35
35
  resque (~> 1.19.0)
@@ -48,9 +48,9 @@ GEM
48
48
  rspec-mocks (2.6.0)
49
49
  rubyzip (0.9.5)
50
50
  sinatra (1.3.2)
51
- rack (>= 1.3.6, ~> 1.3)
51
+ rack (~> 1.3, >= 1.3.6)
52
52
  rack-protection (~> 1.2)
53
- tilt (>= 1.3.3, ~> 1.3)
53
+ tilt (~> 1.3, >= 1.3.3)
54
54
  sqlite3 (1.3.5)
55
55
  templater (1.0.0)
56
56
  diff-lcs (>= 1.1.2)
@@ -75,7 +75,7 @@ DEPENDENCIES
75
75
  jdbc-sqlite3 (>= 3.7.2)
76
76
  jruby-openssl (>= 0.7.4)
77
77
  rack-test (>= 0.5.3)
78
- rhoconnect (~> 3.1.0.beta)
78
+ rhoconnect (~> 3.1.0)
79
79
  rspec (~> 2.6.0)
80
80
  sqlite3 (>= 1.3.3)
81
81
  thin
data/bench/run_bench.sh CHANGED
@@ -1,5 +1,4 @@
1
- #!/bin/sh
2
-
1
+ #!/bin/bash
3
2
  #
4
3
  # Add the following line to crontab to execute benchmarks as a cron job on workdays at 1AM
5
4
  #
@@ -29,15 +28,20 @@ git reset --hard HEAD | tee -a /tmp/bench.log 2>&1
29
28
  git pull origin master | tee -a /tmp/bench.log 2>&1
30
29
  echo '' | tee -a /tmp/bench.log
31
30
 
31
+ echo 'Flush Redis DB' | tee -a /tmp/bench.log
32
+ redis-cli flushdb > /dev/null
33
+
32
34
  # Run benchmarks for ruby 1.8.7, ree, 1.9.2, and 1.9.3
33
35
  # TODO: 'jruby'
34
- for ruby in '1.9.3' '1.9.2' '1.8.7' 'ree'
36
+ for ruby in '1.9.3' '1.8.7' 'ree'
35
37
  do
36
38
  rvm use $ruby > /dev/null
37
39
  ruby_version=$(rvm current)
38
40
  echo "Running benchmarks for $ruby_version ..." | tee -a /tmp/bench.log
39
41
  echo "" | tee -a /tmp/bench.log
40
- ruby ./bench/bench_runner.rb $RHOCONNECT_HOME 2>&1 | tee -a /tmp/bench.log
42
+
43
+ ruby ./bench/bench_runner.rb $RHOCONNECT_HOME /tmp/bench.log
44
+ if (($?)) ; then echo "Benchmarks for $ruby_version failed"; exit 1; fi
41
45
  done
42
46
 
43
47
 
@@ -394,7 +394,8 @@ end
394
394
  def generate_common_info
395
395
 
396
396
  readme = <<_README_
397
- Thank you for choosing Rhomobile for your cross-platform app needs!
397
+
398
+ Thank you for choosing Rhoconnect for your mobile app sync needs!
398
399
  To finish this setup, please complete the following...
399
400
 
400
401
  1) Add necessary bins to the path(s) of the users who will
@@ -13,13 +13,13 @@ module Constants
13
13
  SSH_KEY = "#{HOME_DIR}/.ssh/#{PEM_FILE}"
14
14
  ACCESS_KEY_FILE = "#{HOME_DIR}/.ec2"
15
15
  UBUNTU_STACK = { :image_id => 'ami-3d491a78',
16
- :flavor_id => 'm1.small',
16
+ :flavor_id => 'c1.medium',
17
17
  :key_name => 'alexdevkey',
18
18
  :groups => 'load-test',
19
19
  :user => 'ubuntu'}
20
20
 
21
21
  CENTOS_STACK = { :image_id => 'ami-13346656',
22
- :flavor_id => 'm1.small',
22
+ :flavor_id => 'c1.medium',
23
23
  :key_name => 'alexdevkey',
24
24
  :groups => 'load-test',
25
25
  :user => 'root'}
@@ -3,6 +3,7 @@
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'
6
7
  require 'rubygems'
7
8
  require 'fog'
8
9
  require 'net/http'
@@ -16,23 +17,24 @@ require 'readline'
16
17
  def cmd(cmd)
17
18
  puts cmd
18
19
  system(cmd)
19
- # Return the exit status
20
- $?
20
+ exit 1 if !$?.to_i == 0
21
21
  end #cmd
22
22
 
23
- # nightly_build?
24
- # Return whether or not
25
- def nightly_build?
26
- ARGV.include? 'nightly'
27
- end #nightly_build?
28
-
29
23
  # ssh_cmd
30
24
  # More easily issue commands over the ssh connection.
31
25
  def ssh_cmd(cmd)
32
26
  puts cmd
33
27
  puts @ssh.run(cmd)[0].stdout
28
+ exit_code = @ssh.run('echo $?')[0].stdout
29
+ exit 1 if exit_code.to_i != 0
34
30
  end #ssh_cmd
35
31
 
32
+ # nightly_build?
33
+ # Return whether or not
34
+ def nightly_build?
35
+ ARGV.include? 'nightly'
36
+ end #nightly_build?
37
+
36
38
  # compile_stack_info
37
39
  # Fills in all necessary information which is stack specific
38
40
  def compile_stack_info
@@ -43,10 +45,15 @@ def compile_stack_info
43
45
 
44
46
  # This part of the package name will always be the same
45
47
  local_file = "#{`pwd`.strip}/pkg/"
48
+
49
+ # Determine whether or not the build is a nightly build.
50
+ bucket = nightly_build? ? 'rhoconnect' : 'rhoconnect-test'
51
+
52
+ # Determine which folder in the bucket to grab files from
53
+ packages = Rhoconnect::VERSION.include?('beta') ? 'beta-packages' : 'packages'
46
54
 
47
55
  # Append the rest of the file name according to distribution
48
56
  if @user == 'ubuntu'
49
- nightly_build? ? packages = 'beta-packages' : packages = 'packages'
50
57
 
51
58
  @dist = { :flavor => "ubuntu",
52
59
  :package => "rhoconnect_#{Constants::RC_VERSION}_all.deb",
@@ -58,7 +65,7 @@ def compile_stack_info
58
65
  :repo_src_file => '/etc/apt/sources.list',
59
66
  :repo_str => '\n' +
60
67
  '# This is the repository for rhoconnect packages\n' +
61
- "deb http://rhoconnect.s3.amazonaws.com/#{packages}/deb rhoconnect main" }
68
+ "deb http://#{bucket}.s3.amazonaws.com/#{packages}/deb rhoconnect main" }
62
69
  elsif @user == 'root'
63
70
  @dist = { :flavor => "centos",
64
71
  :package => "rhoconnect-#{Constants::RC_VERSION}.noarch.rpm",
@@ -70,7 +77,7 @@ def compile_stack_info
70
77
  :repo_src_file => '/etc/yum.repos.d/rhoconnect.repo',
71
78
  :repo_str => '[rhoconnect]\n' +
72
79
  'name=Rhoconnect\n' +
73
- "baseurl=http://rhoconnect.s3.amazonaws.com/#{packages}/rpm" +
80
+ "baseurl=http://#{bucket}.s3.amazonaws.com/#{packages}/rpm" +
74
81
  '\nenabled=1\n' +
75
82
  'gpgcheck=0\n' }
76
83
 
@@ -183,12 +190,6 @@ end #install_package
183
190
  # Attempts to start redis and nginx servers
184
191
  def start_servers
185
192
  max_attempts = 100
186
- puts "Waiting #{Constants::SLEEP} seconds for services to initialize."
187
- Constants::SLEEP.times do |sec|
188
- print '.'
189
- STDOUT.flush
190
- sleep 1
191
- end #do
192
193
  puts
193
194
 
194
195
  ['Redis', 'Nginx'].each do |program|
@@ -201,8 +202,9 @@ def start_servers
201
202
  end #while
202
203
  if attempts >= max_attempts
203
204
  puts "#{program} failed to start."
205
+ exit 1
204
206
  else
205
- puts "#{program} start took #{attempts} attempts."
207
+ puts "#{program} start took #{attempts} attempts." if attempts > 1
206
208
  end #if
207
209
  puts
208
210
  end #do
@@ -225,7 +227,7 @@ end #check_rc_service
225
227
  # compute_time
226
228
  # General time computation method
227
229
  def compute_time(start_time, end_time)
228
- time_delta = (end_time - start_time)
230
+ time_delta = (end_time - start_time).round 3
229
231
 
230
232
  if time_delta >= 60
231
233
  time_delta /= 60
@@ -245,6 +247,9 @@ end #compute_time
245
247
  # Test Package installations
246
248
  Constants::STACKS.each do |stack|
247
249
  start_time = Time.now
250
+
251
+
252
+
248
253
  begin
249
254
  @stack = stack
250
255
  compile_stack_info
@@ -1,5 +1,15 @@
1
+ require 'rake'
2
+
1
3
  desc 'Creates and uploads apt and rpm repos.'
2
- task "build:repos" => ['build:deb', 'build:rpm'] do
4
+ task "build:repos", :build_type do |t, args|
5
+ # Run dependent rake jobs first
6
+ Rake::Task['build:deb'].invoke
7
+ Rake::Task['build:rpm'].invoke
8
+ args.with_defaults :build_type => 'nightly-build'
9
+ puts args
10
+ # Exit if args are not valid args
11
+ exit 1 if !args[:build_type].eql? "nightly-build" and !args[:build_type].eql? "release-build"
12
+
3
13
  require 'find'
4
14
  require 'fileutils'
5
15
 
@@ -7,7 +17,7 @@ task "build:repos" => ['build:deb', 'build:rpm'] do
7
17
 
8
18
  PKG_DIR = '/packages'
9
19
  BETA_PKG_DIR = '/beta-packages'
10
- BUCKET = 'rhoconnect'
20
+ BUCKET = args[:build_type].eql?('release-build') ? 'rhoconnect-test' : 'rhoconnect'
11
21
 
12
22
  def cmd(cmd)
13
23
  puts cmd unless @raked
@@ -58,7 +68,6 @@ task "build:repos" => ['build:deb', 'build:rpm'] do
58
68
  def copy_files
59
69
  # Copy the packages to their respective directory
60
70
  Find.find('./pkg') do |file|
61
- puts "File: #{file}"
62
71
  if !FileTest.directory?(file)
63
72
  dest_dir = File.extname(file)
64
73
  dest_dir[0] = '' #get rid of '.' before extension name
@@ -85,19 +94,19 @@ task "build:repos" => ['build:deb', 'build:rpm'] do
85
94
 
86
95
  # Call S3 upload script
87
96
  ['deb', 'rpm'].each do |dir|
88
- beta = 0
97
+ beta = false
89
98
  pkg_dir = PKG_DIR
90
99
  Find.find("#{PKG_DIR}/#{dir}") do |file|
91
100
  if File.extname(file) =~ /deb|rpm/
92
- file =~ /.*beta.*/ ? beta += 1 : beta = beta
93
- pkg_dir = BETA_PKG_DIR
101
+ beta = file.include?('beta') ? true : false
102
+ pkg_dir = BETA_PKG_DIR if beta
94
103
  cmd "sudo mkdir #{BETA_PKG_DIR}" unless File.directory? BETA_PKG_DIR
95
104
  cmd "sudo chmod 777 #{BETA_PKG_DIR}"
96
105
  # If one beta pkg is found, break.
97
- break
106
+ break if beta
98
107
  end #if
99
108
  end #do
100
- cmd "sudo cp -rf #{PKG_DIR}/#{dir} #{BETA_PKG_DIR}/#{dir}"
109
+ cmd "sudo cp -rf #{PKG_DIR}/#{dir} #{BETA_PKG_DIR}/#{dir}" if pkg_dir == BETA_PKG_DIR
101
110
  cmd "sudo ruby ./installer/utils/package_upload/s3_upload.rb #{pkg_dir}/#{dir} #{BUCKET} #{@raked}"
102
111
  end #do
103
112
  end #build:repos
@@ -1,3 +1,3 @@
1
1
  module Rhoconnect
2
- VERSION = '3.1.0'
2
+ VERSION = '3.1.1'
3
3
  end
data/rhoconnect.gemspec CHANGED
@@ -37,7 +37,7 @@ Gem::Specification.new do |s|
37
37
  ]
38
38
 
39
39
  s.add_dependency('bundler', '~> 1.0')
40
- s.add_dependency("rack", '~> 1.4.1')
40
+ s.add_dependency("rack", '~> 1.3.6')
41
41
  s.add_dependency("sinatra", '~> 1.3')
42
42
  s.add_dependency('rake', '~> 0.9.2')
43
43
  s.add_dependency('json', '~> 1.6.0')
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rhoconnect
3
3
  version: !ruby/object:Gem::Version
4
- hash: 3
4
+ hash: 1
5
5
  prerelease:
6
6
  segments:
7
7
  - 3
8
8
  - 1
9
- - 0
10
- version: 3.1.0
9
+ - 1
10
+ version: 3.1.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Rhomobile
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-01-31 00:00:00 Z
18
+ date: 2012-02-07 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  version_requirements: &id001 !ruby/object:Gem::Requirement
@@ -38,12 +38,12 @@ dependencies:
38
38
  requirements:
39
39
  - - ~>
40
40
  - !ruby/object:Gem::Version
41
- hash: 5
41
+ hash: 23
42
42
  segments:
43
43
  - 1
44
- - 4
45
- - 1
46
- version: 1.4.1
44
+ - 3
45
+ - 6
46
+ version: 1.3.6
47
47
  requirement: *id002
48
48
  type: :runtime
49
49
  prerelease: false