Created
          August 31, 2012 09:57 
        
      - 
      
- 
        Save siroken3/3551013 to your computer and use it in GitHub Desktop. 
    capistranoのrole一覧をsqliteを使って取得する ref: http://qiita.com/items/bcfa059debd45257ca4b
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | role(:server) do | |
| hosts = Array.new | |
| db = SQLite3::Database.new("serverlist.db") | |
| db.execute("SELECT name FROM serverlist WHERE role = 'server'") do |host| | |
| hosts.push(host[0]) | |
| end | |
| db.close() | |
| hosts | |
| end | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | CREATE TABLE serverlist ( | |
| name varchar(10), | |
| env varchar(10), | |
| role varchar(10) | |
| ); | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment