Class: SdocAll::Rails
- Extended by:
- ClassMethods
- Defined in:
- lib/sdoc_all/parts/rails.rb
Defined Under Namespace
Modules: ClassMethods
Constant Summary
Constants included from Base::ClassMethods
Base::ClassMethods::BASE_PATH, Base::ClassMethods::DOCS_PATH, Base::ClassMethods::PUBLIC_PATH
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
- #add_tasks(options = {}) ⇒ Object
-
#initialize(raw_config) ⇒ Rails
constructor
A new instance of Rails.
Methods included from ClassMethods
Methods included from Base::ClassMethods
#add_merge_task, #add_task, #base_path, #clear, #docs_path, #entries, #inherited, #public_path, #remove_if_present, #short_name, #sources_path, #subclasses, #system, #tasks, #to_document, #used_sources, #with_env
Constructor Details
#initialize(raw_config) ⇒ Rails
Returns a new instance of Rails.
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/sdoc_all/parts/rails.rb', line 3 def initialize(raw_config) raw_config ||= {} raw_config = {:version => raw_config} unless raw_config.is_a?(Hash) if raw_config[:version] unless self.class.versions.include?(raw_config[:version]) raise ConfigError.new("you don't have rails #{raw_config[:version]} installed") end else if self.class.versions.empty? raise ConfigError.new("you don't have any rails versions installed") end end @config = { :version => raw_config.delete(:version) || self.class.versions.last, } (raw_config) end |
Instance Method Details
#add_tasks(options = {}) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/sdoc_all/parts/rails.rb', line 24 def add_tasks( = {}) version = config[:version] path = sources_path + version unless path.directory? Base.remove_if_present(path) sources_path Base.with_env 'VERSION', version do Base.system('rails', path, '--freeze') end end self.class.used_sources << path paths = FileList.new Dir.chdir(path) do File.open('vendor/rails/railties/lib/tasks/documentation.rake') do |f| true until f.readline['Rake::RDocTask.new("rails")'] until (line = f.readline.strip) == '}' if line['rdoc.rdoc_files.include'] paths.include(line[/'(.*)'/, 1]) elsif line['rdoc.rdoc_files.exclude'] paths.exclude(line[/'(.*)'/, 1]) end end end paths.resolve end Base.add_task( :src_path => path, :doc_path => "rails-#{version}", :paths => paths.to_a, :title => "rails-#{version}" ) end |