wlang 0.10.0 → 0.10.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -37,5 +37,6 @@
37
37
  }
38
38
  </div>
39
39
  }
40
+ <<{analytics.wtpl}
40
41
  </body>
41
42
  </html>
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  title: WLang
3
- version: 0.10.0
3
+ version: 0.10.1
4
4
  sections:
5
5
  - identifier: about
6
6
  name: About
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.0".freeze
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("No data loader for #{extension}") if loader.nil?
289
+ raise ::WLang::Error, "No data loader for #{extension}" if loader.nil?
289
290
  loader.call(uri)
290
291
  end
291
292
 
File without changes
data/lib/wlang/parser.rb CHANGED
@@ -209,7 +209,7 @@ module WLang
209
209
  # parsing on a '}')
210
210
  #
211
211
  def has_block?(offset)
212
- self.source_text[offset,2]=='}{'
212
+ self.source_text[offset,2] == template.block_endstart
213
213
  end
214
214
 
215
215
  #
@@ -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)
@@ -1,4 +1,4 @@
1
- require "wlang"
1
+ require File.expand_path('../spec_helper', __FILE__)
2
2
  describe "WLang's version of BasicObject" do
3
3
 
4
4
  class A
@@ -1,4 +1,4 @@
1
- require "wlang"
1
+ require File.expand_path('../spec_helper', __FILE__)
2
2
  describe("WLang should support coderay encoder") do
3
3
 
4
4
  it("should support basic coderay encoding") {
File without changes
@@ -1,4 +1,4 @@
1
- require 'wlang'
1
+ require File.expand_path('../spec_helper', __FILE__)
2
2
  require 'wlang/hash_scope'
3
3
 
4
4
  describe ::WLang::HashScope do
@@ -1,4 +1,4 @@
1
- require "wlang"
1
+ require File.expand_path('../spec_helper', __FILE__)
2
2
  describe("WLang should support redcloth encoder") do
3
3
 
4
4
  it("should support basic redcloth encoding") {
@@ -0,0 +1,2 @@
1
+ $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
2
+ require 'wlang'
File without changes
@@ -1,4 +1,4 @@
1
- require 'wlang'
1
+ require File.expand_path('../spec_helper', __FILE__)
2
2
  describe ::WLang do
3
3
 
4
4
  it("should allow easy use of encoders") {
@@ -0,0 +1,8 @@
1
+ require File.expand_path('../spec_helper', __FILE__)
2
+ describe WLang do
3
+
4
+ it "should have a version number" do
5
+ WLang.const_defined?(:VERSION).should be_true
6
+ end
7
+
8
+ end
@@ -1,5 +1,4 @@
1
- require "wlang"
2
-
1
+ require File.expand_path('../spec_helper', __FILE__)
3
2
  describe "The wlang/xhtml dialect" do
4
3
 
5
4
  it("should provide helpers to create links") {
@@ -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
@@ -0,0 +1,13 @@
1
+ Subject: [ANN] !{lower} !{version} Released
2
+
3
+ !{lower} version !{version} has been released!
4
+
5
+ !{summary}
6
+
7
+ *{links as l}{* <!{l}>}{!{"\n"}}
8
+
9
+ !{description}
10
+
11
+ Changes:
12
+
13
+ !{changes}
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
@@ -0,0 +1,5 @@
1
+ # Installs a rake task for generating the specification.
2
+ desc "Generate doc/specification/specification.html"
3
+ task :genspec do
4
+ Kernel.exec("ruby -Ilib bin/wlang --methodize --output doc/specification/specification.html doc/specification/specification.wtpl")
5
+ end
@@ -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
+