wlang 0.10.0 → 0.10.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +72 -62
- data/Gemfile +2 -0
- data/Gemfile.lock +37 -0
- data/Manifest.txt +16 -0
- data/README.md +5 -7
- data/Rakefile +23 -0
- data/doc/specification/analytics.wtpl +13 -0
- data/doc/specification/dialects.wtpl +1 -1
- data/doc/specification/specification.html +199 -169
- data/doc/specification/specification.wtpl +1 -0
- data/doc/specification/specification.yml +1 -1
- data/lib/wlang.rb +3 -2
- data/lib/wlang/loader.rb +0 -0
- data/lib/wlang/parser.rb +1 -1
- data/lib/wlang/template.rb +5 -0
- data/{test/spec → spec}/basic_object.spec +1 -1
- data/{test/spec → spec}/coderay_dialect.spec +1 -1
- data/{test/spec → spec}/dialect/apply_post_transform.spec +0 -0
- data/{test/spec → spec}/global_extensions.rb +0 -0
- data/{test/spec → spec}/hash_scope.spec +1 -1
- data/{test/spec → spec}/redcloth_dialect.spec +1 -1
- data/spec/spec_helper.rb +2 -0
- data/{test/spec → spec}/test_all.rb +0 -0
- data/{test/spec → spec}/wlang.spec +1 -1
- data/spec/wlang_spec.rb +8 -0
- data/{test/spec → spec}/xhtml_dialect.spec +1 -2
- data/tasks/debug_mail.rake +77 -0
- data/tasks/debug_mail.txt +13 -0
- data/tasks/gem.rake +68 -0
- data/tasks/genspec.rake +5 -0
- data/tasks/spec_test.rake +79 -0
- data/tasks/unit_test.rake +76 -0
- data/tasks/yard.rake +51 -0
- data/wlang.gemspec +193 -0
- data/wlang.noespec +54 -0
- metadata +478 -80
data/lib/wlang.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
require 'wlang/loader'
|
1
2
|
require 'wlang/ext/string'
|
2
3
|
require 'stringio'
|
3
4
|
require 'wlang/rule'
|
@@ -20,7 +21,7 @@ require 'wlang/intelligent_buffer'
|
|
20
21
|
module WLang
|
21
22
|
|
22
23
|
# Current version of WLang
|
23
|
-
VERSION = "0.10.
|
24
|
+
VERSION = "0.10.1".freeze
|
24
25
|
|
25
26
|
######################################################################## About files and extensions
|
26
27
|
|
@@ -285,7 +286,7 @@ module WLang
|
|
285
286
|
def self.load_data(uri, extension=nil)
|
286
287
|
check_file_extension(extension = extension.nil? ? File.extname(uri) : extension)
|
287
288
|
loader = DATA_EXTENSIONS[extension]
|
288
|
-
raise ::WLang::Error
|
289
|
+
raise ::WLang::Error, "No data loader for #{extension}" if loader.nil?
|
289
290
|
loader.call(uri)
|
290
291
|
end
|
291
292
|
|
data/lib/wlang/loader.rb
ADDED
File without changes
|
data/lib/wlang/parser.rb
CHANGED
data/lib/wlang/template.rb
CHANGED
@@ -58,6 +58,11 @@ module WLang
|
|
58
58
|
@source.to_s
|
59
59
|
end
|
60
60
|
end
|
61
|
+
|
62
|
+
# Returns template's block endstart (typically '}{')
|
63
|
+
def block_endstart
|
64
|
+
@block_endstart ||= BLOCK_SYMBOLS[block_symbols].reverse.join
|
65
|
+
end
|
61
66
|
|
62
67
|
# Instantiates the template, with optinal context and hosted language.
|
63
68
|
def instantiate(context = {}, hosted = ::WLang::HostedLanguage.new)
|
File without changes
|
File without changes
|
data/spec/spec_helper.rb
ADDED
File without changes
|
data/spec/wlang_spec.rb
ADDED
@@ -0,0 +1,77 @@
|
|
1
|
+
# Installs a rake task for debuging the announcement mail.
|
2
|
+
#
|
3
|
+
# This file installs the 'rake debug_mail' that flushes an announcement mail
|
4
|
+
# for your library on the standard output. It is automatically generated
|
5
|
+
# by Noe from your .noespec file, and should therefore be configured there,
|
6
|
+
# under the variables/rake_tasks/debug_mail entry, as illustrated below:
|
7
|
+
#
|
8
|
+
# variables:
|
9
|
+
# rake_tasks:
|
10
|
+
# debug_mail:
|
11
|
+
# rx_changelog_sections: /^#/
|
12
|
+
# nb_changelog_sections: 1
|
13
|
+
# ...
|
14
|
+
#
|
15
|
+
# If you have specific needs requiring manual intervention on this file,
|
16
|
+
# don't forget to set safe-override to false in your noe specification:
|
17
|
+
#
|
18
|
+
# template-info:
|
19
|
+
# manifest:
|
20
|
+
# tasks/debug_mail.rake:
|
21
|
+
# safe-override: false
|
22
|
+
#
|
23
|
+
# The mail template used can be found in debug_mail.txt. That file may be
|
24
|
+
# changed to tune the mail you want to send. If you do so, don't forget to
|
25
|
+
# add a manifest entry in your .noespec file to avoid overriding you
|
26
|
+
# changes. The mail template uses wlang, with parentheses for block
|
27
|
+
# delimiters.
|
28
|
+
#
|
29
|
+
# template-info:
|
30
|
+
# manifest:
|
31
|
+
# tasks/debug_mail.txt:
|
32
|
+
# safe-override: false
|
33
|
+
#
|
34
|
+
begin
|
35
|
+
require 'wlang'
|
36
|
+
require 'yaml'
|
37
|
+
|
38
|
+
task :debug_mail do
|
39
|
+
# Check that a .noespec file exists
|
40
|
+
noespec_file = File.expand_path('../../wlang.noespec', __FILE__)
|
41
|
+
unless File.exists?(noespec_file)
|
42
|
+
raise "Unable to find .noespec project file, sorry."
|
43
|
+
end
|
44
|
+
|
45
|
+
# Load it as well as variables and options
|
46
|
+
noespec = YAML::load(File.read(noespec_file))
|
47
|
+
vars = noespec['variables'] || {}
|
48
|
+
|
49
|
+
# Changes are taken from CHANGELOG
|
50
|
+
logs = Dir[File.expand_path("../../CHANGELOG.*", __FILE__)]
|
51
|
+
unless logs.size == 1
|
52
|
+
abort "Unable to find a changelog file"
|
53
|
+
end
|
54
|
+
|
55
|
+
# Load interesting changesets
|
56
|
+
changes, end_found = [], 0
|
57
|
+
File.readlines(logs.first).select{|line|
|
58
|
+
if line =~ /^#/
|
59
|
+
break if end_found >= 2
|
60
|
+
end_found += 1
|
61
|
+
end
|
62
|
+
changes << line
|
63
|
+
}
|
64
|
+
vars['changes'] = changes.join
|
65
|
+
|
66
|
+
# WLang template
|
67
|
+
template = File.expand_path('../debug_mail.txt', __FILE__)
|
68
|
+
|
69
|
+
# Let's go!
|
70
|
+
$stdout << WLang::file_instantiate(template, vars, "wlang/active-text")
|
71
|
+
end
|
72
|
+
|
73
|
+
rescue LoadError
|
74
|
+
task :debug_mail do
|
75
|
+
abort "wlang is not available. Try 'gem install wlang'"
|
76
|
+
end
|
77
|
+
end
|
data/tasks/gem.rake
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
# Installs rake tasks for gemming and packaging
|
2
|
+
#
|
3
|
+
# This file installs the 'rake package', 'rake gem' tasks and associates
|
4
|
+
# (clobber_package, repackage, ...). It is automatically generated by Noe
|
5
|
+
# from your .noespec file, and should therefore be configured there, under
|
6
|
+
# the variables/rake_tasks/gem entry, as illustrated below:
|
7
|
+
#
|
8
|
+
# variables:
|
9
|
+
# rake_tasks:
|
10
|
+
# gem:
|
11
|
+
# package_dir: pkg
|
12
|
+
# need_tar: false
|
13
|
+
# need_tar_gz: false
|
14
|
+
# need_tar_bz2: false
|
15
|
+
# need_zip: false
|
16
|
+
# ...
|
17
|
+
#
|
18
|
+
# If you have specific needs requiring manual intervention on this file,
|
19
|
+
# don't forget to set safe-override to false in your noe specification:
|
20
|
+
#
|
21
|
+
# template-info:
|
22
|
+
# manifest:
|
23
|
+
# tasks/gem.rake:
|
24
|
+
# safe-override: false
|
25
|
+
#
|
26
|
+
begin
|
27
|
+
require 'rubygems/package_task'
|
28
|
+
Gem::PackageTask.new($gemspec) do |t|
|
29
|
+
|
30
|
+
# Name of the package
|
31
|
+
t.name = $gemspec.name
|
32
|
+
|
33
|
+
# Version of the package
|
34
|
+
t.version = $gemspec.version
|
35
|
+
|
36
|
+
# Directory used to store the package files
|
37
|
+
t.package_dir = "pkg"
|
38
|
+
|
39
|
+
# True if a gzipped tar file (tgz) should be produced
|
40
|
+
t.need_tar = false
|
41
|
+
|
42
|
+
# True if a gzipped tar file (tar.gz) should be produced
|
43
|
+
t.need_tar_gz = false
|
44
|
+
|
45
|
+
# True if a bzip2'd tar file (tar.bz2) should be produced
|
46
|
+
t.need_tar_bz2 = false
|
47
|
+
|
48
|
+
# True if a zip file should be produced (default is false)
|
49
|
+
t.need_zip = false
|
50
|
+
|
51
|
+
# List of files to be included in the package.
|
52
|
+
t.package_files = $gemspec.files
|
53
|
+
|
54
|
+
# Tar command for gzipped or bzip2ed archives.
|
55
|
+
t.tar_command = "tar"
|
56
|
+
|
57
|
+
# Zip command for zipped archives.
|
58
|
+
t.zip_command = "zip"
|
59
|
+
|
60
|
+
end
|
61
|
+
rescue LoadError
|
62
|
+
task :gem do
|
63
|
+
abort 'rubygems/package_task is not available. You should verify your rubygems installation'
|
64
|
+
end
|
65
|
+
task :package do
|
66
|
+
abort 'rubygems/package_task is not available. You should verify your rubygems installation'
|
67
|
+
end
|
68
|
+
end
|
data/tasks/genspec.rake
ADDED
@@ -0,0 +1,79 @@
|
|
1
|
+
# Installs a rake task for for running examples written using rspec.
|
2
|
+
#
|
3
|
+
# This file installs the 'rake spec_test' (aliased as 'rake spec') as well as
|
4
|
+
# extends 'rake test' to run spec tests, if any. It is automatically generated
|
5
|
+
# by Noe from your .noespec file, and should therefore be configured there,
|
6
|
+
# under the variables/rake_tasks/spec_test entry, as illustrated below:
|
7
|
+
#
|
8
|
+
# variables:
|
9
|
+
# rake_tasks:
|
10
|
+
# spec_test:
|
11
|
+
# pattern: spec/**/*_spec.rb
|
12
|
+
# verbose: true
|
13
|
+
# rspec_opts: [--color, --backtrace]
|
14
|
+
# ...
|
15
|
+
#
|
16
|
+
# If you have specific needs requiring manual intervention on this file,
|
17
|
+
# don't forget to set safe-override to false in your noe specification:
|
18
|
+
#
|
19
|
+
# template-info:
|
20
|
+
# manifest:
|
21
|
+
# tasks/spec_test.rake:
|
22
|
+
# safe-override: false
|
23
|
+
#
|
24
|
+
# This file has been written to conform to RSpec v2.4.0. More information about
|
25
|
+
# rspec and options of the rake task defined below can be found on
|
26
|
+
# http://relishapp.com/rspec
|
27
|
+
#
|
28
|
+
begin
|
29
|
+
require "rspec/core/rake_task"
|
30
|
+
desc "Run RSpec code examples"
|
31
|
+
RSpec::Core::RakeTask.new(:spec_test) do |t|
|
32
|
+
# Glob pattern to match files.
|
33
|
+
t.pattern = "spec/*.spec"
|
34
|
+
|
35
|
+
# By default, if there is a Gemfile, the generated command will include
|
36
|
+
# 'bundle exec'. Set this to true to ignore the presence of a Gemfile,
|
37
|
+
# and not add 'bundle exec' to the command.
|
38
|
+
t.skip_bundler = false
|
39
|
+
|
40
|
+
# Name of Gemfile to use
|
41
|
+
t.gemfile = "Gemfile"
|
42
|
+
|
43
|
+
# Whether or not to fail Rake when an error occurs (typically when
|
44
|
+
# examples fail).
|
45
|
+
t.fail_on_error = true
|
46
|
+
|
47
|
+
# A message to print to stderr when there are failures.
|
48
|
+
t.failure_message = nil
|
49
|
+
|
50
|
+
# Use verbose output. If this is set to true, the task will print the
|
51
|
+
# executed spec command to stdout.
|
52
|
+
t.verbose = true
|
53
|
+
|
54
|
+
# Use rcov for code coverage?
|
55
|
+
t.rcov = false
|
56
|
+
|
57
|
+
# Path to rcov.
|
58
|
+
t.rcov_path = "rcov"
|
59
|
+
|
60
|
+
# Command line options to pass to rcov. See 'rcov --help' about this
|
61
|
+
t.rcov_opts = []
|
62
|
+
|
63
|
+
# Command line options to pass to ruby. See 'ruby --help' about this
|
64
|
+
t.ruby_opts = []
|
65
|
+
|
66
|
+
# Path to rspec
|
67
|
+
t.rspec_path = "rspec"
|
68
|
+
|
69
|
+
# Command line options to pass to rspec. See 'rspec --help' about this
|
70
|
+
t.rspec_opts = ["--color", "--backtrace"]
|
71
|
+
end
|
72
|
+
rescue LoadError => ex
|
73
|
+
task :spec_test do
|
74
|
+
abort 'rspec is not available. In order to run spec, you must: gem install rspec'
|
75
|
+
end
|
76
|
+
ensure
|
77
|
+
task :spec => [:spec_test]
|
78
|
+
task :test => [:spec_test]
|
79
|
+
end
|
@@ -0,0 +1,76 @@
|
|
1
|
+
# Installs a rake task for for running unit tests.
|
2
|
+
#
|
3
|
+
# This file installs the 'rake unit_test' and extends 'rake test' to run unit
|
4
|
+
# tests, if any. It is automatically generated by Noe from your .noespec file,
|
5
|
+
# and should therefore be configured there, under the variables/rake_tasks/unit_test
|
6
|
+
# entry, as illustrated below:
|
7
|
+
#
|
8
|
+
# variables:
|
9
|
+
# rake_tasks:
|
10
|
+
# unit_test:
|
11
|
+
# pattern: test/test*.rb
|
12
|
+
# verbose: false
|
13
|
+
# warning: false
|
14
|
+
# ...
|
15
|
+
#
|
16
|
+
# If you have specific needs requiring manual intervention on this file,
|
17
|
+
# don't forget to set safe-override to false in your noe specification:
|
18
|
+
#
|
19
|
+
# template-info:
|
20
|
+
# manifest:
|
21
|
+
# tasks/unit_test.rake:
|
22
|
+
# safe-override: false
|
23
|
+
#
|
24
|
+
# More info about the TestTask and its options can be found on
|
25
|
+
# http://rake.rubyforge.org/classes/Rake/TestTask.html
|
26
|
+
#
|
27
|
+
begin
|
28
|
+
desc "Lauches unit tests"
|
29
|
+
require 'rake/testtask'
|
30
|
+
Rake::TestTask.new(:unit_test) do |t|
|
31
|
+
|
32
|
+
# List of directories to added to $LOAD_PATH before running the
|
33
|
+
# tests. (default is 'lib')
|
34
|
+
t.libs = ["lib"]
|
35
|
+
|
36
|
+
# True if verbose test output desired. (default is false)
|
37
|
+
t.verbose = false
|
38
|
+
|
39
|
+
# Test options passed to the test suite. An explicit TESTOPTS=opts
|
40
|
+
# on the command line will override this. (default is NONE)
|
41
|
+
t.options = nil
|
42
|
+
|
43
|
+
# Request that the tests be run with the warning flag set.
|
44
|
+
# E.g. warning=true implies "ruby -w" used to run the tests.
|
45
|
+
t.warning = false
|
46
|
+
|
47
|
+
# Glob pattern to match test files. (default is 'test/test*.rb')
|
48
|
+
t.pattern = nil
|
49
|
+
|
50
|
+
# Style of test loader to use. Options are:
|
51
|
+
#
|
52
|
+
# * :rake -- Rake provided test loading script (default).
|
53
|
+
# * :testrb -- Ruby provided test loading script.
|
54
|
+
# * :direct -- Load tests using command line loader.
|
55
|
+
#
|
56
|
+
t.loader = :rake
|
57
|
+
|
58
|
+
# Array of commandline options to pass to ruby when running test
|
59
|
+
# loader.
|
60
|
+
t.ruby_opts = []
|
61
|
+
|
62
|
+
# Explicitly define the list of test files to be included in a
|
63
|
+
# test. +list+ is expected to be an array of file names (a
|
64
|
+
# FileList is acceptable). If both +pattern+ and +test_files+ are
|
65
|
+
# used, then the list of test files is the union of the two.
|
66
|
+
t.test_files = ["test/unit/test_all.rb", "test/blackbox/test_all.rb", "test/standard_dialects/test_all.rb", "test/standard_dialects/**/*_test.rb"]
|
67
|
+
|
68
|
+
end
|
69
|
+
rescue LoadError => ex
|
70
|
+
task :unit_test do
|
71
|
+
abort 'rspec is not available. In order to run spec, you must: gem install rspec'
|
72
|
+
end
|
73
|
+
ensure
|
74
|
+
task :test => [:unit_test]
|
75
|
+
end
|
76
|
+
|