linguify 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -9,16 +9,16 @@ GEM
9
9
  bundler (~> 1.0)
10
10
  git (>= 1.2.5)
11
11
  rake
12
- rake (0.9.2)
12
+ rake (0.9.2.2)
13
13
  rcov (0.9.11)
14
- rspec (2.6.0)
15
- rspec-core (~> 2.6.0)
16
- rspec-expectations (~> 2.6.0)
17
- rspec-mocks (~> 2.6.0)
18
- rspec-core (2.6.4)
19
- rspec-expectations (2.6.0)
14
+ rspec (2.7.0)
15
+ rspec-core (~> 2.7.0)
16
+ rspec-expectations (~> 2.7.0)
17
+ rspec-mocks (~> 2.7.0)
18
+ rspec-core (2.7.1)
19
+ rspec-expectations (2.7.0)
20
20
  diff-lcs (~> 1.1.2)
21
- rspec-mocks (2.6.0)
21
+ rspec-mocks (2.7.0)
22
22
  ruby2ruby (1.3.1)
23
23
  ruby_parser (~> 2.0)
24
24
  sexp_processor (~> 3.0)
data/README.md CHANGED
@@ -7,152 +7,166 @@ Since the code ends up compiled like all code should be you can execute your cod
7
7
 
8
8
  ## Installation
9
9
 
10
- gem install linguify
10
+ ``` ruby
11
+ gem install linguify
12
+ ```
11
13
 
12
14
  ## Basic usage
13
15
 
14
- require 'linguify'
15
-
16
- reduce /all directories/ => 'directories' do
17
- Dir.entries('.').select{ |f| f[0] != '.' && File.directory?(f) }
18
- end
19
-
20
- reduce /({directories:[^}]*}) recursively/ => 'directories' do |dirs|
21
- all_dirs = dirs
22
- Find.find(dirs) do |path|
23
- if FileTest.directory?(path)
24
- if File.basename(path)[0] == '.'
25
- Find.prune # Don't look any further into this directory.
26
- else
27
- all_dirs << path
28
- next
29
- end
30
- end
31
- end
32
- all_dirs
33
- end
34
-
35
- reduce /all files inside ({directories:[^}]*})/ => 'files' do |dirs|
36
- dirs.map{ |f| File.new(f, "r") }
37
- end
38
-
39
- reduce /view ({files:[^}]*})/ => '' do |files|
40
- files.each do |file|
41
- pp file
42
- end
43
- end
44
-
45
- "view all files inside all directories recursively".linguify.to_ruby
46
- # => "code = lambda do
47
- # directories_0 = Dir.entries(\".\").select { |f| ((not (f[0] == \".\")) and File.directory?(f)) }
48
- # directories_1 = (all_dirs = directories_0
49
- # Find.find(directories_0) do |path|
50
- # if FileTest.directory?(path) then
51
- # if (File.basename(path)[0] == \".\") then
52
- # Find.prune
53
- # else
54
- # (all_dirs << path)
55
- # next
56
- # end
57
- # end
58
- # end
59
- # all_dirs)
60
- # files_2 = directories_1.map { |f| File.new(f, \"r\") }
61
- # files_2.each { |file| pp(file) }
62
- # end
63
- # "
16
+ ``` ruby
17
+ require 'linguify'
18
+
19
+ reduce /all directories/ => 'directories' do
20
+ Dir.entries('.').select{ |f| f[0] != '.' && File.directory?(f) }
21
+ end
22
+
23
+ reduce /({directories:[^}]*}) recursively/ => 'directories' do |dirs|
24
+ all_dirs = dirs
25
+ Find.find(dirs) do |path|
26
+ if FileTest.directory?(path)
27
+ if File.basename(path)[0] == '.'
28
+ Find.prune # Don't look any further into this directory.
29
+ else
30
+ all_dirs << path
31
+ next
32
+ end
33
+ end
34
+ end
35
+ all_dirs
36
+ end
37
+
38
+ reduce /all files inside ({directories:[^}]*})/ => 'files' do |dirs|
39
+ dirs.map{ |f| File.new(f, "r") }
40
+ end
41
+
42
+ reduce /view ({files:[^}]*})/ do |files|
43
+ files.each do |file|
44
+ pp file
45
+ end
46
+ end
47
+
48
+ "view all files inside all directories recursively".linguify.to_ruby
49
+ # => "code = lambda do
50
+ # directories_0 = Dir.entries(\".\").select { |f| ((not (f[0] == \".\")) and File.directory?(f)) }
51
+ # directories_1 = (all_dirs = directories_0
52
+ # Find.find(directories_0) do |path|
53
+ # if FileTest.directory?(path) then
54
+ # if (File.basename(path)[0] == \".\") then
55
+ # Find.prune
56
+ # else
57
+ # (all_dirs << path)
58
+ # next
59
+ # end
60
+ # end
61
+ # end
62
+ # all_dirs)
63
+ # files_2 = directories_1.map { |f| File.new(f, \"r\") }
64
+ # files_2.each { |file| pp(file) }
65
+ # end
66
+ # "
67
+ ```
64
68
 
65
69
  And if you simply want to execute your magnificent piece of art:
66
70
 
67
- "view all files inside all directories recursively".linguify.run
71
+ ``` ruby
72
+ "view all files inside all directories recursively".linguify.run
73
+ ```
68
74
 
69
75
  Or even:
70
76
 
71
- # compile once, run plenty
72
- code = "view all files inside all directories recursively".linguify
73
- loop do
74
- code.run
75
- end
77
+ ``` ruby
78
+ # compile once, run plenty
79
+ code = "view all files inside all directories recursively".linguify
80
+ loop do
81
+ code.run
82
+ end
83
+ ```
76
84
 
77
85
  ## More advanced usage
78
86
 
79
87
  Linguify supports mixing javascript and ruby.
80
88
  A typical case would be to express NOSQL queries in plain English for everyones convenience.
81
89
 
82
- require 'linguify'
90
+ ``` ruby
91
+ require 'linguify'
83
92
 
84
- reduce /a possible javascript NOSQL query/ => {:to => 'query', :lang => :js} do
85
- @db.forEach(lambda{ |record|
86
- emit(record);
87
- }
88
- )
89
- end
93
+ reduce /a possible javascript NOSQL query/ => {:to => 'query', :lang => :js} do
94
+ @db.forEach(lambda{ |record|
95
+ emit(record);
96
+ }
97
+ )
98
+ end
90
99
 
91
- reduce /execute ({query:[^}]*})/ => '' do |query|
92
- db.map query
93
- end
100
+ reduce /execute ({query:[^}]*})/ do |query|
101
+ db.map query
102
+ end
94
103
 
95
- "execute a possible javascript NOSQL query".linguify.to_ruby
96
- # => "code = lambda do
97
- # query = \"function(){\\n this.db.forEach(function(record){\\n emit(record)\\n });\\n}\"
98
- # db.map(query)
99
- # end
100
- # "
104
+ "execute a possible javascript NOSQL query".linguify.to_ruby
105
+ # => "code = lambda do
106
+ # query = \"function(){\\n this.db.forEach(function(record){\\n emit(record)\\n });\\n}\"
107
+ # db.map(query)
108
+ # end
109
+ # "
110
+ ```
101
111
 
102
112
  The nature of Linguify's expression reduction face pragmatic programmers with a urge to inline the code the arguments represents.
103
113
  Luckily Linguify has evolved to embrace such minds. Linguify is not for the general masses. It is for the mighty few pragmatics.
104
114
 
105
- require 'linguify'
106
-
107
- reduce /inlined code/ => {:to => 'code', :lang => :ruby, :inline => true} do
108
- something.each do |foobar| # life is not worth living without psedo foobars
109
- pp foobar
110
- end
111
- end
112
-
113
- reduce /execute ({code:[^}]*})/ => '' do |code|
114
- pp "hey mum"
115
- code
116
- pp "you will never know what I just did"
117
- end
118
-
119
- "execute inlined code".linguify.to_ruby
120
- # => "code = lambda do
121
- # (pp(\"hey mum\")
122
- # (something.each { |foobar| pp(foobar) })
123
- # pp(\"you will never know what I just did\"))
124
- # end
125
- # "
115
+ ``` ruby
116
+ require 'linguify'
117
+
118
+ reduce /inlined code/ => {:to => 'code', :lang => :ruby, :inline => true} do
119
+ something.each do |foobar| # life is not worth living without psedo foobars
120
+ pp foobar
121
+ end
122
+ end
123
+
124
+ reduce /execute ({code:[^}]*})/ do |code|
125
+ pp "hey mum"
126
+ code
127
+ pp "you will never know what I just did"
128
+ end
129
+
130
+ "execute inlined code".linguify.to_ruby
131
+ # => "code = lambda do
132
+ # (pp(\"hey mum\")
133
+ # (something.each { |foobar| pp(foobar) })
134
+ # pp(\"you will never know what I just did\"))
135
+ # end
136
+ # "
137
+ ```
126
138
 
