rhoconnect 3.0.0.beta1 → 3.0.0.beta3

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.
Files changed (87) hide show
  1. data/CHANGELOG +16 -2
  2. data/Gemfile +14 -5
  3. data/Gemfile.lock +13 -23
  4. data/Rakefile +86 -0
  5. data/bench/bench_runner.rb +5 -4
  6. data/bench/benchapp/Gemfile +17 -8
  7. data/bench/blobapp/Gemfile +13 -14
  8. data/doc/adapters-crm.txt +226 -0
  9. data/doc/adapters-intro.txt +18 -0
  10. data/doc/client.txt +29 -2
  11. data/doc/heroku-addon.txt +54 -0
  12. data/doc/install.txt +1 -2
  13. data/doc/migration.txt +18 -6
  14. data/doc/net-plugin.txt +276 -0
  15. data/doc/plugin-intro.txt +6 -0
  16. data/doc/push.txt +1 -1
  17. data/doc/rails-plugin.txt +116 -0
  18. data/doc/rest-api.txt +2 -2
  19. data/doc/settings.txt +59 -0
  20. data/doc/tutorial.txt +8 -5
  21. data/generators/rhoconnect.rb +30 -0
  22. data/generators/templates/application/Gemfile +16 -7
  23. data/generators/templates/application/gitignore +4 -0
  24. data/install.sh +74 -106
  25. data/installer/deb-scripts/LICENSE +75 -0
  26. data/installer/deb-scripts/install.sh +300 -0
  27. data/installer/deb-scripts/scripts/rho_connect_install_constants.rb +32 -0
  28. data/installer/deb-scripts/scripts/rho_connect_install_installers.rb +103 -0
  29. data/installer/deb-scripts/scripts/rho_connect_install_utilities.rb +110 -0
  30. data/installer/deb-scripts/scripts/rhoinstaller.rb +55 -0
  31. data/installer/deb-scripts/utils/README +67 -0
  32. data/installer/deb-scripts/utils/create_texts.rb +76 -0
  33. data/installer/deb-scripts/utils/redis_init_script +124 -0
  34. data/installer/deb-scripts/utils/redis_log_rotate +8 -0
  35. data/installer/unix-like/install.sh +361 -0
  36. data/installer/unix-like/post-install.sh +8 -0
  37. data/installer/unix-like/pre-install.sh +8 -0
  38. data/installer/unix-like/rho_connect_install_constants.rb +9 -14
  39. data/installer/unix-like/rho_connect_install_debian.rb +7 -5
  40. data/installer/unix-like/rho_connect_install_dnd.rb +6 -6
  41. data/installer/unix-like/rho_connect_install_get_params.rb +1 -1
  42. data/installer/unix-like/rho_connect_install_installers.rb +39 -38
  43. data/installer/unix-like/rho_connect_install_utilities.rb +9 -10
  44. data/installer/unix-like/rho_connect_install_yum.rb +6 -5
  45. data/installer/unix-like/rhoinstaller.rb +8 -3
  46. data/installer/utils/create_texts.rb +313 -85
  47. data/installer/windows/rhosync.nsi +5 -5
  48. data/lib/rhoconnect/api/application/clientcreate.rb +1 -1
  49. data/lib/rhoconnect/api/application/clientregister.rb +1 -1
  50. data/lib/rhoconnect/api/application/clientreset.rb +1 -1
  51. data/lib/rhoconnect/client.rb +0 -1
  52. data/lib/rhoconnect/client_sync.rb +1 -0
  53. data/lib/rhoconnect/console/app/routes/home.rb +1 -1
  54. data/lib/rhoconnect/console/app/routes/user.rb +8 -3
  55. data/lib/rhoconnect/console/app/views/adapter.erb +2 -2
  56. data/lib/rhoconnect/console/app/views/ping.erb +14 -2
  57. data/lib/rhoconnect/console/app/views/users.erb +8 -1
  58. data/lib/rhoconnect/jobs/ping_job.rb +11 -3
  59. data/lib/rhoconnect/model.rb +2 -2
  60. data/lib/rhoconnect/read_state.rb +2 -0
  61. data/lib/rhoconnect/server.rb +4 -3
  62. data/lib/rhoconnect/source.rb +33 -6
  63. data/lib/rhoconnect/source_adapter.rb +5 -9
  64. data/lib/rhoconnect/source_sync.rb +11 -5
  65. data/lib/rhoconnect/store.rb +7 -4
  66. data/lib/rhoconnect/tasks.rb +3 -3
  67. data/lib/rhoconnect/version.rb +1 -1
  68. data/lib/rhoconnect.rb +22 -8
  69. data/rhoconnect.gemspec +4 -22
  70. data/spec/api/application/rhoconnect_api_spec.rb +54 -8
  71. data/spec/api/source/get_source_params_spec.rb +2 -1
  72. data/spec/api/source/list_sources_spec.rb +3 -3
  73. data/spec/app_spec.rb +8 -1
  74. data/spec/apps/rhotestapp/settings/settings.yml +10 -5
  75. data/spec/apps/rhotestapp/sources/other_adapter.rb +7 -0
  76. data/spec/client_sync_spec.rb +5 -8
  77. data/spec/dynamic_adapter_spec.rb +8 -8
  78. data/spec/generator/generator_spec.rb +4 -2
  79. data/spec/jobs/ping_job_spec.rb +53 -0
  80. data/spec/model_spec.rb +2 -2
  81. data/spec/rhosync_spec.rb +1 -1
  82. data/spec/server/server_spec.rb +3 -14
  83. data/spec/source_sync_spec.rb +84 -2
  84. data/spec/support/shared_examples.rb +2 -2
  85. data/tasks/redis.rake +2 -2
  86. metadata +30 -41
  87. data/spec/api/rhosync_api_spec.rb.orig +0 -606
