public
Description: Tools to manage ExpressionEngine ... maybe.
Clone URL: git://github.com/vigetlabs/crash_cart.git
Find mysql socket when connecting to localhost

git-svn-id: http://svn.extendviget.com/lab/crash_cart/trunk@581 
e959a6d6-1924-0410-92b3-a6fa492f4c66
preagan (author)
Fri Mar 21 23:27:18 -0700 2008
commit  2721eea75ac85ca0c6a56d4f4c2fa96e4e828c94
tree    5b4dbbf922aa7185fd3a269372ae5d10d19ee011
parent  be401d8613375972c0fbc265feec654dd96f4081
...
2
3
4
5
 
6
7
8
...
2
3
4
 
5
6
7
8
0
@@ -2,7 +2,7 @@ require 'rubygems'
0
 require 'rake/gempackagetask'
0
 require 'spec/rake/spectask'
0
 
0
-require 'crash_cart/version'
0
+require 'lib/crash_cart/version'
0
 
0
 GEM = "crash_cart"
0
 AUTHOR = "Patrick Reagan"
0
...
1
2
 
3
4
5
...
1
2
3
4
5
6
0
@@ -1,5 +1,6 @@
0
 #!/usr/bin/env ruby
0
 
0
+require 'rubygems'
0
 require 'activerecord'
0
 
0
 lib_dir = File.join(File.dirname(__FILE__), %w{.. lib})
...
2
3
4
5
6
7
 
 
8
9
10
11
 
 
 
 
 
 
 
12
13
14
15
16
17
 
 
18
19
...
2
3
4
 
 
 
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
 
 
22
23
24
25
0
@@ -2,18 +2,24 @@ Useful reporting features?
0
 
0
 * Tree structure of:
0
   * Sites
0
- * Weblogs
0
- * Template Groups
0
- * Templates
0
+ * Template Groups
0
+ * Templates
0
         * Should be saved to disk?
0
         * Is saved on disk?
0
         * Is in a subversion repository?
0
         
0
+ * Weblogs
0
+
0
+
0
+Site: Viget Labs
0
+|-- Development Blog: Blogroll
0
+`-- Development Blog: Posts
0
+
0
 Useful installation-wide settings:
0
 
0
 * Select to save all weblogs as templates
0
 * Update the root directory and all subsequent settings
0
-* Update the base URL for the site
0
-
0
+* Update the base URL for the site (does this include per-weblog URLs?)
0
+* Convert slug data (underscore -> dash -> underscore) and update the appropriate EE setting
0
 
0
 
...
32
33
34
 
 
 
 
 
 
 
35
36
37
...
51
52
53
 
54
55
56
...
32
33
34
35
36
37
38
39
40
41
42
43
44
...
58
59
60
61
62
63
64
0
@@ -32,6 +32,13 @@ module ExpressionEngine
0
     def [](key)
0
       configuration[key]
0
     end
0
+
0
+ def socket
0
+ if @socket.nil? && @configuration[:database][:host] == 'localhost'
0
+ @socket = `mysql_config --socket`.strip
0
+ end
0
+ @socket
0
+ end
0
 
0
     private
0
     def configuration
0
@@ -51,6 +58,7 @@ module ExpressionEngine
0
           key = match[0]
0
           @configuration[:database][mapping[key]] = match[1] if mapping.has_key?(key)
0
         end
0
+ @configuration[:database][:socket] = socket unless socket.nil?
0
       end
0
 
0
       @configuration
...
1
2
 
 
3
4
5
...
 
 
1
2
3
4
5
0
@@ -1,5 +1,5 @@
0
-require 'expression_engine/models/weblog'
0
-require 'expression_engine/models/template'
0
+require 'lib/expression_engine/models/weblog'
0
+require 'lib/expression_engine/models/template'
0
 
0
 module ExpressionEngine
0
 
...
23
24
25
26
 
 
 
 
27
28
 
 
 
 
 
 
 
 
29
30
31
...
23
24
25
 
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
0
@@ -23,9 +23,20 @@ module ExpressionEngine
0
     end
0
 
0
     it "should be able to read in the database configuration" do
0
- expected = {:username => 'reaganpr', :host => 'localhost', :password => 'testing', :database => 'ee_demo', :adapter => 'mysql'}
0
+ expected = {
0
+ :username => 'reaganpr', :host => 'localhost', :password => 'testing',
0
+ :database => 'ee_demo', :adapter => 'mysql', :socket => '/tmp/mysql.sock'
0
+ }
0
       @config[:database].should == expected
0
     end
0
+
0
+ it "should be able to locate the mysql socket" do
0
+ socket_path = '/var/lib/mysql/mysql.sock'
0
+ @config.expects(:`).with('mysql_config --socket').returns("#{socket_path}\n")
0
+
0
+ @config[:database][:host].should == 'localhost'
0
+ @config[:database][:socket].should == socket_path
0
+ end
0
 
0
   end
0
 

Comments

    No one has commented yet.