opulent 1.0.4 → 1.0.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e02913ca7a92447940158c0b4ff5dee49a28c32c
4
- data.tar.gz: 97be181ec7177499387884db7dee3acaa644f7c4
3
+ metadata.gz: dc38d5cc3026c471f1310cf7beb48cd156c23cfb
4
+ data.tar.gz: 0d69fbbb3da365d7d20f7726ecafac7b3ba8593d
5
5
  SHA512:
6
- metadata.gz: c2fea0f9dc244784ccd505f290c53c6c1b22518c280f010be00d589ebcb496422f50f680e4085f708622929bbd0fd297e1612bc5ff6726cce9ba60c12d7bf071
7
- data.tar.gz: 2112d92298f2752e573d15633594f1425ae9bf718658b1d66759d9602a0e05d37d18a04830c13abf6a491ca348a4d9eff56a95609cac6da474fc65978bedc6af
6
+ metadata.gz: 5a5341b39775f5410f2dc8983f219618122617ed2636768610c3c9dec48e665d9ad46f02ac3ae6847f6cff38112484d935e7227703c268178a9d3c58c184028c
7
+ data.tar.gz: 136f5752c6fce44857f32b9e27068dc722fbc568f1111834a675a57df998ae76cee61234014b7443fa9e74428698adf98e888b9f26eb4e4f4d2f4d8f1bff69f6
@@ -105,7 +105,7 @@ module Opulent
105
105
  # @param context [Symbol] Context name in which the error happens
106
106
  # @param data [Array] Additional error information
107
107
  #
108
- def error(context, *data)
108
+ def self.error(context, *data)
109
109
  message = case context
110
110
  when :enumerable
111
111
  "The provided each structure iteration input \"#{data[0]}\" is not Enumerable."
@@ -133,7 +133,7 @@ module Opulent
133
133
  enumerable = each_context.evaluate(node[@value][1])
134
134
 
135
135
  # Check if input can be iterated
136
- error :enumerable, node[@value][1] unless enumerable.respond_to? :each
136
+ self.error :enumerable, node[@value][1] unless enumerable.respond_to? :each
137
137
 
138
138
  # Selectively iterate through the input and add the result using the previously
139
139
  # defined proc object
@@ -20,7 +20,7 @@ module Opulent
20
20
  name = node[@value]
21
21
 
22
22
  # Check if filter is registered
23
- error :filter_registered, name unless Filters.filters.has_key? name
23
+ self.error :filter_registered, name unless Filters.filters.has_key? name
24
24
 
25
25
  # Load the required filter
26
26
  Filters.filters[name].load_filter
@@ -41,7 +41,7 @@ module Opulent
41
41
  # Call given input block and return the output
42
42
  #
43
43
  def evaluate_yield
44
- @block.call
44
+ @block.call if @block
45
45
  end
46
46
 
47
47
  # Extend the call context with a Hash, String or other Object
@@ -52,7 +52,7 @@ module Opulent
52
52
  # Create new local variables from the input hash
53
53
  locals.each do |key, value|
54
54
  begin
55
- @binding.local_variable_set(key.to_sym, value)
55
+ @binding.local_variable_set key.to_sym, value
56
56
  rescue NameError => variable
57
57
  Compiler.error :variable_name, variable, key
58
58
  end
@@ -71,18 +71,17 @@ module Opulent
71
71
  bind.eval('self.class.class_variables').each do |var|
72
72
  @binding.eval('self').class_variable_set var, bind.eval(var.to_s)
73
73
  end
74
-
75
- bind.eval('self.class.constants').each do |var|
76
- @binding.eval('self').const_set var, bind.eval(var.to_s)
77
- end
74
+ #
75
+ # bind.eval('self.class.constants').each do |var|
76
+ # @binding.eval('self').const_set var, bind.eval(var.to_s)
77
+ # end
78
78
  end
79
79
  end
80
80
 
81
-
82
81
  # @Binding
83
82
  class Binding
84
83
  def self.new
85
- binding
84
+ return binding
86
85
  end
87
86
  end
88
87
  end
@@ -27,6 +27,9 @@ module Opulent
27
27
  # Get the complete file path based on the current file being compiled
28
28
  require_path = File.expand_path name[1..-2], @dir
29
29
 
30
+ # Try to see if it has any existing extension, otherwise add .op
31
+ require_path += '.op' unless Settings::Extensions.include? File.extname require_path
32
+
30
33
  # Throw an error if the file doesn't exist
31
34
  error :require, name unless Dir[require_path].any?
32
35
 
@@ -45,7 +48,7 @@ module Opulent
45
48
  lines = indent_lines File.read(file), " " * indent
46
49
 
47
50
  # Indent all the output lines with the current indentation
48
- @code.insert @i+1, *lines.lines
51
+ @code.insert @i + 1, *lines.lines
49
52
  end
50
53
 
51
54
  return true
@@ -2,6 +2,9 @@
2
2
  module Opulent
3
3
  # @Settings
4
4
  module Settings
5
+ # Default Opulent allowed file extensions
6
+ Extensions = %w(.op .opl .opulent)
7
+
5
8
  # Default yield target which is used for child block replacements
6
9
  DefaultYield = :children
7
10
 
@@ -1,4 +1,4 @@
1
1
  # @Opulent
2
2
  module Opulent
3
- VERSION = "1.0.4"
3
+ VERSION = "1.0.7"
4
4
  end
@@ -27,6 +27,9 @@ Gem::Specification.new do |spec|
27
27
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
28
28
  spec.require_paths = ["lib"]
29
29
 
30
+ # This gem will work with 2.1.0 or greater...
31
+ spec.required_ruby_version = '>= 2.1.0'
32
+
30
33
  spec.add_development_dependency "bundler", "~> 1.10"
31
34
  spec.add_development_dependency "rake", "~> 10.0"
32
35
  spec.add_development_dependency "rspec"
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.0.4
4
+ version: 1.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Grozav
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-07-10 00:00:00.000000000 Z
11
+ date: 2015-07-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -124,7 +124,6 @@ files:
124
124
  - ".libold/opulent/template.rb"
125
125
  - ".libold/opulent/tokens.rb"
126
126
  - ".libold/opulent/version.rb"
127
- - ".rspec"
128
127
  - ".travis.yml"
129
128
  - Gemfile
130
129
  - LICENSE
@@ -182,7 +181,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
182
181
  requirements:
183
182
  - - ">="
184
183
  - !ruby/object:Gem::Version
185
- version: '0'
184
+ version: 2.1.0
186
185
  required_rubygems_version: !ruby/object:Gem::Requirement
187
186
  requirements:
188
187
  - - ">="
@@ -190,9 +189,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
190
189
  version: '0'
191
190
  requirements: []
192
191
  rubyforge_project:
193
- rubygems_version: 2.4.6
192
+ rubygems_version: 2.4.5
194
193
  signing_key:
195
194
  specification_version: 4
196
195
  summary: Intelligent Templating Engine for Creative Web Developers.
197
196
  test_files: []
198
- has_rdoc:
data/.rspec DELETED
@@ -1,2 +0,0 @@
1
- --format documentation
2
- --color