dbt 1.0.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 +7 -0
- data/.gitignore +1 -0
- data/LICENSE +26 -0
- data/README.md +59 -0
- data/dbt.gemspec +34 -0
- data/lib/dbt.rb +63 -0
- data/lib/dbt/version.rb +3 -0
- metadata +62 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 6b0184ee78207b1c1bab0405b741d061480160ec
|
4
|
+
data.tar.gz: 184709d851ad68ca44ad667848558b051ec88fd5
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: c7c6d8853ffb4ae849ca8cad52ebeede8095adaea0757dceb6bade4de121b81316dafaf198b5c89c0c2f84ec930de689551bd27292ff6597cac01051d3a3d5fb
|
7
|
+
data.tar.gz: 138fc508e6636a95760b687b1f3208b6f6f468e2680352bfa4d841933bacaf200df8779f953572b44852a6eafcea6f7ba5b2143e12ab69dc969019b4c0fb8eb3
|
data/.gitignore
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
dbt-*.gem
|
data/LICENSE
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
Copyright (c) 2012, Colin Thomas Arnold Gray
|
2
|
+
All rights reserved.
|
3
|
+
|
4
|
+
Redistribution and use in source and binary forms, with or without
|
5
|
+
modification, are permitted provided that the following conditions are met:
|
6
|
+
|
7
|
+
1. Redistributions of source code must retain the above copyright notice, this
|
8
|
+
list of conditions and the following disclaimer.
|
9
|
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
10
|
+
this list of conditions and the following disclaimer in the documentation
|
11
|
+
and/or other materials provided with the distribution.
|
12
|
+
|
13
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
14
|
+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
15
|
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
16
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
17
|
+
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
18
|
+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
19
|
+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
20
|
+
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
21
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
22
|
+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
23
|
+
|
24
|
+
The views and conclusions contained in the software and documentation are those
|
25
|
+
of the authors and should not be interpreted as representing official policies,
|
26
|
+
either expressed or implied, of the DBT Project.
|
data/README.md
ADDED
@@ -0,0 +1,59 @@
|
|
1
|
+
DBT
|
2
|
+
----------
|
3
|
+
|
4
|
+
DBT (Dependencies and deBugging Tool) is a tool that looks for `break`,
|
5
|
+
`require`, and `provides` commands (and does a *teensy* bit of code analyzing -
|
6
|
+
it will detect VERY basic class and module declarations) to make your RubyMotion
|
7
|
+
`Rakefile` and `debugger_cmds` files short and consistent.
|
8
|
+
|
9
|
+
**CAUTION**: It overwrites the `debugger_cmds` file!
|
10
|
+
|
11
|
+
To use, include this gem (`gem 'depdep'`), and add `app.analyze` to your
|
12
|
+
`Rakefile`, after you have added your libraries and whatnot. It looks at
|
13
|
+
`app.files` and scans those files, so I mean it when I say "after you have added
|
14
|
+
your libraries and whatnot". In your source code you add DBT commands:
|
15
|
+
|
16
|
+
```ruby
|
17
|
+
# @provides Foo
|
18
|
+
# @requires Bar
|
19
|
+
def scary_method
|
20
|
+
#-----> break
|
21
|
+
doing
|
22
|
+
interesting
|
23
|
+
stuff
|
24
|
+
end
|
25
|
+
```
|
26
|
+
|
27
|
+
When you run `rake`, these commands will be found and translated into directives
|
28
|
+
for `app.files_dependencies` and `debugger_cmds`. Run `rake` or `rake debug=1`,
|
29
|
+
and off you go!
|
30
|
+
|
31
|
+
Your files will be grep'd for `^\w*(class|module)`, and these will be registered
|
32
|
+
automatically as:
|
33
|
+
|
34
|
+
```ruby
|
35
|
+
# @provides class:ClassName
|
36
|
+
class ClassName
|
37
|
+
end
|
38
|
+
|
39
|
+
# @provides module:ModuleName
|
40
|
+
class ModuleName
|
41
|
+
end
|
42
|
+
```
|
43
|
+
|
44
|
+
So right out of the box, you can add `# @requires class:Foo` if you're having
|
45
|
+
trouble with dependencies and want a quick fix without having to add
|
46
|
+
`# @provides` declarations all over the place.
|
47
|
+
|
48
|
+
The syntax for a command is:
|
49
|
+
|
50
|
+
```regex
|
51
|
+
^#[ \t]*@(provides|requires)
|
52
|
+
or for break points:
|
53
|
+
^#--+> *(break)( *(\w+|[0-9]+))?$
|
54
|
+
```
|
55
|
+
|
56
|
+
If a line number is given to the `break` command, a breakpoint will be added *at
|
57
|
+
that line*, otherwise it will be added to the line below `break`. It's better to
|
58
|
+
insert the `#--> break` where you NEED it, rather than hardcode line numbers,
|
59
|
+
since line numbers are not constant.
|
data/dbt.gemspec
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/dbt/version.rb', __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
gem.name = 'dbt'
|
6
|
+
gem.version = DBT::VERSION
|
7
|
+
gem.email = 'colinta@gmail.com'
|
8
|
+
gem.licenses = ['BSD']
|
9
|
+
|
10
|
+
gem.authors = ['Colin Thomas-Arnold <colinta@gmail.com>']
|
11
|
+
gem.email = ['colinta@gmail.com']
|
12
|
+
|
13
|
+
gem.description = <<-DESC
|
14
|
+
DBT (Dependencies and deBugging Tool) is a tool that helps declare and declare
|
15
|
+
dependencies (+app.files_dependencies+), and assists with debugging, in
|
16
|
+
RubyMotion project. It looks for 'break', 'requires', and 'provides' commands
|
17
|
+
(it does a *teensy* bit of code analyzing to provide some defaults) to make your
|
18
|
+
RubyMotion +Rakefile+ and +debugger_cmds+ files short and consistent.
|
19
|
+
|
20
|
+
To use, include this gem, and add +app.analyze+ to your +Rakefile+ in the
|
21
|
+
+Motion::Project::App.setup+ block. In your source code you can add DBT
|
22
|
+
commands and those will be translated into directives for
|
23
|
+
`app.files_dependencies` and `debugger_cmds`.
|
24
|
+
|
25
|
+
Run +rake+ or +rake debug=1+, and off you go!
|
26
|
+
DESC
|
27
|
+
|
28
|
+
gem.summary = 'Keep your Rakefile and debugger_cmds files short and consistent'
|
29
|
+
gem.homepage = 'https://github.com/colinta/dbt'
|
30
|
+
|
31
|
+
gem.files = `git ls-files`.split($\)
|
32
|
+
gem.require_paths = ['lib']
|
33
|
+
gem.test_files = gem.files.grep(%r{^spec/})
|
34
|
+
end
|
data/lib/dbt.rb
ADDED
@@ -0,0 +1,63 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
Motion::Project::App.setup do |app|
|
4
|
+
def app.analyze
|
5
|
+
debugger_cmds_output = "#------> Creado por el Analizarruptor <------#\n"
|
6
|
+
dependers = Hash.new { |hash,key| hash[key] = [] }
|
7
|
+
providers = {}
|
8
|
+
|
9
|
+
files.uniq!
|
10
|
+
files.each do |filename|
|
11
|
+
File.open(filename, 'r') do |file|
|
12
|
+
file.each_line do |line|
|
13
|
+
command = false
|
14
|
+
|
15
|
+
if line =~ /^#--+>/
|
16
|
+
command, dep = line.rstrip.sub(/^#--+> */, '').split(' ', 2)
|
17
|
+
elsif line =~ /^#[ \t]*@(provides|requires)/
|
18
|
+
command, dep = line.rstrip.sub(/^#[ \t]*@/, '').split(' ', 2)
|
19
|
+
end
|
20
|
+
|
21
|
+
if command
|
22
|
+
case command
|
23
|
+
when 'break'
|
24
|
+
dep ||= file.lineno + 1
|
25
|
+
debugger_cmds_output += "break #{File.basename filename}:#{dep}\n"
|
26
|
+
when 'provides'
|
27
|
+
if providers.key? dep
|
28
|
+
puts "\033[1m!HAY DEMASIADOS!\033[0m \033[1;31m#{dep}\033[0m"
|
29
|
+
end
|
30
|
+
providers[dep] = filename
|
31
|
+
when 'requires'
|
32
|
+
dependers[filename] << dep
|
33
|
+
else
|
34
|
+
puts "\033[1m!NO COMPRENDO!\033[0m \"#{command} #{dep}\""
|
35
|
+
puts "\033[1;31m#{filename}:#{file.lineno}\033[0m"
|
36
|
+
end
|
37
|
+
elsif line =~ /^\s*class\s+(\w+)/
|
38
|
+
dep = "class:#{$1}"
|
39
|
+
providers[dep] = filename
|
40
|
+
elsif line =~ /^\s*module\s+(\w+)/
|
41
|
+
dep = "module:#{$1}"
|
42
|
+
providers[dep] = filename
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end # files
|
47
|
+
|
48
|
+
dependers.each do |filename, dependencies|
|
49
|
+
if dep = dependencies.find { |dep| ! providers.include? dep }
|
50
|
+
puts "\033[1m!NO HAY!\033[0m \033[1;31m#{dep}\033[0m"
|
51
|
+
raise "#{filename} could not find a provider for #{dep}"
|
52
|
+
else
|
53
|
+
self.files_dependencies filename => dependencies.map{|dep| providers[dep] }
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
unless debugger_cmds_output.empty?
|
58
|
+
File.open('debugger_cmds', 'w') do |file|
|
59
|
+
file.write debugger_cmds_output
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
data/lib/dbt/version.rb
ADDED
metadata
ADDED
@@ -0,0 +1,62 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: dbt
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Colin Thomas-Arnold <colinta@gmail.com>
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-02-28 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: |
|
14
|
+
DBT (Dependencies and deBugging Tool) is a tool that helps declare and declare
|
15
|
+
dependencies (+app.files_dependencies+), and assists with debugging, in
|
16
|
+
RubyMotion project. It looks for 'break', 'requires', and 'provides' commands
|
17
|
+
(it does a *teensy* bit of code analyzing to provide some defaults) to make your
|
18
|
+
RubyMotion +Rakefile+ and +debugger_cmds+ files short and consistent.
|
19
|
+
|
20
|
+
To use, include this gem, and add +app.analyze+ to your +Rakefile+ in the
|
21
|
+
+Motion::Project::App.setup+ block. In your source code you can add DBT
|
22
|
+
commands and those will be translated into directives for
|
23
|
+
`app.files_dependencies` and `debugger_cmds`.
|
24
|
+
|
25
|
+
Run +rake+ or +rake debug=1+, and off you go!
|
26
|
+
email:
|
27
|
+
- colinta@gmail.com
|
28
|
+
executables: []
|
29
|
+
extensions: []
|
30
|
+
extra_rdoc_files: []
|
31
|
+
files:
|
32
|
+
- .gitignore
|
33
|
+
- LICENSE
|
34
|
+
- README.md
|
35
|
+
- dbt.gemspec
|
36
|
+
- lib/dbt.rb
|
37
|
+
- lib/dbt/version.rb
|
38
|
+
homepage: https://github.com/colinta/dbt
|
39
|
+
licenses:
|
40
|
+
- BSD
|
41
|
+
metadata: {}
|
42
|
+
post_install_message:
|
43
|
+
rdoc_options: []
|
44
|
+
require_paths:
|
45
|
+
- lib
|
46
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
47
|
+
requirements:
|
48
|
+
- - '>='
|
49
|
+
- !ruby/object:Gem::Version
|
50
|
+
version: '0'
|
51
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - '>='
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '0'
|
56
|
+
requirements: []
|
57
|
+
rubyforge_project:
|
58
|
+
rubygems_version: 2.0.3
|
59
|
+
signing_key:
|
60
|
+
specification_version: 4
|
61
|
+
summary: Keep your Rakefile and debugger_cmds files short and consistent
|
62
|
+
test_files: []
|