@@ -10,7 +10,7 @@ module GetParams
10
10
  def get_flavor(options)
11
11
  get_cmd = ''
12
12
  Constants::SUPPORTED_PKG_MGRS.each do |mgr|
13
- if `which #{ mgr }` != ""
13
+ if `which #{ mgr } 2> /dev/null` != ""
14
14
  get_cmd = mgr
15
15
  end #if
16
16
  end #do
@@ -8,29 +8,34 @@ module Installers
8
8
  @options=''
9
9
 
10
10
  # configure_passenger
11
- # This method installs items that were retrieved via wget as well as
12
- # passenger
11
+ # This method installs items that were retrieved via wget as well as passenger
13
12
  def configure_passenger(options)
14
13
  @options=options
15
- installs = 0
16
14
  print_header "Configuring Passenger"
17
15
  if @options[:web_server] && !check_web_server_running
18
16
  if @options[:web_server] == "apache2"
19
17
  print_header "Configuring Apache2 to work with Passenger"
18
+ cmd "yes | #{@options[:prefix]}/bin/passenger-install-#{ @options[:web_server] }-module"
20
19
  elsif @options[:web_server] == "nginx"
21
- print_header "Configuring Nginx to work with Passenger"
20
+ print_header "Configuring and Compiling Nginx to work with Passenger"
21
+ nginx_version = Constants::Nginx
22
+ cmd "cd #{@options[:prefix]}; wget http://nginx.org/download/#{nginx_version}.tar.gz; tar -xzvf #{nginx_version}.tar.gz"
23
+ cmd "#{@options[:prefix]}/bin/passenger-install-nginx-module --auto --prefix=/opt/nginx \
24
+ --nginx-source-dir=#{@options[:prefix]}/#{nginx_version} \
25
+ --extra-configure-flags='--with-http_ssl_module --with-http_gzip_static_module --user=nginx --group=nginx'"
22
26
  else
23
27
  log_print "That web server is not yet supported. Sorry..."
28
+ exit
24
29
  end #if
25
30
  end #if
26
- cmd "yes | #{@options[:prefix]}bin/passenger-install-#{ @options[:web_server] }-module"
27
31
 
28
32
  if $? != 0
29
33
  log_print "Some dependencies are not installed.\nPlease install them and re-run this script..."
30
34
  exit
31
- else
32
- cmd "echo passenger >> #{@options[:prefix]}installchecklist"
33
35
  end #if
36
+ # FIXME:
37
+ cmd "rm -rf #{@options[:prefix]}/#{nginx_version}; rm #{@options[:prefix]}/#{nginx_version}.tar.gz" if File.exist? "#{@options[:prefix]}/#{nginx_version}.tar.gz"
38
+
34
39
  end #configure_passenger
35
40
 
36
41
  # install_all_packages
@@ -59,44 +64,37 @@ module Installers
59
64
  # This method installs all gems specified in the GEMS list defined in the
60
65
  # Constants file
61
66
  def install_all_gems
62
- gem_path = "#{@options[:prefix]}bin/gem"
67
+ @gem_path = "#{@options[:prefix]}/bin/gem"
63
68
  Constants::GEMS.each do |gem|
64
- install_gem gem, gem_path
69
+ install_gem gem
65
70
  end #do
66
71
  end #install_all_gems
67
72
 
68
73
  # install_gem
69
74
  # This method installs the given gem unless it is already installed
