dev 2.0.268 → 2.0.269

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,15 +1,14 @@
1
- puts __FILE__ if defined?(DEBUG)
2
-
3
- require 'rake'
4
-
5
1
  class Tasks
6
- @@quiet=false
2
+ attr_accessor :env
3
+ @@default=nil
7
4
 
8
- def self.quiet
9
- @@quiet
10
- end
5
+ def initialize env=nil
6
+ @@default=self
7
+ @env=env
8
+ @env=Environment.new if @env.nil?
9
+ end
11
10
 
12
- def self.execute value
11
+ def execute value
13
12
  if(value.respond_to?(:execute))
14
13
  value.update if value.respond_to?(:update)
15
14
  value.execute
@@ -24,14 +23,23 @@ class Tasks
24
23
  end
25
24
  end
26
25
 
27
- def self.execute_task task
26
+ def execute_task task
28
27
  if(defined?(COMMANDS))
29
28
  if(COMMANDS.has_key?(task))
30
- puts "[:#{task}]" if(!Tasks.quiet)
31
- Tasks.execute(COMMANDS[task])
29
+ puts ":#{task}" if !@env.colorize?
30
+ if @env.colorize?
31
+ require 'ansi/code'
32
+ puts ANSI.white + ANSI.bold + ":#{task}" + ANSI.reset if @env.colorize?
33
+ end
34
+ execute(COMMANDS[task])
32
35
  end
33
36
  end
34
37
  end
38
+
39
+ def self.execute_task task
40
+ @@default=Tasks.new if @@default.nil?
41
+ @@default.execute_task task
42
+ end
35
43
  end
36
44
 
