diff options
| author | Jarek Prokop <jprokop@redhat.com> | 2022-10-26 09:29:59 +0200 |
|---|---|---|
| committer | Jarek Prokop <jprokop@redhat.com> | 2022-10-26 09:36:45 +0200 |
| commit | eb072f5e22a18aa8b93d7952957d6f5bdced8659 (patch) | |
| tree | 55d701a0dfc2e73535c37a5f8716b5cc38a1ef31 | |
| download | fedora_darkfish-eb072f5e22a18aa8b93d7952957d6f5bdced8659.tar.gz fedora_darkfish-eb072f5e22a18aa8b93d7952957d6f5bdced8659.tar.xz fedora_darkfish-eb072f5e22a18aa8b93d7952957d6f5bdced8659.zip | |
Initial commit.
| -rw-r--r-- | .gitignore | 3 | ||||
| -rw-r--r-- | LICENSE | 21 | ||||
| -rw-r--r-- | README.md | 28 | ||||
| -rw-r--r-- | fedora_darkfish.gemspec | 37 | ||||
| -rw-r--r-- | fedora_darkfish.spec | 64 | ||||
| -rw-r--r-- | lib/rdoc/generator/fedora_darkfish.rb | 46 |
6 files changed, 199 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b26c78e --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +fedora_darkfish-*.gem +result/ +*.src.rpm @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2022 Jaroslav Prokop + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..bc6f5fc --- /dev/null +++ b/README.md @@ -0,0 +1,28 @@ +# Fedora Darkfish generator for RDoc + +RDoc plugin for Fedora leveraging the Darkfish template that symlinks common template files. + +## Installation + +Add this line to your application's `Gemfile`: + +``` +gem 'fedora_darkfish' +``` + +And then execute the `bundle` command to install the gem. + +Alternatively, you can also manually install the gem using the following command: + +``` +$ gem install fedora_darkfish +``` + +To use the gem with the `rdoc` command on CLI, you have to require it, so that RDoc is able to pick the gem up: +``` +$ RUBYOPT='-r fedora_darkfish' rdoc --fmt=fedora +``` + +## License + +The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT). diff --git a/fedora_darkfish.gemspec b/fedora_darkfish.gemspec new file mode 100644 index 0000000..9cc8a69 --- /dev/null +++ b/fedora_darkfish.gemspec @@ -0,0 +1,37 @@ +lib = File.expand_path('lib', __dir__) +$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) + +Gem::Specification.new do |spec| + spec.name = 'fedora_darkfish' + spec.version = '1.0.0' + spec.authors = ['Jaroslav Prokop'] + spec.email = ['jar.prokop@volny.cz'] + + spec.summary = 'RDoc plugin for Fedora leveraging the Darkfish template' + spec.description = 'RDoc plugin for Fedora leveraging the Darkfish template' \ + 'that symlinks common files.' + spec.homepage = 'https://fedorapeople.org/cgit/jackorp/public_git/fedora_darkfish.git/commit/?h=rawhide' + spec.license = 'MIT' + + # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host' + # to allow pushing to a single host or delete this section to allow pushing to any host. + if spec.respond_to?(:metadata) + spec.metadata['allowed_push_host'] = 'https://rubygems.org' + else + raise 'RubyGems 2.0 or newer is required to protect against ' \ + 'public gem pushes.' + end + + spec.files = %w[ + README.md + LICENSE + lib/rdoc/generator/fedora_darkfish.rb + ] + spec.test_files = `git ls-files -- {test,spec,features}/*`.split("\n") + spec.require_paths = [File.join('lib', 'rdoc', 'generator')] + + spec.add_dependency 'rdoc' + + spec.add_development_dependency 'rake', '>= 12' + spec.add_development_dependency 'test_unit' +end diff --git a/fedora_darkfish.spec b/fedora_darkfish.spec new file mode 100644 index 0000000..7644e10 --- /dev/null +++ b/fedora_darkfish.spec @@ -0,0 +1,64 @@ +# Generated from fedora_darkfish-1.0.0.gem by gem2rpm -*- rpm-spec -*- +%global gem_name fedora_darkfish + +Name: rubygem-%{gem_name} +Version: 1.0.0 +Release: 1%{?dist} +Summary: RDoc plugin for Fedora leveraging the Darkfish template +License: MIT +URL: https://gitlab.com/jackorp/fedora_darkfish +Source0: %{gem_name}-%{version}.gem +BuildRequires: ruby(release) +BuildRequires: rubygems-devel +BuildRequires: ruby +# BuildRequires: rubygem(test_unit) +BuildArch: noarch + +%description +RDoc plugin for Fedora leveraging the Darkfish templatethat symlinks common +files. + + +%package doc +Summary: Documentation for %{name} +Requires: %{name} = %{version}-%{release} +BuildArch: noarch + +%description doc +Documentation for %{name}. + +%prep +%setup -q -n %{gem_name}-%{version} + +%build +# Create the gem as gem install only works on a gem file +gem build ../%{gem_name}-%{version}.gemspec + +# %%gem_install compiles any C extensions and installs the gem into ./%%gem_dir +# by default, so that we can move it into the buildroot in %%install +%gem_install + +%install +mkdir -p %{buildroot}%{gem_dir} +cp -a .%{gem_dir}/* \ + %{buildroot}%{gem_dir}/ + +%check +pushd .%{gem_instdir} +# Run the test suite. +popd + +%files +%dir %{gem_instdir} +%license %{gem_instdir}/LICENSE +%{gem_libdir} +%{gem_spec} +%exclude %{gem_cache} + +%files doc +%doc %{gem_docdir} +%doc %{gem_instdir}/README.md + +%changelog +* Tue Oct 25 2022 Jarek Prokop <jprokop@redhat.com> - 1.0.0-1 +- Initial package diff --git a/lib/rdoc/generator/fedora_darkfish.rb b/lib/rdoc/generator/fedora_darkfish.rb new file mode 100644 index 0000000..1e121a5 --- /dev/null +++ b/lib/rdoc/generator/fedora_darkfish.rb @@ -0,0 +1,46 @@ +require 'rdoc' +require 'rdoc/generator/darkfish' +require 'rdoc/generator/json_index' + + +class RDoc::Generator::Fedora < RDoc::Generator::Darkfish + RDoc::RDoc.add_generator self + + def initialize store, options + super store, options + @json_index = RDoc::Generator::FedoraJsonIndex.new self,options + end + + def install_rdoc_static_file source, destination, options # :nodoc: + return unless source.exist? + + return if source.fnmatch?('*fonts/*') + + begin + FileUtils.mkdir_p File.dirname(destination), **options + FileUtils.ln_sf source, destination, **options + rescue + end + end +end + +class RDoc::Generator::FedoraJsonIndex < RDoc::Generator::JsonIndex + def generate + super + + out_dir = @base_dir + @options.op_dir + + Dir.chdir @template_dir do + Dir['**/*.js'].each do |source| + dest = File.join out_dir, source + source = File.realpath source + FileUtils.ln_sf source, dest, :verbose => $DEBUG_RDOC + end + end + end + + # Don't generate gzipped content. Because we have always shipped also the + # original, it just increases the size. + def generate_gzipped + end +end |
