cross_platform_csproj 0.0.4 → 0.0.5
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/lib/cross_platform_csproj.rb +25 -8
- metadata +3 -3
@@ -3,6 +3,16 @@ require 'nokogiri'
|
|
3
3
|
class CrossPlatformCSProj
|
4
4
|
|
5
5
|
def self.updateProject(projectFile, fileList)
|
6
|
+
if !File.exists?(projectFile)
|
7
|
+
puts "CSProject file does not point to any file: #{projectFile}"
|
8
|
+
end
|
9
|
+
|
10
|
+
for file in fileList do
|
11
|
+
if !File.exists?(file)
|
12
|
+
puts "A file in the in the file list is not a valid file: #{fileList}"
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
6
16
|
rootPath = File.dirname(projectFile).gsub('/', '\\')
|
7
17
|
document = openDocument(projectFile)
|
8
18
|
parent = getParentNode(document)
|
@@ -64,19 +74,22 @@ class CrossPlatformCSProj
|
|
64
74
|
|
65
75
|
parentNode = node
|
66
76
|
end
|
77
|
+
if node.children.length == 0 && node.attributes.length == 0
|
78
|
+
node.remove()
|
79
|
+
end
|
67
80
|
end
|
68
81
|
|
69
82
|
if parentNode == nil
|
70
|
-
|
83
|
+
projectNodes = document.css('Project')
|
71
84
|
|
72
|
-
if
|
85
|
+
if projectNodes.length == 0
|
73
86
|
puts 'ERROR: invalid CSharp project file'
|
74
87
|
return nil
|
75
88
|
end
|
76
89
|
|
77
90
|
parentNode = Nokogiri::XML::Node.new('ItemGroup', document)
|
78
91
|
|
79
|
-
|
92
|
+
projectNodes[0].add_child(parentNode)
|
80
93
|
end
|
81
94
|
|
82
95
|
return parentNode
|
@@ -85,7 +98,7 @@ class CrossPlatformCSProj
|
|
85
98
|
def self.getRelativePath(path, pathRelative)
|
86
99
|
pathRelative = pathRelative.gsub('/', '\\')
|
87
100
|
path = path.gsub('/', '\\')
|
88
|
-
path = path.gsub(pathRelative
|
101
|
+
path = path.gsub!(/^#{pathRelative}/, "")
|
89
102
|
|
90
103
|
if (path.length > 0 and path.start_with?('\\'))
|
91
104
|
return path[1..path.length - 1]
|
@@ -94,7 +107,7 @@ class CrossPlatformCSProj
|
|
94
107
|
return path
|
95
108
|
end
|
96
109
|
|
97
|
-
def self.getCoreFiles(path)
|
110
|
+
def self.getCoreFiles(path = '.')
|
98
111
|
fileList = FileList.new()
|
99
112
|
|
100
113
|
fileList.include("#{path}/**/*.cs")
|
@@ -102,7 +115,7 @@ class CrossPlatformCSProj
|
|
102
115
|
return fileList
|
103
116
|
end
|
104
117
|
|
105
|
-
def self.getAndroidFiles(path)
|
118
|
+
def self.getAndroidFiles(path = '.')
|
106
119
|
fileList = getCoreFiles(path);
|
107
120
|
|
108
121
|
fileList.exclude("#{path}/**/IOS/**/*.cs")
|
@@ -114,7 +127,7 @@ class CrossPlatformCSProj
|
|
114
127
|
return fileList;
|
115
128
|
end
|
116
129
|
|
117
|
-
def self.getIOSFiles(path)
|
130
|
+
def self.getIOSFiles(path = '.')
|
118
131
|
fileList = getCoreFiles(path);
|
119
132
|
|
120
133
|
fileList.exclude("#{path}/**/Android/**/*.cs")
|
@@ -123,10 +136,12 @@ class CrossPlatformCSProj
|
|
123
136
|
fileList.exclude("#{path}/**/*.Android.cs")
|
124
137
|
fileList.exclude("#{path}/**/*.Windows.cs")
|
125
138
|
|
139
|
+
fileList.exclude("#{path}/**/Resources/Resource.Designer.cs")
|
140
|
+
|
126
141
|
return fileList;
|
127
142
|
end
|
128
143
|
|
129
|
-
def self.getWindowsFiles(path)
|
144
|
+
def self.getWindowsFiles(path = '.')
|
130
145
|
fileList = getCoreFiles(path);
|
131
146
|
|
132
147
|
fileList.exclude("#{path}/**/Android/**/*.cs")
|
@@ -135,6 +150,8 @@ class CrossPlatformCSProj
|
|
135
150
|
fileList.exclude("#{path}/**/*.Android.cs")
|
136
151
|
fileList.exclude("#{path}/**/*.IOS.cs")
|
137
152
|
|
153
|
+
fileList.exclude("#{path}/**/Resources/Resource.Designer.cs")
|
154
|
+
|
138
155
|
return fileList;
|
139
156
|
end
|
140
157
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cross_platform_csproj
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
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-
|
12
|
+
date: 2013-02-21 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: Offers functions which synchronize the file and folder structure to a
|
15
15
|
CSharp project. Users maintain a cross platform CSharp library using the file system. Running
|
@@ -44,7 +44,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
44
44
|
version: '0'
|
45
45
|
requirements: []
|
46
46
|
rubyforge_project:
|
47
|
-
rubygems_version: 1.8.
|
47
|
+
rubygems_version: 1.8.25
|
48
48
|
signing_key:
|
49
49
|
specification_version: 3
|
50
50
|
summary: Tools for creating cross platform CSharp projects.
|