70
- def install_gem(gem, gem_path)
71
- if gem =~ /sqlite3/ && @options[:pkg_mgr] =~ /yum/ # CentOS
72
- sqlite3_cmd= "export LD_LIBRARY_PATH=#{@options[:prefix]}lib; #{@options[:prefix]}bin/gem install sqlite3 --no-ri --no-rdoc -- --with-sqlite3-include=#{@options[:prefix]}include"
73
- cmd sqlite3_cmd
74
- else
75
- cmd "#{@gem_path} install #{ gem } --no-ri --no-rdoc" unless check_gem gem, @gem_path
76
- end
75
+ def install_gem(gem)
76
+ cmd "#{@gem_path} install #{ gem } --no-ri --no-rdoc" unless check_gem gem, @gem_path
77
77
  end #install_gem
78
78
 
79
79
  # install_rubygems
80
80
  # This method installs rubygems which was downloaded and untarred earlier
81
81
  def install_rubygems
82
82
  print_header "Installing Rubygems"
83
- Dir.chdir("#{@options[:prefix]}#{Constants::RUBYGEMS}")
84
- cmd "#{@options[:prefix]}bin/ruby setup.rb --prefix=#{@options[:prefix]}#{Constants::RUBYGEMS}"
85
- @gem_path = "#{@options[:prefix]}bin/gem"
86
- cmd "sed -n '1 c\#!/opt/rhoconnect/bin/ruby' #{@options[:prefix]}bin/gem"
87
- @gem="#{@options[:prefix]}bin/gem"
88
- cmd "echo rubygems >> #{@options[:prefix]}installchecklist"
83
+ Dir.chdir("#{@options[:prefix]}/#{Constants::RUBYGEMS}")
84
+ cmd "#{@options[:prefix]}/bin/ruby setup.rb --prefix=#{@options[:prefix]}/#{Constants::RUBYGEMS}"
85
+ @gem_path = "#{@options[:prefix]}/bin/gem"
86
+ cmd "sed -n '1 c\#!/opt/rhoconnect/bin/ruby' #{@options[:prefix]}/bin/gem"
89
87
  end #install_rubygems
90
88
 
91
89
  # install_redis
92
90
  # This method installs redis
93
91
  def install_redis
94
- Dir.chdir("#{@options[:prefix]}#{Constants::REDIS}/src")
92
+ Dir.chdir("#{@options[:prefix]}/#{Constants::REDIS}/src")
95
93
  cmd "make; make PREFIX=#{@options[:prefix]} install"
96
- cmd "mkdir #{@options[:prefix]}etc" unless File.exist? "#{@options[:prefix]}etc"
94
+ cmd "mkdir #{@options[:prefix]}/etc" unless File.exist? "#{@options[:prefix]}/etc"
97
95
 
98
96
  #cmd "cp ../redis.conf #{@options[:prefix]}etc"
99
- redis_conf_file = File.new("#{@options[:prefix]}etc/redis.conf", 'w')
97
+ redis_conf_file = File.new("#{@options[:prefix]}/etc/redis.conf", 'w')
100
98
  File.foreach("../redis.conf") do |line|
101
99
  # daemonize no --> daemonize yes
102
100
  # logfile stdout --> logfile /var/log/redis.log
@@ -109,17 +107,14 @@ module Installers
109
107
  end
110
108
  end
111
109
  redis_conf_file.close
112
-
113
- cmd "echo redis >> #{@options[:prefix]}installchecklist"
114
110
  end #install_redis
115
111
 
116
112
  # install_sqlite
117
113
  # This method instaqll sqlite
118
114
  def install_sqlite
119
- Dir.chdir("#{@options[:prefix]}#{Constants::SQLITE3}")
115
+ Dir.chdir("#{@options[:prefix]}/#{Constants::SQLITE3}")
120
116
  cmd "./configure --prefix=#{@options[:prefix]}"
121
117
  cmd "make; make install"
122
- cmd "echo sqlite >> #{@options[:prefix]}installchecklist"
123
118
  end #install_sqlite
124
119
 
125
120
  # install_rhoconnect
@@ -127,16 +122,22 @@ module Installers
127
122
  def install_rhoconnect
128
123
  # start installations
129
124
  # store current gem_path
130
- orig_gem_path = `which gem`
125
+ # orig_gem_path = `which gem`
131
126
  print_header "Installing Rhoconnect"
127
+ path_to_rc_gem = "/tmp/installdir/rhoconnect-#{@options[:version]}/rhoconnect-#{@options[:version]}.gem"
128
+
132
129
  Dir.chdir(@options[:start_dir])
