datashift 0.15.0 → 0.16.0
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.
- checksums.yaml +7 -0
 - data/README.markdown +91 -55
 - data/VERSION +1 -1
 - data/datashift.gemspec +8 -23
 - data/lib/applications/jexcel_file.rb +1 -2
 - data/lib/datashift.rb +34 -15
 - data/lib/datashift/column_packer.rb +98 -34
 - data/lib/datashift/data_transforms.rb +83 -0
 - data/lib/datashift/delimiters.rb +58 -10
 - data/lib/datashift/excel_base.rb +123 -0
 - data/lib/datashift/exceptions.rb +45 -7
 - data/lib/datashift/load_object.rb +25 -0
 - data/lib/datashift/mapping_service.rb +91 -0
 - data/lib/datashift/method_detail.rb +40 -62
 - data/lib/datashift/method_details_manager.rb +18 -2
 - data/lib/datashift/method_dictionary.rb +27 -10
 - data/lib/datashift/method_mapper.rb +49 -41
 - data/lib/datashift/model_mapper.rb +42 -22
 - data/lib/datashift/populator.rb +258 -143
 - data/lib/datashift/thor_base.rb +38 -0
 - data/lib/exporters/csv_exporter.rb +57 -145
 - data/lib/exporters/excel_exporter.rb +73 -60
 - data/lib/generators/csv_generator.rb +65 -5
 - data/lib/generators/generator_base.rb +69 -3
 - data/lib/generators/mapping_generator.rb +112 -0
 - data/lib/helpers/core_ext/csv_file.rb +33 -0
 - data/lib/loaders/csv_loader.rb +41 -39
 - data/lib/loaders/excel_loader.rb +130 -116
 - data/lib/loaders/loader_base.rb +190 -146
 - data/lib/loaders/paperclip/attachment_loader.rb +4 -4
 - data/lib/loaders/paperclip/datashift_paperclip.rb +5 -3
 - data/lib/loaders/paperclip/image_loading.rb +9 -7
 - data/lib/loaders/reporter.rb +17 -8
 - data/lib/thor/export.thor +12 -13
 - data/lib/thor/generate.thor +1 -9
 - data/lib/thor/import.thor +13 -24
 - data/lib/thor/mapping.thor +65 -0
 - data/spec/Gemfile +13 -11
 - data/spec/Gemfile.lock +98 -93
 - data/spec/csv_exporter_spec.rb +104 -99
 - data/spec/csv_generator_spec.rb +159 -0
 - data/spec/csv_loader_spec.rb +197 -16
 - data/spec/datashift_spec.rb +9 -0
 - data/spec/excel_exporter_spec.rb +149 -58
 - data/spec/excel_generator_spec.rb +35 -44
 - data/spec/excel_loader_spec.rb +196 -178
 - data/spec/excel_spec.rb +8 -5
 - data/spec/loader_base_spec.rb +47 -7
 - data/spec/mapping_spec.rb +117 -0
 - data/spec/method_dictionary_spec.rb +24 -11
 - data/spec/method_mapper_spec.rb +5 -7
 - data/spec/model_mapper_spec.rb +41 -0
 - data/spec/paperclip_loader_spec.rb +3 -6
 - data/spec/populator_spec.rb +48 -14
 - data/spec/spec_helper.rb +85 -73
 - data/spec/thor_spec.rb +40 -5
 - metadata +93 -86
 - data/lib/applications/excel_base.rb +0 -63
 
| 
         @@ -50,11 +50,11 @@ module DataShift 
     | 
|
| 
       50 
50 
     | 
    
         
             
                  #         :attach_to_field => avatar    : User.avatar = attachment
         
     | 
| 
       51 
51 
     | 
    
         
             
                  #         
         
     | 
| 
       52 
52 
     | 
    
         
             
                  #       
         
     | 
