drush-deploy 1.0.3 → 1.0.4
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.
- data/README.md +1 -1
 - data/drush-deploy.gemspec +1 -1
 - data/lib/drush_deploy/database.rb +26 -1
 - data/lib/drush_deploy/recipes/db.rb +6 -5
 - data/lib/drush_deploy/recipes/setup.rb +1 -1
 - metadata +8 -8
 
    
        data/README.md
    CHANGED
    
    
    
        data/drush-deploy.gemspec
    CHANGED
    
    | 
         @@ -1,6 +1,6 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            Gem::Specification.new do |s|
         
     | 
| 
       2 
2 
     | 
    
         
             
              s.name        = 'drush-deploy'
         
     | 
| 
       3 
     | 
    
         
            -
              s.version     = '1.0. 
     | 
| 
      
 3 
     | 
    
         
            +
              s.version     = '1.0.4'
         
     | 
| 
       4 
4 
     | 
    
         
             
              s.summary     = "Deployment strategy for Drupal using Drush"
         
     | 
| 
       5 
5 
     | 
    
         
             
              s.description = "Utilizes capistrano to allow for doing intellegent deployments of drupal projects."
         
     | 
| 
       6 
6 
     | 
    
         
             
              s.authors     = ["Matt Edlefsen"]
         
     | 
| 
         @@ -7,6 +7,20 @@ require 'php_serialize' 
     | 
|
| 
       7 
7 
     | 
    
         
             
            module DrushDeploy
         
     | 
| 
       8 
8 
     | 
    
         
             
              class Database
         
     | 
| 
       9 
9 
     | 
    
         
             
                class Error < DrushDeploy::Error; end
         
     | 
| 
      
 10 
     | 
    
         
            +
                class ConfigNotFound < Error
         
     | 
| 
      
 11 
     | 
    
         
            +
                  def initialize(site_name,db_name)
         
     | 
| 
      
 12 
     | 
    
         
            +
                    super "Couldn't locate database configuration #{site_name}/#{db_name}. Please check your database configuration."
         
     | 
| 
      
 13 
     | 
    
         
            +
                  end
         
     | 
| 
      
 14 
     | 
    
         
            +
                end
         
     | 
| 
      
 15 
     | 
    
         
            +
                class FieldNotFound < Error
         
     | 
| 
      
 16 
     | 
    
         
            +
                  def initialize(key,site_name = 'default',db_name = 'default')
         
     | 
| 
      
 17 
     | 
    
         
            +
                    key = [key] unless key.is_a? Array
         
     | 
| 
      
 18 
     | 
    
         
            +
                    key = key.map {|k| "'#{k}'"}.join(',')
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
                    super "Couldn't find #{key} field#{key.size == 1 ? '' : 's'} in database configuration #{site_name}/#{db_name}."\
         
     | 
| 
      
 21 
     | 
    
         
            +
                          " Please check your database configuration."
         
     | 
| 
      
 22 
     | 
    
         
            +
                  end
         
     | 
| 
      
 23 
     | 
    
         
            +
                end
         
     | 
| 
       10 
24 
     | 
    
         | 
| 
       11 
25 
     | 
    
         | 
| 
       12 
26 
     | 
    
         
             
                STANDARD_KEYS = %w(driver database username password host port prefix collation).map &:to_sym
         
     | 
| 
         @@ -146,7 +160,11 @@ module DrushDeploy 
     | 
|
| 
       146 
160 
     | 
    
         
             
                  options = (args.size>0 && args.last.is_a?(Hash)) ? args.pop : {}
         
     | 
| 
       147 
161 
     | 
    
         
             
                  site_name = args[0] || :default
         
     | 
| 
       148 
162 
     | 
    
         
             
                  db_name = args[1] || :default
         
     | 
| 
       149 
     | 
    
         
            -
                   
     | 
| 
      
 163 
     | 
    
         
            +
                  if databases[site_name] && databases[site_name][db_name]
         
     | 
| 
      
 164 
     | 
    
         
            +
                    conf = databases[site_name][db_name].dup
         
     | 
| 
      
 165 
     | 
    
         
            +
                  else
         
     | 
| 
      
 166 
     | 
    
         
            +
                    throw ConfigNotFound.new site_name,db_name
         
     | 
| 
      
 167 
     | 
    
         
            +
                  end
         
     | 
| 
       150 
168 
     | 
    
         
             
                  if options[:admin] && conf[:admin_username]
         
     | 
| 
       151 
169 
     | 
    
         
             
                    conf[:username] = conf[:admin_username]
         
     | 
| 
       152 
170 
     | 
    
         
             
                    conf[:password] = conf[:admin_password]
         
     | 
| 
         @@ -171,6 +189,7 @@ module DrushDeploy 
     | 
|
| 
       171 
189 
     | 
    
         
             
                  conf[:database] = db if db
         
     | 
| 
       172 
190 
     | 
    
         
             
                  db = conf[:database]
         
     | 
| 
       173 
191 
     | 
    
         
             
                  if @db_status[db].nil?
         
     | 
