dbt 1.1.5 → 1.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cdc97a0d058196ba1d1818563374a85f7a3f7639
4
- data.tar.gz: 7430e1d594142b990368eab65ce451767878787e
3
+ metadata.gz: fe25a13de0aa54db62876aa76a0fb8354be01525
4
+ data.tar.gz: 9fbd2c03eaba0cb009098f9bc77e467f7e8730e6
5
5
  SHA512:
6
- metadata.gz: 29885c9081e3e8169617c9662874743592d4742674817f45cbd6a60025b376581c05da5fcd158af85bc6ba4659e288dc05706903fdb1d207bcf962f8bcf7e852
7
- data.tar.gz: ec926ca2eab8b50fdf7680f84324020a0594f1989af927bcfb3e1842657f84dacdaf1f5846e71883d14eeb78d4736b97201eb328bdbe48dff1d3e6cfed1968da
6
+ metadata.gz: 60727b62db58afff9a18756be56ecbd83ad56a69c0fcebbd9acecdab55bcaeaae5210f31dd3de77dc2b51aad4ec7d80f5484cc824c163bc983d37594b4217a02
7
+ data.tar.gz: ea073cf767e28b1bc0bcc100f1fa0224848151b73026050161f4e536b854f5127204de1242cf2cab6bf9a3ebd73053afc9b4b68aa58c40984f36037226311c33
data/README.md CHANGED
@@ -1,11 +1,16 @@
1
1
  DBT
2
2
  ---
3
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
- `debugger_cmds` file easy to create, and declaring your file dependencies stupid
8
- simple.
4
+ DBT (Dependencies and deBugging Tool) is a RubyMotion tool that works for iOS, OSX,
5
+ and Android to detect classes and dependencies. It will declare them in your config
6
+ so you don't have to manually manage them.
7
+
8
+ # iOS/OSX Dependency Analysis
9
+
10
+ DBT will look for `break`, `require`, and `provides` commands (and does a *teensy*
11
+ bit of code analyzing - it will detect VERY basic class and module declarations)
12
+ to make your RubyMotion `debugger_cmds` file easy to create, and declaring your file
13
+ dependencies stupid simple.
9
14
 
10
15
  **CAUTION**: It overwrites the `debugger_cmds` file!
11
16
 
@@ -102,6 +107,31 @@ module Foo ; module Bar
102
107
  end end
103
108
  ```
104
109
 
110
+ # Android
111
+
112
+ In Android, dependencies are handled automatically, but you need to declare your
113
+ `Android::App::Activity` classes in your config. Normally, you'd do something like
114
+ this:
115
+
116
+ ```ruby
117
+ app.sub_activities = [
118
+ "FirstActivity",
119
+ "SecondActivity",
120
+ # etc
121
+ ]
122
+ ```
123
+
124
+ With DBT, you can now add these declarations to the top of your activities:
125
+
126
+ ```ruby
127
+ # @activity FirstActivity
128
+ class FirstActivity < Android::App::Activity
129
+ # ...
130
+ end
131
+ ```
132
+
133
+ That's all the functionality we have for Android at the moment, but it's pretty helpful!
134
+
105
135
  # Breakpoints
106
136
 
107
137
  Breakpoints are created using the syntax `#--> break`, with two or more dashes
@@ -126,3 +156,11 @@ If a line number is given to the `break` command, a breakpoint will be added at
126
156
  *that* line, otherwise it will be added to the line below `break`. It's better
127
157
  to insert the `#--> break` where you NEED it, rather than hardcode line numbers,
128
158
  since line numbers are not constant.
159
+
160
+ # Running Tests
161
+
162
+ We have two simple test files, so just run them manually.
163
+
164
+ ```sh-session
165
+ $ ruby spec/ios_spec.rb && ruby spec/android_spec.rb
166
+ ```
data/lib/dbt.rb CHANGED
@@ -1,71 +1,14 @@
1
1
  # coding: utf-8
2
+ require 'dbt/version'
3
+ require 'dbt/android'
4
+ require 'dbt/ios'
2
5
 
3
6
  module DBT
4
7
  module_function
5
8
  def analyze(app)