127
139
  And you can even inline sub-expressions:
128
140
 
129
- require 'linguify'
130
-
131
- reduce /sub expression/ => {:to => 'sub_expression', :lang => :ruby, :inline => true} do
132
- pp "this is the sub expression code"
133
- end
134
-
135
- reduce /({sub_expression:[^}]*}) of inlined code/ => {:to => 'code', :lang => :ruby, :inline => true} do |sub|
136
- something.each do |foobar| # life is not worth living without psedo foobars
137
- pp foobar
138
- end
139
- end
140
-
141
- reduce /execute ({code:[^}]*})/ => '' do |code|
142
- pp "hey mum"
143
- code
144
- code[:sub]
145
- pp "you will never know what I just did"
146
- end
147
-
148
- "execute sub expression of inlined code".linguify.to_ruby
149
- # => "code = lambda do
150
- # (pp(\"hey mum\")
151
- # (something.each { |foobar| pp(foobar) })
152
- # pp(\"this is the sub expression code\")
153
- # pp(\"you will never know what I just did\"))
154
- # end
155
- # "
141
+ ``` ruby
142
+ require 'linguify'
143
+
144
+ reduce /sub expression/ => {:to => 'sub_expression', :lang => :ruby, :inline => true} do
145
+ pp "this is the sub expression code"
146
+ end
147
+
148
+ reduce /({sub_expression:[^}]*}) of inlined code/ => {:to => 'code', :lang => :ruby, :inline => true} do |sub|
149
+ something.each do |foobar| # life is not worth living without psedo foobars
150
+ pp foobar
151
+ end
152
+ end
153
+
154
+ reduce /execute ({code:[^}]*})/ do |code|
155
+ pp "hey mum"
156
+ code
157
+ code[:sub]
158
+ pp "you will never know what I just did"
159
+ end
160
+
161
+ "execute sub expression of inlined code".linguify.to_ruby
162
+ # => "code = lambda do
163
+ # (pp(\"hey mum\")
164
+ # (something.each { |foobar| pp(foobar) })
165
+ # pp(\"this is the sub expression code\")
166
+ # pp(\"you will never know what I just did\"))
167
+ # end
168
+ # "
169
+ ```
156
170
 
157
171
  ## License
158
172
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.0
1
+ 0.4.0
@@ -11,8 +11,8 @@ module Linguify
11
11
 
12
12
  # Lingquify a sentence
13
13
  #
14
- # * +str+ - A plain English string, or a plain English string with reductions in it.
15
- # * +replace+ - In which "scope" to bind the code during compilation
14
+ # @param [ String ] string A plain English string, or a plain English string with reductions in it.
15
+ # @param [ Binding ] binding See +Kernel#eval+
16
16
  #
17
17
  def initialize str,bind
18
18
 
@@ -66,7 +66,7 @@ module Linguify
66
66
 
67
67
  # Find a reduction rule for the string
68
68
  #
69
- # * +str+ - A plain English string, or a plain English string with reductions in it.
69
+ # @param [ String ] string A plain English string, or a plain English string with reductions in it.
70
70
  #
71
71
  def find_rule str
72
72
  found = Linguify.rules.select do |rule|
data/lib/linguify/proc.rb CHANGED
@@ -1,6 +1,11 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  class Proc
4
+
5
+ # Translate the Proc to a +Reduction+.
6
+ #
7
+ # @returns [ Reduction ] A +Reduction+ containing the code of the Proc.
8
+ #
4
9
  def to_reduction args={}
