porter 0.1.2 → 0.1.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/VERSION +1 -1
 - data/generators/porter/templates/porter.rake +22 -20
 - data/generators/porter/templates/porter_config.yml +12 -8
 - data/porter.gemspec +2 -2
 - metadata +4 -4
 
    
        data/VERSION
    CHANGED
    
    | 
         @@ -1 +1 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            0.1. 
     | 
| 
      
 1 
     | 
    
         
            +
            0.1.4
         
     | 
| 
         @@ -39,34 +39,36 @@ namespace :porter do 
     | 
|
| 
       39 
39 
     | 
    
         | 
| 
       40 
40 
     | 
    
         
             
                task :assets => :environment do
         
     | 
| 
       41 
41 
     | 
    
         
             
                  require 'yaml'
         
     | 
| 
       42 
     | 
    
         
            -
                  root 
     | 
| 
       43 
     | 
    
         
            -
                  config 
     | 
| 
       44 
     | 
    
         
            -
                  user 
     | 
| 
       45 
     | 
    
         
            -
                  domain 
     | 
| 
       46 
     | 
    
         
            -
                  dir 
     | 
| 
       47 
     | 
    
         
            -
                   
     | 
| 
       48 
     | 
    
         
            -
                   
     | 
| 
       49 
     | 
    
         
            -
                   
     | 
| 
       50 
     | 
    
         
            -
                   
     | 
| 
       51 
     | 
    
         
            -
             
     | 
| 
       52 
     | 
    
         
            -
                   
     | 
| 
       53 
     | 
    
         
            -
                  puts "Building a list of assets #{excluding}to rsync down..."
         
     | 
| 
      
 42 
     | 
    
         
            +
                  root           = RAILS_ROOT
         
     | 
| 
      
 43 
     | 
    
         
            +
                  config         = YAML.load_file(File.join(RAILS_ROOT, 'config', 'porter_config.yml'))
         
     | 
| 
      
 44 
     | 
    
         
            +
                  user           = config['server']['user']
         
     | 
| 
      
 45 
     | 
    
         
            +
                  domain         = config['server']['domain']
         
     | 
| 
      
 46 
     | 
    
         
            +
                  dir            = config['server']['dir']
         
     | 
| 
      
 47 
     | 
    
         
            +
                  entire_dirs    = config['assets']['entire_dirs'].blank? ? '' : config['assets']['entire_dirs'].split(',').map { |i| i.strip }
         
     | 
| 
      
 48 
     | 
    
         
            +
                  excludable_dir = config['assets']['excludable_dir']
         
     | 
| 
      
 49 
     | 
    
         
            +
                  model          = config['assets']['excludable_model'].constantize unless config['assets']['excludable_model'].blank?
         
     | 
| 
      
 50 
     | 
    
         
            +
                  column         = config['assets']['excludable_column']
         
     | 
| 
      
 51 
     | 
    
         
            +
                  exclusions     = config['assets']['excludable_matches'].blank? ? '' : config['assets']['excludable_matches'].split(',').map { |i| i.strip }
         
     | 
| 
      
 52 
     | 
    
         
            +
                  rsync_options  = config['assets']['rsync_options']
         
     | 
| 
       54 
53 
     | 
    
         | 
| 
       55 
     | 
    
         
            -
                   
     | 
| 
      
 54 
     | 
    
         
            +
                  if exclusions.blank?
         
     | 
| 
      
 55 
     | 
    
         
            +
                    entire_dirs << excludable_dir unless excludable_dir.blank?
         
     | 
| 
      
 56 
     | 
    
         
            +
                  else
         
     | 
| 
      
 57 
     | 
    
         
            +
                    puts "Building a list of excludable assets (excluding: #{exclusions.join(', ')}) to rsync down..."
         
     | 
| 
       56 
58 
     | 
    
         
             
                    rsync_file_list = File.new('rsync_file_list.txt', "w")
         
     | 
| 
       57 
