asrake 0.10.0 → 0.11.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -81,6 +81,22 @@ ASRake::CompcTask.new :build, args do |compc|
81
81
  end
82
82
  ```
83
83
 
84
+ ### Include ASDoc in a SWC
85
+
86
+ If you are compiling with `CompcArgs` or a `CompcTask`, you can set the field `include_asdoc` to have documentation added to your swc
87
+
88
+ ```ruby
89
+ desc "Build swc"
90
+ ASRake::CompcTask.new :build do |build|
91
+ build.target_player = 11.0
92
+ build.output = "bin/bin/my_project.swc"
93
+ build.debug = true
94
+ build.source_path << "bin/src"
95
+ build.statically_link_only_referenced_classes << "lib/lib_used_in_project.swc"
96
+ build.include_asdoc = true
97
+ end
98
+ ```
99
+
84
100
  ### Build an AIR
85
101
 
86
102
  Compile your SWF file as normal, but set the `isAIR` property to true
@@ -142,24 +158,6 @@ namespace :version do
142
158
  end
143
159
  ```
144
160
 
145
- ### Clean
146
-
147
- ```
148
- ASRake::CleanTask.new(*compiler_args)
149
- ```
150
-
151
- Provide your compiler arguments to `ASRake::CleanTask` and it will automatically create clean and clobber tasks.
152
-
153
- ```ruby
154
- swf = ASRake::MxmlcTask.new :build do |build|
155
- build.load_config << "mxmlc_config.xml"
156
- build.output = "bin/my_app.swf"
157
- build.isAIR = true
158
- end
159
-
160
- ASRake::CleanTask.new swf
161
- ```
162
-
163
161
  Additional Functionality
164
162
  ------------------------
165
163
 
data/lib/asrake/asdoc.rb CHANGED
@@ -6,25 +6,19 @@ require 'nokogiri'
6
6
  module ASRake
7
7
  class Asdoc
8
8
 
9
- attr_accessor :output
9
+ attr_accessor :additional_args
10
10
 
11
+ # we have some special handling of this
11
12
  attr_accessor :doc_sources
12
- attr_accessor :doc_classes
13
- attr_accessor :doc_namespaces
14
- attr_accessor :source_path
15
- attr_accessor :library_path
16
-
17
- attr_accessor :load_config
18
- #
19
- # The path to the ASDoc template directory. The default is the asdoc/templates directory in the ASDoc
20
- # installation directory. This directory contains all the HTML, CSS, XSL, and image files used for
21
- # generating the output.
22
- #
23
- attr_accessor :templates_path
24
-
25
- attr_accessor :additional_args
26
13
 