| 
       53 
     | 
    
         
            -
                  def initialize(attachment_klazz,  
     | 
| 
      
 53 
     | 
    
         
            +
                  def initialize(attachment_klazz, attachment = nil, options = {})
         
     | 
| 
       54 
54 
     | 
    
         | 
| 
       55 
55 
     | 
    
         
             
                    init_from_options( options )
         
     | 
| 
       56 
56 
     | 
    
         | 
| 
       57 
     | 
    
         
            -
                    super( attachment_klazz,  
     | 
| 
      
 57 
     | 
    
         
            +
                    super( attachment_klazz, attachment, options.dup )
         
     | 
| 
       58 
58 
     | 
    
         | 
| 
       59 
59 
     | 
    
         
             
                    puts "Attachment Class is #{load_object_class}" if(@verbose)
         
     | 
| 
       60 
60 
     | 
    
         | 
| 
         @@ -153,8 +153,8 @@ module DataShift 
     | 
|
| 
       153 
153 
     | 
    
         
             
                      # Check if attachment must have an associated record
         
     | 
| 
       154 
154 
     | 
    
         
             
                      if(record)
         
     | 
| 
       155 
155 
     | 
    
         
             
                        reset()
         
     | 
| 
       156 
     | 
    
         
            -
             
     | 
| 
       157 
     | 
    
         
            -
                         
     | 
| 
      
 156 
     | 
    
         
            +
             
     | 
| 
      
 157 
     | 
    
         
            +
                        create_paperclip_attachment(@load_object_class, file_name, record, attach_to_field, options)
         
     | 
| 
       158 
158 
     | 
    
         | 
| 
       159 
159 
     | 
    
         
             
                        puts "Added Attachment #{File.basename(file_name)} to #{record.send(attach_to_find_by_field)}(id : #{record.id})" if(@verbose)
         
     | 
| 
       160 
160 
     | 
    
         
             
                      end
         
     | 
| 
         @@ -72,7 +72,9 @@ module DataShift 
     | 
|
| 
       72 
72 
     | 
    
         
             
                #
         
     | 
| 
       73 
73 
     | 
    
         
             
                #       Give : { :has_attached_file_attribute => :icon }
         
     | 
| 
       74 
74 
     | 
    
         
             
                #
         
     | 
| 
       75 
     | 
    
         
            -
                def  
     | 
| 
      
 75 
     | 
    
         
            +
                def create_paperclip_attachment(klass, attachment_path, record = nil, attach_to_record_field = nil, options = {})
         
     | 
| 
      
 76 
     | 
    
         
            +
             
     | 
| 
      
 77 
     | 
    
         
            +
                  logger.info("Paperclip::create_paperclip_attachment on Class #{klass}")
         
     | 
| 
       76 
78 
     | 
    
         | 
| 
       77 
79 
     | 
    
         
             
                  has_attached_file_attribute = options[:has_attached_file_name] ? options[:has_attached_file_name].to_sym : :attachment
         
     | 
| 
       78 
80 
     | 
    
         | 
| 
         @@ -87,7 +89,7 @@ module DataShift 
     | 
|
| 
       87 
89 
     | 
    
         
             
                    @attachment = klass.new(paperclip_attributes, :without_protection => true)
         
     | 
| 
       88 
90 
     | 
    
         
             
                  rescue => e
         
     | 
| 
       89 
91 
     | 
    
         
             
                    logger.error( e.backtrace)
         
     | 
| 
       90 
     | 
    
         
            -
                    logger.error("Failed to create PaperClip Attachment : #{e.inspect}")
         
     | 
| 
      
 92 
     | 
    
         
            +
                    logger.error("Failed to create PaperClip Attachment for cl;ass #{klass} : #{e.inspect}")
         
     | 
| 
       91 
93 
     | 
    
         
             
                    raise CreateAttachmentFailed.new("Failed to create PaperClip Attachment from : #{attachment_path}")
         
     | 
| 
       92 
94 
     | 
    
         
             
                  ensure
         
     | 
| 
       93 
95 
     | 
    
         
             
                    attachment_file.close unless attachment_file.closed?
         
     | 
| 
         @@ -99,7 +101,7 @@ module DataShift 
     | 
|
| 
       99 
101 
     | 
    
         
             
                      puts "Success: Created Attachment #{@attachment.id} : #{@attachment.attachment_file_name}"
         
     | 
| 
       100 
102 
     | 
    
         | 
| 
       101 
103 
     | 
    
         
             
                      if(attach_to_record_field.is_a? MethodDetail)
         
     | 
| 
       102 
     | 
    
         
            -
                        DataShift::Populator.new(). 
     | 
| 
      
 104 
     | 
    
         
            +
                        DataShift::Populator.new().prepare_and_assign(attach_to_record_field, record, @attachment)
         
     | 
| 
       103 
105 
     | 
    
         
             
                      else
         
     | 
| 
       104 
106 
     | 
    
         
             
                        # assume its not a has_many and try basic send
         
     | 
| 
       105 
107 
     | 
    
         
             
                        record.send("#{attach_to_record_field}=", @attachment)
         
     | 
| 
         @@ -11,17 +11,17 @@ require 'attachment_loader' 
     | 
|
| 
       11 
11 
     | 
    
         
             
            module DataShift
         
     | 
| 
       12 
12 
     | 
    
         | 
| 
       13 
13 
     | 
    
         
             
              module ImageLoading
         
     | 
| 
       14 
     | 
    
         
            -
             
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
                include DataShift::Logging
         
     | 
| 
       15 
16 
     | 
    
         
             
                include DataShift::Paperclip 
         
     | 
| 
       16 
17 
     | 
    
         | 
| 
       17 
     | 
    
         
            -
                
         
     | 
| 
       18 
18 
     | 
    
         
             
                # Note the paperclip attachment model defines the storage path via something like :
         
     | 
| 
       19 
19 
     | 
    
         
             
                # 
         
     | 
| 
       20 
20 
     | 
    
         
             
                # => :path => ":rails_root/public/blah/blahs/:id/:style/:basename.:extension"
         
     | 
| 
       21 
21 
     | 
    
         
             
                # 
         
     | 
| 
       22 
22 
     | 
    
         
             
                # Options 
         
     | 
| 
       23 
23 
     | 
    
         
             
                # 
         
     | 
| 
       24 
     | 
    
         
            -
                #   See also DataShift::paperclip  
     | 
| 
      
 24 
     | 
    
         
            +
                #   See also DataShift::paperclip create_paperclip_attachment for more options
         
     | 
| 
       25 
25 
     | 
    
         
             
                #   
         
     | 
| 
       26 
26 
     | 
    
         
             
                #   Example:  Image is a model class with an attachment.
         
     | 
| 
       27 
27 
     | 
    
         
             
                #             Image table contains a viewable field which can contain other  models,
         
     | 
| 
         @@ -30,7 +30,9 @@ module DataShift 
     | 
|
| 
       30 
30 
     | 
    
         
             
                #   :viewable_record 
         
     | 
| 
       31 
31 
     | 
    
         
             
                #   
         
     | 
| 
       32 
32 
     | 
    
         
             
                def create_attachment(klass, attachment_path, record = nil, attach_to_record_field = nil, options = {})
         
     | 
| 
       33 
     | 
    
         
            -
             
     | 
| 
      
 33 
     | 
    
         
            +
             
     | 
| 
      
 34 
     | 
    
         
            +
                  logger.debug("ImageLoading::create_attachment on Class #{klass}")
         
     | 
| 
      
 35 
     | 
    
         
            +
             
     | 
| 
       34 
36 
     | 
    
         
             
                  image_attributes = { :attributes => 
         
     | 
| 
       35 
37 
     | 
    
         
             
                                        { :alt => (options[:alt] || ""),
         
     | 
| 
       36 
38 
     | 
    
         
             
                                          :position => (!options[:position] && record and record.respond_to?(:images)) ? record.images.length : 0
         
     | 
| 
         @@ -39,9 +41,9 @@ module DataShift 
     | 
|
| 
       39 
41 
     | 
    
         | 
| 
       40 
42 
     | 
    
         
             
                  attachment_options = options.dup.merge(image_attributes)
         
     | 
| 
       41 
43 
     | 
    
         | 
| 
       42 
     | 
    
         
            -
                   
     | 
| 
       43 
     | 
    
         
            -
             
     | 
| 
       44 
     | 
    
         
            -
                   
     | 
| 
      
 44 
     | 
    
         
            +
                  logger.debug("Adding Attachment for #{klass.inspect}")
         
     | 
| 
      
 45 
     | 
    
         
            +
             
     | 
| 
      
 46 
     | 
    
         
            +
                  create_paperclip_attachment(klass, attachment_path, record, attach_to_record_field, attachment_options)
         
     | 
| 
       45 
47 
     | 
    
         
             
                end
         
     | 
| 
       46 
48 
     | 
    
         | 
| 
       47 
49 
     | 
    
         
             
                # Set of file extensions ImageMagik can process so default glob
         
     | 
    
        data/lib/loaders/reporter.rb
    CHANGED
    
    | 
         @@ -11,10 +11,17 @@ module DataShift 
     | 
|
| 
       11 
11 
     | 
    
         
             
              class Reporter
         
     | 
| 
       12 
12 
     | 
    
         | 
| 
       13 
13 
     | 
    
         
             
                include DataShift::Logging
         
     | 
| 
       14 
     | 
    
         
            -
                  
         
     | 
| 
       15 
     | 
    
         
            -
                attr_accessor :processed_object_count, :loaded_objects, :failed_objects
         
     | 
| 
       16 
14 
     | 
    
         | 
| 
       17 
     | 
    
         
            -
             
     | 
| 
      
 15 
     | 
    
         
            +
                # actual data rows/objects inbound
         
     | 
| 
      
 16 
     | 
    
         
            +
                attr_accessor :processed_object_count
         
     | 
| 
      
 17 
     | 
    
         
            +
                alias_method :processed_inbound_count, :processed_object_count
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
                # DB objects created, updated etc
         
     | 
| 
      
 20 
     | 
    
         
            +
                attr_accessor :loaded_objects, :failed_objects
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
                # actual data rows/objects inbound
         
     | 
| 
      
 23 
     | 
    
         
            +
                attr_accessor :success_inbound_count, :failed_inbound_count
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
       18 
25 
     | 
    
         
             
                def initialize()
         
     | 
| 
       19 
26 
     | 
    
         
             
                  reset
         
     | 
| 
       20 
27 
     | 
    
         
             
                end
         
     | 
| 
         @@ -22,10 +29,11 @@ module DataShift 
     | 
|
| 
       22 
29 
     | 
    
         
             
                def reset()
         
     | 
| 
       23 
30 
     | 
    
         
             
                  @processed_object_count = 0
         
     | 
| 
       24 
31 
     | 
    
         
             
                  @loaded_objects, @failed_objects = [], []
         
     | 
| 
      
 32 
     | 
    
         
            +
                  @success_inbound_count, @failed_inbound_count = 0,0
         
     | 
| 
       25 
33 
     | 
    
         
             
                end
         
     | 
| 
       26 
34 
     | 
    
         | 
| 
       27 
35 
     | 
    
         
             
                def add_loaded_object(object)
         
     | 
| 
       28 
     | 
    
         
            -
                  @loaded_objects << object unless(object.nil? || @loaded_objects.include?(object))
         
     | 
| 
      
 36 
     | 
    
         
            +
                  @loaded_objects << object.id unless(object.nil? || @loaded_objects.include?(object))
         
     | 
| 
       29 
37 
     | 
    
         
             
                end
         
     | 
| 
       30 
38 
     | 
    
         | 
| 
       31 
39 
     | 
    
         
             
                def add_failed_object(object)
         
     | 
| 
         @@ -37,12 +45,13 @@ module DataShift 
     | 
|
| 
       37 
45 
     | 
    
         | 
| 
       38 
46 
     | 
    
         
             
                  puts "\nProcessing Summary Report"
         
     | 
| 
       39 
47 
     | 
    
         
             
                  puts ">>>>>>>>>>>>>>>>>>>>>>>>>\n"
         
     | 
| 
       40 
     | 
    
         
            -
                  puts "Processed total of #{processed_object_count} #{processed_object_count > 1 ? 'entries' : 'entry'}"
         
     | 
| 
       41 
     | 
    
         
            -
                  puts "#{loaded_objects.size} objects were  
     | 
| 
       42 
     | 
    
         
            -
             
     | 
| 
      
 48 
     | 
    
         
            +
                  puts "Processed total of #{processed_object_count} inbound #{processed_object_count > 1 ? 'entries' : 'entry'}"
         
     | 
| 
      
 49 
     | 
    
         
            +
                  puts "#{loaded_objects.size}\tdatabase objects were successfully processed."
         
     | 
| 
      
 50 
     | 
    
         
            +
                  puts "#{success_inbound_count}\tinbound rows were successfully processed."
         
     | 
| 
      
 51 
     | 
    
         
            +
             
     | 
| 
       43 
52 
     | 
    
         
             
                  puts "There were NO failures." if failed_objects.empty?
         
     | 
| 
       44 
53 
     | 
    
         | 
| 
       45 
     | 
    
         
            -
                  puts "WARNING : Check logs : #{failed_objects.size} rows contained errors 
     | 
| 
      
 54 
     | 
    
         
            +
                  puts "WARNING : Check logs : #{failed_objects.size} rows contained errors" unless failed_objects.empty?
         
     | 
| 
       46 
55 
     | 
    
         
             
                end
         
     | 
| 
       47 
56 
     | 
    
         | 
| 
       48 
57 
     | 
    
         
             
              end
         
     | 
    
        data/lib/thor/export.thor
    CHANGED
    
    | 
         @@ -15,16 +15,17 @@ 
     | 
|
| 
       15 
15 
     | 
    
         
             
            #
         
     | 
| 
       16 
16 
     | 
    
         
             
            # => bundle exec thor datashift:export:excel -m <active record class> -r <output_template.xls> -a
         
     | 
| 
       17 
17 
     | 
    
         
             
            #
         
     | 
| 
      
 18 
     | 
    
         
            +
            require 'thor_base'
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
       18 
21 
     | 
    
         
             
            require 'datashift'
         
     | 
| 
       19 
     | 
    
         
            -
             
     | 
| 
       20 
     | 
    
         
            -
            # Note, not DataShift, case sensitive,  
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
            # Note, for thor not DataShift, case sensitive, want namespace for cmd line to be : datashift
         
     | 
| 
       21 
24 
     | 
    
         
             
            module Datashift
         
     | 
| 
       22 
25 
     | 
    
         | 
| 
       23 
26 
     | 
    
         | 
| 
       24 
     | 
    
         
            -
              class Export <  
     | 
| 
       25 
     | 
    
         
            -
             
     | 
| 
       26 
     | 
    
         
            -
                include DataShift::Logging
         
     | 
| 
       27 
     | 
    
         
            -
                  
         
     | 
| 
      
 27 
     | 
    
         
            +
              class Export < DataShift::DSThorBase
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
       28 
29 
     | 
    
         
             
                desc "excel", "export any active record model (with optional associations)" 
         
     | 
| 
       29 
30 
     | 
    
         
             
                method_option :model, :aliases => '-m', :required => true, :desc => "The active record model to export"
         
     | 
| 
       30 
31 
     | 
    
         
             
                method_option :result, :aliases => '-r', :required => true, :desc => "Create template of model in supplied file"
         
     | 
| 
         @@ -32,11 +33,9 @@ module Datashift 
     | 
|
| 
       32 
33 
     | 
    
         
             
                method_option :exclude, :aliases => '-e',  :type => :array, :desc => "Use with -a : Exclude association types. Any from #{DataShift::MethodDetail::supported_types_enum.to_a.inspect}"
         
     | 
| 
       33 
34 
     | 
    
         | 
| 
       34 
35 
     | 
    
         
             
                def excel()
         
     | 
| 
       35 
     | 
    
         
            -
             
     | 
| 
       36 
     | 
    
         
            -
                   
     | 
| 
       37 
     | 
    
         
            -
             
     | 
| 
       38 
     | 
    
         
            -
                  require File.expand_path('config/environment.rb')
         
     | 
| 
       39 
     | 
    
         
            -
               
         
     | 
| 
      
 36 
     | 
    
         
            +
             
     | 
| 
      
 37 
     | 
    
         
            +
                  start_connections
         
     | 
| 
      
 38 
     | 
    
         
            +
             
     | 
| 
       40 
39 
     | 
    
         
             
                  require 'excel_exporter'
         
     | 
| 
       41 
40 
     | 
    
         | 
| 
       42 
41 
     | 
    
         
             
                  model = options[:model]
         
     | 
| 
         @@ -44,7 +43,7 @@ module Datashift 
     | 
|
| 
       44 
43 
     | 
    
         | 
| 
       45 
44 
     | 
    
         
             
                  logger.info "Datashift: Start Excel export to #{result}"
         
     | 
| 
       46 
45 
     | 
    
         | 
| 
       47 
     | 
    
         
            -
                  klass = ModelMapper::class_from_string(model)  #Kernel.const_get(model)
         
     | 
| 
      
 46 
     | 
    
         
            +
                  klass = DataShift::ModelMapper::class_from_string(model)  #Kernel.const_get(model)
         
     | 
| 
       48 
47 
     | 
    
         | 
| 
       49 
48 
     | 
    
         
             
                  raise "ERROR: No such Model [#{model}] found - check valid model supplied via -model <Class>" if(klass.nil?)
         
     | 
| 
       50 
49 
     | 
    
         | 
| 
         @@ -86,7 +85,7 @@ module Datashift 
     | 
|
| 
       86 
85 
     | 
    
         | 
| 
       87 
86 
     | 
    
         
             
                  logger.info "Datashift: Start CSV export to #{result}"
         
     | 
| 
       88 
87 
     | 
    
         | 
| 
       89 
     | 
    
         
            -
                  klass = ModelMapper::class_from_string(model)  #Kernel.const_get(model)
         
     | 
| 
      
 88 
     | 
    
         
            +
                  klass = DataShift::ModelMapper::class_from_string(model)  #Kernel.const_get(model)
         
     | 
| 
       90 
89 
     | 
    
         | 
| 
       91 
90 
     | 
    
         
             
                  raise "ERROR: No such Model [#{model}] found - check valid model supplied via -model <Class>" if(klass.nil?)
         
     | 
| 
       92 
91 
     | 
    
         | 
    
        data/lib/thor/generate.thor
    CHANGED
    
    | 
         @@ -46,16 +46,8 @@ module Datashift 
     | 
|
| 
       46 
46 
     | 
    
         
             
                  result = options[:result]
         
     | 
| 
       47 
47 
     | 
    
         | 
| 
       48 
48 
     | 
    
         
             
                  logger.info "Datashift: Start Excel template generation in #{result}"
         
     | 
| 
       49 
     | 
    
         
            -
                        
         
     | 
| 
       50 
     | 
    
         
            -
                  begin
         
     | 
| 
       51 
     | 
    
         
            -
                    # support modules e.g "Spree::Property") 
         
     | 
| 
       52 
     | 
    
         
            -
                    klass = ModelMapper::class_from_string(model)  #Kernel.const_get(model)
         
     | 
| 
       53 
     | 
    
         
            -
                  rescue NameError => e
         
     | 
| 
       54 
     | 
    
         
            -
                    puts e
         
     | 
| 
       55 
     | 
    
         
            -
                    raise Thor::Error.new("ERROR: No such Model [#{model}] found - check valid model supplied")
         
     | 
| 
       56 
     | 
    
         
            -
                  end
         
     | 
| 
       57 
49 
     | 
    
         | 
| 
       58 
     | 
    
         
            -
                   
     | 
| 
      
 50 
     | 
    
         
            +
                  klass = DataShift::ModelMapper.class_from_string_or_raise( model )
         
     | 
| 
       59 
51 
     | 
    
         | 
| 
       60 
52 
     | 
    
         
             
                  begin
         
     | 
| 
       61 
53 
     | 
    
         
             
                    gen = DataShift::ExcelGenerator.new(result)
         
     | 
    
        data/lib/thor/import.thor
    CHANGED
    
    | 
         @@ -44,38 +44,33 @@ module Datashift 
     | 
|
| 
       44 
44 
     | 
    
         
             
                  require 'excel_loader'
         
     | 
| 
       45 
45 
     | 
    
         | 
| 
       46 
46 
     | 
    
         
             
                  model = options[:model]
         
     | 
| 
       47 
     | 
    
         
            -
                  begin
         
     | 
| 
       48 
     | 
    
         
            -
                    # support modules e.g "Spree::Property") 
         
     | 
| 
       49 
     | 
    
         
            -
                    klass = ModelMapper::class_from_string(model) 
         
     | 
| 
       50 
     | 
    
         
            -
                  rescue NameError
         
     | 
| 
       51 
     | 
    
         
            -
                    raise "ERROR: No such AR Model found - check valid model supplied with -m <Class>"
         
     | 
| 
       52 
     | 
    
         
            -
                  end
         
     | 
| 
       53 
47 
     | 
    
         | 
| 
       54 
     | 
    
         
            -
                   
     | 
| 
       55 
     | 
    
         
            -
             
     | 
| 
      
 48 
     | 
    
         
            +
                  klass = DataShift::ModelMapper.class_from_string_or_raise( model )
         
     | 
| 
      
 49 
     | 
    
         
            +
             
     | 
| 
      
 50 
     | 
    
         
            +
                  loader_options = { :instance_methods => true }
         
     | 
| 
      
 51 
     | 
    
         
            +
             
     | 
| 
       56 
52 
     | 
    
         
             
                  if(options[:loader])
         
     | 
| 
       57 
53 
     | 
    
         
             
                    begin
         
     | 
| 
       58 
54 
     | 
    
         | 
| 
       59 
     | 
    
         
            -
                      loader_klass = ModelMapper::class_from_string(options[:loader]) 
     | 
| 
      
 55 
     | 
    
         
            +
                      loader_klass = DataShift::ModelMapper::class_from_string(options[:loader])
         
     | 
| 
       60 
56 
     | 
    
         | 
| 
       61 
57 
     | 
    
         
             
                      loader = loader_klass.new(klass)
         
     | 
| 
       62 
58 
     | 
    
         | 
| 
       63 
59 
     | 
    
         
             
                      logger.info("INFO: Using loader : #{loader.class}")
         
     | 
| 
       64 
60 
     | 
    
         
             
                    rescue
         
     | 
| 
       65 
61 
     | 
    
         
             
                      logger.error("INFO: No specific #{model}Loader found  - using generic ExcelLoader")
         
     | 
| 
       66 
     | 
    
         
            -
                      loader = DataShift::ExcelLoader.new(klass,  
     | 
| 
      
 62 
     | 
    
         
            +
                      loader = DataShift::ExcelLoader.new(klass, nil, loader_options)
         
     | 
| 
       67 
63 
     | 
    
         
             
                    end
         
     | 
| 
       68 
64 
     | 
    
         
             
                  else
         
     | 
| 
       69 
65 
     | 
    
         
             
                    logger.info("No Loader specified - using generic ExcelLoader")
         
     | 
| 
       70 
     | 
    
         
            -
                    loader = DataShift::ExcelLoader.new(klass,  
     | 
| 
      
 66 
     | 
    
         
            +
                    loader = DataShift::ExcelLoader.new(klass, nil, loader_options)
         
     | 
| 
       71 
67 
     | 
    
         
             
                  end
         
     | 
| 
       72 
68 
     | 
    
         | 
| 
       73 
     | 
    
         
            -
                   
     | 
| 
       74 
     | 
    
         
            -
                  loader.logger.verbose if(options['verbose'])
         
     | 
| 
      
 69 
     | 
    
         
            +
                  #TOFIX - multi loggers to file + STDOUT
         
     | 
| 
      
 70 
     | 
    
         
            +
                  # loader.logger.verbose if(options['verbose'])
         
     | 
| 
       75 
71 
     | 
    
         | 
| 
       76 
72 
     | 
    
         
             
                  loader.configure_from( options[:config] ) if(options[:config])
         
     | 
| 
       77 
73 
     | 
    
         | 
| 
       78 
     | 
    
         
            -
             
     | 
| 
       79 
74 
     | 
    
         
             
                  loader.perform_load(options[:input])
         
     | 
| 
       80 
75 
     | 
    
         
             
                end
         
     | 
| 
       81 
76 
     | 
    
         | 
| 
         @@ -96,19 +91,13 @@ module Datashift 
     | 
|
| 
       96 
91 
     | 
    
         
             
                  require 'csv_loader'
         
     | 
| 
       97 
92 
     | 
    
         | 
| 
       98 
93 
     | 
    
         
             
                  model = options[:model]
         
     | 
| 
       99 
     | 
    
         
            -
                  begin
         
     | 
| 
       100 
     | 
    
         
            -
                    # support modules e.g "Spree::Property") 
         
     | 
| 
       101 
     | 
    
         
            -
                    klass = ModelMapper::class_from_string(model) 
         
     | 
| 
       102 
     | 
    
         
            -
                  rescue NameError
         
     | 
| 
       103 
     | 
    
         
            -
                    raise "ERROR: No such AR Model found - check valid model supplied with -m <Class>"
         
     | 
| 
       104 
     | 
    
         
            -
                  end
         
     | 
| 
       105 
94 
     | 
    
         | 
| 
       106 
     | 
    
         
            -
                   
     | 
| 
       107 
     | 
    
         
            -
                  
         
     | 
| 
      
 95 
     | 
    
         
            +
                  klass = DataShift::ModelMapper.class_from_string_or_raise( model )
         
     | 
| 
       108 
96 
     | 
    
         | 
| 
       109 
97 
     | 
    
         
             
                  loader = DataShift::CsvLoader.new(klass)
         
     | 
| 
       110 
     | 
    
         
            -
             
     | 
| 
       111 
     | 
    
         
            -
                   
     | 
| 
      
 98 
     | 
    
         
            +
             
     | 
| 
      
 99 
     | 
    
         
            +
                  #TOFIX - multi loggers to file + STDOUT
         
     | 
| 
      
 100 
     | 
    
         
            +
                  # loader.logger.verbose if(options['verbose'])
         
     | 
| 
       112 
101 
     | 
    
         | 
| 
       113 
102 
     | 
    
         
             
                  loader.configure_from( options[:config] ) if(options[:config])
         
     | 
| 
       114 
103 
     | 
    
         | 
| 
         @@ -0,0 +1,65 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # Copyright:: (c) Autotelik Media Ltd 2015
         
     | 
| 
      
 2 
     | 
    
         
            +
            # Author ::   Tom Statter
         
     | 
| 
      
 3 
     | 
    
         
            +
            # Date ::     Mar 2015
         
     | 
| 
      
 4 
     | 
    
         
            +
            # License::   MIT.
         
     | 
| 
      
 5 
     | 
    
         
            +
            #
         
     | 
| 
      
 6 
     | 
    
         
            +
            # Usage::
         
     | 
| 
      
 7 
     | 
    
         
            +
            #
         
     | 
| 
      
 8 
     | 
    
         
            +
            #  To pull Datashift commands into your main application :
         
     | 
| 
      
 9 
     | 
    
         
            +
            #
         
     | 
| 
      
 10 
     | 
    
         
            +
            #     require 'datashift'
         
     | 
| 
      
 11 
     | 
    
         
            +
            #
         
     | 
| 
      
 12 
     | 
    
         
            +
            #     DataShift::load_commands
         
     | 
| 
      
 13 
     | 
    
         
            +
            #
         
     | 
| 
      
 14 
     | 
    
         
            +
            require 'datashift'
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
            # Note, not DataShift, case sensitive, create namespace for command line : datashift
         
     | 
| 
      
 17 
     | 
    
         
            +
            module Datashift
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
              class Mapping < Thor
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
                include DataShift::Logging
         
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
      
 24 
     | 
    
         
            +
                desc "template", "Generate a simple mappings template\nInput is treated as the *source* unless otherwise directed"
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
                method_option :model, :aliases => '-m', :desc => "The active record model to use for mappings"
         
     | 
| 
      
 27 
     | 
    
         
            +
                method_option :model_as_dest, :aliases => '-d', :type=> :boolean, :desc => "Set model attributes as destination"
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
      
 29 
     | 
    
         
            +
                method_option :excel, :aliases => '-e', :desc => "The excel spreadsheet to use for mappings"
         
     | 
| 
      
 30 
     | 
    
         
            +
                method_option :excel_as_dest, :aliases => '-a', :type=> :boolean, :desc => "Set excel headers as destination"
         
     | 
| 
      
 31 
     | 
    
         
            +
             
     | 
| 
      
 32 
     | 
    
         
            +
                method_option :result, :aliases => '-r', :required => true, :desc => "Create template of model in supplied file"
         
     | 
| 
      
 33 
     | 
    
         
            +
             
     | 
| 
      
 34 
     | 
    
         
            +
                def template()
         
     | 
| 
      
 35 
     | 
    
         
            +
             
     | 
| 
      
 36 
     | 
    
         
            +
                  # TODO - We're assuming run from a rails app/top level dir...
         
     | 
| 
      
 37 
     | 
    
         
            +
                  # ...can we make this more robust ? e.g what about when using active record but not in Rails app, 
         
     | 
| 
      
 38 
     | 
    
         
            +
                  require File.expand_path('config/environment.rb')
         
     | 
| 
      
 39 
     | 
    
         
            +
             
     | 
| 
      
 40 
     | 
    
         
            +
                  result = options[:result]
         
     | 
| 
      
 41 
     | 
    
         
            +
             
     | 
| 
      
 42 
     | 
    
         
            +
                  if(File.directory?(result))
         
     | 
| 
      
 43 
     | 
    
         
            +
                    result = File.join(result, "mapping_template.yaml")
         
     | 
| 
      
 44 
     | 
    
         
            +
                    puts "Output generated in #{result}"
         
     | 
| 
      
 45 
     | 
    
         
            +
                  end
         
     | 
| 
      
 46 
     | 
    
         
            +
             
     | 
| 
      
 47 
     | 
    
         
            +
                  logger.info "Datashift: Starting mapping template generation in #{result}"
         
     | 
| 
      
 48 
     | 
    
         
            +
             
     | 
| 
      
 49 
     | 
    
         
            +
                  mapper = DataShift::MappingGenerator.new(result)
         
     | 
| 
      
 50 
     | 
    
         
            +
             
     | 
| 
      
 51 
     | 
    
         
            +
                  model = options[:model]
         
     | 
| 
      
 52 
     | 
    
         
            +
             
     | 
| 
      
 53 
     | 
    
         
            +
                  mappings = String.new
         
     | 
| 
      
 54 
     | 
    
         
            +
             
     | 
| 
      
 55 
     | 
    
         
            +
                  mappings += mapper.generate(model, options) unless(model.nil? && options[:excel])
         
     | 
| 
      
 56 
     | 
    
         
            +
             
     | 
| 
      
 57 
     | 
    
         
            +
                  mappings += mapper.generate_from_excel(options[:excel], options) if(options[:excel])
         
     | 
| 
      
 58 
     | 
    
         
            +
             
     | 
| 
      
 59 
     | 
    
         
            +
                  File.open(result, 'w') { |f| f << mappings }
         
     | 
| 
      
 60 
     | 
    
         
            +
             
     | 
| 
      
 61 
     | 
    
         
            +
                end
         
     | 
| 
      
 62 
     | 
    
         
            +
             
     | 
| 
      
 63 
     | 
    
         
            +
              end
         
     | 
| 
      
 64 
     | 
    
         
            +
             
     | 
| 
      
 65 
     | 
    
         
            +
            end
         
     | 
    
        data/spec/Gemfile
    CHANGED
    
    | 
         @@ -1,21 +1,23 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            source 'https://rubygems.org'
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
       3 
     | 
    
         
            -
             
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
       4 
4 
     | 
    
         
             
            # DEFINE WHICH VERSIONS ON VITAL GEMS WE WANT TO TEST WITH
         
     | 
| 
       5 
5 
     | 
    
         | 
| 
       6 
     | 
    
         
            -
            gem 'rails', '4. 
     | 
| 
      
 6 
     | 
    
         
            +
            gem 'rails', '4.1.8'
         
     | 
| 
       7 
7 
     | 
    
         | 
| 
       8 
     | 
    
         
            -
            gem 'spreadsheet'
         
     | 
| 
      
 8 
     | 
    
         
            +
            gem 'spreadsheet', '1.0.0'
         
     | 
| 
       9 
9 
     | 
    
         
             
            gem 'paperclip'
         
     | 
| 
      
 10 
     | 
    
         
            +
            gem 'activesupport'
         
     | 
| 
       10 
11 
     | 
    
         | 
| 
      
 12 
     | 
    
         
            +
            gem 'database_cleaner'
         
     | 
| 
       11 
13 
     | 
    
         | 
| 
       12 
     | 
    
         
            -
            gem ' 
     | 
| 
       13 
     | 
    
         
            -
            gem 'rspec-core'  # RSpec runner and example groups.
         
     | 
| 
       14 
     | 
    
         
            -
            gem 'rspec-expectations'  # RSpec matchers for should and should_not.
         
     | 
| 
       15 
     | 
    
         
            -
            gem 'rspec-mocks'  # RSpec test double framework with stubbing and mocking.
         
     | 
| 
       16 
     | 
    
         
            -
            gem 'rspec-rails'  # RSpec version 2.x for Rails version 3.x.
         
     | 
| 
      
 14 
     | 
    
         
            +
            gem 'factory_girl_rails'
         
     | 
| 
       17 
15 
     | 
    
         | 
| 
       18 
     | 
    
         
            -
            gem ' 
     | 
| 
      
 16 
     | 
    
         
            +
            gem 'rspec'
         
     | 
| 
      
 17 
     | 
    
         
            +
            gem 'rspec-core'
         
     | 
| 
      
 18 
     | 
    
         
            +
            gem 'rspec-expectations' # RSpec matchers for should and should_not.
         
     | 
| 
      
 19 
     | 
    
         
            +
            gem 'rspec-mocks'        # RSpec test double framework with stubbing and mocking.
         
     | 
| 
      
 20 
     | 
    
         
            +
            gem 'rspec-rails'       # RSpec version 2.x for Rails version 3.x.
         
     | 
| 
       19 
21 
     | 
    
         | 
| 
       20 
22 
     | 
    
         
             
            # we need both, for JRuby testing of Excel and non JRuby csv
         
     | 
| 
       21 
23 
     | 
    
         
             
            platform :jruby do
         
     | 
| 
         @@ -23,7 +25,7 @@ platform :jruby do 
     | 
|
| 
       23 
25 
     | 
    
         
             
              gem 'activerecord-jdbcsqlite3-adapter'
         
     | 
| 
       24 
26 
     | 
    
         
             
            end
         
     | 
| 
       25 
27 
     | 
    
         | 
| 
       26 
     | 
    
         
            -
            platform :ruby do 
     | 
| 
       27 
     | 
    
         
            -
               
     | 
| 
      
 28 
     | 
    
         
            +
            platform :ruby do
         
     | 
| 
      
 29 
     | 
    
         
            +
              gem 'sqlite3'
         
     | 
| 
       28 
30 
     | 
    
         
             
            end
         
     | 
| 
       29 
31 
     | 
    
         | 
    
        data/spec/Gemfile.lock
    CHANGED
    
    | 
         @@ -1,129 +1,134 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            GEM
         
     | 
| 
       2 
2 
     | 
    
         
             
              remote: https://rubygems.org/
         
     | 
| 
       3 
3 
     | 
    
         
             
              specs:
         
     | 
| 
       4 
     | 
    
         
            -
                actionmailer (4. 
     | 
| 
       5 
     | 
    
         
            -
                  actionpack (= 4. 
     | 
| 
       6 
     | 
    
         
            -
                   
     | 
| 
       7 
     | 
    
         
            -
             
     | 
| 
       8 
     | 
    
         
            -
             
     | 
| 
       9 
     | 
    
         
            -
                   
     | 
| 
       10 
     | 
    
         
            -
                   
     | 
| 
      
 4 
     | 
    
         
            +
                actionmailer (4.1.8)
         
     | 
| 
      
 5 
     | 
    
         
            +
                  actionpack (= 4.1.8)
         
     | 
| 
      
 6 
     | 
    
         
            +
                  actionview (= 4.1.8)
         
     | 
| 
      
 7 
     | 
    
         
            +
                  mail (~> 2.5, >= 2.5.4)
         
     | 
| 
      
 8 
     | 
    
         
            +
                actionpack (4.1.8)
         
     | 
| 
      
 9 
     | 
    
         
            +
                  actionview (= 4.1.8)
         
     | 
| 
      
 10 
     | 
    
         
            +
                  activesupport (= 4.1.8)
         
     | 
| 
       11 
11 
     | 
    
         
             
                  rack (~> 1.5.2)
         
     | 
| 
       12 
12 
     | 
    
         
             
                  rack-test (~> 0.6.2)
         
     | 
| 
       13 
     | 
    
         
            -
                 
     | 
| 
       14 
     | 
    
         
            -
                  activesupport (= 4. 
     | 
| 
       15 
     | 
    
         
            -
                  builder (~> 3.1 
     | 
| 
       16 
     | 
    
         
            -
             
     | 
| 
       17 
     | 
    
         
            -
             
     | 
| 
       18 
     | 
    
         
            -
                   
     | 
| 
       19 
     | 
    
         
            -
                   
     | 
| 
       20 
     | 
    
         
            -
             
     | 
| 
       21 
     | 
    
         
            -
             
     | 
| 
       22 
     | 
    
         
            -
             
     | 
| 
       23 
     | 
    
         
            -
                   
     | 
| 
       24 
     | 
    
         
            -
                 
     | 
| 
       25 
     | 
    
         
            -
                  activerecord-jdbc-adapter (~> 1.3.7)
         
     | 
| 
       26 
     | 
    
         
            -
                  jdbc-sqlite3 (~> 3.7.2)
         
     | 
| 
       27 
     | 
    
         
            -
                activesupport (4.0.4)
         
     | 
| 
      
 13 
     | 
    
         
            +
                actionview (4.1.8)
         
     | 
| 
      
 14 
     | 
    
         
            +
                  activesupport (= 4.1.8)
         
     | 
| 
      
 15 
     | 
    
         
            +
                  builder (~> 3.1)
         
     | 
| 
      
 16 
     | 
    
         
            +
                  erubis (~> 2.7.0)
         
     | 
| 
      
 17 
     | 
    
         
            +
                activemodel (4.1.8)
         
     | 
| 
      
 18 
     | 
    
         
            +
                  activesupport (= 4.1.8)
         
     | 
| 
      
 19 
     | 
    
         
            +
                  builder (~> 3.1)
         
     | 
| 
      
 20 
     | 
    
         
            +
                activerecord (4.1.8)
         
     | 
| 
      
 21 
     | 
    
         
            +
                  activemodel (= 4.1.8)
         
     | 
| 
      
 22 
     | 
    
         
            +
                  activesupport (= 4.1.8)
         
     | 
| 
      
 23 
     | 
    
         
            +
                  arel (~> 5.0.0)
         
     | 
| 
      
 24 
     | 
    
         
            +
                activesupport (4.1.8)
         
     | 
| 
       28 
25 
     | 
    
         
             
                  i18n (~> 0.6, >= 0.6.9)
         
     | 
| 
       29 
     | 
    
         
            -
                   
     | 
| 
       30 
     | 
    
         
            -
                   
     | 
| 
      
 26 
     | 
    
         
            +
                  json (~> 1.7, >= 1.7.7)
         
     | 
| 
      
 27 
     | 
    
         
            +
                  minitest (~> 5.1)
         
     | 
| 
       31 
28 
     | 
    
         
             
                  thread_safe (~> 0.1)
         
     | 
| 
       32 
     | 
    
         
            -
                  tzinfo (~>  
     | 
| 
       33 
     | 
    
         
            -
                arel ( 
     | 
| 
       34 
     | 
    
         
            -
                 
     | 
| 
       35 
     | 
    
         
            -
                builder (3.1.4)
         
     | 
| 
      
 29 
     | 
    
         
            +
                  tzinfo (~> 1.1)
         
     | 
| 
      
 30 
     | 
    
         
            +
                arel (5.0.1.20140414130214)
         
     | 
| 
      
 31 
     | 
    
         
            +
                builder (3.2.2)
         
     | 
| 
       36 
32 
     | 
    
         
             
                climate_control (0.0.3)
         
     | 
| 
       37 
33 
     | 
    
         
             
                  activesupport (>= 3.0)
         
     | 
| 
       38 
     | 
    
         
            -
                cocaine (0.5. 
     | 
| 
      
 34 
     | 
    
         
            +
                cocaine (0.5.8)
         
     | 
| 
       39 
35 
     | 
    
         
             
                  climate_control (>= 0.0.3, < 1.0)
         
     | 
| 
      
 36 
     | 
    
         
            +
                concurrent-ruby (1.0.1)
         
     | 
| 
      
 37 
     | 
    
         
            +
                database_cleaner (1.5.1)
         
     | 
| 
       40 
38 
     | 
    
         
             
                diff-lcs (1.2.5)
         
     | 
| 
       41 
39 
     | 
    
         
             
                erubis (2.7.0)
         
     | 
| 
       42 
     | 
    
         
            -
                 
     | 
| 
       43 
     | 
    
         
            -
                i18n (0.6.9)
         
     | 
| 
       44 
     | 
    
         
            -
                jdbc-sqlite3 (3.7.2.1)
         
     | 
| 
       45 
     | 
    
         
            -
                jruby-openssl (0.9.4)
         
     | 
| 
       46 
     | 
    
         
            -
                  bouncy-castle-java (>= 1.5.0147)
         
     | 
| 
       47 
     | 
    
         
            -
                mail (2.5.4)
         
     | 
| 
       48 
     | 
    
         
            -
                  mime-types (~> 1.16)
         
     | 
| 
       49 
     | 
    
         
            -
                  treetop (~> 1.4.8)
         
     | 
| 
       50 
     | 
    
         
            -
                mime-types (1.25.1)
         
     | 
| 
       51 
     | 
    
         
            -
                minitest (4.7.5)
         
     | 
| 
       52 
     | 
    
         
            -
                multi_json (1.10.0)
         
     | 
| 
       53 
     | 
    
         
            -
                paperclip (4.1.1)
         
     | 
| 
       54 
     | 
    
         
            -
                  activemodel (>= 3.0.0)
         
     | 
| 
      
 40 
     | 
    
         
            +
                factory_girl (4.5.0)
         
     | 
| 
       55 
41 
     | 
    
         
             
                  activesupport (>= 3.0.0)
         
     | 
| 
       56 
     | 
    
         
            -
             
     | 
| 
      
 42 
     | 
    
         
            +
                factory_girl_rails (4.6.0)
         
     | 
| 
      
 43 
     | 
    
         
            +
                  factory_girl (~> 4.5.0)
         
     | 
| 
      
 44 
     | 
    
         
            +
                  railties (>= 3.0.0)
         
     | 
| 
      
 45 
     | 
    
         
            +
                i18n (0.7.0)
         
     | 
| 
      
 46 
     | 
    
         
            +
                json (1.8.3)
         
     | 
| 
      
 47 
     | 
    
         
            +
                mail (2.6.3)
         
     | 
| 
      
 48 
     | 
    
         
            +
                  mime-types (>= 1.16, < 3)
         
     | 
| 
      
 49 
     | 
    
         
            +
                mime-types (2.99.1)
         
     | 
| 
      
 50 
     | 
    
         
            +
                mimemagic (0.3.0)
         
     | 
| 
      
 51 
     | 
    
         
            +
                minitest (5.8.4)
         
     | 
| 
      
 52 
     | 
    
         
            +
                paperclip (4.3.5)
         
     | 
| 
      
 53 
     | 
    
         
            +
                  activemodel (>= 3.2.0)
         
     | 
| 
      
 54 
     | 
    
         
            +
                  activesupport (>= 3.2.0)
         
     | 
| 
      
 55 
     | 
    
         
            +
                  cocaine (~> 0.5.5)
         
     | 
| 
       57 
56 
     | 
    
         
             
                  mime-types
         
     | 
| 
       58 
     | 
    
         
            -
             
     | 
| 
       59 
     | 
    
         
            -
                rack (1.5. 
     | 
| 
       60 
     | 
    
         
            -
                rack-test (0.6. 
     | 
| 
      
 57 
     | 
    
         
            +
                  mimemagic (= 0.3.0)
         
     | 
| 
      
 58 
     | 
    
         
            +
                rack (1.5.5)
         
     | 
| 
      
 59 
     | 
    
         
            +
                rack-test (0.6.3)
         
     | 
| 
       61 
60 
     | 
    
         
             
                  rack (>= 1.0)
         
     | 
| 
       62 
     | 
    
         
            -
                rails (4. 
     | 
| 
       63 
     | 
    
         
            -
                  actionmailer (= 4. 
     | 
| 
       64 
     | 
    
         
            -
                  actionpack (= 4. 
     | 
| 
       65 
     | 
    
         
            -
                   
     | 
| 
       66 
     | 
    
         
            -
                   
     | 
| 
      
 61 
     | 
    
         
            +
                rails (4.1.8)
         
     | 
| 
      
 62 
     | 
    
         
            +
                  actionmailer (= 4.1.8)
         
     | 
| 
      
 63 
     | 
    
         
            +
                  actionpack (= 4.1.8)
         
     | 
| 
      
 64 
     | 
    
         
            +
                  actionview (= 4.1.8)
         
     | 
| 
      
 65 
     | 
    
         
            +
                  activemodel (= 4.1.8)
         
     | 
| 
      
 66 
     | 
    
         
            +
                  activerecord (= 4.1.8)
         
     | 
| 
      
 67 
     | 
    
         
            +
                  activesupport (= 4.1.8)
         
     | 
| 
       67 
68 
     | 
    
         
             
                  bundler (>= 1.3.0, < 2.0)
         
     | 
| 
       68 
     | 
    
         
            -
                  railties (= 4. 
     | 
| 
       69 
     | 
    
         
            -
                  sprockets-rails (~> 2.0 
     | 
| 
       70 
     | 
    
         
            -
                railties (4. 
     | 
| 
       71 
     | 
    
         
            -
                  actionpack (= 4. 
     | 
| 
       72 
     | 
    
         
            -
                  activesupport (= 4. 
     | 
| 
      
 69 
     | 
    
         
            +
                  railties (= 4.1.8)
         
     | 
| 
      
 70 
     | 
    
         
            +
                  sprockets-rails (~> 2.0)
         
     | 
| 
      
 71 
     | 
    
         
            +
                railties (4.1.8)
         
     | 
| 
      
 72 
     | 
    
         
            +
                  actionpack (= 4.1.8)
         
     | 
| 
      
 73 
     | 
    
         
            +
                  activesupport (= 4.1.8)
         
     | 
| 
       73 
74 
     | 
    
         
             
                  rake (>= 0.8.7)
         
     | 
| 
       74 
75 
     | 
    
         
             
                  thor (>= 0.18.1, < 2.0)
         
     | 
| 
       75 
     | 
    
         
            -
                rake ( 
     | 
| 
       76 
     | 
    
         
            -
                rspec ( 
     | 
| 
       77 
     | 
    
         
            -
                  rspec-core (~>  
     | 
| 
       78 
     | 
    
         
            -
                  rspec-expectations (~>  
     | 
| 
       79 
     | 
    
         
            -
                  rspec-mocks (~>  
     | 
| 
       80 
     | 
    
         
            -
                rspec-core ( 
     | 
| 
       81 
     | 
    
         
            -
             
     | 
| 
       82 
     | 
    
         
            -
             
     | 
| 
       83 
     | 
    
         
            -
             
     | 
| 
       84 
     | 
    
         
            -
             
     | 
| 
       85 
     | 
    
         
            -
             
     | 
| 
       86 
     | 
    
         
            -
                   
     | 
| 
       87 
     | 
    
         
            -
                   
     | 
| 
       88 
     | 
    
         
            -
             
     | 
| 
       89 
     | 
    
         
            -
                   
     | 
| 
       90 
     | 
    
         
            -
                   
     | 
| 
       91 
     | 
    
         
            -
                   
     | 
| 
       92 
     | 
    
         
            -
             
     | 
| 
       93 
     | 
    
         
            -
             
     | 
| 
      
 76 
     | 
    
         
            +
                rake (11.0.1)
         
     | 
| 
      
 77 
     | 
    
         
            +
                rspec (3.4.0)
         
     | 
| 
      
 78 
     | 
    
         
            +
                  rspec-core (~> 3.4.0)
         
     | 
| 
      
 79 
     | 
    
         
            +
                  rspec-expectations (~> 3.4.0)
         
     | 
| 
      
 80 
     | 
    
         
            +
                  rspec-mocks (~> 3.4.0)
         
     | 
| 
      
 81 
     | 
    
         
            +
                rspec-core (3.4.4)
         
     | 
| 
      
 82 
     | 
    
         
            +
                  rspec-support (~> 3.4.0)
         
     | 
| 
      
 83 
     | 
    
         
            +
                rspec-expectations (3.4.0)
         
     | 
| 
      
 84 
     | 
    
         
            +
                  diff-lcs (>= 1.2.0, < 2.0)
         
     | 
| 
      
 85 
     | 
    
         
            +
                  rspec-support (~> 3.4.0)
         
     | 
| 
      
 86 
     | 
    
         
            +
                rspec-mocks (3.4.1)
         
     | 
| 
      
 87 
     | 
    
         
            +
                  diff-lcs (>= 1.2.0, < 2.0)
         
     | 
| 
      
 88 
     | 
    
         
            +
                  rspec-support (~> 3.4.0)
         
     | 
| 
      
 89 
     | 
    
         
            +
                rspec-rails (3.4.2)
         
     | 
| 
      
 90 
     | 
    
         
            +
                  actionpack (>= 3.0, < 4.3)
         
     | 
| 
      
 91 
     | 
    
         
            +
                  activesupport (>= 3.0, < 4.3)
         
     | 
| 
      
 92 
     | 
    
         
            +
                  railties (>= 3.0, < 4.3)
         
     | 
| 
      
 93 
     | 
    
         
            +
                  rspec-core (~> 3.4.0)
         
     | 
| 
      
 94 
     | 
    
         
            +
                  rspec-expectations (~> 3.4.0)
         
     | 
| 
      
 95 
     | 
    
         
            +
                  rspec-mocks (~> 3.4.0)
         
     | 
| 
      
 96 
     | 
    
         
            +
                  rspec-support (~> 3.4.0)
         
     | 
| 
      
 97 
     | 
    
         
            +
                rspec-support (3.4.1)
         
     | 
| 
      
 98 
     | 
    
         
            +
                ruby-ole (1.2.12)
         
     | 
| 
      
 99 
     | 
    
         
            +
                spreadsheet (1.0.0)
         
     | 
| 
       94 
100 
     | 
    
         
             
                  ruby-ole (>= 1.0)
         
     | 
| 
       95 
     | 
    
         
            -
                sprockets ( 
     | 
| 
       96 
     | 
    
         
            -
                   
     | 
| 
       97 
     | 
    
         
            -
                   
     | 
| 
       98 
     | 
    
         
            -
             
     | 
| 
       99 
     | 
    
         
            -
                  tilt (~> 1.1, != 1.3.0)
         
     | 
| 
       100 
     | 
    
         
            -
                sprockets-rails (2.0.1)
         
     | 
| 
      
 101 
     | 
    
         
            +
                sprockets (3.5.2)
         
     | 
| 
      
 102 
     | 
    
         
            +
                  concurrent-ruby (~> 1.0)
         
     | 
| 
      
 103 
     | 
    
         
            +
                  rack (> 1, < 3)
         
     | 
| 
      
 104 
     | 
    
         
            +
                sprockets-rails (2.3.3)
         
     | 
| 
       101 
105 
     | 
    
         
             
                  actionpack (>= 3.0)
         
     | 
| 
       102 
106 
     | 
    
         
             
                  activesupport (>= 3.0)
         
     | 
| 
       103 
     | 
    
         
            -
                  sprockets ( 
     | 
| 
       104 
     | 
    
         
            -
                sqlite3 (1.3. 
     | 
| 
      
 107 
     | 
    
         
            +
                  sprockets (>= 2.8, < 4.0)
         
     | 
| 
      
 108 
     | 
    
         
            +
                sqlite3 (1.3.11)
         
     | 
| 
       105 
109 
     | 
    
         
             
                thor (0.19.1)
         
     | 
| 
       106 
     | 
    
         
            -
                thread_safe (0.3. 
     | 
| 
       107 
     | 
    
         
            -
                 
     | 
| 
       108 
     | 
    
         
            -
             
     | 
| 
       109 
     | 
    
         
            -
                treetop (1.4.15)
         
     | 
| 
       110 
     | 
    
         
            -
                  polyglot
         
     | 
| 
       111 
     | 
    
         
            -
                  polyglot (>= 0.3.1)
         
     | 
| 
       112 
     | 
    
         
            -
                tzinfo (0.3.39)
         
     | 
| 
      
 110 
     | 
    
         
            +
                thread_safe (0.3.5)
         
     | 
| 
      
 111 
     | 
    
         
            +
                tzinfo (1.2.2)
         
     | 
| 
      
 112 
     | 
    
         
            +
                  thread_safe (~> 0.1)
         
     | 
| 
       113 
113 
     | 
    
         | 
| 
       114 
114 
     | 
    
         
             
            PLATFORMS
         
     | 
| 
       115 
     | 
    
         
            -
              java
         
     | 
| 
       116 
115 
     | 
    
         
             
              ruby
         
     | 
| 
       117 
116 
     | 
    
         | 
| 
       118 
117 
     | 
    
         
             
            DEPENDENCIES
         
     | 
| 
       119 
118 
     | 
    
         
             
              activerecord-jdbcsqlite3-adapter
         
     | 
| 
      
 119 
     | 
    
         
            +
              activesupport
         
     | 
| 
      
 120 
     | 
    
         
            +
              database_cleaner
         
     | 
| 
      
 121 
     | 
    
         
            +
              factory_girl_rails
         
     | 
| 
       120 
122 
     | 
    
         
             
              jruby-openssl
         
     | 
| 
       121 
123 
     | 
    
         
             
              paperclip
         
     | 
| 
       122 
     | 
    
         
            -
              rails (= 4. 
     | 
| 
      
 124 
     | 
    
         
            +
              rails (= 4.1.8)
         
     | 
| 
       123 
125 
     | 
    
         
             
              rspec
         
     | 
| 
       124 
126 
     | 
    
         
             
              rspec-core
         
     | 
| 
       125 
127 
     | 
    
         
             
              rspec-expectations
         
     | 
| 
       126 
128 
     | 
    
         
             
              rspec-mocks
         
     | 
| 
       127 
129 
     | 
    
         
             
              rspec-rails
         
     | 
| 
       128 
     | 
    
         
            -
              spreadsheet
         
     | 
| 
      
 130 
     | 
    
         
            +
              spreadsheet (= 1.0.0)
         
     | 
| 
       129 
131 
     | 
    
         
             
              sqlite3
         
     | 
| 
      
 132 
     | 
    
         
            +
             
     | 
| 
      
 133 
     | 
    
         
            +
            BUNDLED WITH
         
     | 
| 
      
 134 
     | 
    
         
            +
               1.11.2
         
     |