elliottcable-spark 0
Sign up to get free protection for your applications and to get access to all the features.
- data/.manifest +7 -0
- data/README.markdown +7 -0
- data/Rakefile.rb +92 -0
- data/lib/spark.rb +38 -0
- data/lib/spark/core_ext.rb +1 -0
- data/lib/spark/core_ext/string.rb +35 -0
- data/lib/spark/rake/speck_task.rb +19 -0
- data/spark.gemspec +46 -0
- metadata +123 -0
data/.manifest
ADDED
data/README.markdown
ADDED
data/Rakefile.rb
ADDED
@@ -0,0 +1,92 @@
|
|
1
|
+
($:.unshift File.expand_path(File.join( File.dirname(__FILE__), 'lib' ))).uniq!
|
2
|
+
require 'spark'
|
3
|
+
|
4
|
+
# =======================
|
5
|
+
# = Gem packaging tasks =
|
6
|
+
# =======================
|
7
|
+
begin
|
8
|
+
require 'echoe'
|
9
|
+
|
10
|
+
task :install => :'package:install'
|
11
|
+
task :package => :'package:package'
|
12
|
+
task :manifest => :'package:manifest'
|
13
|
+
namespace :package do
|
14
|
+
Echoe.new('spark', Spark::Version) do |g|
|
15
|
+
g.project = 'speck'
|
16
|
+
g.author = ['elliottcable']
|
17
|
+
g.email = ['Spark@elliottcable.com']
|
18
|
+
g.summary = "Rakes are for chumps. *Real* men ignite their specks with sparks!"
|
19
|
+
g.url = 'http://github.com/elliottcable/spark'
|
20
|
+
g.runtime_dependencies = ['speck']
|
21
|
+
g.development_dependencies = ['echoe >= 3.0.2', 'slack', 'yard', 'maruku']
|
22
|
+
g.manifest_name = '.manifest'
|
23
|
+
g.retain_gemspec = true
|
24
|
+
g.rakefile_name = 'Rakefile.rb'
|
25
|
+
g.ignore_pattern = /^\.git\/|^meta\/|\.gemspec/
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
rescue LoadError
|
30
|
+
desc 'You need the `echoe` gem to package Spark'
|
31
|
+
task :package
|
32
|
+
end
|
33
|
+
|
34
|
+
# ===============
|
35
|
+
# = Speck tasks =
|
36
|
+
# ===============
|
37
|
+
begin
|
38
|
+
require 'speck'
|
39
|
+
require 'slack'
|
40
|
+
require 'spark'
|
41
|
+
require 'spark/rake/speck_task'
|
42
|
+
|
43
|
+
task :default => :'speck:run'
|
44
|
+
task :speck => :'speck:run'
|
45
|
+
namespace :speck do
|
46
|
+
Spark::Rake::SpeckTask.new
|
47
|
+
end
|
48
|
+
|
49
|
+
rescue LoadError
|
50
|
+
desc 'You need the `speck`, `slack`, and `spark` gems to run specks'
|
51
|
+
task :speck
|
52
|
+
end
|
53
|
+
|
54
|
+
# =======================
|
55
|
+
# = Documentation tasks =
|
56
|
+
# =======================
|
57
|
+
begin
|
58
|
+
require 'yard'
|
59
|
+
require 'yard/rake/yardoc_task'
|
60
|
+
|
61
|
+
task :documentation => :'documentation:generate'
|
62
|
+
namespace :documentation do
|
63
|
+
YARD::Rake::YardocTask.new :generate do |t|
|
64
|
+
t.files = ['lib/**/*.rb']
|
65
|
+
t.options = ['--output-dir', File.join('meta', 'documentation'),
|
66
|
+
'--readme', 'README.markdown',
|
67
|
+
'--markup', 'markdown', '--markup-provider', 'maruku']
|
68
|
+
end
|
69
|
+
|
70
|
+
YARD::Rake::YardocTask.new :dotyardoc do |t|
|
71
|
+
t.files = ['lib/**/*.rb']
|
72
|
+
t.options = ['--no-output',
|
73
|
+
'--readme', 'README.markdown',
|
74
|
+
'--markup', 'markdown', '--markup-provider', 'maruku']
|
75
|
+
end
|
76
|
+
|
77
|
+
task :open do
|
78
|
+
system 'open ' + File.join('meta', 'documentation', 'index.html') if RUBY_PLATFORM['darwin']
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
rescue LoadError
|
83
|
+
desc 'You need the `yard` and `maruku` gems to generate documentation'
|
84
|
+
task :documentation
|
85
|
+
end
|
86
|
+
|
87
|
+
desc 'Check everything over before commiting'
|
88
|
+
task :aok => [:'documentation:generate', :'documentation:open',
|
89
|
+
:'package:manifest',
|
90
|
+
:'speck:run']
|
91
|
+
|
92
|
+
task :ci => [:'documentation:generate', :'speck:run']
|
data/lib/spark.rb
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
require 'spark/core_ext'
|
2
|
+
|
3
|
+
module Spark
|
4
|
+
Version = 0
|
5
|
+
|
6
|
+
class <<self
|
7
|
+
|
8
|
+
##
|
9
|
+
# “Plays” a `Speck` back, recursively. This consists of:
|
10
|
+
#
|
11
|
+
# - Printing data about the `Speck`
|
12
|
+
# - Executing the `Speck`
|
13
|
+
# - Executing each `Check` belonging to the `Speck`
|
14
|
+
# - Printing data about each `Check` and its result
|
15
|
+
# - Recursively repeating the above for each child `Speck`
|
16
|
+
def playback speck
|
17
|
+
speck.execute
|
18
|
+
|
19
|
+
speck.checks.each do |check|
|
20
|
+
begin
|
21
|
+
check.execute
|
22
|
+
# TODO: Provide more useful information about the return value and
|
23
|
+
# expected return value
|
24
|
+
# TODO: Colorize negated Checks with the bang as red, or something
|
25
|
+
# similar
|
26
|
+
puts check.description.ljust(72) + (" # => " + check.status.inspect).green
|
27
|
+
rescue Speck::Exception::CheckFailed
|
28
|
+
# TODO: Print a description of why the error failed, what was expected
|
29
|
+
# and what was actually received.
|
30
|
+
puts check.description.ljust(72) + (" # ! " + check.status.inspect).red
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
speck.children.each {|speck| Spark.playback speck }
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'spark/core_ext/string'
|
@@ -0,0 +1,35 @@
|
|
1
|
+
class String
|
2
|
+
|
3
|
+
##
|
4
|
+
# Provides some methods to colourize strings for output to the terminal.
|
5
|
+
module ANSI
|
6
|
+
|
7
|
+
# The available ANSI colour codes. The index in the array is the ANSI
|
8
|
+
# code.
|
9
|
+
Colours = [
|
10
|
+
:black,
|
11
|
+
:red,
|
12
|
+
:green,
|
13
|
+
:yellow,
|
14
|
+
:blue,
|
15
|
+
:magenta,
|
16
|
+
:cyan,
|
17
|
+
:white
|
18
|
+
]
|
19
|
+
|
20
|
+
Colours.each.with_index do |colour, index|
|
21
|
+
define_method colour do
|
22
|
+
self.wrap_ansi "[3#{index}m"
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
##
|
27
|
+
# Wraps this string in the given ANSI code.
|
28
|
+
def wrap_ansi code
|
29
|
+
"\033#{code}#{self}\033[0m"
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
|
34
|
+
include ANSI
|
35
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Spark
|
2
|
+
module Rake
|
3
|
+
class SpeckTask
|
4
|
+
|
5
|
+
##
|
6
|
+
# Called from a Rake execution environment, will define a new Rake task
|
7
|
+
# that executes all of your root Specks, recursively.
|
8
|
+
def initialize
|
9
|
+
desc 'Recursively runs all root Specks'
|
10
|
+
task :run do
|
11
|
+
Speck::specks.select {|s| s.parent == nil }
|
12
|
+
.each {|speck| Spark.playback speck }
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
data/spark.gemspec
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = %q{spark}
|
5
|
+
s.version = "0"
|
6
|
+
|
7
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
|
+
s.authors = ["elliottcable"]
|
9
|
+
s.date = %q{2009-08-04}
|
10
|
+
s.description = %q{Rakes are for chumps. *Real* men ignite their specks with sparks!}
|
11
|
+
s.email = ["Spark@elliottcable.com"]
|
12
|
+
s.extra_rdoc_files = ["lib/spark/core_ext/string.rb", "lib/spark/core_ext.rb", "lib/spark/rake/speck_task.rb", "lib/spark.rb", "README.markdown"]
|
13
|
+
s.files = ["lib/spark/core_ext/string.rb", "lib/spark/core_ext.rb", "lib/spark/rake/speck_task.rb", "lib/spark.rb", "Rakefile.rb", "README.markdown", ".manifest", "spark.gemspec"]
|
14
|
+
s.has_rdoc = true
|
15
|
+
s.homepage = %q{http://github.com/elliottcable/spark}
|
16
|
+
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Spark", "--main", "README.markdown"]
|
17
|
+
s.require_paths = ["lib"]
|
18
|
+
s.rubyforge_project = %q{speck}
|
19
|
+
s.rubygems_version = %q{1.3.1}
|
20
|
+
s.summary = %q{Rakes are for chumps. *Real* men ignite their specks with sparks!}
|
21
|
+
|
22
|
+
if s.respond_to? :specification_version then
|
23
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
24
|
+
s.specification_version = 2
|
25
|
+
|
26
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
27
|
+
s.add_runtime_dependency(%q<speck>, [">= 0"])
|
28
|
+
s.add_development_dependency(%q<echoe>, [">= 0", "= 3.0.2"])
|
29
|
+
s.add_development_dependency(%q<slack>, [">= 0"])
|
30
|
+
s.add_development_dependency(%q<yard>, [">= 0"])
|
31
|
+
s.add_development_dependency(%q<maruku>, [">= 0"])
|
32
|
+
else
|
33
|
+
s.add_dependency(%q<speck>, [">= 0"])
|
34
|
+
s.add_dependency(%q<echoe>, [">= 0", "= 3.0.2"])
|
35
|
+
s.add_dependency(%q<slack>, [">= 0"])
|
36
|
+
s.add_dependency(%q<yard>, [">= 0"])
|
37
|
+
s.add_dependency(%q<maruku>, [">= 0"])
|
38
|
+
end
|
39
|
+
else
|
40
|
+
s.add_dependency(%q<speck>, [">= 0"])
|
41
|
+
s.add_dependency(%q<echoe>, [">= 0", "= 3.0.2"])
|
42
|
+
s.add_dependency(%q<slack>, [">= 0"])
|
43
|
+
s.add_dependency(%q<yard>, [">= 0"])
|
44
|
+
s.add_dependency(%q<maruku>, [">= 0"])
|
45
|
+
end
|
46
|
+
end
|
metadata
ADDED
@@ -0,0 +1,123 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: elliottcable-spark
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: "0"
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- elliottcable
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2009-08-04 00:00:00 -07:00
|
13
|
+
default_executable:
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: speck
|
17
|
+
type: :runtime
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: "0"
|
24
|
+
version:
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: echoe
|
27
|
+
type: :development
|
28
|
+
version_requirement:
|
29
|
+
version_requirements: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: "0"
|
34
|
+
- - "="
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: 3.0.2
|
37
|
+
version:
|
38
|
+
- !ruby/object:Gem::Dependency
|
39
|
+
name: slack
|
40
|
+
type: :development
|
41
|
+
version_requirement:
|
42
|
+
version_requirements: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - ">="
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: "0"
|
47
|
+
version:
|
48
|
+
- !ruby/object:Gem::Dependency
|
49
|
+
name: yard
|
50
|
+
type: :development
|
51
|
+
version_requirement:
|
52
|
+
version_requirements: !ruby/object:Gem::Requirement
|
53
|
+
requirements:
|
54
|
+
- - ">="
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: "0"
|
57
|
+
version:
|
58
|
+
- !ruby/object:Gem::Dependency
|
59
|
+
name: maruku
|
60
|
+
type: :development
|
61
|
+
version_requirement:
|
62
|
+
version_requirements: !ruby/object:Gem::Requirement
|
63
|
+
requirements:
|
64
|
+
- - ">="
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: "0"
|
67
|
+
version:
|
68
|
+
description: Rakes are for chumps. *Real* men ignite their specks with sparks!
|
69
|
+
email:
|
70
|
+
- Spark@elliottcable.com
|
71
|
+
executables: []
|
72
|
+
|
73
|
+
extensions: []
|
74
|
+
|
75
|
+
extra_rdoc_files:
|
76
|
+
- lib/spark/core_ext/string.rb
|
77
|
+
- lib/spark/core_ext.rb
|
78
|
+
- lib/spark/rake/speck_task.rb
|
79
|
+
- lib/spark.rb
|
80
|
+
- README.markdown
|
81
|
+
files:
|
82
|
+
- lib/spark/core_ext/string.rb
|
83
|
+
- lib/spark/core_ext.rb
|
84
|
+
- lib/spark/rake/speck_task.rb
|
85
|
+
- lib/spark.rb
|
86
|
+
- Rakefile.rb
|
87
|
+
- README.markdown
|
88
|
+
- .manifest
|
89
|
+
- spark.gemspec
|
90
|
+
has_rdoc: true
|
91
|
+
homepage: http://github.com/elliottcable/spark
|
92
|
+
licenses:
|
93
|
+
post_install_message:
|
94
|
+
rdoc_options:
|
95
|
+
- --line-numbers
|
96
|
+
- --inline-source
|
97
|
+
- --title
|
98
|
+
- Spark
|
99
|
+
- --main
|
100
|
+
- README.markdown
|
101
|
+
require_paths:
|
102
|
+
- lib
|
103
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
104
|
+
requirements:
|
105
|
+
- - ">="
|
106
|
+
- !ruby/object:Gem::Version
|
107
|
+
version: "0"
|
108
|
+
version:
|
109
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
110
|
+
requirements:
|
111
|
+
- - ">="
|
112
|
+
- !ruby/object:Gem::Version
|
113
|
+
version: "1.2"
|
114
|
+
version:
|
115
|
+
requirements: []
|
116
|
+
|
117
|
+
rubyforge_project: speck
|
118
|
+
rubygems_version: 1.3.5
|
119
|
+
signing_key:
|
120
|
+
specification_version: 2
|
121
|
+
summary: Rakes are for chumps. *Real* men ignite their specks with sparks!
|
122
|
+
test_files: []
|
123
|
+
|