5
10
  Linguify::Reduction.new(
6
11
  :returns => args[:returns] || '',
@@ -19,7 +24,7 @@ class Proc
19
24
 
20
25
  sexy = reduction.compile
21
26
  code = Marshal.load(Marshal.dump(sexy.first)) # sexy is not cleanly duplicated
22
- code.replace_variable_references!(Linguify::Replacement.new(:sexp => collection.name),:collection)
27
+ code.replace_variable_references! :replacement => Linguify::Replacement.new(:sexp => collection.name), :needle => :collection
23
28
  code
24
29
  end
25
30
  end
@@ -36,6 +36,10 @@ module Linguify
36
36
  @@reductions << self
37
37
  end
38
38
 
39
+ # Extract the arguments from the code block of this Reduction.
40
+ #
41
+ # @returns [ Hash ] Key valye pairs of symbolized variable names and the reduction reference.
42
+ #
39
43
  def determine_arguments
40
44
  s = Marshal.load(Marshal.dump(self)) # sexp handling is not clean cut
41
45
  raise "what is this?" unless s.sexp.sexp_type == :iter && s.sexp[1].sexp_type == :call && s.sexp[1][1] == nil && s.sexp[1][2] == :proc && s.sexp[1][3].sexp_type == :arglist
@@ -57,11 +61,14 @@ module Linguify
57
61
  raise "unsupported argument type #{args}"
58
62
  end
59
63
  end
60
- # args[] now has the symbolized argument names of the code block
61
64
  @named_args = Hash[*args.zip(@args).flatten] if args
62
65
  @named_args ||= {}
63
66
  end
64
67
 
68
+ # Parse the string and return its reduction rule.
69
+ #
70
+ # @returns [ Reduction ] The reduction rule of the string.
71
+ #
65
72
  def self.parse str
66
73
  if /^{(?<return>[^:]*):(?<rid>[0-9]+)}$/ =~ str
67
74
  @@reductions[rid.to_i]
@@ -78,10 +85,13 @@ module Linguify
78
85
 
79
86
  # Compile self
80
87
  #
81
- # * +return_variable+ - The return variable. Can either be a symbol representing the variable name or nil to skip variable assigning.
82
- # * +replace+ - A list of variables in need of a new unique name or replacement with inlined code
88
+ # @param [ Symbol,nil ] return_variable The variable in the code wanting the result.
89
+ # @param [ Array<Symbol,Sexp>] replacement A list of variables in need of a new unique name or replacement with inlined code
90
+ # @returns [ Array<Sexp> ] the compiled code
83
91
  #
84
- def compile_with_return_to_var(return_variable=nil, replace = {})
92
+ def compile_with_return_to_var params={}
93
+ replace = params[:replace] || {}
94
+
85
95
  s = Marshal.load(Marshal.dump(self)) # sexp handling is not clean cut
86
96
  args = @named_args.keys
87
97
  # args[] now has the symbolized argument names of the code block
@@ -94,7 +104,7 @@ module Linguify
94
104
  red = Reduction::parse(arg)
95
105
  if red.lang != lang && red.lang == :js && lang == :ruby
96
106
  # paste javascript code into a ruby variable
97
- code = red.compile_with_return_to_var(nil,replace)
107
+ code = red.compile_with_return_to_var :replace => replace
98
108
  clone = Marshal.load(Marshal.dump(code)) # code is not cleanly duplicated
99
109
  code = Sexp.new(:iter,Sexp.new(:call, nil, :lambda, Sexp.new(:arglist)), nil,
100
110
  Sexp.new(:block,
@@ -107,10 +117,10 @@ module Linguify
107
117
  else
108
118
  raise "trying to reference #{red.lang} code in #{lang} code" if red.lang != lang
109
119
  if red.inline
110
- code = red.compile_with_return_to_var(nil,replace)
120
+ code = red.compile_with_return_to_var :replace => replace
111
121
  replace[args[i]] = Replacement.new(:sexp => Sexp.new(:block,*code), :inline => true)
112
122
  else
113
- code = red.compile_with_return_to_var("#{ret}_#{n}".to_sym,replace)
123
+ code = red.compile_with_return_to_var :return_variable => "#{ret}_#{n}".to_sym, :replace => replace
114
124
  args_code += code
115
125
  replace[args[i]] = Replacement.new(:sexp => "#{ret}_#{n}".to_sym)
116
126
  end
@@ -123,27 +133,31 @@ module Linguify
123
133
  end
124
134
  end
125
135
 
126
- if return_variable
136
+ if params[:return_variable]
127
137
  if s.sexp[3][0] == :block
128
- code = Sexp.new(:lasgn, return_variable,
138
+ code = Sexp.new(:lasgn, params[:return_variable],
129
139
  Sexp.new(:block,
130
140
  *(s.sexp[3][1..-1].map{ |s| s.dup })
131
141
  )
132
142
  )
133
143
  else
134
- code = Sexp.new(:lasgn, return_variable, s.sexp[3].dup)
144
+ code = Sexp.new(:lasgn, params[:return_variable], s.sexp[3].dup)
135
145
  end
136
146
  else
137
147
  code = s.sexp[3].dup
138
148
  end
139
149
 
140
150
  replace.each do |k,v|
141
- code.replace_variable_references!(v,k,@named_args)
151
+ code.replace_variable_references! :replacement => v, :needle => k, :named_args => @named_args
142
152
  end
143
153
 
144
154
  return *args_code + [code]
145
155
  end
146
156
 
157
+ # Get the reduction reference for this Reduction.
158
+ #
159
+ # @returns [ String ] A unique string reference refering to this Reduction.
160
+ #
147
161
  def to_rexp
148
162
  raise "hell" if returns.kind_of?(Array)
149
163
  "{#{returns}:#{reduction_id}}"
data/lib/linguify/sexp.rb CHANGED
@@ -4,12 +4,16 @@ class Sexp < Array
4
4
 
5
5
  # Recurcively replace all references in a code section
6
6
  #
7
- # * +code+ - The code haystack to search and replace in
8
- # * +replacement+ - The replacement code. Either a Sexp (containing code to inline) or a symbol
9
- # * +needle+ - The search needle
7
+ # @param [ Sexp, Symbol ] replacement The replacement code. Either a Sexp (containing code to inline) or a symbol
8
+ # @param [ Sexp ] needle The search needle
9
+ # @param [ Hash ] named_args The arguments of the code block
10
10
  #
11
- def replace_variable_references!(replacement,needle,named_args="")
11
+ def replace_variable_references! params
12
12
 
13
+ replacement = params[:replacement]
14
+ needle = params[:needle]
15
+ named_args = params[:named_args] || ''
16
+
13
17
  case sexp_type
14
18
  when :lasgn
15
19
  self[1]=replacement.sexp if self[1] == needle
@@ -46,12 +50,12 @@ class Sexp < Array
46
50
  sexy = Marshal.load(Marshal.dump(Linguify::Reduction.parse(Linguify::Reduction.parse(named_args[needle]).named_args[arg]).sexp)) # sexp handling is not clean cut
47
51
  self[i+1] = sexy[3]
48
52
  else
49
- h.replace_variable_references!(replacement,needle,named_args) if h && h.kind_of?(Sexp)
53
+ h.replace_variable_references!(:replacement => replacement, :needle => needle, :named_args => named_args) if h && h.kind_of?(Sexp)
50
54
  end
51
55
  end
52
56
  else
53
57
  self[1..-1].each do |h|
54
- h.replace_variable_references!(replacement,needle,named_args) if h && h.kind_of?(Sexp)
58
+ h.replace_variable_references!(:replacement => replacement, :needle => needle, :named_args => named_args) if h && h.kind_of?(Sexp)
55
59
  end
56
60
  end
57
61
  end
@@ -1,9 +1,23 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  class String
4
+
5
+ # Linguify the string.
6
+ #
7
+ # @param [ Binding ] binding See the +Kernel#eval+.
8
+ # @returns [ Linguified ] code The compiled code
9
+ #
10
+ # @example Linguify a string and translate it back to Ruby
11
+ # "this is the famous hello world".linguify.to_ruby
12
+ # # => "code = lambda do
13
+ # # (pp(\"hello world\")
14
+ # # end
15
+ # # "
16
+ #
4
17
  def linguify bind=binding
5
18
  return Linguify::Linguified::cache[self] if Linguify::Linguified::cache[self]
6
19
  Linguify::Linguified::cache[self] = Linguify::Linguified.new(self,bind)
7
20
  end
21
+
8
22
  end
9
23
 
@@ -469,6 +469,10 @@ class Ruby2Js < SexpProcessor
469
469
  exp.empty? ? "" : process(exp.shift)
470
470
  end
471
471
 
472
+ def process_str(exp)
473
+ "\"#{exp.shift.to_s}\""
474
+ end
475
+
472
476
  def process_true(exp)
473
477
  "true"
474
478
  end
data/lib/linguify.rb CHANGED
@@ -6,20 +6,57 @@ require 'linguify/sexp'
6
6
  require 'linguify/string'
7
7
  require 'linguify/proc'
8
8
 
9
+ # Defines a reduction rule.
10
+ #
11
+ # @param [ Hash ] pattern The step matching pattern
12
+ # @param [ Proc ] code The code
13
+ #
14
+ # The step matching pattern only one key-value pair, where the
15
+ # key is the step matching pattern and the
16
+ # value is on of:
17
+ # nil - indicating the last reduction,
18
+ # +String+ - the name of the reduction,
19
+ # +Hash+ - the name of the reduction and adittional parameters
20
+ #
21
+ # Supported parameters:
22
+ # :to - the name of the reduction
23
+ # :lang - what language the code block translates to. (:ruby or :js)
24
+ # :inline - if true, calls to this reduction will be inlined
25
+ #
26
+ # @example Define a reduction rule that reduce a text to a javascript reduction named query.
27
+ # reduce /a possible javascript NOSQL query/ => {:to => 'query', :lang => :js} do
28
+ # @db.forEach(lambda{ |record|
29
+ # emit(record);
30
+ # }
31
+ # )
32
+ # end
33
+ #
9
34
  def reduce(regexp,&code)
10
- rule = regexp.values[0].kind_of?(Hash) ? {
11
- :match => regexp.keys[0],
12
- :result => regexp.values[0][:to] || '',
13
- :lang => regexp.values[0][:lang] || :ruby,
14
- :inline => regexp.values[0][:inline] || false,
15
- :proc => code
16
- } : {
17
- :match => regexp.keys[0],
18
- :result => regexp.values[0],
19
- :lang => :ruby,
20
- :inline => false,
21
- :proc => code
22
- }
35
+ rule = if regexp.kind_of? Regexp
36
+ {
37
+ :match => regexp,
38
+ :result => '',
39
+ :lang => :ruby,
40
+ :inline => false,
41
+ :proc => code
42
+ }
43
+ elsif regexp.values[0].kind_of?(Hash)
44
+ {
45
+ :match => regexp.keys[0],
46
+ :result => regexp.values[0][:to] || '',
47
+ :lang => regexp.values[0][:lang] || :ruby,
48
+ :inline => regexp.values[0][:inline] || false,
49
+ :proc => code
50
+ }
51
+ else
52
+ {
53
+ :match => regexp.keys[0],
54
+ :result => regexp.values[0],
55
+ :lang => :ruby,
56
+ :inline => false,
57
+ :proc => code
58
+ }
59
+ end
23
60
  Linguify::rules << rule
24
61
  end
25
62
 
data/linguify.gemspec ADDED
@@ -0,0 +1,68 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{linguify}
8
+ s.version = "0.4.0"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = [%q{Patrick Hanevold}]
12
+ s.date = %q{2011-10-27}
13
+ s.description = %q{Linguify is a linguistic compiler allowing you to compile and execute plain english.}
14
+ s.email = %q{patrick.hanevold@gmail.com}
15
+ s.extra_rdoc_files = [
16
+ "README.md"
17
+ ]
18
+ s.files = [
19
+ "Gemfile",
20
+ "Gemfile.lock",
21
+ "README.md",
22
+ "Rakefile",
23
+ "VERSION",
24
+ "lib/linguify.rb",
25
+ "lib/linguify/linguified.rb",
26
+ "lib/linguify/proc.rb",
27
+ "lib/linguify/reduction.rb",
28
+ "lib/linguify/sexp.rb",
29
+ "lib/linguify/string.rb",
30
+ "lib/linguify/translators/javascript.rb",
31
+ "linguify.gemspec",
32
+ "spec/linguify/linguify_spec.rb",
33
+ "tasks/spec.rake"
34
+ ]
35
+ s.homepage = %q{http://github.com/patrickhno/linguify}
36
+ s.licenses = [%q{MIT}]
37
+ s.require_paths = [%q{lib}]
38
+ s.rubygems_version = %q{1.8.8}
39
+ s.summary = %q{Linguify, the linguistic compiler.}
40
+
41
+ if s.respond_to? :specification_version then
42
+ s.specification_version = 3
43
+
44
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
45
+ s.add_runtime_dependency(%q<sourcify>, [">= 0"])
46
+ s.add_development_dependency(%q<shoulda>, [">= 0"])
47
+ s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
48
+ s.add_development_dependency(%q<jeweler>, ["~> 1.6.4"])
49
+ s.add_development_dependency(%q<rcov>, [">= 0"])
50
+ s.add_development_dependency(%q<rspec>, [">= 0"])
51
+ else
52
+ s.add_dependency(%q<sourcify>, [">= 0"])
53
+ s.add_dependency(%q<shoulda>, [">= 0"])
54
+ s.add_dependency(%q<bundler>, ["~> 1.0.0"])
55
+ s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
56
+ s.add_dependency(%q<rcov>, [">= 0"])
57
+ s.add_dependency(%q<rspec>, [">= 0"])
58
+ end
59
+ else
60
+ s.add_dependency(%q<sourcify>, [">= 0"])
61
+ s.add_dependency(%q<shoulda>, [">= 0"])
62
+ s.add_dependency(%q<bundler>, ["~> 1.0.0"])
63
+ s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
64
+ s.add_dependency(%q<rcov>, [">= 0"])
65
+ s.add_dependency(%q<rspec>, [">= 0"])
66
+ end
67
+ end
68
+
@@ -29,7 +29,7 @@ describe Linguify::Linguified, "#linguify" do
29
29
  dirs.map{ |f| File.new(f, "r") }
30
30
  end
31
31
 
32
- reduce /view ({files:[^}]*})/ => '' do |files|
32
+ reduce /view ({files:[^}]*})/ do |files|
33
33
  files.each do |file|
34
34
  pp file
35
35
  end
@@ -46,7 +46,7 @@ describe Linguify::Linguified, "#linguify" do
46
46
  )
47
47
  end
48
48
 
49
- reduce /execute ({query:[^}]*})/ => '' do |query|
49
+ reduce /execute ({query:[^}]*})/ do |query|
50
50
  db.map query