59 
     | 
    
         
             
                    attachments = model.find(:all, :conditions => ["#{column} NOT IN (?)", exclusions])
         
     | 
| 
       58 
60 
     | 
    
         
             
                    attachments.each do |a|
         
     | 
| 
       59 
     | 
    
         
            -
                      rsync_file_list.send((a == attachments.last ? :print : :puts),  
     | 
| 
      
 61 
     | 
    
         
            +
                      rsync_file_list.send((a == attachments.last ? :print : :puts), a.partitioned_path.join('/'))
         
     | 
| 
       60 
62 
     | 
    
         
             
                    end
         
     | 
| 
       61 
63 
     | 
    
         
             
                    rsync_file_list.close
         
     | 
| 
      
 64 
     | 
    
         
            +
                    system "rsync --files-from=#{root}/rsync_file_list.txt #{rsync_options} #{user}@#{domain}:#{dir}/shared/#{excludable_dir}/ #{excludable_dir}"
         
     | 
| 
      
 65 
     | 
    
         
            +
                    system "rm #{root}/rsync_file_list.txt" if File.exists?("#{root}/rsync_file_list.txt")
         
     | 
| 
       62 
66 
     | 
    
         
             
                  end
         
     | 
| 
       63 
67 
     | 
    
         | 
| 
       64 
     | 
    
         
            -
                   
     | 
| 
       65 
     | 
    
         
            -
             
     | 
| 
       66 
     | 
    
         
            -
             
     | 
| 
       67 
     | 
    
         
            -
                   
     | 
| 
       68 
     | 
    
         
            -
             
     | 
| 
       69 
     | 
    
         
            -
                  system "rm #{root}/rsync_file_list.txt" if File.exists?("#{root}/rsync_file_list.txt")
         
     | 
| 
      
 68 
     | 
    
         
            +
                  entire_dirs.each do |d|
         
     | 
| 
      
 69 
     | 
    
         
            +
                    puts "Synchronizing assets in #{d}..."
         
     | 
| 
      
 70 
     | 
    
         
            +
                    system "rsync #{rsync_options} #{user}@#{domain}:#{dir}/shared/#{d}/ #{d}"
         
     | 
| 
      
 71 
     | 
    
         
            +
                  end
         
     | 
| 
       70 
72 
     | 
    
         | 
| 
       71 
73 
     | 
    
         
             
                  puts "Production asset synchronization complete"
         
     | 
| 
       72 
74 
     | 
    
         
             
                end
         
     | 
| 
         @@ -6,15 +6,19 @@ server: 
     | 
|
| 
       6 
6 
     | 
    
         
             
              dir: /opt/apps/<%= app %>
         
     | 
| 
       7 
7 
     | 
    
         | 
| 
       8 
8 
     | 
    
         
             
            assets:
         
     | 
| 
       9 
     | 
    
         
            -
               
     | 
| 
       10 
     | 
    
         
            -
               
     | 
| 
       11 
     | 
    
         
            -
               
     | 
| 
      
 9 
     | 
    
         
            +
              entire_dirs: public/attachments
         
     | 
| 
      
 10 
     | 
    
         
            +
              excludable_dir: 
         
     | 
| 
      
 11 
     | 
    
         
            +
              excludable_model: 
         
     | 
| 
      
 12 
     | 
    
         
            +
              excludable_column: 
         
     | 
| 
      
 13 
     | 
    
         
            +
              excludable_matches: 
         
     | 
| 
       12 
14 
     | 
    
         
             
              rsync_options: --verbose --progress --stats --recursive --times --compress
         
     | 
| 
       13 
15 
     | 
    
         | 
| 
       14 
16 
     | 
    
         
             
            # Example:
         
     | 
| 
       15 
     | 
    
         
            -
            # 
     | 
| 
      
 17 
     | 
    
         
            +
            # 
         
     | 
| 
       16 
18 
     | 
    
         
             
            # assets:
         
     | 
| 
       17 
     | 
    
         
            -
            # 
     | 
| 
       18 
     | 
    
         
            -
            # 
     | 
| 
       19 
     | 
    
         
            -
            # 
     | 
| 
       20 
     | 
    
         
            -
            # 
     | 
| 
      
 19 
     | 
    
         
            +
              # entire_dirs: 
         
     | 
| 
      
 20 
     | 
    
         
            +
              # excludable_dir: public/attachments
         
     | 
| 
      
 21 
     | 
    
         
            +
              # excludable_model: Attachment
         
     | 
| 
      
 22 
     | 
    
         
            +
              # excludable_column: attachable_type
         
     | 
| 
      
 23 
     | 
    
         
            +
              # excludable_matches: NULL, Design, Item, Placement
         
     | 
| 
      
 24 
     | 
    
         
            +
              # rsync_options: --verbose --progress --stats --recursive --times --compress
         
     | 
    
        data/porter.gemspec
    CHANGED
    
    | 
         @@ -5,11 +5,11 @@ 
     | 
|
| 
       5 
5 
     | 
    
         | 
| 
       6 
6 
     | 
    
         
             
            Gem::Specification.new do |s|
         
     | 
| 
       7 
7 
     | 
    
         
             
              s.name = %q{porter}
         
     | 
| 
       8 
     | 
    
         
            -
              s.version = "0.1. 
     | 
| 
      
 8 
     | 
    
         
            +
              s.version = "0.1.4"
         
     | 
| 
       9 
9 
     | 
    
         | 
| 
       10 
10 
     | 
    
         
             
              s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
         
     | 
| 
       11 
11 
     | 
    
         
             
              s.authors = ["Kenny Johnston"]
         
     | 
| 
       12 
     | 
    
         
            -
              s.date = %q{2010- 
     | 
| 
      
 12 
     | 
    
         
            +
              s.date = %q{2010-07-02}
         
     | 
| 
       13 
13 
     | 
    
         
             
              s.description = %q{Capistrano and Rake tasks for cloning production database and assets to development.}
         
     | 
| 
       14 
14 
     | 
    
         
             
              s.email = %q{info@appcreations.com}
         
     | 
| 
       15 
15 
     | 
    
         
             
              s.extra_rdoc_files = [
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,13 +1,13 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification 
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: porter
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version 
         
     | 
| 
       4 
     | 
    
         
            -
              hash:  
     | 
| 
      
 4 
     | 
    
         
            +
              hash: 19
         
     | 
| 
       5 
5 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       6 
6 
     | 
    
         
             
              segments: 
         
     | 
| 
       7 
7 
     | 
    
         
             
              - 0
         
     | 
| 
       8 
8 
     | 
    
         
             
              - 1
         
     | 
| 
       9 
     | 
    
         
            -
              -  
     | 
| 
       10 
     | 
    
         
            -
              version: 0.1. 
     | 
| 
      
 9 
     | 
    
         
            +
              - 4
         
     | 
| 
      
 10 
     | 
    
         
            +
              version: 0.1.4
         
     | 
| 
       11 
11 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       12 
12 
     | 
    
         
             
            authors: 
         
     | 
| 
       13 
13 
     | 
    
         
             
            - Kenny Johnston
         
     | 
| 
         @@ -15,7 +15,7 @@ autorequire: 
     | 
|
| 
       15 
15 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       16 
16 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       17 
17 
     | 
    
         | 
| 
       18 
     | 
    
         
            -
            date: 2010- 
     | 
| 
      
 18 
     | 
    
         
            +
            date: 2010-07-02 00:00:00 -07:00
         
     | 
| 
       19 
19 
     | 
    
         
             
            default_executable: 
         
     | 
| 
       20 
20 
     | 
    
         
             
            dependencies: 
         
     | 
| 
       21 
21 
     | 
    
         
             
            - !ruby/object:Gem::Dependency 
         
     |