27
14
  @@compiler_args = [
15
+ [:source_path, :dirs],
16
+ [:load_config, :dirs],
17
+ [:library_path, :dirs],
18
+ [:namespace, :string],
19
+ #
20
+ # The output directory for the generated documentation. The default value is "asdoc-output".
21
+ #
28
22
  [:output, :dir],
29
23
  #
30
24
  # When true, retain the intermediate XML files created by the ASDoc tool. The default value is false.
@@ -45,11 +39,73 @@ class Asdoc
45
39
  # All errors are written to the validation_errors.log file.
46
40
  #
47
41
  [:lenient, :bool],
48
- [:source_path, :array],
49
- [:load_config, :array],
50
- [:library_path, :array],
42
+ #
43
+ # The path to the ASDoc template directory. The default is the asdoc/templates directory in the ASDoc
44
+ # installation directory. This directory contains all the HTML, CSS, XSL, and image files used for
45
+ # generating the output.
46
+ #
47
+ [:templates_path, :dir],
48
+ #
49
+ # A list of classes to document. These classes must be in the source path. This is the default option.
50
+ # This option works the same way as does the -include-classes option for the compc component compiler.
51
+ #
51
52
  [:doc_classes, :array],
53
+ #
54
+ # A list of classes not documented. You must specify individual class names.
55
+ # Alternatively, if the ASDoc comment for the class contains the @private tag, is not documented.
56
+ #
57
+ [:exclude_classes, :array],
58
+ #
59
+ # A list of URIs to document. The classes must be in the source path.
60
+ # You must include a URI and the location of the manifest file that defines the contents of this namespace.
61
+ # This option works the same way as does the -include-namespaces option for the compc component compiler.
62
+ #
52
63
  [:doc_namespaces, :array],
64
+ #
65
+ # Specifies the location of the include examples used by the @includeExample tag. This option specifies the
66
+ # root directory. The examples must be located under this directory in subdirectories that correspond to the
67
+ # package name of the class. For example, you specify the examples-path as c:\myExamples. For a class in the
68
+ # package myComp.myClass, the example must be in the directory c:\myExamples\myComp.myClass.
69
+ #
70
+ [:examples_path, :dir],
71
+ #
72
+ # The text that appears at the bottom of the HTML pages in the output documentation.
73
+ #
74
+ [:footer, :string],
75
+ #
76
+ # The text that appears in the browser window in the output documentation.
77
+ # The default value is "API Documentation".
78
+ #
79
+ [:window_title, :string],
80
+ #
81
+ # An integer that changes the width of the left frameset of the documentation. You can change this
82
+ # size to accommodate the length of your package names.
83
+ # The default value is 210 pixels.
84
+ #
85
+ [:left_frameset_width, :string],
86
+ #
87
+ # The text that appears at the top of the HTML pages in the output documentation.
88
+ # The default value is "API Documentation".
89
+ #
90
+ [:main_title, :string],
91
+ #
92
+ # The descriptions to use when describing a package in the documentation.
93
+ # You can specify more than one package option.
94
+ # The following example adds two package descriptions to the output:
95
+ # asdoc = ASRake::Asdoc.new
96
+ # asdoc.package << 'com.my.business "Contains business classes and interfaces"'
97
+ # asdoc.package << 'com.my.commands "Contains command base classes and interfaces"'
98
+ [:package, :array],
99
+ #
100
+ # Specifies an XML file containing the package descriptions.
101
+ #
102
+ [:package_description_file, :dir],
103
+ #
104
+ # Disable strict compilation mode. By default, classes that do not define constructors, or contain methods
105
+ # that do not define return values cause compiler failures. If necessary, set strict to false to override
106
+ # this default and continue compilation.
107
+ #
108
+ [:strict, :bool]
53
109
  ]
54
110
 
55
111
  @@compiler_args.each do |name, type|
@@ -57,19 +113,25 @@ class Asdoc
57
113
  end
58
114
 
59
115
  def initialize
60
-
61
116
  # set all defaults
62
117
  @@compiler_args.each do |name, type|
63
- instance_variable_set("@#{name}", []) if type == :array
118
+ instance_variable_set("@#{name}", []) if type == :array || type == :dirs
64
119
  end
65
120
 
66
121
  @doc_sources = []
67
122
 
68
123
  yield self if block_given?
69
-
70
124
  end
71
125
 
72
- def execute
126
+ def add(args)
127
+ self.source_path << args.source_path
128
+ self.library_path << args.library_path
129
+ self.library_path << args.include_libraries
130
+ self.library_path << args.external_library_path
131
+ args.source_path.each { |p| self.doc_classes << ASRake::get_classes(p) } if args.kind_of? ASRake::CompcArguments_Module
132
+ end
133
+
134
+ def execute(&block)
73
135
  command = "#{FlexSDK::asdoc}"
74
136
 
75
137
  @@compiler_args.each do |name, type|
@@ -78,12 +140,19 @@ class Asdoc
78
140
  case type
79
141
  when :bool
80
142
  command << " -#{arg}=#{value}" if value
81
- when :array
143
+ when :dirs
82
144
  value.flatten!