51
51
  end
52
52
 
@@ -64,7 +64,7 @@ describe Linguify::Linguified, "#linguify" do
64
64
  end
65
65
  end
66
66
 
67
- reduce /execute ({code:[^}]*})/ => '' do |code|
67
+ reduce /execute ({code:[^}]*})/ do |code|
68
68
  pp "hey mum"
69
69
  code
70
70
  code[:sub]
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: linguify
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.3.0
5
+ version: 0.4.0
6
6
  platform: ruby
7
7
  authors:
8
8
  - Patrick Hanevold
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-10-22 00:00:00 Z
13
+ date: 2011-10-27 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: sourcify
@@ -87,7 +87,6 @@ extensions: []
87
87
  extra_rdoc_files:
88
88
  - README.md
89
89
  files:
90
- - .document
91
90
  - Gemfile
92
91
  - Gemfile.lock
93
92
  - README.md
@@ -100,6 +99,7 @@ files:
100
99
  - lib/linguify/sexp.rb
101
100
  - lib/linguify/string.rb
102
101
  - lib/linguify/translators/javascript.rb
102
+ - linguify.gemspec
103
103
  - spec/linguify/linguify_spec.rb
104
104
  - tasks/spec.rake
105
105
  homepage: http://github.com/patrickhno/linguify
@@ -115,7 +115,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
115
115
  requirements:
116
116
  - - ">="
117
117
  - !ruby/object:Gem::Version
118
- hash: -3911346781784924082
118
+ hash: 1805068760905318468
119
119
  segments:
120
120
  - 0
121
121
  version: "0"
data/.document DELETED
@@ -1,5 +0,0 @@
1
- lib/**/*.rb
2
- bin/*
3
- -
4
- features/**/*.feature
5
- LICENSE.txt