tool-shed 0.0.4
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.
- data/Gemfile +9 -0
- data/LICENSE +20 -0
- data/README.md +52 -0
- data/bin/as-asset-detector +16 -0
- data/bin/as-class-detector +16 -0
- data/bin/as-docp +16 -0
- data/bin/as-manifest +16 -0
- data/bin/as-style-detector +16 -0
- data/coverage/unit/index.html +330 -0
- data/coverage/unit/jquery-1.3.2.min.js +19 -0
- data/coverage/unit/jquery.tablesorter.min.js +15 -0
- data/coverage/unit/lib-hel-asdoc_package_rb.html +447 -0
- data/coverage/unit/lib-hel-manifest_rb.html +555 -0
- data/coverage/unit/lib-hel-opts-asdoc_package_opts_rb.html +195 -0
- data/coverage/unit/lib-hel-opts-manifest_opts_rb.html +195 -0
- data/coverage/unit/lib-hel-opts-tool_opts_rb.html +531 -0
- data/coverage/unit/lib-hel-opts-unused_class_opts_rb.html +207 -0
- data/coverage/unit/lib-hel-opts-unused_style_opts_rb.html +201 -0
- data/coverage/unit/lib-hel-project_tools_rb.html +423 -0
- data/coverage/unit/lib-hel-search_rb.html +363 -0
- data/coverage/unit/lib-hel-stripper_rb.html +357 -0
- data/coverage/unit/lib-hel-tool_rb.html +423 -0
- data/coverage/unit/lib-hel-unused_class_rb.html +675 -0
- data/coverage/unit/lib-hel-unused_style_rb.html +747 -0
- data/coverage/unit/lib-hel-version_rb.html +135 -0
- data/coverage/unit/lib-hel_tools_rb.html +165 -0
- data/coverage/unit/print.css +12 -0
- data/coverage/unit/rcov.js +42 -0
- data/coverage/unit/screen.css +270 -0
- data/coverage.data +0 -0
- data/lib/shed/asdoc_package.rb +64 -0
- data/lib/shed/manifest.rb +82 -0
- data/lib/shed/opts/asdoc_package_opts.rb +22 -0
- data/lib/shed/opts/manifest_opts.rb +22 -0
- data/lib/shed/opts/tool_opts.rb +114 -0
- data/lib/shed/opts/unused_asset_opts.rb +24 -0
- data/lib/shed/opts/unused_class_opts.rb +24 -0
- data/lib/shed/opts/unused_style_opts.rb +23 -0
- data/lib/shed/project_tools.rb +60 -0
- data/lib/shed/search.rb +50 -0
- data/lib/shed/stripper.rb +49 -0
- data/lib/shed/tool.rb +60 -0
- data/lib/shed/unused_asset.rb +68 -0
- data/lib/shed/unused_class.rb +102 -0
- data/lib/shed/unused_style.rb +114 -0
- data/lib/shed/version.rb +12 -0
- data/lib/tool_shed.rb +19 -0
- data/rakefile.rb +109 -0
- data/rdoc/classes/ASDocPackage.html +281 -0
- data/rdoc/classes/ASDocPackageOpts.html +204 -0
- data/rdoc/classes/Manifest.html +323 -0
- data/rdoc/classes/ManifestOpts.html +205 -0
- data/rdoc/classes/ProjectTools.html +302 -0
- data/rdoc/classes/Search.html +203 -0
- data/rdoc/classes/Stripper.html +223 -0
- data/rdoc/classes/Tool.html +313 -0
- data/rdoc/classes/ToolOpts.html +297 -0
- data/rdoc/classes/UnusedClass.html +258 -0
- data/rdoc/classes/UnusedClassOpts.html +206 -0
- data/rdoc/classes/UnusedStyle.html +277 -0
- data/rdoc/classes/UnusedStyleOpts.html +205 -0
- data/rdoc/created.rid +1 -0
- data/rdoc/files/LICENSE.html +129 -0
- data/rdoc/files/README_md.html +138 -0
- data/rdoc/files/lib/hel/asdoc_package_rb.html +107 -0
- data/rdoc/files/lib/hel/manifest_rb.html +107 -0
- data/rdoc/files/lib/hel/opts/asdoc_package_opts_rb.html +107 -0
- data/rdoc/files/lib/hel/opts/manifest_opts_rb.html +107 -0
- data/rdoc/files/lib/hel/opts/tool_opts_rb.html +114 -0
- data/rdoc/files/lib/hel/opts/unused_class_opts_rb.html +107 -0
- data/rdoc/files/lib/hel/opts/unused_style_opts_rb.html +107 -0
- data/rdoc/files/lib/hel/project_tools_rb.html +107 -0
- data/rdoc/files/lib/hel/search_rb.html +114 -0
- data/rdoc/files/lib/hel/stripper_rb.html +107 -0
- data/rdoc/files/lib/hel/tool_rb.html +107 -0
- data/rdoc/files/lib/hel/unused_class_rb.html +107 -0
- data/rdoc/files/lib/hel/unused_style_rb.html +107 -0
- data/rdoc/files/lib/hel/version_rb.html +107 -0
- data/rdoc/files/lib/hel_tools_rb.html +127 -0
- data/rdoc/fr_class_index.html +39 -0
- data/rdoc/fr_file_index.html +43 -0
- data/rdoc/fr_method_index.html +75 -0
- data/rdoc/index.html +24 -0
- data/rdoc/rdoc-style.css +208 -0
- data/test/fixtures/search/App.mxml +0 -0
- data/test/fixtures/search/hide/Hidden.as +0 -0
- data/test/fixtures/search/org/helvector/Main.as +0 -0
- data/test/fixtures/src/org/helvector/Helvector.as +16 -0
- data/test/fixtures/src/org/helvector/one/HelOne.as +14 -0
- data/test/fixtures/src/org/helvector/one/HelOneTwo.mxml +0 -0
- data/test/fixtures/src/org/helvector/one/package.asdoc +1 -0
- data/test/fixtures/src/org/helvector/package.asdoc +1 -0
- data/test/fixtures/src/org/helvector/three/HelThree.as +14 -0
- data/test/fixtures/src/org/helvector/three/package.asdoc +1 -0
- data/test/fixtures/src/org/helvector/two/HelTwo.as +14 -0
- data/test/fixtures/src/org/helvector/two/package.asdoc +1 -0
- data/test/fixtures/unused-asset/assets/css/referenced.css +0 -0
- data/test/fixtures/unused-asset/assets/css/un-referenced.css +0 -0
- data/test/fixtures/unused-asset/assets/fonts/referenced.otf +0 -0
- data/test/fixtures/unused-asset/assets/fonts/un-referenced.otf +0 -0
- data/test/fixtures/unused-asset/assets/img/referenced.jpg +0 -0
- data/test/fixtures/unused-asset/assets/img/referenced.png +0 -0
- data/test/fixtures/unused-asset/assets/img/un-referenced.jpg +0 -0
- data/test/fixtures/unused-asset/assets/img/un-referenced.png +0 -0
- data/test/fixtures/unused-asset/src/org/helvector/ToolShed.as +30 -0
- data/test/fixtures/unused-cla/link-report.xml +17 -0
- data/test/fixtures/unused-cla/manifest.xml +6 -0
- data/test/fixtures/unused-cla/src/Unused.as +0 -0
- data/test/fixtures/unused-cla/src/Used.as +0 -0
- data/test/fixtures/unused-css/css/styles.css +2 -0
- data/test/fixtures/unused-css/css-multiple/more.css +2 -0
- data/test/fixtures/unused-css/css-multiple/styles.css +2 -0
- data/test/fixtures/unused-css/css-with-comments/commented.css +6 -0
- data/test/fixtures/unused-css/src/CSSApp.mxml +5 -0
- data/test/test_helper.rb +9 -0
- data/test/unit/test_asdoc_package.rb +72 -0
- data/test/unit/test_asdoc_package_opts.rb +28 -0
- data/test/unit/test_manifest.rb +53 -0
- data/test/unit/test_manifest_opts.rb +28 -0
- data/test/unit/test_search.rb +67 -0
- data/test/unit/test_source_tools.rb +97 -0
- data/test/unit/test_stripper.rb +56 -0
- data/test/unit/test_tool.rb +73 -0
- data/test/unit/test_tool_opts.rb +81 -0
- data/test/unit/test_unused_asset.rb +59 -0
- data/test/unit/test_unused_asset_opts.rb +32 -0
- data/test/unit/test_unused_class.rb +50 -0
- data/test/unit/test_unused_class_opts.rb +32 -0
- data/test/unit/test_unused_style.rb +103 -0
- data/test/unit/test_unused_style_opts.rb +31 -0
- data/tool-shed-0.0.3.gem +0 -0
- data/tool-shed.gemspec +41 -0
- metadata +265 -0
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
|
|
3
|
+
#
|
|
4
|
+
# Detects styles that are not used in a Flex application.
|
|
5
|
+
#
|
|
6
|
+
# This needs to be provided with a source directory to search for used styles,
|
|
7
|
+
# and a directory containing css files which will be loaded and parsed for
|
|
8
|
+
# style definitions.
|
|
9
|
+
#
|
|
10
|
+
# NOTE: This tool needs further work before it can be considerd to cover all
|
|
11
|
+
# use cases.
|
|
12
|
+
#
|
|
13
|
+
class UnusedStyle < Tool
|
|
14
|
+
attr_reader :report,
|
|
15
|
+
:declared,
|
|
16
|
+
:used,
|
|
17
|
+
:unused,
|
|
18
|
+
:undeclared
|
|
19
|
+
|
|
20
|
+
def initialize(opt,out=STDOUT)
|
|
21
|
+
super(opt,out)
|
|
22
|
+
|
|
23
|
+
@css_dir = opt[:css_dir]
|
|
24
|
+
|
|
25
|
+
@style_regex = /styleName\s*=\s*["']\s*\{?\s*([\w.]+)\s*\}?\s*["']/
|
|
26
|
+
@declared_regex = /^\.(\w+)/
|
|
27
|
+
|
|
28
|
+
@declared, @used, @unused, @undeclared = []
|
|
29
|
+
|
|
30
|
+
unless valid_opts
|
|
31
|
+
@out.puts "#{INVALID_OPTS} The directory specified as containging css files does not exist, or does not contain css files."
|
|
32
|
+
return
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
detect
|
|
36
|
+
|
|
37
|
+
@report = describe
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def valid_opts
|
|
41
|
+
return false unless File.exist?(@css_dir)
|
|
42
|
+
|
|
43
|
+
found = Dir.chdir("#{@css_dir}") do |d|
|
|
44
|
+
Dir.glob('*.css')
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
found.length > 0
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def detect
|
|
51
|
+
@declared = scan_dirs(/\.(css)/, @css_dir, @declared_regex)
|
|
52
|
+
@used = scan_dirs(/\.(as|mxml)/, @src, @style_regex)
|
|
53
|
+
|
|
54
|
+
#Find any style names used in the source which haven't been declared.
|
|
55
|
+
@undeclared = @used-@declared
|
|
56
|
+
|
|
57
|
+
#Find any style names declared in the css but not used in the src.
|
|
58
|
+
@unused = @declared-@used
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
private
|
|
62
|
+
|
|
63
|
+
#
|
|
64
|
+
# Returns a string detailing the findings of the style detection.
|
|
65
|
+
#
|
|
66
|
+
def describe
|
|
67
|
+
desc = "#{generated_at}"
|
|
68
|
+
desc << add_desc("declared in CSS", @declared)
|
|
69
|
+
desc << add_desc("used in MXML",@used)
|
|
70
|
+
desc << add_desc("declared but not used (in a styleName property)",@unused)
|
|
71
|
+
desc << add_desc("used but not declared",@undeclared)
|
|
72
|
+
desc
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
#
|
|
76
|
+
# Prints a description category.
|
|
77
|
+
#
|
|
78
|
+
def add_desc(txt,list)
|
|
79
|
+
d = "\nStyles #{txt}: #{list.length.to_s}\n"
|
|
80
|
+
d << list.join("\n") unless list.empty?
|
|
81
|
+
d
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
#
|
|
85
|
+
# Scans directories for all files that match the file extension regex, and
|
|
86
|
+
# for each match goes on to scan that document for items matching the syntax
|
|
87
|
+
# regex.
|
|
88
|
+
#
|
|
89
|
+
def scan_dirs(extension_regex,path,syntax_regex)
|
|
90
|
+
d = []
|
|
91
|
+
|
|
92
|
+
Search.find_all(extension_regex,path,@excludes) do |path|
|
|
93
|
+
d << scan_doc(path,syntax_regex)
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
d.flatten!.sort!.uniq! unless d.empty?
|
|
97
|
+
d
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
#
|
|
101
|
+
# Opens the document specified by path and returns a list of all first capture
|
|
102
|
+
# group matches, after stripping comments.
|
|
103
|
+
#
|
|
104
|
+
def scan_doc(path,regex)
|
|
105
|
+
n = []
|
|
106
|
+
f = File.open(path,"r").read.strip
|
|
107
|
+
f = Stripper.comments(f)
|
|
108
|
+
f.scan(regex) do |style_name|
|
|
109
|
+
n << $1
|
|
110
|
+
end
|
|
111
|
+
n
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
end
|
data/lib/shed/version.rb
ADDED
data/lib/tool_shed.rb
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
|
|
3
|
+
require 'shed/tool'
|
|
4
|
+
require 'shed/opts/tool_opts'
|
|
5
|
+
|
|
6
|
+
require 'shed/asdoc_package'
|
|
7
|
+
require 'shed/manifest'
|
|
8
|
+
require 'shed/opts/asdoc_package_opts'
|
|
9
|
+
require 'shed/opts/manifest_opts'
|
|
10
|
+
require 'shed/opts/unused_asset_opts'
|
|
11
|
+
require 'shed/opts/unused_class_opts'
|
|
12
|
+
require 'shed/opts/unused_style_opts'
|
|
13
|
+
require 'shed/project_tools'
|
|
14
|
+
require 'shed/search'
|
|
15
|
+
require 'shed/stripper'
|
|
16
|
+
require 'shed/unused_asset'
|
|
17
|
+
require 'shed/unused_class'
|
|
18
|
+
require 'shed/unused_style'
|
|
19
|
+
require 'shed/version'
|
data/rakefile.rb
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
|
|
2
|
+
require 'bundler'
|
|
3
|
+
|
|
4
|
+
Bundler.require
|
|
5
|
+
|
|
6
|
+
require 'rake/clean'
|
|
7
|
+
require 'rake/testtask'
|
|
8
|
+
require 'rake/rdoctask'
|
|
9
|
+
|
|
10
|
+
require File.dirname(__FILE__) + '/lib/shed/version'
|
|
11
|
+
|
|
12
|
+
Rake::RDocTask.new do |rdoc|
|
|
13
|
+
rdoc.title = " ActionScript Tools v.#{ToolShed::VERSION::STRING}"
|
|
14
|
+
rdoc.rdoc_dir = 'rdoc'
|
|
15
|
+
rdoc.main = "ToolShed::ToolShed"
|
|
16
|
+
rdoc.rdoc_files.include("README.md", "LICENSE", "lib/**/*.rb")
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
CLEAN.add('rdoc')
|
|
20
|
+
|
|
21
|
+
namespace :test do
|
|
22
|
+
Rake::TestTask.new(:units) do |test|
|
|
23
|
+
test.libs << "test"
|
|
24
|
+
test.test_files = Dir["test/unit/test_*.rb"]
|
|
25
|
+
test.verbose = true
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# Thanks to Project Sprouts and Luke Bayes for the coverage, flog
|
|
29
|
+
# and flay tasks below.
|
|
30
|
+
#
|
|
31
|
+
namespace :coverage do
|
|
32
|
+
desc "Delete aggregate coverage data."
|
|
33
|
+
task(:clean) { rm_f "coverage.data" }
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
# Apparently, rcov does not work on Windows or Ubuntu?
|
|
37
|
+
# Hide these tasks so that we can at least
|
|
38
|
+
# run the others...
|
|
39
|
+
if(RUBY_PLATFORM =~ /darwin/i)
|
|
40
|
+
require 'rcov/rcovtask'
|
|
41
|
+
|
|
42
|
+
CLEAN.add('coverage.data')
|
|
43
|
+
CLEAN.add('coverage')
|
|
44
|
+
|
|
45
|
+
# Hold collection in case we need it:
|
|
46
|
+
#%w[unit functional integration].each do |target|
|
|
47
|
+
%w[unit].each do |target|
|
|
48
|
+
namespace :coverage do
|
|
49
|
+
Rcov::RcovTask.new(target) do |t|
|
|
50
|
+
t.libs = ["lib", "test"]
|
|
51
|
+
t.test_files = FileList["test/#{target}/**/test_*.rb"]
|
|
52
|
+
t.output_dir = "coverage/#{target}"
|
|
53
|
+
t.verbose = true
|
|
54
|
+
t.rcov_opts = ["--sort coverage",
|
|
55
|
+
"--aggregate coverage.data",
|
|
56
|
+
"--exclude .bundle",
|
|
57
|
+
"--exclude .gem",
|
|
58
|
+
"--exclude errors.rb",
|
|
59
|
+
"--exclude progress_bar.rb"]
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
task :coverage => "test:coverage:#{target}"
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
namespace :torture do
|
|
67
|
+
desc "Flog the Sprouts"
|
|
68
|
+
task :flog do
|
|
69
|
+
puts "--------------------------"
|
|
70
|
+
puts "Flog Report:"
|
|
71
|
+
message =<<EOM
|
|
72
|
+
According to Jake Scruggs at http://bit.ly/3QrvW a
|
|
73
|
+
method average score of:
|
|
74
|
+
|
|
75
|
+
Score Means
|
|
76
|
+
0-10 Awesome
|
|
77
|
+
11-20 Good enough
|
|
78
|
+
21-40 Might need refactoring
|
|
79
|
+
41-60 Possible to justify
|
|
80
|
+
61-100 Danger
|
|
81
|
+
100-200 Whoop, whoop, whoop
|
|
82
|
+
200 + Someone please think of the children
|
|
83
|
+
EOM
|
|
84
|
+
puts message
|
|
85
|
+
puts ""
|
|
86
|
+
|
|
87
|
+
sh "find lib -name '*.rb' | xargs flog"
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
desc "Flay the Sprouts"
|
|
91
|
+
task :flay do
|
|
92
|
+
puts "--------------------------"
|
|
93
|
+
puts "Flay Report:"
|
|
94
|
+
sh "flay lib/**/*.rb"
|
|
95
|
+
end
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
desc "Run all tortuous reports"
|
|
99
|
+
task :torture => ['torture:flog', 'torture:flay']
|
|
100
|
+
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
task :test => 'test:units'
|
|
104
|
+
|
|
105
|
+
desc "Default"
|
|
106
|
+
task :default => [:test]
|
|
107
|
+
|
|
108
|
+
desc "Run all tests and reports"
|
|
109
|
+
task :cruise => [:test, 'test:coverage', 'test:torture']
|
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
2
|
+
<!DOCTYPE html
|
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
5
|
+
|
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
|
7
|
+
<head>
|
|
8
|
+
<title>Class: ASDocPackage</title>
|
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
|
10
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
|
11
|
+
<link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
|
|
12
|
+
<script type="text/javascript">
|
|
13
|
+
// <![CDATA[
|
|
14
|
+
|
|
15
|
+
function popupCode( url ) {
|
|
16
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function toggleCode( id ) {
|
|
20
|
+
if ( document.getElementById )
|
|
21
|
+
elem = document.getElementById( id );
|
|
22
|
+
else if ( document.all )
|
|
23
|
+
elem = eval( "document.all." + id );
|
|
24
|
+
else
|
|
25
|
+
return false;
|
|
26
|
+
|
|
27
|
+
elemStyle = elem.style;
|
|
28
|
+
|
|
29
|
+
if ( elemStyle.display != "block" ) {
|
|
30
|
+
elemStyle.display = "block"
|
|
31
|
+
} else {
|
|
32
|
+
elemStyle.display = "none"
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return true;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// Make codeblocks hidden by default
|
|
39
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
|
40
|
+
|
|
41
|
+
// ]]>
|
|
42
|
+
</script>
|
|
43
|
+
|
|
44
|
+
</head>
|
|
45
|
+
<body>
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
<div id="classHeader">
|
|
50
|
+
<table class="header-table">
|
|
51
|
+
<tr class="top-aligned-row">
|
|
52
|
+
<td><strong>Class</strong></td>
|
|
53
|
+
<td class="class-name-in-header">ASDocPackage</td>
|
|
54
|
+
</tr>
|
|
55
|
+
<tr class="top-aligned-row">
|
|
56
|
+
<td><strong>In:</strong></td>
|
|
57
|
+
<td>
|
|
58
|
+
<a href="../files/lib/hel/asdoc_package_rb.html">
|
|
59
|
+
lib/hel/asdoc_package.rb
|
|
60
|
+
</a>
|
|
61
|
+
<br />
|
|
62
|
+
</td>
|
|
63
|
+
</tr>
|
|
64
|
+
|
|
65
|
+
<tr class="top-aligned-row">
|
|
66
|
+
<td><strong>Parent:</strong></td>
|
|
67
|
+
<td>
|
|
68
|
+
<a href="Tool.html">
|
|
69
|
+
Tool
|
|
70
|
+
</a>
|
|
71
|
+
</td>
|
|
72
|
+
</tr>
|
|
73
|
+
</table>
|
|
74
|
+
</div>
|
|
75
|
+
<!-- banner header -->
|
|
76
|
+
|
|
77
|
+
<div id="bodyContent">
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
<div id="contextContent">
|
|
82
|
+
|
|
83
|
+
<div id="description">
|
|
84
|
+
<p>
|
|
85
|
+
Reads ’.asdoc’ files from a specified source tree and
|
|
86
|
+
concatencates them into a xml configuration file that can be used to
|
|
87
|
+
generate ActionScript documentation for the Actionscript packages.
|
|
88
|
+
</p>
|
|
89
|
+
|
|
90
|
+
</div>
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
</div>
|
|
94
|
+
|
|
95
|
+
<div id="method-list">
|
|
96
|
+
<h3 class="section-bar">Methods</h3>
|
|
97
|
+
|
|
98
|
+
<div class="name-list">
|
|
99
|
+
<a href="#M000008">build</a>
|
|
100
|
+
<a href="#M000009">create_xml</a>
|
|
101
|
+
<a href="#M000006">new</a>
|
|
102
|
+
<a href="#M000007">scan</a>
|
|
103
|
+
</div>
|
|
104
|
+
</div>
|
|
105
|
+
|
|
106
|
+
</div>
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
<!-- if includes -->
|
|
110
|
+
|
|
111
|
+
<div id="section">
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
<div id="attribute-list">
|
|
118
|
+
<h3 class="section-bar">Attributes</h3>
|
|
119
|
+
|
|
120
|
+
<div class="name-list">
|
|
121
|
+
<table>
|
|
122
|
+
<tr class="top-aligned-row context-row">
|
|
123
|
+
<td class="context-item-name">xml</td>
|
|
124
|
+
<td class="context-item-value"> [R] </td>
|
|
125
|
+
<td class="context-item-desc"></td>
|
|
126
|
+
</tr>
|
|
127
|
+
</table>
|
|
128
|
+
</div>
|
|
129
|
+
</div>
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
<!-- if method_list -->
|
|
134
|
+
<div id="methods">
|
|
135
|
+
<h3 class="section-bar">Public Class methods</h3>
|
|
136
|
+
|
|
137
|
+
<div id="method-M000006" class="method-detail">
|
|
138
|
+
<a name="M000006"></a>
|
|
139
|
+
|
|
140
|
+
<div class="method-heading">
|
|
141
|
+
<a href="#M000006" class="method-signature">
|
|
142
|
+
<span class="method-name">new</span><span class="method-args">(opt,out=STDOUT)</span>
|
|
143
|
+
</a>
|
|
144
|
+
</div>
|
|
145
|
+
|
|
146
|
+
<div class="method-description">
|
|
147
|
+
<p><a class="source-toggle" href="#"
|
|
148
|
+
onclick="toggleCode('M000006-source');return false;">[Source]</a></p>
|
|
149
|
+
<div class="method-source-code" id="M000006-source">
|
|
150
|
+
<pre>
|
|
151
|
+
<span class="ruby-comment cmt"># File lib/hel/asdoc_package.rb, line 11</span>
|
|
152
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">opt</span>,<span class="ruby-identifier">out</span>=<span class="ruby-constant">STDOUT</span>)
|
|
153
|
+
<span class="ruby-keyword kw">super</span>(<span class="ruby-identifier">opt</span>,<span class="ruby-identifier">out</span>)
|
|
154
|
+
|
|
155
|
+
<span class="ruby-ivar">@asdoc</span> = <span class="ruby-regexp re">/\.asdoc$/</span>
|
|
156
|
+
|
|
157
|
+
<span class="ruby-ivar">@header</span> = <span class="ruby-value str">"<?xml version='1.0' encoding='utf-8'?>\n<flex-config>\n\t<packages>"</span>
|
|
158
|
+
<span class="ruby-ivar">@package</span> = <span class="ruby-value str">"\t\t<package>\n\t\t\t<string>%s</string>\n\t\t\t<string><![CDATA[%s]]></string>\n\t\t</package>\n"</span>
|
|
159
|
+
<span class="ruby-ivar">@footer</span> = <span class="ruby-value str">"\t</packages>\n</flex-config>"</span>
|
|
160
|
+
|
|
161
|
+
<span class="ruby-identifier">build</span>
|
|
162
|
+
<span class="ruby-keyword kw">end</span>
|
|
163
|
+
</pre>
|
|
164
|
+
</div>
|
|
165
|
+
</div>
|
|
166
|
+
</div>
|
|
167
|
+
|
|
168
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
|
169
|
+
|
|
170
|
+
<div id="method-M000008" class="method-detail">
|
|
171
|
+
<a name="M000008"></a>
|
|
172
|
+
|
|
173
|
+
<div class="method-heading">
|
|
174
|
+
<a href="#M000008" class="method-signature">
|
|
175
|
+
<span class="method-name">build</span><span class="method-args">()</span>
|
|
176
|
+
</a>
|
|
177
|
+
</div>
|
|
178
|
+
|
|
179
|
+
<div class="method-description">
|
|
180
|
+
<p>
|
|
181
|
+
Build the flex compiler config file that can be passed to the asdoc tool.
|
|
182
|
+
</p>
|
|
183
|
+
<p><a class="source-toggle" href="#"
|
|
184
|
+
onclick="toggleCode('M000008-source');return false;">[Source]</a></p>
|
|
185
|
+
<div class="method-source-code" id="M000008-source">
|
|
186
|
+
<pre>
|
|
187
|
+
<span class="ruby-comment cmt"># File lib/hel/asdoc_package.rb, line 43</span>
|
|
188
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">build</span>
|
|
189
|
+
<span class="ruby-identifier">asdocs</span> = <span class="ruby-identifier">scan</span>(<span class="ruby-ivar">@src</span>)
|
|
190
|
+
|
|
191
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">asdocs</span>.<span class="ruby-identifier">empty?</span>
|
|
192
|
+
<span class="ruby-identifier">puts</span> <span class="ruby-value str">"No .asdoc files found."</span>
|
|
193
|
+
<span class="ruby-keyword kw">else</span>
|
|
194
|
+
<span class="ruby-ivar">@xml</span> = <span class="ruby-identifier">create_xml</span>(<span class="ruby-identifier">asdocs</span>)
|
|
195
|
+
<span class="ruby-identifier">to_disk</span>(<span class="ruby-ivar">@xml</span>)
|
|
196
|
+
<span class="ruby-keyword kw">end</span>
|
|
197
|
+
<span class="ruby-keyword kw">end</span>
|
|
198
|
+
</pre>
|
|
199
|
+
</div>
|
|
200
|
+
</div>
|
|
201
|
+
</div>
|
|
202
|
+
|
|
203
|
+
<div id="method-M000009" class="method-detail">
|
|
204
|
+
<a name="M000009"></a>
|
|
205
|
+
|
|
206
|
+
<div class="method-heading">
|
|
207
|
+
<a href="#M000009" class="method-signature">
|
|
208
|
+
<span class="method-name">create_xml</span><span class="method-args">(asdocs)</span>
|
|
209
|
+
</a>
|
|
210
|
+
</div>
|
|
211
|
+
|
|
212
|
+
<div class="method-description">
|
|
213
|
+
<p>
|
|
214
|
+
Constructs the flex complier config file when given a list of paths to
|
|
215
|
+
asdoc files.
|
|
216
|
+
</p>
|
|
217
|
+
<p><a class="source-toggle" href="#"
|
|
218
|
+
onclick="toggleCode('M000009-source');return false;">[Source]</a></p>
|
|
219
|
+
<div class="method-source-code" id="M000009-source">
|
|
220
|
+
<pre>
|
|
221
|
+
<span class="ruby-comment cmt"># File lib/hel/asdoc_package.rb, line 58</span>
|
|
222
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">create_xml</span>(<span class="ruby-identifier">asdocs</span>)
|
|
223
|
+
<span class="ruby-identifier">x</span> = <span class="ruby-ivar">@header</span>
|
|
224
|
+
<span class="ruby-identifier">asdocs</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">d</span><span class="ruby-operator">|</span> <span class="ruby-identifier">x</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">sprintf</span>(<span class="ruby-ivar">@package</span>, <span class="ruby-identifier">d</span>[<span class="ruby-identifier">:package</span>], <span class="ruby-constant">IO</span>.<span class="ruby-identifier">read</span>(<span class="ruby-identifier">d</span>[<span class="ruby-identifier">:path</span>])) }
|
|
225
|
+
<span class="ruby-identifier">x</span> <span class="ruby-operator"><<</span> <span class="ruby-ivar">@footer</span>
|
|
226
|
+
<span class="ruby-identifier">x</span>
|
|
227
|
+
<span class="ruby-keyword kw">end</span>
|
|
228
|
+
</pre>
|
|
229
|
+
</div>
|
|
230
|
+
</div>
|
|
231
|
+
</div>
|
|
232
|
+
|
|
233
|
+
<div id="method-M000007" class="method-detail">
|
|
234
|
+
<a name="M000007"></a>
|
|
235
|
+
|
|
236
|
+
<div class="method-heading">
|
|
237
|
+
<a href="#M000007" class="method-signature">
|
|
238
|
+
<span class="method-name">scan</span><span class="method-args">(path)</span>
|
|
239
|
+
</a>
|
|
240
|
+
</div>
|
|
241
|
+
|
|
242
|
+
<div class="method-description">
|
|
243
|
+
<p>
|
|
244
|
+
Scan the given path and it‘s child directories for all .asdoc files.
|
|
245
|
+
</p>
|
|
246
|
+
<p><a class="source-toggle" href="#"
|
|
247
|
+
onclick="toggleCode('M000007-source');return false;">[Source]</a></p>
|
|
248
|
+
<div class="method-source-code" id="M000007-source">
|
|
249
|
+
<pre>
|
|
250
|
+
<span class="ruby-comment cmt"># File lib/hel/asdoc_package.rb, line 26</span>
|
|
251
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">scan</span>(<span class="ruby-identifier">path</span>)
|
|
252
|
+
<span class="ruby-identifier">puts</span> <span class="ruby-node">"Scanning '#{path}' for asdoc files..."</span>
|
|
253
|
+
|
|
254
|
+
<span class="ruby-identifier">found</span> = []
|
|
255
|
+
|
|
256
|
+
<span class="ruby-constant">Search</span>.<span class="ruby-identifier">find_all</span>(<span class="ruby-ivar">@asdoc</span>,<span class="ruby-identifier">path</span>,<span class="ruby-ivar">@excludes</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">p</span><span class="ruby-operator">|</span>
|
|
257
|
+
<span class="ruby-identifier">found</span> <span class="ruby-operator"><<</span> {<span class="ruby-identifier">:path</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">p</span>, <span class="ruby-identifier">:package</span> =<span class="ruby-operator">></span> <span class="ruby-constant">ProjectTools</span>.<span class="ruby-identifier">package</span>(<span class="ruby-identifier">p</span>)}
|
|
258
|
+
<span class="ruby-keyword kw">end</span>
|
|
259
|
+
|
|
260
|
+
<span class="ruby-identifier">found</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">f</span><span class="ruby-operator">|</span> <span class="ruby-identifier">log</span>(<span class="ruby-node">"Adding #{f[:path]}"</span>) }
|
|
261
|
+
|
|
262
|
+
<span class="ruby-identifier">found</span>
|
|
263
|
+
<span class="ruby-keyword kw">end</span>
|
|
264
|
+
</pre>
|
|
265
|
+
</div>
|
|
266
|
+
</div>
|
|
267
|
+
</div>
|
|
268
|
+
|
|
269
|
+
|
|
270
|
+
</div>
|
|
271
|
+
|
|
272
|
+
|
|
273
|
+
</div>
|
|
274
|
+
|
|
275
|
+
|
|
276
|
+
<div id="validator-badges">
|
|
277
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
|
278
|
+
</div>
|
|
279
|
+
|
|
280
|
+
</body>
|
|
281
|
+
</html>
|