Module: Doc::Configurator::Ruby::Stdlib
- Included in:
- Doc::Configurator::Ruby
- Defined in:
- lib/doc/configurator/ruby/stdlib.rb
Constant Summary collapse
- STDLIB_CONFIG_URL =
'http://stdlib-doc.rubyforge.org/svn/trunk/data/gendoc.yaml'
- STDLIB_CONFIG_NAME =
'stdlib-config.yaml'
- STDLIB_CONFIG_VENDOR_PATH =
FSPath(__FILE__).dirname / '../../../../vendor' / STDLIB_CONFIG_NAME
Instance Method Summary collapse
- #download_stdlib_config ⇒ Object
- #read_stdlib_config ⇒ Object
- #stdlib_config(update) ⇒ Object
- #stdlib_config_path ⇒ Object
Instance Method Details
#download_stdlib_config ⇒ Object
28 29 30 31 32 33 34 |
# File 'lib/doc/configurator/ruby/stdlib.rb', line 28 def download_stdlib_config url = URI.parse(STDLIB_CONFIG_URL) response = Net::HTTP.start(url.host, url.port){ |http| http.get(url.path) } if response.kind_of?(Net::HTTPSuccess) stdlib_config_path.write(response.body) end end |
#read_stdlib_config ⇒ Object
24 25 26 |
# File 'lib/doc/configurator/ruby/stdlib.rb', line 24 def read_stdlib_config YAML.load_file stdlib_config_path if stdlib_config_path.size? end |
#stdlib_config(update) ⇒ Object
13 14 15 16 17 18 |
# File 'lib/doc/configurator/ruby/stdlib.rb', line 13 def stdlib_config(update) if update || !read_stdlib_config download_stdlib_config end read_stdlib_config || YAML.load_file(STDLIB_CONFIG_VENDOR_PATH) end |
#stdlib_config_path ⇒ Object
20 21 22 |
# File 'lib/doc/configurator/ruby/stdlib.rb', line 20 def stdlib_config_path sources_dir / STDLIB_CONFIG_NAME end |