133
- cmd "#{@options[:prefix]}bin/bundle config build.sqlite3" +
134
- " --with-sqlite3-include=#{@options[:prefix]}include" +
135
- " --with-sqlite3-lib=#{@options[:prefix]}lib"
136
- cmd "#{@options[:prefix]}bin/bundle install" +
137
- " --without=test development" +
138
- " --path=#{@options[:prefix]}"
139
- cmd "export PATH=#{@options[:prefix]}bin:$PATH; rake install"
140
- cmd "echo rhoconnect >> #{@options[:prefix]}installchecklist"
130
+ if File.exists?(path_to_rc_gem)
131
+ install_gem path_to_rc_gem
132
+ else
133
+ cmd "#{@options[:prefix]}/bin/bundle config build.sqlite3 " +
134
+ "--with-sqlite3-include=#{@options[:prefix]}/include " +
135
+ "--with-sqlite3-lib=#{@options[:prefix]}/lib" if @options[:pkg_mgr] =~ /yum/ # CentOS
136
+ cmd "#{@options[:prefix]}/bin/bundle install --system --binstubs=/opt/rhoconnect/bin --without=test development"
137
+ # PATH=/opt/rhoconnect/bin:$PATH rake build
138
+ cmd "PATH=#{@options[:prefix]}/bin:$PATH rake build"
139
+ cmd "#{@gem_path} install pkg/rhoconnect-*.gem --no-ri --no-rdoc"
140
+ `rm -f pkg/rhoconnect-*.gem`
141
+ end #if
141
142
  end #install_rhoconnect
142
143
  end #Installers
@@ -47,7 +47,7 @@ module Utilities
47
47
  # This method issues the given system command and calls log_print for output
48
48
  def cmd(cmd)
49
49
  log_print cmd
50
- log_print `#{ cmd }`
50
+ log_print `#{cmd}`
51
51
  end #cmd
52
52
 
53
53
  #set_log_file
@@ -71,15 +71,14 @@ module Utilities
71
71
  # cleanup
72
72
  # This method moves all compressed files from the installation directory
73
73
  # that were downloaded by this installation process
74
- def cleanup(prefix, options)
74
+ def cleanup(prefix)
75
75
  print_header "Cleaning up"
76
- Dir.mkdir("#{prefix}downloads") unless File.directory?("#{prefix}downloads")
77
- Constants::URLS.each do |url|
78
- file = get_version url
79
- if File.exists?("#{prefix}#{file}")
80
- cmd "rm -rf #{prefix}downloads/#{file}"
81
- cmd "mv #{prefix}#{file}* #{prefix}downloads"
82
- end #if
83
- end # do
76
+ Constants::SOFTWARE.each do |sw|
77
+ if File.exist? "#{prefix}/#{sw}.tar.gz"
78
+ cmd "rm #{prefix}/#{sw}.tar.gz"
79
+ cmd "rm -rf #{prefix}/#{sw}"
80
+ end
81
+ end
84
82
  end #cleanup
83
+
85
84
  end #Utilities
@@ -26,12 +26,13 @@ class Yum
26
26
  set_log_file @options[:log]
27
27
 
28
28
  #gather necessary files
29
- download_and_decompress @options[:prefix]
29
+ download_and_decompress(@options[:prefix], [Constants::REDIS_URL, Constants::SQLITE3_URL])
30
30
 
31
- #install ruby gems
32
- install_rubygems
31
+ # ruby gems is installed by the REE installer
32
+ # install_rubygems
33
33
  install_redis if @options[:redis]
34
- install_sqlite
34
+ # Cent OS uses obsolete sqlite3 libs, update them the latest ones
35
+ install_sqlite
35
36
 
36
37
  #start installing
37
38
  install_all_gems
@@ -41,7 +42,7 @@ class Yum
41
42
  install_rhoconnect
42
43
 
43
44
  #remove downloaded tarballs
44
- cleanup options[:prefix], @options
45
+ cleanup options[:prefix]
45
46
  end #execute_installation
46
47
 
47
48
  # to_s
@@ -54,9 +54,14 @@ optparse = OptionParser.new do|opts|
54
54
  opts.on( '-s', '--silent', 'Perform installation with minimal output' ) do
55
55
  options[:silent] = true
56
56
  end #do
57
+
58
+ options[:version] = nil
59
+ opts.on( '-v', '--version VERSION', 'Specify VERSION as the rhoconect version' ) do |ver|
60
+ options[:version] = ver
61
+ end #do
57
62
 
58
- options[:web_server] = "apache2"
59
- opts.on( '-w', '--web-server SERVER', 'Specify apache2 or nginx. Default is Apache2.' ) do |server|
63
+ options[:web_server] = "nginx"
64
+ opts.on( '-w', '--web-server SERVER', 'Specify apache2 or nginx. Default is Nginx.' ) do |server|
60
65
  options[:web_server] = server
61
66
  end #do
62
67
 
@@ -69,7 +74,7 @@ end #do
69
74
  options[:start_dir] = `pwd`.strip
70
75
 
71
76
  optparse.parse!
72
- log = Logger.new(IO.readlines("#{options[:prefix]}info.dat").last.strip)
77
+ log = Logger.new(IO.readlines("#{options[:prefix]}/info.dat").last.strip)
73
78
  log.datetime_format = "%Y-%m-%d %H:%M:%S" # simplify time output
74
79
  options[:log] = log
75
80