analizaruptor 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +26 -0
- data/README.md +14 -0
- data/analizaruptor.gemspec +35 -0
- data/lib/analizaruptor.rb +60 -0
- data/lib/analizaruptor/version.rb +3 -0
- metadata +102 -0
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 Analizaruptor Project.
|
data/README.md
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
Analizaruptor
|
2
|
+
-------------
|
3
|
+
|
4
|
+
Analizaruptor is a tool that looks 'require', and 'provides' commands (and does
|
5
|
+
a *teensy* bit of code analyzing (`/(class|module)\s*(\w`)/`) to provide some
|
6
|
+
defaults) to make your RubyMotion `Rakefile` and `debugger_cmds` files short and
|
7
|
+
consistent.
|
8
|
+
|
9
|
+
To use, include this gem, and add `app.analyze` to your `Rakefile`, after you
|
10
|
+
have added your libraries and whatnot. In your source code you can add
|
11
|
+
Analizaruptor commands (`#----> break|provides|requires`) and those will be
|
12
|
+
translated into directives for `app.files_dependencies` and `debugger_cmds`.
|
13
|
+
|
14
|
+
Run `rake` or `rake debug=1`, and off you go!
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/analizaruptor/version.rb', __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
gem.name = 'analizaruptor'
|
6
|
+
gem.version = Analizaruptor::VERSION
|
7
|
+
gem.email = 'colinta@gmail.com'
|
8
|
+
|
9
|
+
gem.authors = ['Colin Thomas-Arnold <colinta@gmail.com>']
|
10
|
+
|
11
|
+
gem.description = <<-DESC
|
12
|
+
Analizaruptor is a tool that looks 'require', and 'provides' commands (and does
|
13
|
+
a *teensy* bit of code analyzing (+/(class|module)\s*(\w+)/+) to provide some
|
14
|
+
defaults) to make your RubyMotion +Rakefile+ and +debugger_cmds+ files short and
|
15
|
+
consistent.
|
16
|
+
|
17
|
+
To use, include this gem, and add +app.analyze+ to your +Rakefile+, after you
|
18
|
+
have added your libraries and whatnot. In your source code you can add
|
19
|
+
Analizaruptor commands (+#----> break|provides|requires+) and those will be
|
20
|
+
translated into directives for `app.files_dependencies` and `debugger_cmds`.
|
21
|
+
|
22
|
+
Run +rake+ or +rake debug=1+, and off you go!
|
23
|
+
DESC
|
24
|
+
|
25
|
+
gem.summary = 'Keep your Rakefile and debugger_cmds files short and consistent'
|
26
|
+
gem.homepage = 'https://github.com/colinta/analizaruptor'
|
27
|
+
|
28
|
+
gem.files = `git ls-files`.split($\)
|
29
|
+
gem.require_paths = ['lib']
|
30
|
+
gem.test_files = gem.files.grep(%r{^spec/})
|
31
|
+
|
32
|
+
gem.add_dependency 'rake'
|
33
|
+
gem.add_development_dependency 'rspec'
|
34
|
+
|
35
|
+
end
|
@@ -0,0 +1,60 @@
|
|
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
|
+
matched = false
|
12
|
+
|
13
|
+
File.open(filename, 'r') do |file|
|
14
|
+
file.each_line do |line|
|
15
|
+
if line =~ /^#--+>/
|
16
|
+
matched = true
|
17
|
+
|
18
|
+
command, dep = line.rstrip.sub(/^#--+> */, '').split(' ', 2)
|
19
|
+
case command
|
20
|
+
when 'break'
|
21
|
+
dep ||= file.lineno + 1
|
22
|
+
debugger_cmds_output += "break #{File.basename filename}:#{dep}\n"
|
23
|
+
when 'provides'
|
24
|
+
if providers.key? dep
|
25
|
+
puts "\033[1m¡HAY DEMASIADOS!\033[0m \033[1;31m#{dep}\033[0m"
|
26
|
+
end
|
27
|
+
providers[dep] = filename
|
28
|
+
when 'requires'
|
29
|
+
dependers[filename] << dep
|
30
|
+
else
|
31
|
+
puts "\033[1m¡NO COMPRENDO!\033[0m \"#{command} #{dep}\""
|
32
|
+
puts "\033[1;31m#{filename}:#{file.lineno}\033[0m"
|
33
|
+
end
|
34
|
+
elsif line =~ /^\s*class\s+(\w+)/
|
35
|
+
dep = "class:#{$1}"
|
36
|
+
providers[dep] = filename
|
37
|
+
elsif line =~ /^\s*module\s+(\w+)/
|
38
|
+
dep = "module:#{$1}"
|
39
|
+
providers[dep] = filename
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end # files
|
44
|
+
|
45
|
+
dependers.each do |filename, dependencies|
|
46
|
+
if dep = dependencies.find { |dep| ! providers.include? dep }
|
47
|
+
puts "\033[1m¡NO HAY!\033[0m \033[1;31m#{dep}\033[0m"
|
48
|
+
raise "Could not find a provider for #{dep}"
|
49
|
+
else
|
50
|
+
self.files_dependencies filename => dependencies.map{|dep| providers[dep] }
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
unless debugger_cmds_output.empty?
|
55
|
+
File.open('debugger_cmds', 'w') do |file|
|
56
|
+
file.write debugger_cmds_output
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
metadata
ADDED
@@ -0,0 +1,102 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: analizaruptor
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Colin Thomas-Arnold <colinta@gmail.com>
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-10-31 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rake
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: rspec
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
type: :development
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
description: ! 'Analizaruptor is a tool that looks ''require'', and ''provides'' commands
|
47
|
+
(and does
|
48
|
+
|
49
|
+
a *teensy* bit of code analyzing (+/(class|module) *(w+)/+) to provide some
|
50
|
+
|
51
|
+
defaults) to make your RubyMotion +Rakefile+ and +debugger_cmds+ files short and
|
52
|
+
|
53
|
+
consistent.
|
54
|
+
|
55
|
+
|
56
|
+
To use, include this gem, and add +app.analyze+ to your +Rakefile+, after you
|
57
|
+
|
58
|
+
have added your libraries and whatnot. In your source code you can add
|
59
|
+
|
60
|
+
Analizaruptor commands (+#----> break|provides|requires+) and those will be
|
61
|
+
|
62
|
+
translated into directives for `app.files_dependencies` and `debugger_cmds`.
|
63
|
+
|
64
|
+
|
65
|
+
Run +rake+ or +rake debug=1+, and off you go!
|
66
|
+
|
67
|
+
'
|
68
|
+
email: colinta@gmail.com
|
69
|
+
executables: []
|
70
|
+
extensions: []
|
71
|
+
extra_rdoc_files: []
|
72
|
+
files:
|
73
|
+
- LICENSE
|
74
|
+
- README.md
|
75
|
+
- analizaruptor.gemspec
|
76
|
+
- lib/analizaruptor.rb
|
77
|
+
- lib/analizaruptor/version.rb
|
78
|
+
homepage: https://github.com/colinta/analizaruptor
|
79
|
+
licenses: []
|
80
|
+
post_install_message:
|
81
|
+
rdoc_options: []
|
82
|
+
require_paths:
|
83
|
+
- lib
|
84
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
85
|
+
none: false
|
86
|
+
requirements:
|
87
|
+
- - ! '>='
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
91
|
+
none: false
|
92
|
+
requirements:
|
93
|
+
- - ! '>='
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: '0'
|
96
|
+
requirements: []
|
97
|
+
rubyforge_project:
|
98
|
+
rubygems_version: 1.8.24
|
99
|
+
signing_key:
|
100
|
+
specification_version: 3
|
101
|
+
summary: Keep your Rakefile and debugger_cmds files short and consistent
|
102
|
+
test_files: []
|