visual_studio_files 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/visual_studio_files.rb +19 -6
  2. metadata +2 -2
@@ -21,14 +21,21 @@ module VisualStudioFiles
21
21
  depend_upon = file.elements.select { |el| el.name == 'DependentUpon' }.map { |e| e.get_text.value }
22
22
  generator = file.elements.select { |el| el.name == 'Generator' }.map { |e| e.get_text.value }
23
23
  sub_type = file.elements.select { |el| el.name == 'SubType' }.map { |e| e.get_text.value }
24
- files.push(FileReference.new({
24
+ copy_to_output_directory = file.elements.select { |el| el.name == 'CopyToOutputDirectory' }.map { |e| e.get_text.value }
25
+ hash = {
25
26
  :file=>file.attributes['Include'],
26
27
  :type=>elementType,
27
28
  :link=> links.first,
28
29
  :dependent_upon=>depend_upon.first,
29
- :generator => generator.first,
30
- :sub_type => sub_type.first
31
- }))
30
+ :sub_type => sub_type.first
31
+ }
32
+ if generator!=nil
33
+ hash[:generator] = generator.first
34
+ end
35
+ if copy_to_output_directory!=nil
36
+ hash[:copy_to_output_directory] = copy_to_output_directory.first
37
+ end
38
+ files.push(FileReference.new(hash))
32
39
  }
33
40
  }
34
41
  return files
@@ -51,6 +58,9 @@ module VisualStudioFiles
51
58
  if ref.sub_type
52
59
  el.add_element('SubType').add_text(ref.sub_type)
53
60
  end
61
+ if ref.copy_to_output_directory
62
+ el.add_element('CopyToOutputDirectory').add_text(ref.copy_to_output_directory)
63
+ end
54
64
  end
55
65
  def clear_links()
56
66
  element_types.each { |elementType|
@@ -73,7 +83,7 @@ module VisualStudioFiles
73
83
  end
74
84
 
75
85
  class FileReference
76
- attr_reader :file, :downcase_and_path_replaced, :type, :link, :dependent_upon, :generator, :sub_type
86
+ attr_reader :file, :downcase_and_path_replaced, :type, :link, :dependent_upon, :generator, :sub_type, :copy_to_output_directory
77
87
  def initialize opts
78
88
  opts.each do |key,value|
79
89
  self[key]=value
@@ -99,6 +109,8 @@ module VisualStudioFiles
99
109
  @sub_type = value
100
110
  when :generator
101
111
  @generator = value
112
+ when :copy_to_output_directory
113
+ @copy_to_output_directory = value
102
114
  end
103
115
  end
104
116
  def link?
@@ -130,7 +142,8 @@ module VisualStudioFiles
130
142
  :link=>@link,
131
143
  :dependent_upon=>@dependent_upon,
132
144
  :sub_type=>@sub_type,
133
- :generator=>@generator
145
+ :generator=>@generator,
146
+ :copy_to_output_directory=>@copy_to_output_directory
134
147
  }
135
148
  end
136
149
  def to_s
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: visual_studio_files
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-10-29 00:00:00.000000000 Z
12
+ date: 2014-09-11 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: This library is intended to help when manipulating such things as the
15
15
  files included in a visual studio project. Or verify some condition related to the