iron-spect 0.0.5 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/iron-spect/version.rb +1 -1
- data/lib/iron-spect.rb +59 -9
- metadata +4 -4
data/lib/iron-spect/version.rb
CHANGED
data/lib/iron-spect.rb
CHANGED
@@ -9,19 +9,32 @@ module IronSpect
|
|
9
9
|
@sln_file_manager = Parsers::SolutionFileParser.new(repo_dir)
|
10
10
|
@sln_file = @sln_file_manager.parse
|
11
11
|
@repo_dir = repo_dir
|
12
|
-
@startup_csproj_file = get_global_property('MonoDevelopProperties', 'StartupItem')
|
12
|
+
@startup_csproj_file = if (get_global_property('MonoDevelopProperties', 'StartupItem')) then
|
13
|
+
load_project get_global_property('MonoDevelopProperties', 'StartupItem')
|
14
|
+
else
|
15
|
+
(first_exe_project) ? first_exe_project : @sln_file[:projects].first
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
|
20
|
+
|
21
|
+
def startup_project
|
22
|
+
@startup_csproj_file
|
13
23
|
end
|
14
24
|
|
15
|
-
def get_executable_path(type)
|
16
|
-
raise "You must provide either 'Release' or 'Debug'" if not(type =~ /^(Debug|Release)$/)
|
17
25
|
|
26
|
+
def startup_executable_path(configuration, platform='AnyCPU')
|
18
27
|
|
19
|
-
|
28
|
+
#break out early if the configuration or type provided is invalid
|
29
|
+
nil if not(configuration =~ /^(Debug|Release)$/)
|
30
|
+
nil if not(platform =~ /^(AnyCPU|x86|x64|Itanium)$/)
|
31
|
+
|
32
|
+
@csproj_file_manager = Parsers::ProjectFileParser.new(startup_local_path)
|
20
33
|
startup_csproj = @csproj_file_manager.parse
|
21
34
|
|
22
35
|
startup_csproj['PropertyGroup'].each do |property|
|
23
36
|
if property.include?('Condition')
|
24
|
-
if property['Condition'] === "'$(Configuration)|$(Platform)' == '#{
|
37
|
+
if property['Condition'] === "'$(Configuration)|$(Platform)' == '#{configuration}|#{platform}'"
|
25
38
|
@out_path = property['OutputPath'][0].gsub(/\\/, '/').strip
|
26
39
|
end
|
27
40
|
end
|
@@ -36,21 +49,24 @@ module IronSpect
|
|
36
49
|
|
37
50
|
next
|
38
51
|
end
|
39
|
-
|
52
|
+
nil if (@out_path.nil? || @assembly_name.nil? || @out_type.nil?)
|
40
53
|
"#{@repo_dir}/#{strip_csproj}/#{@out_path}#{@assembly_name}.#{@out_type}"
|
41
54
|
end
|
42
55
|
|
56
|
+
|
43
57
|
def get_global_property(property_tag, property)
|
44
58
|
@sln_file[:global].each do |prop|
|
59
|
+
#puts prop[:properties] if (prop[:property_tag] === property_tag)
|
45
60
|
prop_set = prop[:properties] if (prop[:property_tag] === property_tag)
|
46
61
|
next if prop_set.nil?
|
47
62
|
prop_set.each do |p|
|
48
63
|
return p[:value].gsub(/\\/, '/') if p[:key] === property
|
49
64
|
end
|
50
|
-
raise "Property '#{property}' not found for property tag '#{property_tag}'"
|
51
65
|
end
|
66
|
+
nil
|
52
67
|
end
|
53
68
|
|
69
|
+
|
54
70
|
def get_project_property(project_name, property)
|
55
71
|
@sln_file[:projects].each do |project|
|
56
72
|
if project[:assembly_info][:name] =~ /("?)#{project_name}("?)/
|
@@ -58,11 +74,45 @@ module IronSpect
|
|
58
74
|
return project[:guid].gsub(/\\/, '/') if property === 'guid'
|
59
75
|
end
|
60
76
|
end
|
61
|
-
|
77
|
+
nil
|
78
|
+
end
|
79
|
+
|
80
|
+
|
81
|
+
private
|
82
|
+
|
83
|
+
def first_exe_project
|
84
|
+
@sln_file[:projects].each do |project|
|
85
|
+
parsed = Parsers::ProjectFileParser.new(project[:assembly_info][:path]).parse
|
86
|
+
parsed['PropertyGroup'].each do |property_group|
|
87
|
+
if property_group.include?('OutputType')
|
88
|
+
if property_group['OutputType'].first === 'Exe'
|
89
|
+
return project
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
94
|
+
nil
|
62
95
|
end
|
63
96
|
|
97
|
+
|
98
|
+
def load_project(path)
|
99
|
+
@sln_file[:projects].each do |project|
|
100
|
+
if (project[:assembly_info][:path] === path)
|
101
|
+
return project
|
102
|
+
end
|
103
|
+
next
|
104
|
+
end
|
105
|
+
nil
|
106
|
+
end
|
107
|
+
|
108
|
+
|
64
109
|
def strip_csproj
|
65
|
-
|
110
|
+
startup_local_path.match(/(^.*)\/.*\.csproj$/).captures[0].strip
|
66
111
|
end
|
112
|
+
|
113
|
+
def startup_local_path
|
114
|
+
@startup_csproj_file[:assembly_info][:path]
|
115
|
+
end
|
116
|
+
|
67
117
|
end
|
68
118
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: iron-spect
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 1.0.0
|
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-08-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: xml-simple
|
@@ -141,7 +141,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
141
141
|
version: '0'
|
142
142
|
segments:
|
143
143
|
- 0
|
144
|
-
hash:
|
144
|
+
hash: 514363538231883232
|
145
145
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
146
146
|
none: false
|
147
147
|
requirements:
|
@@ -150,7 +150,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
150
150
|
version: '0'
|
151
151
|
segments:
|
152
152
|
- 0
|
153
|
-
hash:
|
153
|
+
hash: 514363538231883232
|
154
154
|
requirements: []
|
155
155
|
rubyforge_project:
|
156
156
|
rubygems_version: 1.8.25
|