opulent 1.1.7 → 1.1.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e4e6711a377fd5f4bdb35c0d1acb44a542e2ad86
4
- data.tar.gz: 2df71d3a64fb210a6b0853285fff5d82e4a7363c
3
+ metadata.gz: ddc258c62764fc5d4682a818b54020aa9b0cedb3
4
+ data.tar.gz: a6b329acbba5dff20e8d5a66ec7894077bd2d8ff
5
5
  SHA512:
6
- metadata.gz: 20aa32c2d2edf206eef8eafaff65255fe0039ad10cfdaa92af9be2fdd890d1d91c99dd38b46780c28e8ba86cb76bd0c0207b6a06388fb1ee925dc5149eedd2d7
7
- data.tar.gz: a4a00b6cb4be54cb77a56aba84978e8a3e196b299c8bab178c721770ec508297476f97d98742942aa4a1965c870826ab7db44dc5add25549f4e031d7ef7d5890
6
+ metadata.gz: 9ad7aa47c0dc555fb42de99c7da3a361464c99ac4bbc2b2582a6b4396cf67852c6bb974e922f1b3a63dea6460028445f554b043634ad6de4e9c3f6a27c94ced9
7
+ data.tar.gz: f0cf7b68a4d0846aa75447e5d50d6da271152dcf65e3bfc956b307658cc177461a592cebdd2d0c142cecb12de2fef1a59b98bd2726010be3b3b80ac2f36195cf
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
@@ -30,9 +30,10 @@ module Opulent
30
30
  @children = 3
31
31
  @indent = 4
32
32
 
33
- # Set current compiled file
34
- @file = file
35
- @dir = File.dirname @file
33
+ # Set current compiled file as the first in the file stack together with
34
+ # its base indentation. The stack is used to allow require directives to
35
+ # be used with the last parent path found
36
+ @file = [[file, -1]]
36
37
 
37
38
  # Initialize definitions for the parser
38
39
  @definitions = definitions
@@ -48,7 +48,7 @@ module Opulent
48
48
  current_node = [:node, node_name, options, [], indent]
49
49
 
50
50
  # Check if the node is explicitly self enclosing
51
- if(close = accept_stripped :self_enclosing) || Settings::SelfEnclosing.include?(node_name)
51
+ if(close = accept_stripped :self_enclosing) || (!@definitions.keys.include?(node_name) && Settings::SelfEnclosing.include?(node_name))
52
52
  current_node[@options][:self_enclosing] = true
53
53
 
54
54
  unless close.nil? || close.strip.empty?
@@ -25,7 +25,7 @@ module Opulent
25
25
  end
26
26
 
27
27
  # Get the complete file path based on the current file being compiled
28
- require_path = File.expand_path name[1..-2], @dir
28
+ require_path = File.expand_path name[1..-2], File.dirname(@file[-1][0])
29
29
 
30
30
  # Try to see if it has any existing extension, otherwise add .op
31
31
  require_path += '.op' unless Settings::Extensions.include? File.extname require_path
@@ -36,7 +36,9 @@ module Opulent
36
36
  # Require entire directory tree
37
37
  Dir[require_path].each do |file|
38
38
  # Skip current file when including from same directory
39
- next if file == @file
39
+ next if file == @file[-1][0]
40
+
41
+ @file << [require_path, indent]
40
42
 
41
43
  # Throw an error if the file doesn't exist
42
44
  error :require_dir, file if File.directory? file
@@ -26,6 +26,9 @@ module Opulent
26
26
  @i -= 1; break
27
27
  end
28
28
 
29
+ # If last require path had a greater indentation, pop the last file path
30
+ @file.pop if @file[-1][1] > indent
31
+
29
32
  # Try the main Opulent node types and process each one of them using
30
33
  # their matching evaluation procedure
31
34
  current_node = node(parent, indent) ||
@@ -1,4 +1,4 @@
1
1
  # @Opulent
2
2
  module Opulent
3
- VERSION = "1.1.7"
3
+ VERSION = "1.1.9"
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opulent
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.7
4
+ version: 1.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Grozav
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-27 00:00:00.000000000 Z
11
+ date: 2015-07-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -129,6 +129,7 @@ files:
129
129
  - Gemfile
130
130
  - LICENSE
131
131
  - README.md
132
+ - Rakefile
132
133
  - benchmark/benchmark.rb
133
134
  - benchmark/cases/node/node.haml
134
135
  - benchmark/cases/node/node.op