cinderella 0.2.5 → 0.2.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/Rakefile +1 -1
  2. data/bin/cinderella +0 -38
  3. data/lib/cinderella.rb +59 -0
  4. metadata +3 -3
data/Rakefile CHANGED
@@ -3,7 +3,7 @@ require 'rubygems/specification'
3
3
  require 'bundler'
4
4
 
5
5
  GEM = "cinderella"
6
- GEM_VERSION = "0.2.5"
6
+ GEM_VERSION = "0.2.6"
7
7
  AUTHOR = "Corey Donohoe"
8
8
  EMAIL = "atmos@atmos.org"
9
9
  HOMEPAGE = "http://github.com/atmos/cinderella"
data/bin/cinderella CHANGED
@@ -2,7 +2,6 @@
2
2
  require "rubygems"
3
3
  require "cinderella"
4
4
  require "optparse"
5
- require "etc"
6
5
 
7
6
  ENV['HOME'] ||= '/Users/bofh'
8
7
  ENV['USER'] ||= 'bofh'
@@ -10,43 +9,6 @@ ENV['EMAIL'] ||= 'noreply@gmail.com'
10
9
  ENV['EDITOR'] ||= 'vim'
11
10
  ENV['FULLNAME'] ||= 'Marlon Brando'
12
11
 
13
- RECOMMENDED_LLVM = 2206
14
- MACOS_FULL_VERSION = `/usr/bin/sw_vers -productVersion`.chomp
15
- MACOS_VERSION = /(10\.\d+)(\.\d+)?/.match(MACOS_FULL_VERSION).captures.first.to_f
16
-
17
- # stop people from running this as root
18
- if Etc.getpwuid.uid == 0
19
- $stderr.puts "#{$0} should not be run as root, try again as a normal user"
20
- exit 1
21
- end
22
-
23
- # let people know they're using a non-cinderella based rvm
24
- unless ENV['rvm_path'].nil? || ENV['rvm_path'] =~ /#{ENV['HOME']}\/Developer/
25
- $stderr.puts "You have a pre-existing rvm install that might mess with installation"
26
- $stderr.puts "You should take a look at https://github.com/atmos/cinderella/issues#issue/25"
27
- $stderr.puts "I'm going to continue anyway, *fingers crossed* ;)"
28
- end
29
-
30
- # ensure we have a recent version of snow leopard/xcode
31
- if MACOS_VERSION >= 10.6
32
- begin
33
- xcode_path = `/usr/bin/xcode-select -print-path`.chomp
34
- exit(1) if xcode_path.empty?
35
- if `#{xcode_path}/usr/bin/llvm-gcc-4.2 -v 2>&1` =~ /LLVM build (\d{4,})/
36
- if $1.to_i < RECOMMENDED_LLVM
37
- $stderr.puts "You should really upgrade your xcode install"
38
- end
39
- end
40
- rescue
41
- $stderr.puts "You need xcode for this to work :\\"
42
- exit(1)
43
- end
44
- else
45
- $stderr.puts "You should really upgrade to snow leopard"
46
- $stderr.puts "Make sure you have xcode installed and cross your fingers"
47
- $stderr.puts "I've seen it work on leopard though..."
48
- end
49
-
50
12
  Cider::Runner.run
51
13
 
52
14
  # vim:ft=ruby
data/lib/cinderella.rb CHANGED
@@ -1,14 +1,40 @@
1
+ require "etc"
1
2
  require "json"
2
3
  require "tmpdir"
3
4
  require "rest_client"
4
5
 
5
6
  module Cider
6
7
  class Runner
8
+ RECOMMENDED_LLVM = 2206
9
+ MACOS_FULL_VERSION = `/usr/bin/sw_vers -productVersion`.chomp
10
+ MACOS_VERSION = /(10\.\d+)(\.\d+)?/.match(MACOS_FULL_VERSION).captures.first.to_f
11
+
7
12
  def self.run
8
13
  new.run
9
14
  end
10
15
 
11
16
  def run
17
+ if root?
18
+ warn "#{$0} should not be run as root, try again as a normal user"
19
+ exit 1
20
+ end
21
+
22
+ unless sane_os_version?
23
+ warn "You should really upgrade to snow leopard"
24
+ warn "Make sure you have xcode installed and cross your fingers"
25
+ warn "I've seen it work on leopard though..."
26
+ end
27
+
28
+ unless sane_xcode_version?
29
+ $stderr.puts "You need xcode for this to work :\\"
30
+ exit(1)
31
+ end
32
+
33
+ if sketchy_ruby?
34
+ warn "You have a pre-existing ruby install that might mess with installation"
35
+ warn "I'm going to continue anyway, *fingers crossed* ;)"
36
+ end
37
+
12
38
  system("rm -rf ~/.cinderella")
13
39
  system("chef-solo -c #{config}")
14
40
  exit($?.to_i)
@@ -21,6 +47,39 @@ module Cider
21
47
 
22
48
  private
23
49
 
50
+ def sketchy_ruby?
51
+ case `which ruby`.chomp
52
+ when '/usr/bin/ruby', /#{ENV['HOME']}\/Developer/
53
+ false
54
+ else
55
+ true
56
+ end
57
+ end
58
+
59
+ def root?
60
+ Etc.getpwuid.uid == 0
61
+ end
62
+
63
+ def sane_os_version?
64
+ MACOS_VERSION >= 10.6
65
+ end
66
+
67
+ def sane_xcode_version?
68
+ xcode_path = `/usr/bin/xcode-select -print-path`.chomp
69
+ if xcode_path.empty?
70
+ false
71
+ elsif `#{xcode_path}/usr/bin/llvm-gcc-4.2 -v 2>&1` =~ /LLVM build (\d{4,})/
72
+ if $1.to_i < RECOMMENDED_LLVM
73
+ warn "You should really upgrade your xcode install"
74
+ end
75
+ true
76
+ end
77
+ end
78
+
79
+ def warn(msg)
80
+ $stderr.puts msg
81
+ end
82
+
24
83
  def download_solo_rb
25
84
  response = RestClient.get("http://ciderapp.org/solo.rb")
26
85
  if response.code == 200
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cinderella
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 27
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 5
10
- version: 0.2.5
9
+ - 6
10
+ version: 0.2.6
11
11
  platform: ruby
12
12
  authors:
13
13
  - Corey Donohoe