83
- value = value.map{|s| s.index(' ') != nil ? "'#{s}'" : s} if value.length > 1
145
+ value.uniq!
146
+ value = value.map{|s| s.index(' ') != nil ? "\"#{s}\"" : s} if value.length > 1
84
147
  command << " -#{arg} #{cf value.join(' ')}" if !value.empty?
85
148
  when :dir
86
149
  command << " -#{arg}=#{cf value}" if value != nil
150
+ when :array
151
+ value.flatten!
152
+ value.uniq!
153
+ command << " -#{arg} #{value.join(' ')}" if !value.empty?
154
+ when :string
155
+ command << " -#{arg} #{value}" if value != nil
87
156
  else
88
157
  fail "unknown type #{type}"
89
158
  end
@@ -99,7 +168,8 @@ class Asdoc
99
168
 
100
169
  command << " #{additional_args}" if self.additional_args != nil
101
170
 
102
- run command
171
+ puts if !block_given?
172
+ run(command, true, &block)
103
173
  end
104
174
 
105
175
  end
@@ -115,7 +115,7 @@ module BaseCompilerArguments_Module
115
115
  end
116
116
 
117
117
  def to_s
118
- generate_args
118
+ @output
119
119
  end
120
120
 
121
121
  #
@@ -198,8 +198,11 @@ module BaseCompilerArguments_Module
198
198
 
199
199
  def build(tips=true)
200
200
  fail "Compiler not defined in #{self}" if compiler == nil
201
+ puts
201
202
  if tips
203
+ puts "> #{compiler}#{generate_args}"
202
204
  run "#{compiler}#{generate_args}" do |line|
205
+ puts "> #{line}"
203
206
  generate_error_message_tips(line)
204
207
  end
205
208
  else
@@ -23,6 +23,11 @@ module CompcArguments_Module
23
23
  return compc
24
24
  end
25
25
 
26
+ def merge_in(args)
27
+ super
28
+ self.include_asdoc = args.include_asdoc
29
+ end
30
+
26
31
  end
27
32
 
28
33
  class CompcArguments
@@ -48,30 +48,29 @@ class CompcTask < BaseCompilerTask
48
48
  if @include_asdoc
49
49
  file self.output do
50
50
  asdoc = ASRake::Asdoc.new
51
- asdoc.output = "#{self.output_dir}/.asrake/"
52
- asdoc.source_path = self.source_path
53
- asdoc.library_path = self.library_path
54
- asdoc.load_config = self.load_config
55
- self.source_path.each do |path|
56
- asdoc.doc_classes << ASRake::get_classes(path)
57
- end
51
+ asdoc.output = "#{self.output_dir}/.asrake_temp/"
52
+ asdoc.add(self)
58
53
  asdoc.keep_xml = true
59
54
  asdoc.skip_xsl = true
60
55
  asdoc.lenient = true
61
- asdoc.exclude_dependencies = true
62
- asdoc.execute
56
+ asdoc.execute { |line| }
63
57
 
64
58
  if output_is_dir?
65
59
  cp_r File.join(asdoc.output, 'tempdita'), File.join(self.output_dir, 'docs')
66
60
  else
67
61
  Zip::ZipFile.open(self.output) do |zipfile|
62
+ # remove any existing docs (eg, from -include-libraries linking a swc with asdoc)
63
+ begin
64
+ zipfile.remove('docs')
65
+ rescue
66
+ end
68
67
  FileList[File.join(asdoc.output, 'tempdita', '*')].each do |file|
69
68
  zipfile.add(File.join('docs', File.basename(file)), file)
70
69
  end
71
70
  end
72
71
  end
73
72
 
74
- rm_rf asdoc.output
73
+ rm_rf asdoc.output, :verbose => false
75
74
  end
76
75
  end
77
76
 
data/lib/asrake/host.rb CHANGED
@@ -16,10 +16,10 @@ end
16
16
  def run(command, abort_on_failure = true)