| 
      
 192 
     | 
    
         
            +
                    throw FieldNotFound.new 'database' unless conf[:database]
         
     | 
| 
       174 
193 
     | 
    
         
             
                    logger.info "Fetching status of db #{conf[:database]}"
         
     | 
| 
       175 
194 
     | 
    
         
             
                    sql = %q{SELECT count(*) FROM information_schema.tables 
         
     | 
| 
       176 
195 
     | 
    
         
             
                             WHERE table_schema = '%{database}' LIMIT 1} % conf
         
     | 
| 
         @@ -183,6 +202,7 @@ module DrushDeploy 
     | 
|
| 
       183 
202 
     | 
    
         | 
| 
       184 
203 
     | 
    
         
             
                def db_versions
         
     | 
| 
       185 
204 
     | 
    
         
             
                  conf = config(:admin => true)
         
     | 
| 
      
 205 
     | 
    
         
            +
                  throw FieldNotFound.new 'database' unless conf[:database]
         
     | 
| 
       186 
206 
     | 
    
         
             
                  logger.info "Getting list of databases versions"
         
     | 
| 
       187 
207 
     | 
    
         
             
                  sql = %q{SELECT SCHEMA_NAME FROM information_schema.SCHEMATA
         
     | 
| 
       188 
208 
     | 
    
         
             
                           WHERE SCHEMA_NAME REGEXP '%{database}_[0-9]+';} % conf
         
     | 
| 
         @@ -192,6 +212,7 @@ module DrushDeploy 
     | 
|
| 
       192 
212 
     | 
    
         
             
                def db_exists?(db = nil)
         
     | 
| 
       193 
213 
     | 
    
         
             
                  conf = config(:admin => true)
         
     | 
| 
       194 
214 
     | 
    
         
             
                  conf[:database] = db if db
         
     | 
| 
      
 215 
     | 
    
         
            +
                  throw FieldNotFound.new 'database' unless conf[:database]
         
     | 
| 
       195 
216 
     | 
    
         
             
                  logger.info "Checking existence of #{conf[:database]}"
         
     | 
| 
       196 
217 
     | 
    
         
             
                  sql = %q{SELECT COUNT(*) FROM information_schema.SCHEMATA WHERE SCHEMA_NAME = '%{database}';} % conf
         
     | 
| 
       197 
218 
     | 
    
         
             
                  conf[:database] = 'information_schema'
         
     | 
| 
         @@ -202,6 +223,7 @@ module DrushDeploy 
     | 
|
| 
       202 
223 
     | 
    
         
             
                  conf = config(:admin => true)
         
     | 
| 
       203 
224 
     | 
    
         
             
                  conf[:database] = db if db
         
     | 
| 
       204 
225 
     | 
    
         
             
                  db = conf[:database]
         
     | 
| 
      
 226 
     | 
    
         
            +
                  throw FieldNotFound.new 'database' unless conf[:database]
         
     | 
| 
       205 
227 
     | 
    
         
             
                  logger.info "Fetching table list of #{conf[:database]}"
         
     | 
| 
       206 
