github_readme_generator 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 87dbb96c173ee8d90a0c6e127ffb064573d9c46d
4
+ data.tar.gz: 0e1335d9cd409ba04ddf435e868dfdabe1292e72
5
+ SHA512:
6
+ metadata.gz: cce92862532059ffab62f1754eecca5fd645b987cfc06372af23d36eb3658d116e7f41efa3b5ce0d47447f6fb492c9af2e97306366fc11787f05afc98bb0081a
7
+ data.tar.gz: bd4b6f98c9976a07544548fc8cecb859e7ddb9d83995167f8d8de8d993ef088c993057889ba3bd8deab717c7f467c99b796e1b202663c0160e6b1809f6d2534d
@@ -0,0 +1,34 @@
1
+ Github README Generator
2
+ =======================
3
+
4
+ `github-readme-generator` lets you generate a `README.md` file simply.
5
+
6
+ # Example
7
+
8
+ ```ruby
9
+ # Rakefile
10
+ require 'github_readme_generator/task'
11
+
12
+ GitHubReadmeGenerator::RakeTask.new :readme do |config|
13
+ config.title = 'FreeRADIUS Puppet module' # Dynamic using github lib?
14
+ config.badges = {
15
+ :puppetforge_version => {
16
+ :badge => :puppetforge,
17
+ :type => 'v',
18
+ :user => 'raphink', # Dynamic from metadata.json?
19
+ :project => 'freeradius', # Dynamic from metadata.json?
20
+ },
21
+ :puppetforge_downloads => {
22
+ :badge => :puppetforge,
23
+ :type => 'dt',
24
+ :user => 'raphink', # Dynamic from metadata.json?
25
+ :project => 'freeradius', # Dynamic from metadata.json?
26
+ },
27
+ :travis => {
28
+ :badge => :travis,
29
+ :user => 'raphink', # Dynamic from git
30
+ :project => 'puppet-freeradius', # Dynamic from git?
31
+ },
32
+ }
33
+ end
34
+ ```
@@ -0,0 +1,19 @@
1
+ # coding: utf-8
2
+
3
+ Gem::Specification.new do |spec|
4
+ spec.name = "github_readme_generator"
5
+ spec.version = '0.1.0'
6
+
7
+ spec.required_ruby_version = ">= 1.9.3"
8
+ spec.authors = ["Raphaël Pinson"]
9
+ spec.email = "raphael.pinson@camptocamp.com"
10
+ spec.date = `date +"%Y-%m-%d"`.strip!
11
+ spec.summary = "Generate README.md automatically"
12
+ spec.description = "Generate README.md automatically"
13
+ spec.homepage = "https://github.com/raphink/github-readme-generator"
14
+ spec.license = "Apache 2.0"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
+ spec.require_paths = ["lib"]
19
+ end
@@ -0,0 +1,76 @@
1
+ require "rake"
2
+ require "rake/tasklib"
3
+
4
+ module GitHubReadmeGenerator
5
+ class RakeTask < ::Rake::TaskLib
6
+ include ::Rake::DSL if defined?(::Rake::DSL)
7
+
8
+ OPTIONS = %w( title badges )
9
+
10
+ OPTIONS.each do |o|
11
+ attr_accessor o.to_sym
12
+ end
13
+
14
+ # Public: Initialise a new GitHubChangelogGenerator::RakeTask.
15
+ #
16
+ # Example
17
+ #
18
+ # GitHubChangelogGenerator::RakeTask.new
19
+ def initialize(*args, &task_block)
20
+ @name = args.shift || :readme
21
+
22
+ define(args, &task_block)
23
+ end
24
+
25
+ def define(args, &task_block)
26
+ desc "Generate a README.md"
27
+
28
+ task_block.call(*[self, args].slice(0, task_block.arity)) if task_block
29
+
30
+ # clear any (auto-)pre-existing task
31
+ Rake::Task[@name].clear if Rake::Task.task_defined?(@name)
32
+
33
+ task @name do
34
+ out = @title
35
+ out << "\n"
36
+ out << "=" * @title.length
37
+ out << "\n\n"
38
+
39
+ # Badges
40
+ @badges.each do |k, v|
41
+ case v[:badge]
42
+ when :puppetforge
43
+ case v[:type]
44
+ when 'v'
45
+ title = v[:title] || 'Puppet Forge Version'
46
+ when 'dt'
47
+ title = v[:title] || 'Puppet Forge Downloads'
48
+ else
49
+ title = v[:title] || 'Puppet Forge'
50
+ end
51
+ img = "https://img.shields.io/puppetforge/#{v[:type]}/#{v[:user]}/#{v[:project]}.svg"
52
+ link = "https://forge.puppetlabs.com/#{v[:user]}/#{v[:project]}"
53
+ out << "[![#{title}](#{img})](#{link})\n"
54
+ when :travis
55
+ title = v[:title] || 'Build Status'
56
+ img = "https://img.shields.io/travis/#{v[:user]}/#{v[:project]}.svg"
57
+ link = "https://travis-ci.org/#{v[:user]}/#{v[:project]}"
58
+ out << "[![#{title}](#{img})](#{link})\n"
59
+ else
60
+ fail "Unknown badge type '#{v[:badge]}'"
61
+ end
62
+ end
63
+
64
+ # Usage from examples
65
+ out << "\n## Usage\n\n"
66
+ Dir.glob('examples/*').each do |e|
67
+ content = File.read(e).gsub(/^#\s*/, '')
68
+ out << "\n#{content}\n"
69
+ end
70
+
71
+ File.open('README.md', 'w').puts(out)
72
+ end
73
+ end
74
+ end
75
+ end
76
+
metadata ADDED
@@ -0,0 +1,47 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: github_readme_generator
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Raphaël Pinson
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-02-03 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Generate README.md automatically
14
+ email: raphael.pinson@camptocamp.com
15
+ executables: []
16
+ extensions: []
17
+ extra_rdoc_files: []
18
+ files:
19
+ - README.md
20
+ - github_readme_generator.gemspec
21
+ - lib/github_readme_generator/task.rb
22
+ homepage: https://github.com/raphink/github-readme-generator
23
+ licenses:
24
+ - Apache 2.0
25
+ metadata: {}
26
+ post_install_message:
27
+ rdoc_options: []
28
+ require_paths:
29
+ - lib
30
+ required_ruby_version: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - ">="
33
+ - !ruby/object:Gem::Version
34
+ version: 1.9.3
35
+ required_rubygems_version: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: '0'
40
+ requirements: []
41
+ rubyforge_project:
42
+ rubygems_version: 2.2.2
43
+ signing_key:
44
+ specification_version: 4
45
+ summary: Generate README.md automatically
46
+ test_files: []
47
+ has_rdoc: