Class: IronSpect::Inspecter
- Inherits:
-
Object
- Object
- IronSpect::Inspecter
- Defined in:
- lib/iron-spect.rb
Instance Method Summary collapse
- #get_global_property(property_tag, property) ⇒ Object
- #get_project_property(project_name, property) ⇒ Object
-
#initialize(repo_dir = Dir.getwd) ⇒ Inspecter
constructor
A new instance of Inspecter.
- #startup_executable_path(configuration, platform = 'AnyCPU') ⇒ Object
- #startup_project ⇒ Object
Constructor Details
#initialize(repo_dir = Dir.getwd) ⇒ Inspecter
Returns a new instance of Inspecter.
8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/iron-spect.rb', line 8 def initialize(repo_dir=Dir.getwd) @sln_file_manager = Parsers::SolutionFileParser.new(repo_dir) @sln_file = @sln_file_manager.parse @repo_dir = repo_dir @startup_csproj_file = if (get_global_property('MonoDevelopProperties', 'StartupItem')) then load_project get_global_property('MonoDevelopProperties', 'StartupItem') else (first_exe_project) ? first_exe_project : @sln_file[:projects].first end end |
Instance Method Details
#get_global_property(property_tag, property) ⇒ Object
57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/iron-spect.rb', line 57 def get_global_property(property_tag, property) @sln_file[:global].each do |prop| #puts prop[:properties] if (prop[:property_tag] === property_tag) prop_set = prop[:properties] if (prop[:property_tag] === property_tag) next if prop_set.nil? prop_set.each do |p| return p[:value].gsub(/\\/, '/') if p[:key] === property end end nil end |
#get_project_property(project_name, property) ⇒ Object
70 71 72 73 74 75 76 77 78 |
# File 'lib/iron-spect.rb', line 70 def get_project_property(project_name, property) @sln_file[:projects].each do |project| if project[:assembly_info][:name] =~ /("?)#{project_name}("?)/ return project[:assembly_info][property.to_sym].gsub(/\\/, '/') if (property != 'guid' && project[:assembly_info][property.to_sym]) return project[:guid].gsub(/\\/, '/') if property === 'guid' end end nil end |
#startup_executable_path(configuration, platform = 'AnyCPU') ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/iron-spect.rb', line 26 def startup_executable_path(configuration, platform='AnyCPU') #break out early if the configuration or type provided is invalid nil if not(configuration =~ /^(Debug|Release)$/) nil if not(platform =~ /^(AnyCPU|x86|x64|Itanium)$/) @csproj_file_manager = Parsers::ProjectFileParser.new(startup_local_path) startup_csproj = @csproj_file_manager.parse startup_csproj['PropertyGroup'].each do |property| if property.include?('Condition') if property['Condition'] === "'$(Configuration)|$(Platform)' == '#{configuration}|#{platform}'" @out_path = property['OutputPath'][0].gsub(/\\/, '/').strip end end if property.include?('AssemblyName') @assembly_name = property['AssemblyName'][0].strip end if property.include?('OutputType') @out_type = property['OutputType'][0].strip.downcase end next end nil if (@out_path.nil? || @assembly_name.nil? || @out_type.nil?) "#{@repo_dir}/#{strip_csproj}/#{@out_path}#{@assembly_name}.#{@out_type}" end |
#startup_project ⇒ Object
21 22 23 |
# File 'lib/iron-spect.rb', line 21 def startup_project @startup_csproj_file end |