228 
     | 
    
         
             
                  db_tables_query = %q{SELECT table_name FROM information_schema.tables
         
     | 
| 
       207 
229 
     | 
    
         
             
                                       WHERE table_schema = '%{database}'
         
     | 
| 
         @@ -280,6 +302,9 @@ module DrushDeploy 
     | 
|
| 
       280 
302 
     | 
    
         
             
                end
         
     | 
| 
       281 
303 
     | 
    
         | 
| 
       282 
304 
     | 
    
         
             
                def self.url(db)
         
     | 
| 
      
 305 
     | 
    
         
            +
                  missing_keys = %w(driver username password host port database).delete_if {|k| db.key? k.to_sym}
         
     | 
| 
      
 306 
     | 
    
         
            +
                  throw FieldNotFound.new missing_keys unless missing_keys.empty?
         
     | 
| 
      
 307 
     | 
    
         
            +
                  
         
     | 
| 
       283 
308 
     | 
    
         
             
                  "#{db[:driver]}://#{db[:username]}:#{db[:password]}@#{db[:host]}:#{db[:port]}/#{db[:database]}"
         
     | 
| 
       284 
309 
     | 
    
         
             
                end
         
     | 
| 
       285 
310 
     | 
    
         
             
              end
         
     | 
| 
         @@ -2,15 +2,16 @@ require 'drush_deploy/database' 
     | 
|
| 
       2 
2 
     | 
    
         | 
| 
       3 
3 
     | 
    
         | 
| 
       4 
4 
     | 
    
         
             
            after "deploy:update_code", "db:drupal:update_settings"
         
     | 
| 
       5 
     | 
    
         
            -
            after "deploy:update_code", "db:version:create"
         
     | 
| 
       6 
     | 
    
         
            -
            before "deploy:rollback", "db:version:rollback"
         
     | 
| 
       7 
5 
     | 
    
         | 
| 
       8 
6 
     | 
    
         
             
            if version_database
         
     | 
| 
       9 
     | 
    
         
            -
               
     | 
| 
       10 
     | 
    
         
            -
              before " 
     | 
| 
       11 
     | 
    
         
            -
              before "db:version:cleanup", "db:drupal:configure"
         
     | 
| 
      
 7 
     | 
    
         
            +
              after "deploy:update_code", "db:version:create"
         
     | 
| 
      
 8 
     | 
    
         
            +
              before "deploy:rollback", "db:version:rollback"
         
     | 
| 
       12 
9 
     | 
    
         
             
            end
         
     | 
| 
       13 
10 
     | 
    
         | 
| 
      
 11 
     | 
    
         
            +
            before "db:version:create", "db:drupal:configure"
         
     | 
| 
      
 12 
     | 
    
         
            +
            before "db:version:rollback", "db:drupal:configure"
         
     | 
| 
      
 13 
     | 
    
         
            +
            before "db:version:cleanup", "db:drupal:configure"
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
       14 
15 
     | 
    
         
             
            if update_modules
         
     | 
| 
       15 
16 
     | 
    
         
             
              after "deploy:update_code", "db:drupal:update"
         
     | 
| 
       16 
17 
     | 
    
         
             
            end
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: drush-deploy
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 1.0. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 1.0.4
         
     | 
| 
       5 
5 
     | 
    
         
             
              prerelease: 
         
     | 
| 
       6 
6 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       7 
7 
     | 
    
         
             
            authors:
         
     | 
| 
         @@ -9,11 +9,11 @@ authors: 
     | 
|
| 
       9 
9 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       10 
10 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       11 
11 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       12 
     | 
    
         
            -
            date: 2012-05- 
     | 
| 
      
 12 
     | 
    
         
            +
            date: 2012-05-21 00:00:00.000000000 Z
         
     | 
| 
       13 
13 
     | 
    
         
             
            dependencies:
         
     | 
| 
       14 
14 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       15 
15 
     | 
    
         
             
              name: capistrano
         
     | 
| 
       16 
     | 
    
         
            -
              requirement: & 
     | 
| 
      
 16 
     | 
    
         
            +
              requirement: &17765540 !ruby/object:Gem::Requirement
         
     | 
| 
       17 
17 
     | 
    
         
             
                none: false
         
     | 
| 
       18 
18 
     | 
    
         
             
                requirements:
         
     | 
| 
       19 
19 
     | 
    
         
             
                - - ! '>='
         
     | 
| 
         @@ -21,10 +21,10 @@ dependencies: 
     | 
|
| 
       21 
21 
     | 
    
         
             
                    version: '2.0'
         
     | 
| 
       22 
22 
     | 
    
         
             
              type: :runtime
         
     | 
| 
       23 
23 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       24 
     | 
    
         
            -
              version_requirements: * 
     | 
| 
      
 24 
     | 
    
         
            +
              version_requirements: *17765540
         
     | 
| 
       25 
25 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       26 
26 
     | 
    
         
             
              name: railsless-deploy
         
     | 
| 
       27 
     | 
    
         
            -
              requirement: & 
     | 
| 
      
 27 
     | 
    
         
            +
              requirement: &17764920 !ruby/object:Gem::Requirement
         
     | 
| 
       28 
28 
     | 
    
         
             
                none: false
         
     | 
| 
       29 
29 
     | 
    
         
             
                requirements:
         
     | 
| 
       30 
30 
     | 
    
         
             
                - - ! '>='
         
     | 
| 
         @@ -32,10 +32,10 @@ dependencies: 
     | 
|
| 
       32 
32 
     | 
    
         
             
                    version: 1.0.2
         
     | 
| 
       33 
33 
     | 
    
         
             
              type: :runtime
         
     | 
| 
       34 
34 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       35 
     | 
    
         
            -
              version_requirements: * 
     | 
| 
      
 35 
     | 
    
         
            +
              version_requirements: *17764920
         
     | 
| 
       36 
36 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       37 
37 
     | 
    
         
             
              name: php_serialize
         
     | 
| 
       38 
     | 
    
         
            -
              requirement: & 
     | 
| 
      
 38 
     | 
    
         
            +
              requirement: &17764340 !ruby/object:Gem::Requirement
         
     | 
| 
       39 
39 
     | 
    
         
             
                none: false
         
     | 
| 
       40 
40 
     | 
    
         
             
                requirements:
         
     | 
| 
       41 
41 
     | 
    
         
             
                - - ! '>='
         
     | 
| 
         @@ -43,7 +43,7 @@ dependencies: 
     | 
|
| 
       43 
43 
     | 
    
         
             
                    version: '1.2'
         
     | 
| 
       44 
44 
     | 
    
         
             
              type: :runtime
         
     | 
| 
       45 
45 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       46 
     | 
    
         
            -
              version_requirements: * 
     | 
| 
      
 46 
     | 
    
         
            +
              version_requirements: *17764340
         
     | 
| 
       47 
47 
     | 
    
         
             
            description: Utilizes capistrano to allow for doing intellegent deployments of drupal
         
     | 
| 
       48 
48 
     | 
    
         
             
              projects.
         
     | 
| 
       49 
49 
     | 
    
         
             
            email: matt@xforty.com
         
     |