37
45
  ['add','analyze','build','clobber','commit',
@@ -6,7 +6,7 @@ task :add do Tasks.execute_task :add;end
6
6
  class Add < Array
7
7
  def update
8
8
  if(File.exists?('.git') && File.exists?('.gitignore'))
9
- add 'git add --all'
9
+ add_quiet 'git add --all'
10
10
  else
11
11
  if(defined?(SOURCE))
12
12
  if(File.exists?('.svn'))
@@ -21,11 +21,11 @@ class Add < Array
21
21
  end
22
22
  if(status.include?('?') || status.include?('was not found') || error.include?('was not found'))
23
23
  if(f.include?(' '))
24
- puts "svn add \"#{f}\" --parents"
25
- add "svn add \"#{f}\" --parents"
24
+ #puts "svn add \"#{f}\" --parents"
25
+ add_quiet add "svn add \"#{f}\" --parents"
26
26
  else
27
- puts "svn add #{f} --parents"
28
- add "svn add #{f} --parents"
27
+ #puts "svn add #{f} --parents"
28
+ add_quiet "svn add #{f} --parents"
29
29
  end
30
30
  end
31
31
  end
@@ -34,10 +34,10 @@ class Add < Array
34
34
  if(File.exists?('.git'))
35
35
  SOURCE.each{|f|
36
36
  if(File.exists?(f) && File.file?(f))
37
- status=`git status #{f} --short`
37
+ status=Command.output("git status #{f} --short")
38
38
  if status.include?('??') || status.include?(' M ')
39
- puts "git add #{f} -v"
40
- add "git add #{f} -v"
39
+ #puts "git add #{f} -v"
40
+ add_quiet "git add #{f} -v"
41
41
  end
42
42
  end
43
43
  }
@@ -7,7 +7,7 @@ class Analyze < Array
7
7
  def update
8
8
  if(`gem list countloc`.include?('countloc ('))
9
9
  FileUtils.mkdir('doc') if(!File.exists?('doc'))
10
- add 'countloc -r * --html doc/countloc.html'
10
+ add_quiet 'countloc -r * --html doc/countloc.html'
11
11
  end
12
12
  end
13
13
  end
@@ -1,7 +1,10 @@
1
1
  puts __FILE__ if defined?(DEBUG)
2
2
 
3
+ require_relative('../base/environment.rb')
4
+
3
5
  desc 'performs build commands'
4
6
  task :build do Tasks.execute_task :build;end
7
+ #task :build do Tasks.execute_task :build;end
5
8
 
6
9
  SLN_FILES=FileList.new('*.sln','*/*.sln','*/*/*.sln')
7
10
  NUGET_FILES=FileList.new('**/*.nuspec')
@@ -10,51 +13,64 @@ WXS_FILES=FileList.new('**/*.wxs')
10
13
  class Build < Array
11
14
  def update
12
15
 
13
- changed = true
14
- if(changed)
16
+ #changed = true
17
+ #if(changed)
18
+ puts "Build scanning for gemspec files" if Environment.default.debug?
15
19
  Dir.glob('*.gemspec'){|gemspec|
16
- add "gem build #{gemspec}" if !File.exist?(Gemspec.gemfile gemspec)
20
+ add_quiet("gem build #{gemspec}") if !File.exist?(Gemspec.gemfile gemspec)
17
21
  }
18
22
 
23
+ puts "Build scanning for sln files" if Environment.default.debug?
19
24
  SLN_FILES.each{|sln_file|
20
-
25
+ puts " #{sln_file}" if Environment.default.debug?
21
26
  build_commands = MSBuild.get_build_commands sln_file
22
27
  if(!build_commands.nil?)
23
28
  build_commands.each{|c|
24
- self.add c
29
+ puts " build command #{c} discovered." if Environment.default.debug?
30
+ #self.add c
31
+ add_quiet(c)
25
32
  }
33
+ else
34
+ puts " no build command discovered." if Environment.default.debug?
26
35
  end
27
36
  }
28
37
 
38
+ puts "Build scanning for nuget files" if Environment.default.debug?
29
39
  NUGET_FILES.each{|nuget_file|
30
40
  build_commands = Nuget.get_build_commands nuget_file
31
41
  if(!build_commands.nil?)
32
42
  build_commands.each{|c|
33
- self.add c
43
+ add_quiet(c)
44
+ #self.add c
34
45
  }
35
46
  end
36
47
  }
37
48
 
49
+ puts "Build scanning for wxs <Product> files" if Environment.default.debug?
38
50
  WXS_FILES.each{|wxs_file|
39
51
  if(IO.read(wxs_file).include?('<Product'))
40
52
  build_commands = Wix.get_build_commands wxs_file
41
53
  if(!build_commands.nil?)
42
54
  build_commands.each{|c|
43
- self.add c
55
+ #self.add c
56
+ add_quiet(c)
44
57
  }
45
58
  end
46
59
  end
47
60
  }
61
+
62
+ puts "Build scanning for wxs <Bundle> files" if Environment.default.debug?
48
63
  WXS_FILES.each{|wxs_file|
49
64
  if(IO.read(wxs_file).include?('<Bundle'))
50
65
  build_commands = Wix.get_build_commands wxs_file
51
66
  if(!build_commands.nil?)
52
67
  build_commands.each{|c|
53
- self.add c
68
+ #self.add c
69
+ add_quiet(c)
54
70
  }
55
71
  end
56
72
  end
57
73
  }
58
- end
74
+ #end
59
75
  end
60
76
  end
@@ -4,7 +4,7 @@ desc 'commits source files to git or subversion'
4
4
  if(File.exists?('git'))
5
5
  task :commit=>[:add] do Tasks.execute_task :commit; end
6
6
  else
7
- task :commit do Tasks.execute_task :commit;end
7
+ task :commit=>[:add] do Tasks.execute_task :commit;end
8
8
  end
9
9
 
10
10
  class Commit < Array
@@ -20,11 +20,11 @@ class Commit < Array
20
20
  Commit.reset_commit_message
21
21
  raise "commit.message required to perform commit"
22
22
  else
23
- add "git commit -m'all'"
23
+ add_quiet "git commit -m'all'"
24
24
  end
25
25
  else
26
- add "git commit -a -v --file commit.message"
27
- add "<%Commit.reset_commit_message%>"
26
+ add_quiet "git commit -a -v --file commit.message"
27
+ add_quiet "<%Commit.reset_commit_message%>"
28
28
  end
29
29
  end
30
30
  end
@@ -34,11 +34,11 @@ class Commit < Array
34
34
  Commit.reset_commit_message
35
35
  raise "commit.message required to perform commit"
36
36
  else
37
- add 'svn commit -m"commit all"'
37
+ add_quiet 'svn commit -m"commit all"'
38
38
  end
39
39
  else
40
- add 'svn commit --file commit.message'
41
- add "<%Commit.reset_commit_message%>"
40
+ add_quiet 'svn commit --file commit.message'
41
+ add_quiet "<%Commit.reset_commit_message%>"
42
42
  end
43
43
  end
44
44
  end
@@ -2,6 +2,7 @@ puts __FILE__ if defined?(DEBUG)
2
2
 
3
3
  require_relative('info.rb')
4
4
  require_relative('../base/array.rb')
5
+ require_relative('../base/environment.rb')
5
6
  require_relative('../base/projects.rb')
6
7
  require_relative('../base/timer.rb')
7
8
 
@@ -22,6 +23,11 @@ if(!defined?(NO_DEFAULT_TASK))
22
23
  end
23
24
  end
24
25
 
25
- puts "[:default] completed in #{TIMER.elapsed_str}"
26
+ puts "[:default] completed in #{TIMER.elapsed_str}" if !Environment.default.colorize?
27
+ if Environment.default.colorize?
28
+ require 'ansi/code'
29
+ puts ANSI.white + ANSI.bold + ":default" + " completed in " + ANSI.yellow + "#{TIMER.elapsed_str}" + ANSI.reset
30
+ end
31
+
26
32
  end # :default
27
33
  end
@@ -6,7 +6,7 @@ task :doc do Tasks.execute_task :doc;end
6
6
  class Doc < Array
7
7
  def update
8
8
  if(Command.exit_code('yard --version'))
9
- add 'yard doc - LICENSE' if File.exists?('README.md') && File.exists?('LICENSE')
9
+ add_quiet 'yard doc - LICENSE' if File.exists?('README.md') && File.exists?('LICENSE')
10
10
  end
11
11
  end
12
12
  end
@@ -1,39 +1,35 @@
1
1
  puts __FILE__ if defined?(DEBUG)
2
-
2
+ require_relative '../base/array.rb'
3
3
  desc 'performs publish commands'
4
4
  task :publish do Tasks.execute_task :publish; end
5
5
 
6
6
  class Publish < Array
7
- def update
8
7
 
9
- FileUtils.mkdir_p("#{Environment.dev_root}/publish") if !File.exists?("#{Environment.dev_root}/publish")
8
+ def update
10
9
  if(File.exists?('.git') && defined?(VERSION))
11
- add "<%Git.tag('#{Rake.application.original_dir}','#{VERSION}')%>"
10
+ add_quiet "<%Git.tag('#{Rake.application.original_dir}','#{VERSION}')%>"
12
11
  end
13
12
 
14
13
  if(Internet.available?)
15
14
  if(File.exists?('.git'))
16
15
  if(`git branch`.include?('* master'))
17
16
  Dir.glob('*.gemspec').each{|gemspec_file|
18
- add "gem push #{Gemspec.gemfile(gemspec_file)}" if !Gemspec.published? gemspec_file
17
+ add_passive "gem push #{Gemspec.gemfile(gemspec_file)}" if !Gemspec.published? gemspec_file
19
18
  }
20
19
  end
21
20
  end
22
21
  if(File.exists?('.svn'))
23
22
  if(`svn info`.include?('/trunk'))
24
23
  Dir.glob('*.gemspec').each{|gemspec_file|
25
- add "gem push #{Gemspec.gemfile(gemspec_file)}" if !Gemspec.published? gemspec_file
24
+ add_quiet "gem push #{Gemspec.gemfile(gemspec_file)}" if !Gemspec.published? gemspec_file
26
25
  }
27
26
  end
28
27
  end
29
28
  end
30
29
 
31
- puts 'publish glob, checking...' if defined? DEBUG
32
30
  Dir.glob("#{Rake.application.original_dir}/**/*.{nupkg,msi,gem}").each{|publish_file|
33
- puts "checking #{publish_file}" if defined? DEBUG
34
- dest="#{Environment.dev_root}/publish/#{File.basename(publish_file)}"
35
- FileUtils.mkdir_p("#{Environment.dev_root}/publish") if !File.exists?("#{Environment.dev_root}/publish")
36
- add "<%FileUtils.cp('#{publish_file}','#{dest}')%>" if(!File.exists?(dest))
31
+ dest="#{Environment.default.publish_dir}/#{File.basename(publish_file)}"
32
+ add_quiet "<%FileUtils.cp('#{publish_file}','#{dest}')%>" if(!File.exists?(dest))
37
33
  }
38
34
  end
39
35
  end
@@ -1,6 +1,3 @@
1
- puts __FILE__ if defined?(DEBUG)
2
-
3
-
4
1
  desc 'performs a git pull'
5
2
  task :pull do Tasks.execute_task :pull; end
6
3
 
@@ -8,7 +5,7 @@ class Pull < Array
8
5
  def update
9
6
  if(Internet.available?)
10
7
  if(File.exists?('.git') && `git config --list`.include?('user.name='))
11
- self << 'git pull' if Git.branch != 'develop'
8
+ add_quiet('git pull') if Git.branch == 'master'
12
9
  end
13
10
  end
14
11
  end
@@ -6,8 +6,8 @@ task :push do Tasks.execute_task :push;end
6
6
  class Push < Array
7
7
  def update
8
8
  if(File.exists?('.git') && `git config --list`.include?('user.name=') && `git branch`.include?('* master'))
9
- self << 'git push'
10
- self << 'git push --tags'
9
+ add_quiet 'git push'
10
+ add_quiet 'git push --tags'
11
11
  end
12
12
  end
13
13
  end
@@ -1,5 +1,3 @@
1
- puts __FILE__ if defined?(DEBUG)
2
-
3
1
  desc 'performs setup commands'
4
2
  task :setup do Tasks.execute_task :setup;end
5
3
 
@@ -9,32 +7,55 @@ task :setup do Tasks.execute_task :setup;end
9
7
  # SVN_EXPORT={ 'System.Data.SQLite/1.0.93.0' => 'https://third-party.googlecode.com/svn/trunk/System.Data.SQLite/1.0.93.0' }
10
8
  #
11
9
  class Setup < Array
10
+
11
+ def initialize value=nil
12
+ env=value if value.kind_of? Environment
13
+ end
14
+
12
15
  def update
13
- add 'bundle install' if(File.exists?('Gemfile'))
16
+ env=Environment.new if env.nil?
14
17
 
15
- ['bin','data','log','make','publish','test'].each{|dir|
16
- add "<%FileUtils.mkdir('#{Environment.dev_root}/#{dir}')%>" if !File.exists? "#{Environment.dev_root}/#{dir}"
17
- }
18
+ add_quiet 'bundle install' if File.exists? 'Gemfile'
19
+ #add Command.new( { :input => 'bundle install', :quiet => true}) if(File.exists?('Gemfile'))
20
+
21
+ #['bin','data','log','make','publish','test'].each{|dir|
22
+ # add "<%FileUtils.mkdir('#{Environment.default.devroot}/#{dir}')%>" if !File.exists? "#{Environment.dev_root}/#{dir}"
23
+ #}
18
24
 
19
25
  Dir.glob('*.gemspec').each{|gemspec_file|
20
- add "<%Gemspec.update('#{gemspec_file}')%>"
26
+ add_quiet "<%Gemspec.update('#{gemspec_file}')%>"
27
+ #add Command.new( { :input => "<%Gemspec.update('#{gemspec_file}')%>", :quiet => true} )
21
28
  }
22
29
 
23
30
  if(Dir.glob('**/packages.config').length > 0)
24
31
  Dir.glob('*.sln').each{|sln_file|
25
- add "nuget restore #{sln_file}"
32
+ add_quiet "nuget restore #{sln_file}"
26
33
  }
27
34
  end
28
35
 
36
+ puts 'Setup checking SVN_EXPORTS...' if env.debug?
29
37
  if(defined?(SVN_EXPORTS))
30
38
  SVN_EXPORTS.each{|k,v|
31
- if(!File.exists?("#{Command.dev_root}/dep/#{k}"))
32
- FileUtils.mkdir_p(File.dirname("#{Command.dev_root}/dep/#{k}")) if !File.exists?("#{Command.dev_root}/dep/#{k}")
33
- dest="#{Command.dev_root}/dep/#{k}"
34
- add "svn export #{v} #{Command.dev_root}/dep/#{k}" if !dest.include?("@")
35
- add "svn export #{v} #{Command.dev_root}/dep/#{k}@" if dest.include?("@")
39
+ dest="#{Command.dev_root}/dep/#{k}"
40
+ if(!File.exists?(dest))
41
+ puts "#{Command.dev_root}/dep/#{k} does not exists" if env.debug?
42
+ FileUtils.mkdir_p(File.dirname(dest)) if !File.exists?(File.dirname(dest))
43
+ if(!dest.include?("@"))
44
+ puts "adding svn export #{v} #{dest}" if env.debug?
45
+ add_quiet "svn export #{v} #{dest}"
46
+ end
47
+ if(dest.include?("@"))
48
+ puts "adding svn export #{v} #{dest}@" if env.debug?
49
+ add_quiet "svn export #{v} #{dest}@"
50
+ end
51
+ #add "svn export #{v} #{dest}" if !dest.include?("@")
52
+ #add "svn export #{v} #{dest}@" if dest.include?("@")
53
+ else
54
+ puts "#{Command.dev_root}/dep/#{k} exists." if env.debug?
36
55
  end
37
56
  }
57
+ else
58
+ puts 'SVN_EXPORTS is not defined' if env.debug?
38
59
  end
39
60
 
40
61
  if(defined?(GIT_EXPORTS))
@@ -47,7 +68,7 @@ class Setup < Array
47
68
  puts `git reset --hard #{v.split('@')[1]}`
48
69
  end
49
70
  else
50
- add "git clone #{v} #{directory}"
71
+ add_quiet "git clone #{v} #{directory}"
51
72
  end
52
73
  end
53
74
  }