6
- debugger_cmds_output = ''
7
- dependers = Hash.new { |hash,key| hash[key] = [] }
8
- providers = {}
9
- default_providers = {}
10
-
11
- files = app.files.flatten.uniq
12
- files.flatten.each do |filename|
13
- File.open(filename, 'r:UTF-8') do |file|
14
- file.each_line do |line|
15
- command = false
16
-
17
- if line =~ /^#--+>/
18
- command, dep = line.rstrip.sub(/^#--+> */, '').split(' ', 2)
19
- elsif line =~ /^[ \t]*#[ \t]*@(provides|requires)/
20
- command, dep = line.rstrip.sub(/^[ \t]*#[ \t]*@/, '').split(' ', 2)
21
- end
22
-
23
- if command
24
- case command
25
- when 'break'
26
- dep ||= file.lineno + 1
27
- debugger_cmds_output += "breakpoint set --file #{File.basename filename} --line #{dep}\n"
28
- when 'provides'
29
- if providers.key? dep
30
- puts "\033[1m!HAY DEMASIADOS!\033[0m \033[1;31m#{dep}\033[0m"
31
- end
32
- providers[dep] = filename
33
- when 'requires'
34
- dependers[filename] << dep
35
- else
36
- puts "\033[1m!NO COMPRENDO!\033[0m \"#{command} #{dep}\""
37
- puts "\033[1;31m#{filename}:#{file.lineno}\033[0m"
38
- end
39
- elsif line =~ /^[ \t]*class[ \t]+(\w+)/
40
- dep = "class:#{$1}"
41
- default_providers[dep] = filename
42
- elsif line =~ /^[ \t]*module[ \t]+(\w+)/
43
- dep = "module:#{$1}"
44
- default_providers[dep] = filename
45
- end
46
- end
47
- end
48
- end # files
49
-
50
- default_providers.each do |dep, filename|
51
- providers[dep] ||= filename
52
- end
53
-
54
- dependers.each do |filename, dependencies|
55
- if dep = dependencies.find { |dep| ! providers.include? dep }
56
- puts "\033[1m!NO HAY!\033[0m \033[1;31m#{dep}\033[0m"
57
- raise "#{filename} could not find a provider for #{dep}"
58
- else
59
- app.files_dependencies filename => dependencies.map { |dep| providers[dep] }
60
- end
61
- end
62
-
63
- unless debugger_cmds_output.empty?
64
- File.open('debugger_cmds', 'w') do |file|
65
- file.write "#------> Creado por el DBT <------#\n"
66
- file.write debugger_cmds_output
67
- end
68
- end
9
+ android = app.respond_to?(:main_activity)
10
+ DBT::Android.analyze(app) if android
11
+ DBT::IOS.analyze(app) unless android
69
12
  end
70
13
  end
71
14
 
@@ -0,0 +1,19 @@
1
+ module DBT
2
+ module Android
3
+ module_function
4
+ def analyze(app)
5
+ activities = []
6
+ files = app.files.flatten.uniq
7
+ files.each do |filename|
8
+ File.open(filename, 'r:UTF-8') do |file|
9
+ file.each_line do |line|
10
+ if line =~ /^[ \t]*#[ \t]*@(activity)/
11
+ command, activity = line.rstrip.sub(/^[ \t]*#[ \t]*@/, '').split(' ', 2)
12
+ app.sub_activities << activity
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,70 @@
1
+ module DBT
2
+ module IOS
3
+ module_function
4
+ def analyze(app)
5
+ debugger_cmds_output = ''
6
+ dependers = Hash.new { |hash,key| hash[key] = [] }
7
+ providers = {}
8
+ default_providers = {}
9
+
10
+ files = app.files.flatten.uniq
11
+ files.flatten.each do |filename|
12
+ File.open(filename, 'r:UTF-8') do |file|
13
+ file.each_line do |line|
14
+ command = false
15
+
16
+ if line =~ /^#--+>/
17
+ command, dep = line.rstrip.sub(/^#--+> */, '').split(' ', 2)
18
+ elsif line =~ /^[ \t]*#[ \t]*@(provides|requires)/
19
+ command, dep = line.rstrip.sub(/^[ \t]*#[ \t]*@/, '').split(' ', 2)
20
+ end
21
+
22
+ if command
23
+ case command
24
+ when 'break'
25
+ dep ||= file.lineno + 1
26
+ debugger_cmds_output += "breakpoint set --file #{File.basename filename} --line #{dep}\n"
27
+ when 'provides'
28
+ if providers.key? dep
29
+ puts "\033[1m!HAY DEMASIADOS!\033[0m \033[1;31m#{dep}\033[0m"
30
+ end
31
+ providers[dep] = filename
32
+ when 'requires'
33
+ dependers[filename] << dep
34
+ else
35
+ puts "\033[1m!NO COMPRENDO!\033[0m \"#{command} #{dep}\""
36
+ puts "\033[1;31m#{filename}:#{file.lineno}\033[0m"
37
+ end
38
+ elsif line =~ /^[ \t]*class[ \t]+(\w+)/
39
+ dep = "class:#{$1}"
40
+ default_providers[dep] = filename
41
+ elsif line =~ /^[ \t]*module[ \t]+(\w+)/
42
+ dep = "module:#{$1}"
43
+ default_providers[dep] = filename
44
+ end
45
+ end
46
+ end
47
+ end # files
48
+
49
+ default_providers.each do |dep, filename|
50
+ providers[dep] ||= filename
51
+ end
52
+
53
+ dependers.each do |filename, dependencies|
54
+ if dep = dependencies.find { |dep| ! providers.include? dep }
55
+ puts "\033[1m!NO HAY!\033[0m \033[1;31m#{dep}\033[0m"
56
+ raise "#{filename} could not find a provider for #{dep}"
57
+ else
58
+ app.files_dependencies filename => dependencies.map { |dep| providers[dep] }
59
+ end
60
+ end
61
+
62
+ unless debugger_cmds_output.empty?
63
+ File.open('debugger_cmds', 'w') do |file|
64
+ file.write "#------> Creado por el DBT <------#\n"
65
+ file.write debugger_cmds_output
66
+ end
67
+ end
68
+ end
69
+ end
70
+ end
@@ -1,3 +1,3 @@
1
1
  module DBT
2
- VERSION = '1.1.5'
2
+ VERSION = '1.2.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dbt
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.5
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Colin Thomas-Arnold <colinta@gmail.com>
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-02 00:00:00.000000000 Z
11
+ date: 2014-08-11 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: |
14
14
  == DBT (Dependencies and deBugging Tool)
@@ -31,12 +31,11 @@ executables: []
31
31
  extensions: []
32
32
  extra_rdoc_files: []
33
33
  files:
34
- - .gitignore
35
- - LICENSE
36
- - README.md
37
- - dbt.gemspec
38
- - lib/dbt.rb
34
+ - lib/dbt/android.rb
35
+ - lib/dbt/ios.rb
39
36
  - lib/dbt/version.rb
37
+ - lib/dbt.rb
38
+ - README.md
40
39
  homepage: https://github.com/colinta/dbt
41
40
  licenses:
42
41
  - BSD
@@ -57,7 +56,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
57
56
  version: '0'
58
57
  requirements: []
59
58
  rubyforge_project:
60
- rubygems_version: 2.0.14
59
+ rubygems_version: 2.0.3
61
60
  signing_key:
62
61
  specification_version: 4
63
62
  summary: Keep your Rakefile and debugger_cmds files short and consistent
data/.gitignore DELETED
@@ -1 +0,0 @@
1
- dbt-*.gem
data/LICENSE DELETED
@@ -1,26 +0,0 @@
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.
@@ -1,36 +0,0 @@
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)
15
-
16
- DBT is a tool that helps declare dependencies (+app.files_dependencies+) and
17
- assists with debugging in a RubyMotion project. It looks for 'break',
18
- 'requires', and 'provides' commands (it does a *teensy* bit of code analyzing to
19
- provide some defaults) to make your RubyMotion +Rakefile+ and +debugger_cmds+
20
- files short and consistent.
21
-
22
- To use, include this gem, and add +DBT.analyze(app)+ to your +Rakefile+ in the
23
- <tt>Motion::Project::App.setup</tt> block. In your source code you can add DBT
24
- commands and those will be translated into directives for
25
- +app.files_dependencies+ and +debugger_cmds+.
26
-
27
- Run +rake+ or <tt>rake debug=1</tt>, and off you go!
28
- DESC
29
-
30
- gem.summary = 'Keep your Rakefile and debugger_cmds files short and consistent'
31
- gem.homepage = 'https://github.com/colinta/dbt'
32
-
33
- gem.files = `git ls-files`.split($\)
34
- gem.require_paths = ['lib']
35
- gem.test_files = gem.files.grep(%r{^spec/})
36
- end