Basic project layout.
This commit is contained in:
parent
626bb9e0b6
commit
702477ca28
|
@ -0,0 +1,13 @@
|
|||
./lib/oga/**/*.rb ./lib/oga.rb
|
||||
-m markdown
|
||||
-M kramdown
|
||||
-o yardoc
|
||||
-r ./README.md
|
||||
--private
|
||||
--protected
|
||||
--asset ./doc/css/common.css:css/common.css
|
||||
--verbose
|
||||
-
|
||||
./doc/*.md
|
||||
LICENSE
|
||||
CONTRIBUTING.md
|
|
@ -0,0 +1,44 @@
|
|||
PATH
|
||||
remote: .
|
||||
specs:
|
||||
oga (0.0.1)
|
||||
ast
|
||||
racc
|
||||
|
||||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
ast (1.1.0)
|
||||
cliver (0.3.2)
|
||||
diff-lcs (1.2.5)
|
||||
docile (1.1.3)
|
||||
kramdown (1.3.2)
|
||||
multi_json (1.8.4)
|
||||
racc (1.4.11)
|
||||
rake (10.1.1)
|
||||
rspec (2.14.1)
|
||||
rspec-core (~> 2.14.0)
|
||||
rspec-expectations (~> 2.14.0)
|
||||
rspec-mocks (~> 2.14.0)
|
||||
rspec-core (2.14.7)
|
||||
rspec-expectations (2.14.5)
|
||||
diff-lcs (>= 1.1.3, < 2.0)
|
||||
rspec-mocks (2.14.6)
|
||||
simplecov (0.8.2)
|
||||
docile (~> 1.1.0)
|
||||
multi_json
|
||||
simplecov-html (~> 0.8.0)
|
||||
simplecov-html (0.8.0)
|
||||
yard (0.8.7.3)
|
||||
|
||||
PLATFORMS
|
||||
ruby
|
||||
|
||||
DEPENDENCIES
|
||||
cliver
|
||||
kramdown
|
||||
oga!
|
||||
rake
|
||||
rspec
|
||||
simplecov
|
||||
yard
|
|
@ -0,0 +1,24 @@
|
|||
require 'bundler/gem_tasks'
|
||||
require 'digest/sha2'
|
||||
require 'rake/clean'
|
||||
require 'cliver'
|
||||
|
||||
GEMSPEC = Gem::Specification.load('oga.gemspec')
|
||||
|
||||
LEXER_INPUT = 'lib/oga/lexer.rl'
|
||||
LEXER_OUTPUT = 'lib/oga/lexer.rb'
|
||||
|
||||
#PARSER_INPUT = 'lib/oga/parser.y'
|
||||
#PARSER_OUTPUT = 'lib/oga/parser.rb'
|
||||
|
||||
GENERATED_FILES = ['coverage', 'yardoc', LEXER_OUTPUT]
|
||||
|
||||
GENERATED_FILES.each do |file|
|
||||
CLEAN << file if File.exist?(file)
|
||||
end
|
||||
|
||||
Dir['./task/*.rake'].each do |task|
|
||||
import(task)
|
||||
end
|
||||
|
||||
task :default => :test
|
|
@ -0,0 +1,26 @@
|
|||
# @title DCO
|
||||
# Developer's Certificate of Origin 1.0
|
||||
|
||||
By making a contribution to this project, I certify that:
|
||||
|
||||
1. The contribution was created in whole or in part by me and I
|
||||
have the right to submit it under the open source license
|
||||
indicated in the file LICENSE; or
|
||||
|
||||
2. The contribution is based upon previous work that, to the best
|
||||
of my knowledge, is covered under an appropriate open source
|
||||
license and I have the right under that license to submit that
|
||||
work with modifications, whether created in whole or in part
|
||||
by me, under the same open source license (unless I am
|
||||
permitted to submit under a different license), as indicated
|
||||
in the file LICENSE; or
|
||||
|
||||
3. The contribution was provided directly to me by some other
|
||||
person who certified (1), (2) or (3) and I have not modified
|
||||
it.
|
||||
|
||||
4. I understand and agree that this project and the contribution
|
||||
are public and that a record of the contribution (including all
|
||||
personal information I submit with it, including my sign-off) is
|
||||
maintained indefinitely and may be redistributed consistent with
|
||||
this project or the open source license(s) involved.
|
|
@ -0,0 +1,2 @@
|
|||
# @title Changelog
|
||||
# Changelog
|
|
@ -0,0 +1,69 @@
|
|||
body
|
||||
{
|
||||
font-size: 14px;
|
||||
line-height: 1.6;
|
||||
margin: 0 auto;
|
||||
max-width: 960px;
|
||||
}
|
||||
|
||||
p code
|
||||
{
|
||||
background: #f2f2f2;
|
||||
padding-left: 3px;
|
||||
padding-right: 3px;
|
||||
}
|
||||
|
||||
pre.code
|
||||
{
|
||||
font-size: 13px;
|
||||
line-height: 1.4;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
/**
|
||||
* YARD uses generic table styles, using a special class means those tables
|
||||
* don't get messed up.
|
||||
*/
|
||||
.table
|
||||
{
|
||||
border: 1px solid #ccc;
|
||||
border-right: none;
|
||||
border-collapse: separate;
|
||||
border-spacing: 0;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.table.full
|
||||
{
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.table .field_name
|
||||
{
|
||||
min-width: 160px;
|
||||
}
|
||||
|
||||
.table thead tr th.no_sort:first-child
|
||||
{
|
||||
width: 25px;
|
||||
}
|
||||
|
||||
.table thead tr th, .table tbody tr td
|
||||
{
|
||||
border-bottom: 1px solid #ccc;
|
||||
border-right: 1px solid #ccc;
|
||||
min-width: 20px;
|
||||
padding: 8px 5px;
|
||||
text-align: left;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
.table tbody tr:last-child td
|
||||
{
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.table tr:nth-child(odd) td
|
||||
{
|
||||
background: #f9f9f9;
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
require 'ast'
|
|
@ -0,0 +1,3 @@
|
|||
module Oga
|
||||
VERSION = '0.0.1'
|
||||
end # Oga
|
|
@ -0,0 +1,27 @@
|
|||
require File.expand_path('../lib/oga/version', __FILE__)
|
||||
|
||||
Gem::Specification.new do |s|
|
||||
s.name = 'oga'
|
||||
s.version = Oga::VERSION
|
||||
s.authors = ['Yorick Peterse']
|
||||
s.email = 'yorickpeterse@gmail.com'
|
||||
s.summary = 'A pure Ruby HTML/XML parser.'
|
||||
s.homepage = 'https://github.com/yorickpeterse/oga/'
|
||||
s.description = s.summary
|
||||
s.license = 'MIT'
|
||||
|
||||
s.files = File.read(File.expand_path('../MANIFEST', __FILE__)).split("\n")
|
||||
|
||||
s.has_rdoc = 'yard'
|
||||
s.required_ruby_version = '>= 1.9.3'
|
||||
|
||||
s.add_dependency 'racc'
|
||||
s.add_dependency 'ast'
|
||||
|
||||
s.add_development_dependency 'cliver'
|
||||
s.add_development_dependency 'rake'
|
||||
s.add_development_dependency 'rspec'
|
||||
s.add_development_dependency 'yard'
|
||||
s.add_development_dependency 'simplecov'
|
||||
s.add_development_dependency 'kramdown'
|
||||
end
|
|
@ -0,0 +1,13 @@
|
|||
require 'rspec'
|
||||
|
||||
if ENV['COVERAGE']
|
||||
require_relative 'support/simplecov'
|
||||
end
|
||||
|
||||
require_relative '../lib/oga'
|
||||
require_relative 'support/parsing'
|
||||
|
||||
RSpec.configure do |config|
|
||||
config.color = true
|
||||
config.include Oga::ParsingHelpers
|
||||
end
|
|
@ -0,0 +1,14 @@
|
|||
module Oga
|
||||
module ParsingHelpers
|
||||
##
|
||||
# Builds an AST node.
|
||||
#
|
||||
# @param [Symbol] type
|
||||
# @param [Array] cihldren
|
||||
# @return [Oga::AST::Node]
|
||||
#
|
||||
def s(type, *children)
|
||||
return Oga::AST::Node.new(type, children)
|
||||
end
|
||||
end # ParsingHelpers
|
||||
end # Oga
|
|
@ -0,0 +1,12 @@
|
|||
require 'simplecov'
|
||||
|
||||
SimpleCov.configure do
|
||||
root File.expand_path('../../../', __FILE__)
|
||||
command_name 'rspec'
|
||||
project_name 'oga'
|
||||
|
||||
add_filter 'spec'
|
||||
add_filter 'lib/oga/version'
|
||||
end
|
||||
|
||||
SimpleCov.start
|
|
@ -0,0 +1,4 @@
|
|||
desc 'Builds a new Gem and its checksum'
|
||||
task :signed_build => [:build] do
|
||||
Rake::Task['checksum'].invoke
|
||||
end
|
|
@ -0,0 +1,13 @@
|
|||
desc 'Creates a SHA512 checksum of the current version'
|
||||
task :checksum do
|
||||
checksums = File.expand_path('../../checksum', __FILE__)
|
||||
name = "#{GEMSPEC.name}-#{GEMSPEC.version}.gem"
|
||||
path = File.join(File.expand_path('../../pkg', __FILE__), name)
|
||||
|
||||
checksum_name = File.basename(path) + '.sha512'
|
||||
checksum = Digest::SHA512.new.hexdigest(File.read(path))
|
||||
|
||||
File.open(File.join(checksums, checksum_name), 'w') do |handle|
|
||||
handle.write(checksum)
|
||||
end
|
||||
end
|
|
@ -0,0 +1,5 @@
|
|||
desc 'Generates auto-generated files'
|
||||
task :generate => [:lexer, :parser]
|
||||
|
||||
desc 'Regenerates auto-generated files'
|
||||
task :regenerate => [:clean, :generate]
|
|
@ -0,0 +1,8 @@
|
|||
rule '.rb' => '.rl' do |task|
|
||||
Cliver.assert('ragel', '~> 6.8')
|
||||
|
||||
sh "ragel -F1 -R #{task.source} -o #{task.name}"
|
||||
end
|
||||
|
||||
desc 'Generates the lexer'
|
||||
task :lexer => [LEXER_OUTPUT]
|
|
@ -0,0 +1,9 @@
|
|||
desc 'Generates the MANIFEST file'
|
||||
task :manifest do
|
||||
generated = GENERATED_FILES.map { |path| File.expand_path(path) }
|
||||
files = (`git ls-files`.split("\n") | generated).sort
|
||||
handle = File.open(File.expand_path('../../MANIFEST', __FILE__), 'w')
|
||||
|
||||
handle.write(files.join("\n"))
|
||||
handle.close
|
||||
end
|
|
@ -0,0 +1,8 @@
|
|||
rule '.rb' => '.y' do |task|
|
||||
Cliver.assert('racc', '~> 1.4')
|
||||
|
||||
sh "racc -l -o #{task.name} #{task.source}"
|
||||
end
|
||||
|
||||
desc 'Generates the parser'
|
||||
task :parser => [PARSER_OUTPUT]
|
|
@ -0,0 +1,6 @@
|
|||
desc 'Creates a Git tag for the current version'
|
||||
task :tag do
|
||||
version = Oga::VERSION
|
||||
|
||||
sh %Q{git tag -a -m "Version #{version}" #{version}}
|
||||
end
|
|
@ -0,0 +1,4 @@
|
|||
desc 'Runs the tests'
|
||||
task :test => [:regenerate] do
|
||||
sh 'rspec spec'
|
||||
end
|
Loading…
Reference in New Issue