@@ -75,7 +96,7 @@ class Setup < Array
75
96
  end
76
97
  }
77
98
  Dir.glob('**/*.wxs').each{|wxs|
78
- current_version=IO.read(wxs).scan(/Version=\"([\d.]+)\"/)[0]
99
+ current_version=IO.read(wxs).scan(/Version=\"([\d.]+)\"/)[0][0]
79
100
  puts "#{wxs} current version=#{current_version}" if defined?(DEBUG)
80
101
  if(current_version.include?('Version='))
81
102
  target_version="Version=\"#{VERSION}\")="
@@ -10,10 +10,9 @@ puts __FILE__ if defined?(DEBUG)
10
10
  desc 'performs test commands'
11
11
  task :test => [:build] do Tasks.execute_task :test;end
12
12
 
13
-
14
13
  class Test < Array
15
14
  def update
16
- add 'rspec --format documentation' if File.exists?('spec')
15
+ add_quiet 'rspec --format documentation' if File.exists?('spec')
17
16
 
18
17
  if(defined?(NUNIT))
19
18
  NUNIT.each{|nunit_dll|
@@ -23,18 +22,18 @@ class Test < Array
23
22
  dll_arg="\"#{nunit_dll}\"" if(nunit_dll.include?(' '))
24
23
  xml_arg="/xml:#{nunit_dll}.TestResults.xml"
25
24
  xml_arg="/xml:\"#{nunit_dll}.TestResults.xml\"" if(nunit_dll.include?(' '))
26
- add "#{nunit_arg} #{dll_arg} #{xml_arg}"
25
+ add_quiet "#{nunit_arg} #{dll_arg} #{xml_arg}"
27
26
  }
28
27
  end
29
28
 
30
29
  if(defined?(NUNIT_X86))
31
30
  NUNIT_X86.each{|nunit_dll|
32
- add "\"#{Test.nunit_console_x86}\" \"#{Rake.application.original_dir}\\#{nunit_dll}\" /xml:\"#{nunit_dll}.TestResults.xml\""
31
+ add_quiet "\"#{Test.nunit_console_x86}\" \"#{Rake.application.original_dir}\\#{nunit_dll}\" /xml:\"#{nunit_dll}.TestResults.xml\""
33
32
  }
34
33
  end
35
34
 
36
35
  if(defined?(TESTS))
37
- TEST.each{|t| add t}
36
+ TEST.each{|t| add_quiet t}
38
37
  end
39
38
  end
40
39