rakyll 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +13 -0
- data/.rspec +2 -0
- data/.travis.yml +5 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +4 -0
- data/README.md +36 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/rakyll/compiler/copy.rb +16 -0
- data/lib/rakyll/compiler/create.rb +24 -0
- data/lib/rakyll/compiler/match.rb +34 -0
- data/lib/rakyll/compiler.rb +20 -0
- data/lib/rakyll/route.rb +34 -0
- data/lib/rakyll/version.rb +3 -0
- data/lib/rakyll.rb +20 -0
- data/rakyll.gemspec +27 -0
- metadata +116 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: f8f532a84a19c5f4e18fe9be45d2c87d56ecb20f
|
4
|
+
data.tar.gz: b144be2f2d4aca77fd85d2b92476640cdf73a1de
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: e3e8fa247b482fca8bb5f73b7f96602f70334f2b099a85946f72af0b39d6ad2764f2c9bbee041fab5634ef19b115b364f26bc7510abd84872135b1b44967f0c7
|
7
|
+
data.tar.gz: 560333a5212ef6f27e462cb4c6b3883c1573bbc35399da4c9cb87d4ce7669f3b3e5cfb8ef57a06f3203d5c8ed2f162c782c479f0de0f18fbe27ad9b2ce6b628c
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at longinus.eva@gmail.com. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [http://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: http://contributor-covenant.org
|
74
|
+
[version]: http://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
# Rakyll
|
2
|
+
|
3
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/rakyll`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
+
|
5
|
+
TODO: Delete this and the text above, and describe your gem
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'rakyll'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install rakyll
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
TODO: Write usage instructions here
|
26
|
+
|
27
|
+
## Development
|
28
|
+
|
29
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
|
+
|
31
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
32
|
+
|
33
|
+
## Contributing
|
34
|
+
|
35
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/rakyll. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
36
|
+
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "rakyll"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
module Rakyll
|
2
|
+
module Compiler
|
3
|
+
class Copy
|
4
|
+
include SetFilename
|
5
|
+
|
6
|
+
def initialize(source_filename)
|
7
|
+
@source_filename = source_filename
|
8
|
+
set_filename(source_filename)
|
9
|
+
end
|
10
|
+
|
11
|
+
def save
|
12
|
+
FileUtils.copy(@source_filename, @filename)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Rakyll
|
2
|
+
module Compiler
|
3
|
+
class Create
|
4
|
+
include Apply
|
5
|
+
include SetFilename
|
6
|
+
attr_reader :url
|
7
|
+
|
8
|
+
def initialize(source_filename)
|
9
|
+
@source_filename = source_filename
|
10
|
+
set_filename(source_filename)
|
11
|
+
end
|
12
|
+
|
13
|
+
def load_all(pattern)
|
14
|
+
Dir.glob(pattern).map do |filename|
|
15
|
+
Match.new filename
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def save
|
20
|
+
File.write(@filename, @body)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
module Rakyll
|
2
|
+
module Compiler
|
3
|
+
class Match
|
4
|
+
include Apply
|
5
|
+
include SetFilename
|
6
|
+
attr_reader :body, :url
|
7
|
+
|
8
|
+
def initialize(source_filename)
|
9
|
+
@source_filename = source_filename
|
10
|
+
metadata_string, markdown_string = File.read(@source_filename).split("---\n")
|
11
|
+
set_metadata_from_yaml(metadata_string)
|
12
|
+
set_body_from_markdown(markdown_string)
|
13
|
+
set_filename(source_filename, '.html')
|
14
|
+
end
|
15
|
+
|
16
|
+
def save
|
17
|
+
File.write(@filename, @body)
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
def set_metadata_from_yaml(metadata_string)
|
22
|
+
YAML.load(metadata_string).each do |key, value|
|
23
|
+
instance_variable_set(:"@#{key}", value)
|
24
|
+
singleton_class.class_eval { attr_reader key }
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def set_body_from_markdown(markdown_string)
|
29
|
+
markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML)
|
30
|
+
@body = markdown.render(markdown_string)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module Rakyll
|
2
|
+
module Compiler
|
3
|
+
module Apply
|
4
|
+
def apply(template_name)
|
5
|
+
template_string = File.read('templates/' + template_name)
|
6
|
+
@body = ERB.new(template_string).result(binding)
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
module SetFilename
|
11
|
+
def set_filename(source_filename, ext = nil)
|
12
|
+
pathname = Pathname.new(source_filename)
|
13
|
+
pathname = pathname.sub_ext(ext) unless ext.nil?
|
14
|
+
@url = '/' + pathname.to_s
|
15
|
+
@filename = '_site/' + pathname.to_s
|
16
|
+
FileUtils.mkdir_p(File.dirname(@filename))
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
data/lib/rakyll/route.rb
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
module Rakyll
|
2
|
+
class Route
|
3
|
+
def initialize
|
4
|
+
@compilers = []
|
5
|
+
end
|
6
|
+
|
7
|
+
def match(pattern, &block)
|
8
|
+
Dir.glob(pattern).each do |source_filename|
|
9
|
+
compiler = Rakyll::Compiler::Match.new source_filename
|
10
|
+
compiler.instance_eval &block
|
11
|
+
@compilers.push compiler
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def copy(pattern)
|
16
|
+
Dir.glob(pattern).each do |source_filename|
|
17
|
+
compiler = Rakyll::Compiler::Copy.new source_filename
|
18
|
+
@compilers.push compiler
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def create(filename, &block)
|
23
|
+
compiler = Rakyll::Compiler::Create.new filename
|
24
|
+
compiler.instance_eval &block
|
25
|
+
@compilers.push compiler
|
26
|
+
end
|
27
|
+
|
28
|
+
def save
|
29
|
+
@compilers.each do |compiler|
|
30
|
+
compiler.save
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
data/lib/rakyll.rb
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'erb'
|
2
|
+
require 'yaml'
|
3
|
+
require 'pathname'
|
4
|
+
require 'fileutils'
|
5
|
+
require 'redcarpet'
|
6
|
+
|
7
|
+
require "rakyll/version"
|
8
|
+
require "rakyll/route"
|
9
|
+
require "rakyll/compiler"
|
10
|
+
require 'rakyll/compiler/copy'
|
11
|
+
require 'rakyll/compiler/create'
|
12
|
+
require 'rakyll/compiler/match'
|
13
|
+
|
14
|
+
module Rakyll
|
15
|
+
def self.dsl(&block)
|
16
|
+
route = Rakyll::Route.new
|
17
|
+
route.instance_eval &block
|
18
|
+
route.save
|
19
|
+
end
|
20
|
+
end
|
data/rakyll.gemspec
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'rakyll/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "rakyll"
|
8
|
+
spec.version = Rakyll::VERSION
|
9
|
+
spec.authors = ["Yusuke Sangenya"]
|
10
|
+
spec.email = ["longinus.eva@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{Static web site generator.}
|
13
|
+
spec.description = %q{Provides DSL to generate static web site easily.}
|
14
|
+
spec.homepage = 'https://github.com/genya0407/rakyll'
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
17
|
+
f.match(%r{^(test|spec|features)/})
|
18
|
+
end
|
19
|
+
spec.bindir = "exe"
|
20
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
21
|
+
spec.require_paths = ["lib"]
|
22
|
+
|
23
|
+
spec.add_dependency "redcarpet", "~> 3.4"
|
24
|
+
spec.add_development_dependency "bundler", "~> 1.14"
|
25
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
26
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
27
|
+
end
|
metadata
ADDED
@@ -0,0 +1,116 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rakyll
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Yusuke Sangenya
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-05-31 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: redcarpet
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '3.4'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '3.4'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.14'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.14'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '10.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '10.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '3.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '3.0'
|
69
|
+
description: Provides DSL to generate static web site easily.
|
70
|
+
email:
|
71
|
+
- longinus.eva@gmail.com
|
72
|
+
executables: []
|
73
|
+
extensions: []
|
74
|
+
extra_rdoc_files: []
|
75
|
+
files:
|
76
|
+
- ".gitignore"
|
77
|
+
- ".rspec"
|
78
|
+
- ".travis.yml"
|
79
|
+
- CODE_OF_CONDUCT.md
|
80
|
+
- Gemfile
|
81
|
+
- README.md
|
82
|
+
- Rakefile
|
83
|
+
- bin/console
|
84
|
+
- bin/setup
|
85
|
+
- lib/rakyll.rb
|
86
|
+
- lib/rakyll/compiler.rb
|
87
|
+
- lib/rakyll/compiler/copy.rb
|
88
|
+
- lib/rakyll/compiler/create.rb
|
89
|
+
- lib/rakyll/compiler/match.rb
|
90
|
+
- lib/rakyll/route.rb
|
91
|
+
- lib/rakyll/version.rb
|
92
|
+
- rakyll.gemspec
|
93
|
+
homepage: https://github.com/genya0407/rakyll
|
94
|
+
licenses: []
|
95
|
+
metadata: {}
|
96
|
+
post_install_message:
|
97
|
+
rdoc_options: []
|
98
|
+
require_paths:
|
99
|
+
- lib
|
100
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
101
|
+
requirements:
|
102
|
+
- - ">="
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: '0'
|
105
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
106
|
+
requirements:
|
107
|
+
- - ">="
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
110
|
+
requirements: []
|
111
|
+
rubyforge_project:
|
112
|
+
rubygems_version: 2.5.2
|
113
|
+
signing_key:
|
114
|
+
specification_version: 4
|
115
|
+
summary: Static web site generator.
|
116
|
+
test_files: []
|