rack-xapper 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,4 +1,5 @@
1
1
  ---
2
- :patch: 1
3
2
  :major: 0
4
- :minor: 0
3
+ :minor: 0
4
+ :patch: 2
5
+ :build:
@@ -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
- Zip::ZipFile.open(F.join(options[:root], options[:xap_path], xap_file), Zip::ZipFile::CREATE) do |zipfile|
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
- f.puts doc.to_s
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
- f.puts doc.to_s
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
- archive.add F.basename(path), path if F.file?(path)
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 |en|
135
- archive.add F.basename(en), en if F.file?(en)
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.rm(@xap_path) if F.exist?(@xap_path)
249
+ FileUtils.rm_f(@xap_path) if F.exist?(@xap_path)
247
250
  XapBuilder.xap_to_disk @options
248
251
  end
249
252
 
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{rack-xapper}
8
- s.version = "0.0.1"
8
+ s.version = "0.0.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["casualjim"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack-xapper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - casualjim