17
17
  command.strip!
18
18
 
19
- puts "> #{command}"
19
+ puts "> #{command}" if !block_given?
20
20
  IO.popen("#{command} 2>&1") do |proc|
21
21
  while !proc.closed? && (line = proc.gets)
22
- puts "> #{line}"
22
+ puts "> #{line}" if !block_given?
23
23
  yield line if block_given?
24
24
  end
25
25
  end
@@ -45,8 +45,13 @@ class VersionTask < Rake::TaskLib
45
45
  puts "Incremented version from #{@version} to #{save(@version.bump!(:revision))}"
46
46
  when ''
47
47
  puts "Current version is #{@version}"
48
+ puts "Version number format is Major.Minor.Revision (aka Major.Minor.Patch)"
49
+ puts "To increment the version, provide the respective part as an argument."
50
+ puts "rake #{@version_task}[major] => #{@version.bump(:major)}"
51
+ puts "rake #{@version_task}[minor] => #{@version.bump(:minor)}"
52
+ puts "rake #{@version_task}[revision] => #{@version.bump(:revision)}"
48
53
  else
49
- fail "Invalid version argument '#{args[:part]}', run 'rake #{@help_task}' for help."
54
+ fail "Invalid version argument '#{args[:part]}', run 'rake #{@version_task}' for help."
50
55
  end
51
56
  @sync_task.execute()
52
57
  end
@@ -60,17 +65,7 @@ class VersionTask < Rake::TaskLib
60
65
 
61
66
  #add to this task to perform some operation post-bump
62
67
  @sync_task = task :sync
63
-
64
- desc "Display help for version task"
65
- @help_task = task :help do
66
- puts "Version number format is Major.Minor.Revision (aka Major.Minor.Patch)"
67
- puts "To display the current version, run without arguments"
68
- puts "rake #{@version_task} => #{@version}"
69
- puts "To increment the version, provide the respective part as an argument."
70
- puts "rake #{@version_task}[major] => #{@version.bump(:major)}"
71
- puts "rake #{@version_task}[minor] => #{@version.bump(:minor)}"
72
- puts "rake #{@version_task}[revision] => #{@version.bump(:revision)}"
73
- end
68
+
74
69
  end
75
70
 
76
71
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: asrake
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.0
4
+ version: 0.11.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-09-18 00:00:00.000000000 Z
12
+ date: 2012-09-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: nokogiri
@@ -73,7 +73,6 @@ files:
73
73
  - lib/asrake/asdoc.rb
74
74
  - lib/asrake/base_compiler_args.rb
75
75
  - lib/asrake/base_compiler_task.rb
76
- - lib/asrake/clean_task.rb
77
76
  - lib/asrake/compc_args.rb
78
77
  - lib/asrake/compc_task.rb
79
78
  - lib/asrake/file_utils.rb
@@ -1,34 +0,0 @@
1
- require 'rake/tasklib'
2
-
3
- module ASRake
4
- class CleanTask < Rake::TaskLib
5
-
6
- attr_accessor :clean_list
7
- attr_accessor :clobber_list
8
-
9
- def initialize(*args)
10
-
11
- self.clean_list = FileList.new
12
- self.clobber_list = FileList.new
13
-
14
- args.each do |configArgs|
15
- clean_list.include(File.join(configArgs.output_dir, "*"))
16
- clean_list.exclude(configArgs.output)
17
-
18
- clobber_list.include(File.join(configArgs.output_dir, "*"))
19
- end
20
-
21
- desc "Remove package results & build artifacts"
22
- task :clean do
23
- clean_list.each { |f| rm_r f rescue nil }
24
- end
25
-
26
- desc "Remove all build & package results"
27
- # adding clean as a dependency in case anything is added to the clean task later
28
- task :clobber => [:clean] do
29
- clobber_list.each { |f| rm_r f rescue nil }
30
- end
31
- end
32
-
33
- end
34
- end