Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

support binary installations

  • Loading branch information...
commit 59851c1ad199df7ad122f0b5e114dc56e6c87fb3 1 parent 4137616
@atmos authored
Showing with 50 additions and 4 deletions.
  1. +7 −1 bin/cinderella
  2. +42 −2 lib/cinderella.rb
  3. +1 −1  lib/cinderella/version.rb
View
8 bin/cinderella
@@ -34,9 +34,13 @@ optparse = OptionParser.new do |opts|
config[:action] = 'version'
end
- opts.on( '-u', '--unstable', 'Build from homebrew master branch instead of a stable sha1' ) do
+ opts.on( '-x', '--unstable', 'Build from homebrew master branch instead of a stable sha1' ) do
config[:unstable] = true
end
+
+ opts.on( '-b', '--binary-installer', 'Build from homebrew master branch instead of a stable sha1' ) do
+ config[:action] = 'binary_install'
+ end
end
optparse.parse!
@@ -44,6 +48,8 @@ optparse.parse!
case config[:action]
when 'uninstall'
Cinderella::Runner.uninstall
+when 'binary_install'
+ Cinderella::Runner.binary_install
when 'version'
Cinderella::Runner.version
else
View
44 lib/cinderella.rb
@@ -23,6 +23,10 @@ def self.uninstall
new.uninstall
end
+ def self.binary_install
+ new.binary_installer
+ end
+
def self.version
puts "Cinderella Version: #{Cinderella::VERSION}"
end
@@ -37,10 +41,9 @@ def root
end
def uninstall
- print "Stopping Service: "
services = %w/memcached mysql redis mongodb postgresql/
services.each do |service|
- print "#{service} "
+ puts "Stopping Server: #{service} "
sleep 0.5
system("lunchy stop #{service}")
end
@@ -50,6 +53,43 @@ def uninstall
puts "Cinderella successfully uninstalled"
end
+ def binary_installer
+ log_file = "#{Dir.tmpdir}/cinderella.binary.output.txt"
+ local_file = "#{Dir.tmpdir}/cinderella-0.3.2.tar.gz"
+ local_user = `whoami`.chomp
+
+ unless File.exists?("/opt")
+ puts "You don't have an /opt directory, we need sudo access for this."
+ puts "You'll only be prompted for your password once."
+ `sudo mkdir -p /opt`
+ `sudo chown #{local_user}:staff /opt`
+ end
+ unless File.exists?(local_file)
+ puts `curl -o #{local_file} #{binary_url}`
+ end
+ if File.exists?(local_file)
+ puts "Extracting #{local_file} to /opt"
+ `tar zxvf #{local_file} -C /opt > #{log_file} 2>&1`
+ if $?.success?
+ puts "Cinderella successfully installed"
+ puts "Open up a new shell and run the following command"
+ puts "\nsource /opt/Developer/cinderella.profile\n"
+ puts "\nThen run the 'cinderella' command."
+ exit 0
+ else
+ puts "Something went wrong installing cinderella, logs at #{log_file}"
+ exit 1
+ end
+ else
+ puts "Had issues downloading the binary installer. Sorry, bro."
+ exit 1
+ end
+ end
+
+ def binary_url
+ "http://cinderella.s3.amazonaws.com/cinderella-0.3.2.tar.bz2"
+ end
+
def run
if root?
warn "#{$0} should not be run as root, try again as a normal user"
View
2  lib/cinderella/version.rb
@@ -1,3 +1,3 @@
module Cinderella
- VERSION = "0.3.1"
+ VERSION = "0.3.2"
end
Please sign in to comment.
Something went wrong with that request. Please try again.