dev_tasks 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a5d529ff3324ec50ec4b86f69bc2e14ba427a5e0
4
- data.tar.gz: b64eb10272c9745518e760233a320916ecb19255
3
+ metadata.gz: c640b3e2fcd16dfa1bf001cbd0797ccb6eed0e1a
4
+ data.tar.gz: 2b58b92b749ed3f6ee40d06bac66bbb8751ef509
5
5
  SHA512:
6
- metadata.gz: 90be83b00cb9fe381d21e7f628fdccb49c890482f731c0229943846c5bbe598954f8b9153ffc5090774ce0e91347ea10bf39d057afe937402809df3b42ef25c3
7
- data.tar.gz: e80f8c389e1fcaa316b02b38eb54dabbec250b939e2ce9353245c66acbdac4072b0881022f7b318c4025f75dccd3990d143b074c052de8531bc0e964cfff2a3c
6
+ metadata.gz: 9593beee644cd3dce9bd188d35ab206d0cc0a46b49e085e5376f4db977046a4fdc699329dfc797bd64bec12327c32b24e6f4c4eb24cd67bc392faaf88df558fe
7
+ data.tar.gz: f07a7a19fafa7de7fe73235c58892983495f94385a7e11609e90bce8ce7bfa58c2cbf79bee74540683b3b6ff03f6fcbe38038a8a1f2f816e71249e250bcb24de
data/lib/add.rb CHANGED
@@ -1,10 +1,9 @@
1
1
  class Add < Array
2
2
 
3
- def self.discover_commands commands
3
+ def initialize
4
4
  if(Dir.exists?(".git"))
5
5
  if(`git status`.include?('untracked files present'))
6
- commands["add"] = Add.new if(!commands.has_key?("add"))
7
- commands["add"].add 'git add -A -v'
6
+ self.add 'git add -A -v'
8
7
  end
9
8
  end
10
9
  end
data/lib/build.rb CHANGED
@@ -1,16 +1,17 @@
1
+ require_relative './color.rb'
2
+ require 'awesome_print'
3
+
1
4
  class Build < Array
2
5
 
3
- def self.discover_commands commands
6
+ def initialize
4
7
  # Gem builds, `gem build dev_tasks.spec`
5
8
  Dir.glob('*.spec') {|f|
6
- commands["build"] = Build.new if(!commands.has_key?("build"))
7
- commands["build"].add "gem build #{f}"
9
+ self.add "gem build #{f}"
8
10
  }
9
11
  # .sln builds, `"C:\Program Files (x86)\MSBuild\12.0\bin\msbuild.exe" "MySolution.sln"
10
12
  Dir.glob('*.sln'){|f|
11
- if File.exist? msbuild
12
- commands["build"] = Build.new if(!commands.has_key?("build"))
13
- commands["build"].add "\"#{self.msbuild}\" \"#{f}\" /nologo /p:Configuration=Release"
13
+ if File.exist? Build.msbuild
14
+ self.add "\"#{Build.msbuild}\" \"#{f}\" /nologo /p:Configuration=Release"
14
15
  end
15
16
  }
16
17
  end
data/lib/color.rb ADDED
@@ -0,0 +1,5 @@
1
+ require 'term/ansicolor'
2
+
3
+ class Color
4
+ extend Term::ANSIColor
5
+ end
data/lib/commands.rb CHANGED
@@ -4,11 +4,13 @@ require_relative './add.rb'
4
4
  require_relative './commit.rb'
5
5
 
6
6
  class Commands < Hash
7
+ attr_accessor :build
8
+
7
9
  def initialize
8
- Build.discover_commands self
9
- Test.discover_commands self
10
- Add.discover_commands self
11
- Commit.discover_commands self
10
+ self["build"] = Build.new
11
+ self["test"] = Test.new
12
+ self["add"] = Add.new
13
+ self["commit"] = Commit.new
12
14
  end
13
15
 
14
16
  def execute_command command
@@ -21,4 +23,16 @@ class Commands < Hash
21
23
  " has exit code " + $?.to_s
22
24
  end
23
25
  end
26
+
27
+ def show
28
+ self.each do |key,array|
29
+ if(array.length > 0)
30
+ puts key
31
+ array.each {|v|
32
+ puts " " + Color.green + v + Color.clear + " "
33
+ }
34
+ end
35
+ end
36
+ puts " "
37
+ end
24
38
  end
data/lib/commit.rb CHANGED
@@ -1,10 +1,9 @@
1
1
  class Commit < Array
2
2
 
