kender 0.1.2 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +8 -8
- data/lib/kender/command.rb +11 -17
- data/lib/kender/commands/brakeman.rb +4 -6
- data/lib/kender/commands/bundle_audit.rb +14 -0
- data/lib/kender/commands/cucumber.rb +8 -9
- data/lib/kender/commands/jasmine.rb +23 -0
- data/lib/kender/commands/rspec.rb +8 -9
- data/lib/kender/commands/shamus.rb +4 -9
- data/lib/kender/commands/test_unit.rb +17 -0
- data/lib/kender/tasks/ci.rake +31 -4
- data/lib/kender/version.rb +1 -1
- metadata +19 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NDQwMWQ5ZGYwMmJjOTQ4OGUwYTA0MDE2YWNjYjY4YjJmOWUyYzUzOA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MzQzODJkYzUwY2NlOWNkMjlmZjAyZjljNGRmYTNmMjlkZTA3ZmM1OQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ODgwNWZkY2M3OTIzODZiMjc2ZmRjNGVmZTNjNTRkZTgxZWQ3NDZhYWY1MmY3
|
10
|
+
ZGQxZTQ2ZTQwZTNlNGMxZjc4MGE0MTgyMGE5Y2YyYWM3MGI5Njc2ZWYyZjZi
|
11
|
+
YzkyMzlmZGUzMjNmODY2YmRhMjhiMmVlYzkzNTg2M2Y1OGNmNDU=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
YWMzYzI2NWY3MGRmZTI1MGMzMmRkNDBiNmRjNThlOTFmMDk5MWMzN2EzODcy
|
14
|
+
ODE5OGQ2OTFhMzVjMWMwNzJmNzIzZTFlOWI3YmQ3YmQ0ODczMzNjMmQ0YWYx
|
15
|
+
ZjE3NTJjNjgwYjU2N2Q2ZDNmZjc4MDM3ODhjMjcyMTk4YzRhNmU=
|
data/lib/kender/command.rb
CHANGED
@@ -2,10 +2,6 @@ module Kender
|
|
2
2
|
# This class abstracts the shell commands we use
|
3
3
|
class Command
|
4
4
|
|
5
|
-
def initialize(command)
|
6
|
-
@command = command
|
7
|
-
end
|
8
|
-
|
9
5
|
def name
|
10
6
|
self.class.name.split("::").last.downcase.to_sym
|
11
7
|
end
|
@@ -14,48 +10,46 @@ module Kender
|
|
14
10
|
"ci:#{name}"
|
15
11
|
end
|
16
12
|
|
17
|
-
# by default all the commands are available
|
18
13
|
def available?
|
19
|
-
|
14
|
+
raise RuntimeError, "Command failed: #{name}, availability status undefined."
|
20
15
|
end
|
21
16
|
|
22
17
|
def execute
|
23
|
-
|
24
|
-
raise RuntimeError, "Command failed: #{@command}"
|
25
|
-
end
|
18
|
+
raise RuntimeError, "Command failed: #{command}" unless run.success?
|
26
19
|
end
|
27
20
|
|
28
|
-
|
21
|
+
#TODO: system reload all the gems again, avoid this.
|
22
|
+
def run
|
29
23
|
system(command)
|
30
24
|
$?
|
31
25
|
end
|
32
26
|
|
33
|
-
|
34
27
|
class << self
|
35
28
|
|
36
29
|
def commands
|
37
30
|
@commands ||= []
|
38
31
|
end
|
39
32
|
|
40
|
-
#TODO: if I store objects instead of classes it seems that the @command
|
41
|
-
#become nil, WHY?!?
|
42
33
|
def inherited(klass)
|
43
|
-
commands << klass
|
34
|
+
commands << klass.new
|
44
35
|
end
|
45
36
|
|
46
37
|
def all_tasks
|
47
|
-
all.map
|
38
|
+
all.map(&:task_name)
|
48
39
|
end
|
49
40
|
|
50
41
|
def all
|
51
|
-
commands.
|
42
|
+
@all ||= commands.select(&:available?)
|
52
43
|
end
|
53
44
|
|
54
45
|
end
|
55
46
|
end
|
56
47
|
end
|
57
48
|
|
49
|
+
require_relative 'commands/jasmine'
|
58
50
|
require_relative 'commands/brakeman'
|
51
|
+
require_relative 'commands/bundle_audit'
|
59
52
|
require_relative 'commands/shamus'
|
60
|
-
require_relative 'commands/
|
53
|
+
require_relative 'commands/test_unit'
|
61
54
|
require_relative 'commands/rspec'
|
55
|
+
require_relative 'commands/cucumber'
|
@@ -1,14 +1,12 @@
|
|
1
1
|
module Kender
|
2
2
|
class Brakeman < Command
|
3
3
|
|
4
|
-
def
|
5
|
-
|
6
|
-
command = 'bundle exec brakeman --quiet --exit-on-warn'
|
7
|
-
super(command)
|
4
|
+
def available?
|
5
|
+
defined?(::Brakeman)
|
8
6
|
end
|
9
7
|
|
10
|
-
|
11
|
-
|
8
|
+
def command
|
9
|
+
'bundle exec brakeman --quiet --exit-on-warn'
|
12
10
|
end
|
13
11
|
|
14
12
|
end
|
@@ -1,17 +1,16 @@
|
|
1
1
|
module Kender
|
2
2
|
class Cucumber < Command
|
3
3
|
|
4
|
-
def
|
5
|
-
|
6
|
-
super(command)
|
4
|
+
def available?
|
5
|
+
defined?(Cucumber) and not(ENV['VALIDATE_PROJECT'])
|
7
6
|
end
|
8
7
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
8
|
+
def command
|
9
|
+
if defined?(ParallelTests)
|
10
|
+
'bundle exec rake parallel:features'
|
11
|
+
else
|
12
|
+
'bundle exec cucumber'
|
13
|
+
end
|
15
14
|
end
|
16
15
|
|
17
16
|
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module Kender
|
2
|
+
# Jasmine is a unit testing framework for javascript similar to rspec.
|
3
|
+
class Jasmine < Command
|
4
|
+
|
5
|
+
# check whether to actually run this command
|
6
|
+
def available?
|
7
|
+
# do not run if running shamus
|
8
|
+
return false if ENV['VALIDATE_PROJECT']
|
9
|
+
|
10
|
+
# verify jasmine and phantomjs are present
|
11
|
+
`phantomjs --version 2>&1 > /dev/null`
|
12
|
+
return false unless $?.success?
|
13
|
+
`bundle exec jasmine license`
|
14
|
+
$?.success?
|
15
|
+
end
|
16
|
+
|
17
|
+
def command
|
18
|
+
'bundle exec rake jasmine:phantom:ci'
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
@@ -1,17 +1,16 @@
|
|
1
1
|
module Kender
|
2
2
|
class Rspec < Command
|
3
3
|
|
4
|
-
def
|
5
|
-
|
6
|
-
super(command)
|
4
|
+
def available?
|
5
|
+
defined?(RSpec) and not(ENV['VALIDATE_PROJECT'])
|
7
6
|
end
|
8
7
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
8
|
+
def command
|
9
|
+
if defined?(ParallelTests)
|
10
|
+
'bundle exec rake parallel:spec'
|
11
|
+
else
|
12
|
+
'bundle exec rspec'
|
13
|
+
end
|
15
14
|
end
|
16
15
|
|
17
16
|
end
|
@@ -1,17 +1,12 @@
|
|
1
1
|
module Kender
|
2
2
|
class Shamus < Command
|
3
3
|
|
4
|
-
def
|
5
|
-
|
6
|
-
super(command)
|
4
|
+
def available?
|
5
|
+
defined?(Shamus) and ENV['VALIDATE_PROJECT']
|
7
6
|
end
|
8
7
|
|
9
|
-
|
10
|
-
|
11
|
-
#this is slow as bundle exec can prove to be quite slow in old rubies
|
12
|
-
return false if !ENV['VALIDATE_PROJECT']
|
13
|
-
`bundle exec shamus --help`
|
14
|
-
$?.success?
|
8
|
+
def command
|
9
|
+
'bundle exec shamus'
|
15
10
|
end
|
16
11
|
end
|
17
12
|
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Kender
|
2
|
+
class TestUnit < Command
|
3
|
+
|
4
|
+
def available?
|
5
|
+
defined?(Test::Unit) and not(ENV['VALIDATE_PROJECT'])
|
6
|
+
end
|
7
|
+
|
8
|
+
def command
|
9
|
+
if defined?(ParallelTests)
|
10
|
+
'bundle exec rake parallel:test'
|
11
|
+
else
|
12
|
+
'bundle exec rake test'
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
data/lib/kender/tasks/ci.rake
CHANGED
@@ -1,3 +1,6 @@
|
|
1
|
+
#make sure we require all the tools we need loaded in memory
|
2
|
+
Bundler.require(:default, :test)
|
3
|
+
|
1
4
|
require 'kender/configuration'
|
2
5
|
require 'kender/github'
|
3
6
|
require 'kender/command'
|
@@ -24,13 +27,13 @@ namespace :ci do
|
|
24
27
|
# Could depend on 'db:schema:load' or 'db:setup' here instead of 'db:migrate'
|
25
28
|
# if the 'db/schema.rb' file was committed to the repo (as per Rails
|
26
29
|
# recommendations).
|
27
|
-
task :config => ['ci:env', 'config:all', '
|
30
|
+
task :config => ['ci:env', 'config:all', 'ci:setup_db']
|
28
31
|
|
29
32
|
desc "Run continuous integration tests with the current configuration"
|
30
33
|
task :run => ['ci:env'] + Kender::Command.all_tasks
|
31
34
|
|
32
35
|
desc "Destroy resources created externally for the continuous integration run, e.g. drops databases"
|
33
|
-
task :clean => ['ci:env', '
|
36
|
+
task :clean => ['ci:env', 'ci:drop_db']
|
34
37
|
|
35
38
|
task :env do
|
36
39
|
if defined?(Rails)
|
@@ -44,12 +47,36 @@ namespace :ci do
|
|
44
47
|
end
|
45
48
|
end
|
46
49
|
|
50
|
+
# Automatically create rake task for each individual command.
|
47
51
|
Kender::Command.all.each do |command|
|
48
|
-
task command.name
|
52
|
+
desc "Individual task for #{command.name}, in parallel if available."
|
53
|
+
task command.name do
|
49
54
|
command.execute
|
50
55
|
end
|
51
56
|
end
|
52
|
-
|
57
|
+
|
58
|
+
desc "Generic task to setup your databases, in parallel if available."
|
59
|
+
task :setup_db do
|
60
|
+
if !defined?(ParallelTests)
|
61
|
+
Rake::Task['db:create'].invoke
|
62
|
+
Rake::Task['db:migrate'].invoke
|
63
|
+
else
|
64
|
+
#TODO: invoke on the task did not work. Why?
|
65
|
+
system('bundle exec rake parallel:create')
|
66
|
+
system('bundle exec rake parallel:prepare')
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
desc "Generic task to drop your databases, in parallel if available."
|
71
|
+
task :drop_db do
|
72
|
+
if !defined?(ParallelTests)
|
73
|
+
Rake::Task['db:drop'].invoke
|
74
|
+
else
|
75
|
+
#TODO: invoke on the task did not work. Why?
|
76
|
+
system('bundle exec rake parallel:drop')
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
53
80
|
namespace :status do
|
54
81
|
|
55
82
|
config = Kender::Configuration.new
|
data/lib/kender/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kender
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Smith
|
@@ -10,7 +10,21 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
date: 2014-06-03 00:00:00.000000000 Z
|
13
|
-
dependencies:
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: bundler
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - ! '>='
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: '0'
|
21
|
+
type: :runtime
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - ! '>='
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: '0'
|
14
28
|
description:
|
15
29
|
email:
|
16
30
|
- asmith@mdsol.com
|
@@ -22,9 +36,12 @@ files:
|
|
22
36
|
- lib/kender.rb
|
23
37
|
- lib/kender/command.rb
|
24
38
|
- lib/kender/commands/brakeman.rb
|
39
|
+
- lib/kender/commands/bundle_audit.rb
|
25
40
|
- lib/kender/commands/cucumber.rb
|
41
|
+
- lib/kender/commands/jasmine.rb
|
26
42
|
- lib/kender/commands/rspec.rb
|
27
43
|
- lib/kender/commands/shamus.rb
|
44
|
+
- lib/kender/commands/test_unit.rb
|
28
45
|
- lib/kender/configuration.rb
|
29
46
|
- lib/kender/github.rb
|
30
47
|
- lib/kender/railtie.rb
|