rack-xapper 0.0.1 → 0.0.2
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.yml +3 -2
 - data/lib/rack/xapper.rb +12 -9
 - data/rack-xapper.gemspec +1 -1
 - metadata +1 -1
 
    
        data/VERSION.yml
    CHANGED
    
    
    
        data/lib/rack/xapper.rb
    CHANGED
    
    | 
         @@ -22,8 +22,9 @@ module Rack 
     | 
|
| 
       22 
22 
     | 
    
         
             
                    xap_file = "#{xap_file}.xap" if xap_file !~ /\.xap$/
         
     | 
| 
       23 
23 
     | 
    
         | 
| 
       24 
24 
     | 
    
         
             
                    collect_metadata(options) unless options.key?(:application_files)
         
     | 
| 
       25 
     | 
    
         
            -
                    
         
     | 
| 
       26 
     | 
    
         
            -
                     
     | 
| 
      
 25 
     | 
    
         
            +
                    pth = F.join(options[:root], options[:xap_path], xap_file)
         
     | 
| 
      
 26 
     | 
    
         
            +
                    FileUtils.mkdir_p(F.dirname(pth)) unless F.exist?(F.dirname(pth))
         
     | 
| 
      
 27 
     | 
    
         
            +
                    Zip::ZipFile.open(pth, Zip::ZipFile::CREATE) do |zipfile|
         
     | 
| 
       27 
28 
     | 
    
         
             
                      xap_files(zipfile, options)
         
     | 
| 
       28 
29 
     | 
    
         
             
                    end
         
     | 
| 
       29 
30 
     | 
    
         
             
                  end
         
     | 
| 
         @@ -53,7 +54,7 @@ module Rack 
     | 
|
| 
       53 
54 
     | 
    
         
             
                        ele.attributes['Source'] = assembly
         
     | 
| 
       54 
55 
     | 
    
         
             
                        doc.root.elements['Deployment.Parts'] << ele
         
     | 
| 
       55 
56 
     | 
    
         
             
                      end
         
     | 
| 
       56 
     | 
    
         
            -
                       
     | 
| 
      
 57 
     | 
    
         
            +
                      doc.write f, 1 
         
     | 
| 
       57 
58 
     | 
    
         
             
                    end
         
     | 
| 
       58 
59 
     | 
    
         
             
                  end
         
     | 
| 
       59 
60 
     | 
    
         | 
| 
         @@ -69,7 +70,7 @@ module Rack 
     | 
|
| 
       69 
70 
     | 
    
         
             
                        ele.attributes['external'] = language[:external]
         
     | 
| 
       70 
71 
     | 
    
         
             
                        doc.root << ele
         
     | 
| 
       71 
72 
     | 
    
         
             
                      end
         
     | 
| 
       72 
     | 
    
         
            -
                       
     | 
| 
      
 73 
     | 
    
         
            +
                      doc.write f, 1
         
     | 
| 
       73 
74 
     | 
    
         
             
                    end
         
     | 
| 
       74 
75 
     | 
    
         
             
                  end
         
     | 
| 
       75 
76 
     | 
    
         | 
| 
         @@ -109,7 +110,7 @@ module Rack 
     | 
|
| 
       109 
110 
     | 
    
         
             
                  def find_languages_in_use(options)
         
     | 
| 
       110 
111 
     | 
    
         
             
                    (options[:application_files] +  options[:extra_app_files]).inject([]) do |langs, candidate|
         
     | 
| 
       111 
112 
     | 
    
         
             
                      lang = options[:languages].find { |lang| lang[:extensions].include?(F.extname(candidate)) }
         
     | 
| 
       112 
     | 
    
         
            -
                      langs << lang if lang
         
     | 
| 
      
 113 
     | 
    
         
            +
                      langs << lang if lang and not langs.include?(lang)
         
     | 
| 
       113 
114 
     | 
    
         
             
                      langs
         
     | 
| 
       114 
115 
     | 
    
         
             
                    end
         
     | 
| 
       115 
116 
     | 
    
         
             
                  end
         
     | 
| 
         @@ -126,13 +127,15 @@ module Rack 
     | 
|
| 
       126 
127 
     | 
    
         | 
| 
       127 
128 
     | 
    
         
             
                  def add_extra_directories(archive, options)
         
     | 
| 
       128 
129 
     | 
    
         
             
                    options[:extra_app_files].collect do |pth|
         
     | 
| 
       129 
     | 
    
         
            -
                       
     | 
| 
      
 130 
     | 
    
         
            +
                      in_ar = F.expand_path(pth).gsub(/^#{FileUtils.pwd}/,'')
         
     | 
| 
      
 131 
     | 
    
         
            +
                      archive.add in_ar, pth if F.file?(pth)
         
     | 
| 
       130 
132 
     | 
    
         
             
                    end
         
     | 
| 
       131 
133 
     | 
    
         
             
                  end
         
     | 
| 
       132 
134 
     | 
    
         | 
| 
       133 
135 
     | 
    
         
             
                  def add_application_files(archive, options)
         
     | 
| 
       134 
     | 
    
         
            -
                    options[:application_files].each do | 
     | 
| 
       135 
     | 
    
         
            -
                       
     | 
| 
      
 136 
     | 
    
         
            +
                    options[:application_files].each do |path|
         
     | 
| 
      
 137 
     | 
    
         
            +
                      in_ar = F.expand_path(path).gsub(/^#{"#{FileUtils.pwd}/#{options[:source_path]}"}\//, '')
         
     | 
| 
      
 138 
     | 
    
         
            +
                      archive.add in_ar, path if F.file?(path)
         
     | 
| 
       136 
139 
     | 
    
         
             
                    end
         
     | 
| 
       137 
140 
     | 
    
         
             
                  end
         
     | 
| 
       138 
141 
     | 
    
         
             
                end
         
     | 
| 
         @@ -243,7 +246,7 @@ module Rack 
     | 
|
| 
       243 
246 
     | 
    
         
             
                  return forbidden  if @path_info.include? ".."
         
     | 
| 
       244 
247 
     | 
    
         | 
| 
       245 
248 
     | 
    
         
             
                  if dev_env? or xap_changed?
         
     | 
| 
       246 
     | 
    
         
            -
                    FileUtils. 
     | 
| 
      
 249 
     | 
    
         
            +
                    FileUtils.rm_f(@xap_path) if F.exist?(@xap_path)
         
     | 
| 
       247 
250 
     | 
    
         
             
                    XapBuilder.xap_to_disk @options
         
     | 
| 
       248 
251 
     | 
    
         
             
                  end
         
     | 
| 
       249 
252 
     | 
    
         | 
    
        data/rack-xapper.gemspec
    CHANGED