3
- def self.discover_commands commands
3
+ def initialize
4
4
  if(Dir.exists?(".git"))
5
5
  if(!`git status`.include?('nothing to commit') || `git status`.include?('untracked files present'))
6
- commands["commit"] = Commit.new if(!commands.has_key?("commit"))
7
- commands["commit"].add 'git commit -a -v -m "commit all"'
6
+ self.add 'git commit -a -v -m "commit all"'
8
7
  end
9
8
  end
10
9
  end
data/lib/console.rb CHANGED
@@ -1,8 +1,4 @@
1
- require 'term/ansicolor'
2
-
3
- class Color
4
- extend Term::ANSIColor
5
- end
1
+ require_relative './color.rb'
6
2
 
7
3
  class Console
8
4
 
data/lib/dev_tasks.rb CHANGED
@@ -1,11 +1,14 @@
1
1
  require 'semver'
2
2
  require 'rake'
3
3
  require 'awesome_print'
4
+ require 'rake/clean'
4
5
  include Rake::DSL
5
6
 
6
7
  require_relative './commands.rb'
7
8
  require_relative './console.rb'
8
9
 
10
+ CLEAN.include("*.gem")
11
+
9
12
  class DevTasks
10
13
 
11
14
  attr_accessor :version, :commands
@@ -45,12 +48,12 @@ class DevTasks
45
48
 
46
49
  def update_tasks
47
50
  dev_task_defaults=Array.new
48
- ["build","test","add","commit","push"].each{|task|
49
- if @commands.has_key? task
50
- define_task(task)
51
- dev_task_defaults << task
51
+ @commands.each do |key,array|
52
+ if(array.length > 0)
53
+ define_task key
54
+ dev_task_defaults << key
52
55
  end
53
- }
56
+ end
54
57
 
55
58
  if(!Rake::Task.task_defined?('dev_tasks_default'))
56
59
  tasklist=""
@@ -70,5 +73,6 @@ DEV_TASKS=DevTasks.new
70
73
  desc 'displays dev_task commands'
71
74
  task :show_commands do
72
75
  puts "DEV_TASKS.commands"
73
- ap DEV_TASKS.commands
76
+ puts " "
77
+ puts DEV_TASKS.commands.show
74
78
  end
data/lib/test.rb CHANGED
@@ -1,15 +1,33 @@
1
1
  class Test < Array
2
2
 
3
- def self.discover_commands commands
3
+ def initialize
4
4
  # rspec tests, 'rspec --pattern="**/*.spec"'
5
5
  if(Dir.glob("**/*spec.rb").length > 0)
6
-
7
- commands["test"] = Test.new if(!commands.has_key?("test"))
8
- commands["test"].add 'rspec --pattern="**/*.spec"'
6
+ self.add 'rspec --pattern="**/*.spec"'
7
+ end
8
+ # nunit tests, 'nunit-console.exe "C::\\Projects\\MyProjects\\bin\\Release\\MyLib.Test.dll"'
9
+ if File.exist? Test.nunit_console
10
+ Dir.glob("*.csproj").each{|p|
11
+ text = File.read(p)
12
+ if(text.include?("nunit.framework.dll"))
13
+ # extract AssemblyName of form: <AssemblyName>MyLibrary.Test</AssemblyName>
14
+ assemblyName=text[/<AssemblyName>([\w\.]+)</,1]
15
+ outputPath=text[/Release[.\w\W]+<OutputPath>([\w\.\\]+)</,1]
16
+ if(!assemblyName.nil? && !outputPath.nil?)
17
+ nunit_dll = "#{Rake.application.original_dir}\\#{outputPath}\\#{assemblyName}.dll".gsub("\\\\","\\").gsub('/','\\')
18
+ puts "nunit_dll: " + nunit_dll
19
+ self.add "\"#{Test.nunit_console}\" \"#{nunit_dll}\""
20
+ end
21
+ end
22
+ }
9
23
  end
10
24
  end
11
25
 
12
26
  def add command
13
27
  self << command if(!include?(command))
14
28
  end
29
+
30
+ def self.nunit_console
31
+ "C:\\Program Files (x86)\\NUnit 2.6.3\\bin\\nunit-console.exe"
32
+ end
15
33
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dev_tasks
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lou Parslow
@@ -88,6 +88,7 @@ extra_rdoc_files: []
88
88
  files:
89
89
  - lib/add.rb
90
90
  - lib/build.rb
91
+ - lib/color.rb
91
92
  - lib/commands.rb
92
93
  - lib/commit.rb
93
94
  - lib/console.rb