Class: Build

Inherits:
Array show all
Defined in:
lib/tasks/build.rb

Instance Attribute Summary

Attributes inherited from Array

#env

Instance Method Summary collapse

Methods inherited from Array

#add, #add_passive, #add_quiet, #execute, #has_command?, #initialize, #to_html

Constructor Details

This class inherits a constructor from Array

Instance Method Details

#updateObject



14
15
16
17
18
19
20
21
22
# File 'lib/tasks/build.rb', line 14

def update
   	update_gemspec
   	update_dotnet
	update_sln if Environment.windows?
	update_smartassembly if Environment.windows?
   	update_nuget if Environment.windows?
   	update_wix if Environment.windows?
       update_xcode if Environment.mac?
end

#update_dotnetObject



31
32
33
34
35
36
# File 'lib/tasks/build.rb', line 31

def update_dotnet
	puts "Build scanning for project.json" if Environment.default.debug?
	if(File.exists?('project.json'))
			add_quiet "dotnet build"
		end
end

#update_gemspecObject



24
25
26
27
28
29
# File 'lib/tasks/build.rb', line 24

def update_gemspec
	puts "Build scanning for gemspec files" if Environment.default.debug?
		Dir.glob('*.gemspec'){|gemspec|
 	add_quiet("gem build #{gemspec}") if !File.exist?(Gemspec.gemfile gemspec)
 }
end

#update_nugetObject



67
68
69
70
71
72
73
74
75
76
77
# File 'lib/tasks/build.rb', line 67

def update_nuget
	puts "Build scanning for nuget files" if Environment.default.debug?
   	NUGET_FILES.each{|nuget_file|
    	build_commands = Nuget.get_build_commands nuget_file
    	if(!build_commands.nil?)
    		build_commands.each{|c|
    			add_quiet(c)
    		}
    	end
    }
end

#update_slnObject



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/tasks/build.rb', line 38

def update_sln
	puts "Build scanning for sln files" if Environment.default.debug?
	SLN_FILES.each{|sln_file|
		puts "  #{sln_file}" if Environment.default.debug?
		build_commands = MSBuild.get_build_commands sln_file
		if(!build_commands.nil?)
			build_commands.each{|c|
				puts "  build command #{c} discovered." if Environment.default.debug?
				add_quiet(c)
			}
		else
			puts "  no build command discovered." if Environment.default.debug?
		end
	}
end

#update_smartassemblyObject



54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/tasks/build.rb', line 54

def update_smartassembly
	puts "Build scanning for sa (smart assembly) files" if Environment.default.debug?
	sa = 'C:/Program Files/Red Gate/SmartAssembly 6/SmartAssembly.com'
	SMARTASSEMBLY_FILES.each{|saproj_file|
		puts "  #{saproj_file}" if Environment.default.debug?
		if(!File.exists?(sa))
			puts "warning: #{sa} does not exist, skipping build command for #{saproj_file}"
		else
			add_quiet("\"#{sa}\" /build #{saproj_file}")
		end
	}
end

#update_wixObject



79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# File 'lib/tasks/build.rb', line 79

def update_wix
	puts "Build scanning for wxs <Product> files" if Environment.default.debug?
	WXS_FILES.each{|wxs_file|
		if(IO.read(wxs_file).include?('<Product'))
		  build_commands = Wix.get_build_commands wxs_file
		  if(!build_commands.nil?)
			build_commands.each{|c|
				add_quiet(c)
			}
		  end
		end
	}

	puts "Build scanning for wxs <Bundle> files" if Environment.default.debug?
	WXS_FILES.each{|wxs_file|
		if(IO.read(wxs_file).include?('<Bundle'))
		  build_commands = Wix.get_build_commands wxs_file
		  if(!build_commands.nil?)
			build_commands.each{|c|
				add_quiet(c)
			}
		  end
		end
	}
end

#update_xcodeObject



104
105
106
107
108
109
110
111
112
113
114
115
# File 'lib/tasks/build.rb', line 104

def update_xcode
	puts "Build scanning for xcodeproj folders" if Environment.default.debug?
    Dir.glob('**/*.xcodeproj').each{|dir|
        puts dir if Environment.default.debug?
        build_commands = XCodeBuild.get_build_commands dir
        if(!build_commands.nil?)
        	build_commands.each{|c|
    			build_commands << c
    		}
    	end
     }
end