drg 0.13.1 → 0.14.0
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 +4 -4
- data/README.md +60 -2
- data/drg.gemspec +3 -2
- data/lib/drg/decorators/sexp_decorator.rb +13 -0
- data/lib/drg/decorators.rb +3 -0
- data/lib/drg/file_context.rb +4 -0
- data/lib/drg/ruby/class_func.rb +13 -0
- data/lib/drg/ruby/condition.rb +52 -0
- data/lib/drg/ruby/const.rb +75 -17
- data/lib/drg/ruby/func.rb +23 -0
- data/lib/drg/ruby/instance_func.rb +13 -0
- data/lib/drg/ruby.rb +12 -42
- data/lib/drg/spec.rb +85 -0
- data/lib/drg/tasks/active_pinner.rb +2 -1
- data/lib/drg/tasks/spec_runner.rb +56 -0
- data/lib/drg/tasks.rb +11 -0
- data/lib/drg/version.rb +1 -1
- data/lib/drg.rb +7 -15
- data/lib/tasks/drg.rake +9 -0
- metadata +28 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8b762ca2893927b7c8daa8f20f406b94cc9aad2f
|
4
|
+
data.tar.gz: ccd11fadf6b920aabf92352cdf326a913a6de90c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 27a26be99bed739f410282a8f161713d7c3066b8a50a04902b783e33b667dbfa1654bee482aab0d0b4c4359bf4441e714c15fb86d3249225bf7a8ba16fb5fd53
|
7
|
+
data.tar.gz: 984f714b1a1371c4e71420c11cfa61b6a98e2c5fa119872bf1d3c94de4c536b7567bc386540ce7e0240e1af66035660734cbf6b3447bf81031b13e665ba9dae4
|
data/README.md
CHANGED
@@ -2,8 +2,13 @@
|
|
2
2
|
[](https://codeclimate.com/github/ridiculous/drg)
|
3
3
|
[](http://badge.fury.io/rb/drg)
|
4
4
|
|
5
|
-
A
|
6
|
-
|
5
|
+
A suite of rake tasks to help you test and manage your project.
|
6
|
+
|
7
|
+
The `drg:pin` suite provides enhanced dependency management with Bundler. You can pin Gem versions to the current or the next
|
8
|
+
available minor, major or patch level version.
|
9
|
+
|
10
|
+
The `drg:spec` task generates RSpec scaffolding for existing code. This helps bootstrap your tests and guide you in what
|
11
|
+
[I think] you should be testing.
|
7
12
|
|
8
13
|
## Requirements
|
9
14
|
|
@@ -20,6 +25,7 @@ gem 'drg'
|
|
20
25
|
## Tasks
|
21
26
|
|
22
27
|
```bash
|
28
|
+
rake drg:spec
|
23
29
|
rake drg:pin
|
24
30
|
rake drg:pin:major
|
25
31
|
rake drg:pin:minor
|
@@ -30,6 +36,58 @@ rake drg:pin:minor_latest
|
|
30
36
|
rake drg:unpin
|
31
37
|
```
|
32
38
|
|
39
|
+
### drg:spec
|
40
|
+
|
41
|
+
Generates RSpec scaffolding for existing code. Pass a file or directory and DRG will generate spec files for each:
|
42
|
+
|
43
|
+
```bash
|
44
|
+
rake drg:spec[app/controllers]
|
45
|
+
rake drg:spec[app/models/user.rb]
|
46
|
+
```
|
47
|
+
|
48
|
+
This task looks at your code's methods and breaks down their conditions into RSpec `context`s. For example:
|
49
|
+
|
50
|
+
Given this file:
|
51
|
+
|
52
|
+
```ruby
|
53
|
+
# app/models/ability.rb
|
54
|
+
class Ability
|
55
|
+
include CanCan::Ability
|
56
|
+
|
57
|
+
def initialize(user)
|
58
|
+
if user.admin?
|
59
|
+
can :manage, :all
|
60
|
+
else
|
61
|
+
can :read, :all
|
62
|
+
can :update, User do |u|
|
63
|
+
u.id == user.id
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
```
|
69
|
+
|
70
|
+
It will generate this spec:
|
71
|
+
```ruby
|
72
|
+
require "spec_helper"
|
73
|
+
|
74
|
+
describe Ability do
|
75
|
+
let(:user) {}
|
76
|
+
|
77
|
+
subject { described_class.new user }
|
78
|
+
|
79
|
+
describe "#initialize" do
|
80
|
+
context "when user.luna?" do
|
81
|
+
before {}
|
82
|
+
end
|
83
|
+
|
84
|
+
context "unless user.luna?" do
|
85
|
+
before {}
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
89
|
+
```
|
90
|
+
|
33
91
|
### drg:pin
|
34
92
|
|
35
93
|
DRG really wants to help you manage your project's gems. But DRG doesn't want to replace Bundler. Instead, we want to build on
|
data/drg.gemspec
CHANGED
@@ -8,8 +8,8 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.version = DRG::VERSION
|
9
9
|
spec.authors = ["Ryan Buckley"]
|
10
10
|
spec.email = ["arebuckley@gmail.com"]
|
11
|
-
spec.summary = %q{
|
12
|
-
spec.description = %q{
|
11
|
+
spec.summary = %q{A suite of rake tasks to help you test and manage your project}
|
12
|
+
spec.description = %q{A suite of rake tasks that provide enhanced dependency management and automatic spec generation}
|
13
13
|
spec.homepage = "https://github.com/ridiculous/drg"
|
14
14
|
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
15
15
|
spec.executables = []
|
@@ -19,6 +19,7 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.add_dependency 'bundler', '~> 1.10'
|
20
20
|
spec.add_dependency 'duck_puncher', '>= 2.0.0', '<= 3.0.0'
|
21
21
|
spec.add_dependency 'highline', '~> 1.7'
|
22
|
+
spec.add_dependency 'ruby2ruby', '~> 2.2'
|
22
23
|
|
23
24
|
spec.add_development_dependency 'rake', '~> 10.0'
|
24
25
|
spec.add_development_dependency 'rspec', '>= 3.2', '< 4'
|
@@ -0,0 +1,13 @@
|
|
1
|
+
class DRG::Decorators::SexpDecorator < DelegateClass(Sexp)
|
2
|
+
def each_sexp_condition
|
3
|
+
return enum_for(__method__) unless block_given?
|
4
|
+
each_sexp do |exp|
|
5
|
+
next unless exp.is_a?(Sexp)
|
6
|
+
if exp.first == :if
|
7
|
+
yield exp
|
8
|
+
elsif nested_sexp = exp.enum_for(:deep_each).find { |s| s.first == :if }
|
9
|
+
yield nested_sexp
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
data/lib/drg/file_context.rb
CHANGED
@@ -0,0 +1,52 @@
|
|
1
|
+
require 'ruby2ruby'
|
2
|
+
|
3
|
+
class DRG::Ruby::Condition
|
4
|
+
|
5
|
+
attr_reader :statement, :nested_conditions, :sexp
|
6
|
+
|
7
|
+
def initialize(sexp)
|
8
|
+
@sexp = sexp
|
9
|
+
@statement = Ruby2Ruby.new.process(sexp.deep_clone)
|
10
|
+
@nested_conditions = Set.new
|
11
|
+
sexp.drop(1).flatten.include?(:if) && sexp.drop(1).deep_each do |exp|
|
12
|
+
DRG::Decorators::SexpDecorator.new(exp).each_sexp_condition do |node|
|
13
|
+
@nested_conditions << self.class.new(node)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
@nested_conditions = @nested_conditions.to_a
|
17
|
+
end
|
18
|
+
|
19
|
+
def short_statement
|
20
|
+
if @statement =~ /(unless|if)(.+)$/
|
21
|
+
($1 << $2).strip
|
22
|
+
elsif @statement =~ /(.*?)\s+\?\s+/
|
23
|
+
$1.strip
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def return_value
|
28
|
+
if @statement =~ /\s+\?\s+(.*?)(:|$)/
|
29
|
+
$1.strip
|
30
|
+
else
|
31
|
+
translate @statement[/(.*?)(unless|if)/, 1].to_s.strip
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def translate(txt)
|
36
|
+
txt.sub! /^return\s*/, 'returns '
|
37
|
+
txt.sub! /^returns\s*$/, 'returns nil'
|
38
|
+
txt.strip
|
39
|
+
end
|
40
|
+
|
41
|
+
#
|
42
|
+
# Set related stuff
|
43
|
+
#
|
44
|
+
|
45
|
+
def eql?(other)
|
46
|
+
hash == other.hash
|
47
|
+
end
|
48
|
+
|
49
|
+
def hash
|
50
|
+
sexp.object_id
|
51
|
+
end
|
52
|
+
end
|
data/lib/drg/ruby/const.rb
CHANGED
@@ -1,24 +1,82 @@
|
|
1
1
|
require 'ruby_parser'
|
2
2
|
|
3
|
-
|
4
|
-
class
|
5
|
-
class Const
|
6
|
-
CONSTANT_DEFS = [:class, :module, :cdecl]
|
3
|
+
class DRG::Ruby::Const
|
4
|
+
CONSTANT_DEFS = { :class => :class, :module => :module, :cdecl => :class }
|
7
5
|
|
8
|
-
|
9
|
-
@parser = RubyParser.new.parse File.read(file)
|
10
|
-
end
|
6
|
+
attr_reader :sexp
|
11
7
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
8
|
+
# @param [Sexp] sexp
|
9
|
+
def initialize(sexp)
|
10
|
+
sexp = sexp.select { |x| x.is_a?(Array) }.last if sexp[0] == :block
|
11
|
+
@sexp = sexp
|
12
|
+
end
|
13
|
+
|
14
|
+
def name(sexp = @sexp, list = [])
|
15
|
+
sexp = Array(sexp)
|
16
|
+
if sexp[1].is_a?(Sexp) && sexp[1][0] == :colon2
|
17
|
+
parts = sexp[1].to_a.flatten
|
18
|
+
list.concat parts.drop(parts.size / 2)
|
19
|
+
elsif CONSTANT_DEFS.key?(sexp[0])
|
20
|
+
name(sexp.compact[2], list << sexp[1].to_s)
|
21
|
+
end
|
22
|
+
list.join('::')
|
23
|
+
end
|
24
|
+
|
25
|
+
def type(sexp = @sexp, val = nil)
|
26
|
+
sexp = Array(sexp)
|
27
|
+
if sexp[1].is_a?(Sexp) && sexp[1][0] == :colon2
|
28
|
+
val = sexp[0]
|
29
|
+
elsif CONSTANT_DEFS.key?(sexp[0])
|
30
|
+
val = type(sexp.compact[2], sexp[0])
|
22
31
|
end
|
32
|
+
CONSTANT_DEFS[val]
|
33
|
+
end
|
34
|
+
|
35
|
+
def initialization_args
|
36
|
+
funcs.find(-> { OpenStruct.new }) { |func| func.name == :initialize }.args.to_a
|
37
|
+
end
|
38
|
+
|
39
|
+
def func_by_name(name_as_symbol)
|
40
|
+
funcs.find { |x| x.name == name_as_symbol }
|
41
|
+
end
|
42
|
+
|
43
|
+
def funcs
|
44
|
+
@funcs ||= load_funkyness
|
45
|
+
end
|
46
|
+
|
47
|
+
def class?
|
48
|
+
type == :class
|
49
|
+
end
|
50
|
+
|
51
|
+
def module?
|
52
|
+
type == :module
|
53
|
+
end
|
54
|
+
|
55
|
+
# @todo
|
56
|
+
def instance_vars
|
57
|
+
end
|
58
|
+
|
59
|
+
# @todo
|
60
|
+
def class_vars
|
61
|
+
end
|
62
|
+
|
63
|
+
private
|
64
|
+
|
65
|
+
def load_funkyness
|
66
|
+
marked_private = false
|
67
|
+
sexp.map { |node|
|
68
|
+
next unless node.is_a?(Sexp)
|
69
|
+
case node.first
|
70
|
+
when :defn
|
71
|
+
DRG::Ruby::InstanceFunc.new(node, marked_private)
|
72
|
+
when :defs
|
73
|
+
DRG::Ruby::ClassFunc.new(node, marked_private)
|
74
|
+
when :call
|
75
|
+
marked_private ||= node[2] == :private
|
76
|
+
nil
|
77
|
+
else
|
78
|
+
nil
|
79
|
+
end
|
80
|
+
}.compact
|
23
81
|
end
|
24
82
|
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
class DRG::Ruby::Func < Struct.new(:sexp, :_private)
|
2
|
+
alias private? _private
|
3
|
+
|
4
|
+
def conditions
|
5
|
+
DRG::Decorators::SexpDecorator.new(sexp).each_sexp_condition.map do |exp|
|
6
|
+
DRG::Ruby::Condition.new(exp)
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
# @note we drop(1) to get rid of :args (which should be the first item in the sexp)
|
11
|
+
def map_args(_sexp = sexp, list = [])
|
12
|
+
val = _sexp.first
|
13
|
+
return list.drop(1) unless val
|
14
|
+
case val
|
15
|
+
when Symbol
|
16
|
+
map_args(_sexp.drop(1), list << val)
|
17
|
+
when Sexp
|
18
|
+
map_args(_sexp.drop(1), list << val[1])
|
19
|
+
else
|
20
|
+
nil
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
data/lib/drg/ruby.rb
CHANGED
@@ -1,50 +1,20 @@
|
|
1
1
|
require 'ruby_parser'
|
2
|
+
require 'delegate'
|
2
3
|
|
3
4
|
module DRG
|
4
5
|
class Ruby
|
5
|
-
|
6
|
+
autoload :Const, 'drg/ruby/const'
|
7
|
+
autoload :Condition, 'drg/ruby/condition'
|
8
|
+
autoload :Func, 'drg/ruby/func'
|
9
|
+
autoload :ClassFunc, 'drg/ruby/class_func'
|
10
|
+
autoload :InstanceFunc, 'drg/ruby/instance_func'
|
6
11
|
|
7
|
-
|
8
|
-
@parser = RubyParser.new.parse File.read(file)
|
9
|
-
end
|
10
|
-
|
11
|
-
def modules
|
12
|
-
end
|
13
|
-
|
14
|
-
class Klass < Struct.new(:sexp)
|
15
|
-
|
16
|
-
def includes
|
17
|
-
end
|
18
|
-
|
19
|
-
def extends
|
20
|
-
end
|
21
|
-
|
22
|
-
def funcs
|
23
|
-
sexp.find_nodes(:defn) + sexp.find_nodes(:defs)
|
24
|
-
end
|
25
|
-
|
26
|
-
def instance_vars
|
27
|
-
end
|
12
|
+
attr_reader :sexp, :const
|
28
13
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
class Func
|
34
|
-
def name
|
35
|
-
end
|
36
|
-
|
37
|
-
def args
|
38
|
-
end
|
39
|
-
|
40
|
-
def private?
|
41
|
-
end
|
42
|
-
|
43
|
-
def conditions
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
class Condition
|
14
|
+
# @param [Pathname] file
|
15
|
+
def initialize(file)
|
16
|
+
@sexp = RubyParser.new.parse File.read(file)
|
17
|
+
@const = DRG::Ruby::Const.new(sexp)
|
48
18
|
end
|
49
19
|
end
|
50
|
-
end
|
20
|
+
end
|
data/lib/drg/spec.rb
ADDED
@@ -0,0 +1,85 @@
|
|
1
|
+
class DRG::Spec < DelegateClass(DRG::Ruby::Const)
|
2
|
+
# = Class
|
3
|
+
# generate a rspec file based on existing code
|
4
|
+
|
5
|
+
def self.generate(file)
|
6
|
+
spec = DRG::Spec.new(file)
|
7
|
+
return if spec.funcs.empty? # nothing to do
|
8
|
+
lines = [%Q(require "spec_helper"), %Q(), %Q(describe #{spec.const} do)]
|
9
|
+
if spec.class?
|
10
|
+
spec.initialization_args.each do |arg|
|
11
|
+
lines << %Q( let(:#{arg}) {})
|
12
|
+
end
|
13
|
+
lines << %Q()
|
14
|
+
lines << %Q( subject { described_class.new #{spec.initialization_args.join(', ')} })
|
15
|
+
elsif spec.module?
|
16
|
+
lines << %Q( subject { Class.new { include #{spec.const} }.new })
|
17
|
+
end
|
18
|
+
|
19
|
+
lines << %Q()
|
20
|
+
spec.funcs.reject(&:private?).each do |func|
|
21
|
+
lines << %Q( describe #{spec.quote("#{func.class? ? '.' : '#'}#{func.name}")} do)
|
22
|
+
func.conditions.each do |condition|
|
23
|
+
lines.concat spec.collect_contexts(condition, ' ')
|
24
|
+
end
|
25
|
+
lines << %Q( end) << %Q()
|
26
|
+
end
|
27
|
+
lines << %Q(end) << %Q()
|
28
|
+
lines
|
29
|
+
end
|
30
|
+
|
31
|
+
attr_reader :ruby, :file
|
32
|
+
|
33
|
+
def initialize(file)
|
34
|
+
@file = file
|
35
|
+
@ruby = DRG::Ruby.new(file)
|
36
|
+
super @ruby.const
|
37
|
+
end
|
38
|
+
|
39
|
+
def const
|
40
|
+
@const ||= begin
|
41
|
+
require file
|
42
|
+
Kernel.const_get(ruby.const.name)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
def collect_contexts(condition, indent = '', contexts = [])
|
47
|
+
new_indent = indent + ' '
|
48
|
+
contexts << %Q(#{indent}context #{quote(tr(condition.short_statement))} do) << %Q(#{new_indent}before {})
|
49
|
+
unless condition.return_value.empty?
|
50
|
+
contexts << %Q(#{new_indent}it #{quote(condition.return_value)} do) << %Q(#{new_indent}end)
|
51
|
+
end
|
52
|
+
if condition.nested_conditions.any?
|
53
|
+
condition.nested_conditions.each { |nc| collect_contexts(nc, new_indent, contexts) }
|
54
|
+
end
|
55
|
+
contexts << %Q(#{indent}end) << %Q() # /context
|
56
|
+
contexts << %Q(#{indent}context #{quote(tr(negate(condition.short_statement)))} do) << %Q(#{new_indent}before {})
|
57
|
+
contexts << %Q(#{indent}end)
|
58
|
+
contexts
|
59
|
+
end
|
60
|
+
|
61
|
+
def quote(txt)
|
62
|
+
txt.strip!
|
63
|
+
if txt =~ /"/
|
64
|
+
"%Q(#{txt})"
|
65
|
+
else
|
66
|
+
%Q("#{txt}")
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
def negate(phrase)
|
71
|
+
if phrase[/^unless /]
|
72
|
+
phrase.sub /^unless /, 'if '
|
73
|
+
else
|
74
|
+
"not #{phrase}"
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
def tr(phrase)
|
79
|
+
phrase.sub! /^if /, 'when '
|
80
|
+
phrase.sub! /^not if /, 'unless '
|
81
|
+
phrase.sub! /^if not /, 'unless '
|
82
|
+
phrase.sub! %r"then$", ''
|
83
|
+
phrase
|
84
|
+
end
|
85
|
+
end
|
@@ -101,7 +101,8 @@ module DRG
|
|
101
101
|
# @param [Array] list of a gem version's segments
|
102
102
|
# @param [Array] other_list of another gem version's segments
|
103
103
|
def higher?(list, other_list)
|
104
|
-
(0..2).to_a
|
104
|
+
gem_version_segments = (0..2).to_a
|
105
|
+
gem_version_segments.any? { |i| list[i].to_i > other_list[i].to_i }
|
105
106
|
end
|
106
107
|
end
|
107
108
|
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
|
3
|
+
module DRG
|
4
|
+
module Tasks
|
5
|
+
class SpecRunner
|
6
|
+
include Log
|
7
|
+
|
8
|
+
attr_reader :file
|
9
|
+
|
10
|
+
# @param [Pathname] file
|
11
|
+
def initialize(file)
|
12
|
+
@file = Pathname.new(file)
|
13
|
+
end
|
14
|
+
|
15
|
+
def perform
|
16
|
+
fail ArgumentError, %Q(File or directory does not exist: "#{file}") if !File.exists?(file) && !File.exists?("#{file}.rb")
|
17
|
+
ruby_files.each do |ruby_file|
|
18
|
+
file_path = Pathname.new(File.expand_path(ruby_file))
|
19
|
+
spec = DRG::Spec.generate(file_path)
|
20
|
+
next unless spec
|
21
|
+
rspec_file = Pathname.new(spec_file(ruby_file))
|
22
|
+
log "Generating #{rspec_file}"
|
23
|
+
FileUtils.mkdir_p(rspec_file.parent)
|
24
|
+
File.open(spec_file(ruby_file), 'wb') do |f|
|
25
|
+
f << spec.join("\n")
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def ruby_files
|
31
|
+
if File.directory?(file)
|
32
|
+
Dir[File.join(file, '**', '*.rb')]
|
33
|
+
else
|
34
|
+
if file.extname.empty?
|
35
|
+
["#{file}.rb"]
|
36
|
+
else
|
37
|
+
[file]
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
# @note subbing out /app/ is Rails specific
|
43
|
+
def spec_file(ruby_file)
|
44
|
+
File.join(spec_path, "#{ruby_file.sub('.rb', '_spec.rb')}").sub '/app/', '/'
|
45
|
+
end
|
46
|
+
|
47
|
+
def spec_path
|
48
|
+
if File.directory?(File.expand_path('spec'))
|
49
|
+
File.expand_path('spec')
|
50
|
+
else
|
51
|
+
fail "Couldn't find spec directory"
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
data/lib/drg/tasks.rb
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
module DRG
|
2
|
+
module Tasks
|
3
|
+
autoload :Updater, 'drg/tasks/updater'
|
4
|
+
autoload :Pinner, 'drg/tasks/pinner'
|
5
|
+
autoload :ActivePinner, 'drg/tasks/active_pinner'
|
6
|
+
autoload :Gemfile, 'drg/tasks/gemfile'
|
7
|
+
autoload :GemfileLine, 'drg/tasks/gemfile_line'
|
8
|
+
autoload :Log, 'drg/tasks/log'
|
9
|
+
autoload :SpecRunner, 'drg/tasks/spec_runner'
|
10
|
+
end
|
11
|
+
end
|
data/lib/drg/version.rb
CHANGED
data/lib/drg.rb
CHANGED
@@ -1,27 +1,19 @@
|
|
1
|
+
require 'pathname'
|
1
2
|
require 'ostruct'
|
2
3
|
require 'set'
|
3
4
|
require 'bundler'
|
4
5
|
require 'duck_puncher'
|
5
6
|
require 'highline/import'
|
6
|
-
|
7
|
-
# defines Object#clone!
|
8
|
-
DuckPuncher.punch! :Object
|
9
|
-
|
10
7
|
require 'drg/version'
|
11
8
|
|
12
9
|
module DRG
|
13
|
-
|
14
|
-
|
15
|
-
autoload :Pinner, 'drg/tasks/pinner'
|
16
|
-
autoload :ActivePinner, 'drg/tasks/active_pinner'
|
17
|
-
autoload :Gemfile, 'drg/tasks/gemfile'
|
18
|
-
autoload :GemfileLine, 'drg/tasks/gemfile_line'
|
19
|
-
autoload :Log, 'drg/tasks/log'
|
20
|
-
end
|
10
|
+
# defines Object#clone! which provides a deep clone
|
11
|
+
DuckPuncher.punch! :Object
|
21
12
|
|
22
|
-
|
23
|
-
|
24
|
-
|
13
|
+
autoload :Tasks, 'drg/tasks'
|
14
|
+
autoload :Ruby, 'drg/ruby'
|
15
|
+
autoload :Decorators, 'drg/decorators'
|
16
|
+
autoload :Spec, 'drg/spec'
|
25
17
|
end
|
26
18
|
|
27
19
|
load 'tasks/drg.rake'
|
data/lib/tasks/drg.rake
CHANGED
@@ -46,4 +46,13 @@ namespace :drg do
|
|
46
46
|
task latest_minor: :minor_latest
|
47
47
|
task latest_patch: :patch_latest
|
48
48
|
end
|
49
|
+
|
50
|
+
task :spec, [:file_name] => :environment do |_, args|
|
51
|
+
DRG::Tasks::SpecRunner.new(args.file_name).perform
|
52
|
+
end
|
53
|
+
|
54
|
+
unless defined?(Rails)
|
55
|
+
task :environment do
|
56
|
+
end
|
57
|
+
end
|
49
58
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: drg
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.14.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Buckley
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-11-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ruby_parser
|
@@ -78,6 +78,20 @@ dependencies:
|
|
78
78
|
- - "~>"
|
79
79
|
- !ruby/object:Gem::Version
|
80
80
|
version: '1.7'
|
81
|
+
- !ruby/object:Gem::Dependency
|
82
|
+
name: ruby2ruby
|
83
|
+
requirement: !ruby/object:Gem::Requirement
|
84
|
+
requirements:
|
85
|
+
- - "~>"
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: '2.2'
|
88
|
+
type: :runtime
|
89
|
+
prerelease: false
|
90
|
+
version_requirements: !ruby/object:Gem::Requirement
|
91
|
+
requirements:
|
92
|
+
- - "~>"
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: '2.2'
|
81
95
|
- !ruby/object:Gem::Dependency
|
82
96
|
name: rake
|
83
97
|
requirement: !ruby/object:Gem::Requirement
|
@@ -112,8 +126,8 @@ dependencies:
|
|
112
126
|
- - "<"
|
113
127
|
- !ruby/object:Gem::Version
|
114
128
|
version: '4'
|
115
|
-
description:
|
116
|
-
|
129
|
+
description: A suite of rake tasks that provide enhanced dependency management and
|
130
|
+
automatic spec generation
|
117
131
|
email:
|
118
132
|
- arebuckley@gmail.com
|
119
133
|
executables: []
|
@@ -131,18 +145,27 @@ files:
|
|
131
145
|
- bin/setup
|
132
146
|
- drg.gemspec
|
133
147
|
- lib/drg.rb
|
148
|
+
- lib/drg/decorators.rb
|
149
|
+
- lib/drg/decorators/sexp_decorator.rb
|
134
150
|
- lib/drg/file_context.rb
|
135
151
|
- lib/drg/file_reader.rb
|
136
152
|
- lib/drg/judge.rb
|
137
153
|
- lib/drg/let.rb
|
138
154
|
- lib/drg/ruby.rb
|
155
|
+
- lib/drg/ruby/class_func.rb
|
156
|
+
- lib/drg/ruby/condition.rb
|
139
157
|
- lib/drg/ruby/const.rb
|
158
|
+
- lib/drg/ruby/func.rb
|
159
|
+
- lib/drg/ruby/instance_func.rb
|
140
160
|
- lib/drg/scanner.rb
|
161
|
+
- lib/drg/spec.rb
|
162
|
+
- lib/drg/tasks.rb
|
141
163
|
- lib/drg/tasks/active_pinner.rb
|
142
164
|
- lib/drg/tasks/gemfile.rb
|
143
165
|
- lib/drg/tasks/gemfile_line.rb
|
144
166
|
- lib/drg/tasks/log.rb
|
145
167
|
- lib/drg/tasks/pinner.rb
|
168
|
+
- lib/drg/tasks/spec_runner.rb
|
146
169
|
- lib/drg/tasks/updater.rb
|
147
170
|
- lib/drg/version.rb
|
148
171
|
- lib/tasks/drg.rake
|
@@ -168,5 +191,5 @@ rubyforge_project:
|
|
168
191
|
rubygems_version: 2.4.6
|
169
192
|
signing_key:
|
170
193
|
specification_version: 4
|
171
|
-
summary:
|
194
|
+
summary: A suite of rake tasks to help you test and manage your project
|
172
195
|
test_files: []
|