zapata 0.0.1 → 0.0.2

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: c4947c74075c16975810dfe03d6b0708dbae7214
4
- data.tar.gz: fd9187d034ba8b411bd8d9d47bd676aa0d4d08ed
3
+ metadata.gz: 02ed505b11c49d0937c21dd672d941ddbed166a7
4
+ data.tar.gz: 7d8b7e08e587db3711a7883d3b6401164547bde2
5
5
  SHA512:
6
- metadata.gz: 5ce92767f6e47248793cddd5a5cc21ec911c5f247c5a809a0747e65a94707e7521648af0bccac6774fc77a9c641368c1bea8d0221b66f8cbe09d494e538f8b56
7
- data.tar.gz: c9840ed16514a3bd7eaf0aceaddea7fa5154c818a4e7099a57249674ba3d5dac5bd7a3543b21709038567a76298dd5087287863401c371462b34f20534cf050a
6
+ metadata.gz: 802d1b5d46141a0c76af5daa092d4b026b62032cc54b3df3137a2e00c0443dd218f04b68cc8e7a6d7935addbbd434f20aa46a20083815a2524244212e959dffc
7
+ data.tar.gz: af4f6ca0d3cae7de44de60b28dc77b0db1446f3925d32d25eb72280c347c806d06743de2315d9616885112a9766a8c7f9a30e65c82f3e573a39ca3aa3639f5a0
data/.travis.yml ADDED
@@ -0,0 +1,12 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.1.0
4
+ - 2.0.0
5
+ - 1.9.3
6
+ - jruby-18mode
7
+ - jruby-19mode
8
+ - rbx-2
9
+ - ruby-head
10
+ - jruby-head
11
+ - ree
12
+ script: bundle exec rspec --pattern "spec/*_spec.rb"
data/README.md CHANGED
@@ -1,3 +1,5 @@
1
+ [![Code Climate](https://codeclimate.com/github/Nedomas/zapata/badges/gpa.svg)](https://codeclimate.com/github/Nedomas/zapata)
2
+
1
3
  # Zapata
2
4
 
3
5
  Who has time to write tests? This is a revolutional tool to make them write
@@ -129,6 +131,11 @@ or
129
131
  gem 'zapata', groups: %w(development test)
130
132
  ```
131
133
 
134
+ To use run
135
+ ```sh
136
+ zapata generate app/models/model_name.rb
137
+ ```
138
+
132
139
  ## Collaboration :heart:
133
140
 
134
141
  I know that code analyzing is a sexy sphere to work on for many developers.
data/bin/zapata CHANGED
@@ -4,17 +4,24 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  require_relative '../lib/zapata'
6
6
 
7
- Slop.parse do
8
- banner 'Usage: zapata [options]'
7
+ description_of_generate = "'zapata generate <filename>'
8
+ -s, --single option to skip app/models analysis"
9
9
 
10
- on '--help', '-h' do
11
- puts help
10
+ slop = Slop.new(help: true, banner: true) do
11
+ banner('Usage: zapata [options]')
12
+ on :v, :version, 'Print version.' do
13
+ puts "Your version is #{Zapata::VERSION}"
12
14
  end
13
15
 
14
- command 'generate' do
16
+ command('generate', description: description_of_generate) do
17
+ on(:s, :single, "Does not analyze 'app/models'", banner: true)
18
+
15
19
  run do |opts, args|
16
- spec_filename = Zapata::Revolutionist.generate(args.shift)
20
+ spec_filename = Zapata::Revolutionist.generate(args.shift, single: opts.single?)
17
21
  puts "Its done, comrades. File #{spec_filename} was generated."
18
22
  end
19
23
  end
20
24
  end
25
+
26
+ puts slop.help if ARGV.empty?
27
+ slop.parse
@@ -2,12 +2,16 @@ module Zapata
2
2
  module Core
3
3
  class Loader
4
4
  class << self
5
+ def spec_dir
6
+ File.join(Dir.pwd, '/spec')
7
+ end
8
+
5
9
  def rails_helper_path
6
- File.expand_path("#{Dir.pwd}/spec/rails_helper", __FILE__)
10
+ File.expand_path("#{spec_dir}/rails_helper", __FILE__)
7
11
  end
8
12
 
9
13
  def spec_helper_path
10
- File.expand_path("#{Dir.pwd}/spec/spec_helper", __FILE__)
14
+ File.expand_path("#{spec_dir}/spec_helper", __FILE__)
11
15
  end
12
16
 
13
17
  def helper_name
@@ -30,7 +34,8 @@ module Zapata
30
34
  end
31
35
 
32
36
  def load_spec_helper
33
- require "#{full_helper_path}.rb"
37
+ $LOAD_PATH << spec_dir
38
+ require "#{helper_name}"
34
39
  end
35
40
  end
36
41
  end
data/lib/zapata/diver.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  module Zapata
2
2
  RETURN_TYPES = %i(missing raw const_send sym float str int ivar true false const nil)
3
+ FINAL_TYPES = Zapata::RETURN_TYPES + %i(array hash)
3
4
  DIVE_TYPES = %i(args begin block defined? nth_ref splat kwsplat class
4
5
  block_pass sclass masgn or and irange erange when and
5
6
  return array kwbegin yield while dstr ensure pair)
@@ -3,90 +3,38 @@ module Zapata
3
3
  class Args
4
4
  class << self
5
5
  def literal(args_node)
6
+ return unless args_node
7
+
6
8
  raw_args = Diver.dive(args_node).to_raw
7
9
  chosen_args = choose_values(raw_args)
8
-
9
- args_in_string = case chosen_args
10
- when Array
11
- rebuilt = chosen_args.map do |primitive|
12
- Printer.print(primitive)
13
- end
14
-
15
- raw_array = Primitive::Raw.new(:array, rebuilt)
16
- Printer.print(raw_array)
17
- when Hash
18
- rebuilt = chosen_args.each_with_object({}) do |(key, val), obj|
19
- obj[Printer.print(key)] = Printer.print(val)
20
- end
21
-
22
- raw_hash = Primitive::Raw.new(:hash, rebuilt)
23
- Printer.print(raw_hash)
24
- when Integer
25
- raw_int = Primitive::Raw.new(:int, chosen_args)
26
- Printer.print(raw_int)
27
- when NilClass
28
- nil
29
- when Symbol
30
- raw_sym = Primitive::Raw.new(:sym, chosen_args)
31
- Printer.print(raw_sym)
32
- else
33
- raise "Not yet implemented"
34
- end
35
-
36
- Printer.args(args_in_string, chosen_args.class)
10
+ Printer.print(chosen_args, args: true)
37
11
  end
38
12
 
39
13
  def choose_values(raw_args)
40
14
  case raw_args.type
41
15
  when :array
42
- raw_args.value.map do |arg|
43
- if (RETURN_TYPES + [:array, :hash]).include?(arg.type)
44
- arg
45
- else
46
- choose_value(arg.value, arg).to_raw
47
- end
16
+ array = raw_args.value.map do |arg|
17
+ Value.new(arg.value, arg).choose.to_raw
48
18
  end
49
- when :hash
50
- raw_args.value.each_with_object({}) do |(rkey, rval), obj|
51
- key = if RETURN_TYPES.include?(rkey.type)
52
- rkey
53
- else
54
- choose_value(rkey.value, rkey).to_raw
55
- end
56
-
57
- val = if RETURN_TYPES.include?(rval.type)
58
- rval
59
- else
60
- choose_value(rval.value, rval).to_raw
61
- end
62
19
 
20
+ Primitive::Raw.new(:array, array)
21
+ when :hash
22
+ hash = raw_args.value.each_with_object({}) do |(rkey, rval), obj|
23
+ key = Value.new(rkey.value, rkey).choose.to_raw
24
+ val = Value.new(rval.value, rval).choose.to_raw
63
25
  obj[key] = val
64
26
  end
65
- when :int, :missing, :nil
66
- raw_args.value
67
- else
68
- raise "Not yet implemented"
69
- end
70
- end
71
-
72
- def choose_value(name, finder = nil)
73
- return Primitive::Raw.new(:nil, nil) if name.nil?
74
- return finder if finder and RETURN_TYPES.include?(finder.type)
75
27
 
76
- possible_values = Revolutionist.analysis_as_array.select do |element|
77
- !is_a_finder?(element, finder) and element.name == name
78
- end
79
-
80
- if possible_values.empty?
81
- return Primitive::Raw.new(:super, name)
28
+ Primitive::Raw.new(:hash, hash)
29
+ when :int
30
+ Primitive::Raw.new(:int, raw_args.value)
31
+ when :missing
32
+ Primitive::Raw.new(:missing, raw_args.value)
33
+ when :nil
34
+ Primitive::Nil.new.to_raw
35
+ else
36
+ raise 'Not yet implemented'
82
37
  end
83
-
84
- Chooser.new(possible_values).by_probability
85
- end
86
-
87
- def is_a_finder?(primitive, finder)
88
- return false unless finder
89
- primitive.class == finder.class and primitive.name == finder.name
90
38
  end
91
39
  end
92
40
  end
@@ -0,0 +1,31 @@
1
+ module Zapata
2
+ module Predictor
3
+ class Value
4
+ extend Memoist
5
+
6
+ def initialize(name, finder = nil)
7
+ @name = name
8
+ @finder = finder
9
+ end
10
+
11
+ def choose
12
+ return Primitive::Raw.new(:nil, nil) if @name.nil?
13
+ return @finder if @finder and FINAL_TYPES.include?(@finder.type)
14
+ return Primitive::Raw.new(:super, @name) if possible_values.empty?
15
+ Chooser.new(possible_values).by_probability
16
+ end
17
+
18
+ def a_finder?(primitive)
19
+ return false unless @finder
20
+ primitive.class == @finder.class and primitive.name == @finder.name
21
+ end
22
+
23
+ def possible_values
24
+ Revolutionist.analysis_as_array.select do |element|
25
+ !a_finder?(element) and element.name == @name
26
+ end
27
+ end
28
+ memoize :possible_values
29
+ end
30
+ end
31
+ end
@@ -7,17 +7,9 @@ module Zapata
7
7
  OpenStruct.new(type: type, name: name, body: @code)
8
8
  end
9
9
 
10
- def dive_deeper
11
- end
12
-
13
10
  def to_raw
14
- chosen_value = Predictor::Args.choose_value(node.name, self).to_raw
15
-
16
- if chosen_value.type == :super
17
- Missing.new(node.name).to_raw
18
- else
19
- chosen_value
20
- end
11
+ chosen_value = Predictor::Value.new(node.name, self).choose.to_raw
12
+ return_with_super_as_missing(chosen_value, node.name)
21
13
  end
22
14
  end
23
15
  end
@@ -7,9 +7,6 @@ module Zapata
7
7
  OpenStruct.new(type: type, body: body)
8
8
  end
9
9
 
10
- def dive_deeper
11
- end
12
-
13
10
  def to_a
14
11
  value
15
12
  end
@@ -20,13 +17,8 @@ module Zapata
20
17
  raw = primitive.to_raw
21
18
 
22
19
  if raw.type == :super
23
- predicted = Predictor::Args.choose_value(raw.value).to_raw
24
-
25
- if predicted.type == :super
26
- Missing.new(primitive.name).to_raw
27
- else
28
- predicted
29
- end
20
+ predicted = Predictor::Value.new(raw.value).choose.to_raw
21
+ return_with_super_as_missing(predicted, primitive.name)
30
22
  else
31
23
  raw
32
24
  end
@@ -6,7 +6,6 @@ module Zapata
6
6
  def initialize(code)
7
7
  @code = code
8
8
  @type = code.type
9
- dive_deeper
10
9
  end
11
10
 
12
11
  def name
@@ -23,6 +22,14 @@ module Zapata
23
22
  def to_raw
24
23
  Diver.dive(node.body).to_raw
25
24
  end
25
+
26
+ def return_with_super_as_missing(raw, name)
27
+ raw.type == :super ? Missing.new(name).to_raw : raw
28
+ end
29
+
30
+ def return_with_missing_as_super(raw, name)
31
+ raw.type == :missing ? Raw.new(:super, name) : raw
32
+ end
26
33
  end
27
34
  end
28
35
  end
@@ -1,6 +1,6 @@
1
1
  module Zapata
2
2
  module Primitive
3
- class Basic < Primitive::Base
3
+ class Basic < Base
4
4
  def to_a
5
5
  [value]
6
6
  end
@@ -11,9 +11,6 @@ module Zapata
11
11
  OpenStruct.new(type: type, body: body)
12
12
  end
13
13
 
14
- def dive_deeper
15
- end
16
-
17
14
  def to_raw
18
15
  Raw.new(node.body.type, node.body.to_a.last)
19
16
  end
@@ -1,6 +1,6 @@
1
1
  module Zapata
2
2
  module Primitive
3
- class Const < Primitive::Basic
3
+ class Const < Basic
4
4
  def node
5
5
  modul, klass = @code.to_a
6
6
  type = @code.type
@@ -0,0 +1,19 @@
1
+ module Zapata
2
+ module Primitive
3
+ class ConstSend
4
+ def initialize(raw_receiver, method_name, args)
5
+ @raw_receiver = raw_receiver
6
+ @method_name = method_name
7
+ @args = args
8
+ end
9
+
10
+ def node
11
+ OpenStruct.new(method_name: @method_name, args: @args)
12
+ end
13
+
14
+ def to_raw
15
+ Raw.new(:const_send, "#{Printer.print(@raw_receiver)}.#{node.method_name}#{Predictor::Args.literal(node.args)}")
16
+ end
17
+ end
18
+ end
19
+ end
@@ -11,9 +11,6 @@ module Zapata
11
11
  value.to_a.flatten
12
12
  end
13
13
 
14
- def dive_deeper
15
- end
16
-
17
14
  def to_raw
18
15
  result = {}
19
16
 
@@ -7,14 +7,11 @@ module Zapata
7
7
  OpenStruct.new(type: type, name: name, body: @code)
8
8
  end
9
9
 
10
- def dive_deeper
11
- end
12
-
13
10
  def to_raw
14
- chosen_value = Predictor::Args.choose_value(node.name, self)
11
+ chosen_value = Predictor::Value.new(node.name, self).choose
15
12
 
16
13
  if chosen_value.node.body == node.body
17
- Raw.new(:missing, node.body.to_a.last)
14
+ Missing.new(node.name).to_raw
18
15
  else
19
16
  chosen_value.to_raw
20
17
  end
@@ -7,9 +7,6 @@ module Zapata
7
7
  OpenStruct.new(type: type, name: name, body: body)
8
8
  end
9
9
 
10
- def dive_deeper
11
- end
12
-
13
10
  def to_raw
14
11
  Diver.dive(node.body).to_raw
15
12
  end
@@ -30,17 +30,10 @@ module Zapata
30
30
 
31
31
  def to_raw
32
32
  if raw_receiver and raw_receiver.type == :const
33
- Raw.new(:const_send, "#{Printer.print(raw_receiver)}.#{node.name}#{Predictor::Args.literal(node.args)}")
34
- elsif %i(+ - * /).include?(node.name)
35
- Raw.new(:super, node.name)
33
+ ConstSend.new(raw_receiver, node.name, node.args).to_raw
36
34
  else
37
- predicted = Predictor::Args.choose_value(node.name, self).to_raw
38
-
39
- if predicted.type == :missing
40
- Raw.new(:super, node.name)
41
- else
42
- predicted
43
- end
35
+ raw = Predictor::Value.new(node.name, self).choose.to_raw
36
+ return_with_missing_as_super(raw, node.name)
44
37
  end
45
38
  end
46
39
  end
@@ -1,16 +1,18 @@
1
1
  module Zapata
2
2
  class Printer
3
3
  class << self
4
- def print(raw)
5
- case raw.type
4
+ extend Memoist
5
+
6
+ def print(raw, args: false)
7
+ type = raw.type
8
+
9
+ result = case type
6
10
  when :const, :send, :int, :const_send, :literal, :float
7
11
  raw.value
8
12
  when :str
9
- # decide which one to use
10
- # "\"#{raw.value}\""
11
- "'#{raw.value}'"
13
+ str(raw)
12
14
  when :sym
13
- ":#{raw.value}"
15
+ sym(raw)
14
16
  when :true
15
17
  true
16
18
  when :false
@@ -22,59 +24,83 @@ module Zapata
22
24
  when :nil
23
25
  'nil'
24
26
  when :missing
25
- print(Primitive::Raw.new(:str, "Missing \"#{raw.value}\""))
27
+ missing(raw)
26
28
  when :ivar
27
- RZpec::Writer.ivars << raw
28
- to_var_name(raw.value)
29
+ ivar(raw)
29
30
  else
30
31
  raise "Not yet implemented #{raw}"
31
32
  end
33
+
34
+ args ? argize(result, type) : result
32
35
  end
33
36
 
34
- def array(given_array)
35
- unnested_array = given_array.map { |el| unnest(el) }
36
- "[#{unnested_array.join(', ')}]"
37
+ def to_var_name(name)
38
+ name.to_s.split('::').last.underscore.delete('@')
37
39
  end
38
40
 
39
- def args(given_args, klass)
40
- return unless given_args.present?
41
+ private
41
42
 
42
- if klass == Array
43
- array_without_closers = given_args[1...-1]
44
- return unless array_without_closers.present?
43
+ def array(given)
44
+ unnested = given.map { |el| unnest(el) }
45
45
 
46
- "(#{array_without_closers})"
47
- elsif [Fixnum, Symbol].include?(klass)
48
- "(#{given_args})"
49
- elsif klass == Hash
50
- "(#{given_args})"
51
- else
52
- raise "Not yet implemented"
53
- end
46
+ "[#{unnested.join(', ')}]"
47
+ end
48
+
49
+ def str(raw)
50
+ # decide which one to use
51
+ # "\"#{raw.value}\""
52
+ "'#{raw.value}'"
53
+ end
54
+
55
+ def sym(raw)
56
+ ":#{raw.value}"
57
+ end
58
+
59
+ def ivar(raw)
60
+ RZpec::Writer.ivars << raw
61
+ to_var_name(raw.value)
62
+ end
63
+
64
+ def missing(raw)
65
+ print(Primitive::Raw.new(:str, "Missing \"#{raw.value}\""))
54
66
  end
55
67
 
56
- def hash(obj)
57
- unnested_hash = obj.each_with_object({}) do |(key, val), obj|
58
- unnested_key = unnest(key)
59
- unnested_val = unnest(val)
60
- obj[unnested_key] = unnested_val
68
+ def argize(value, type)
69
+ case type
70
+ when :array
71
+ value = value[1...-1]
72
+ when :hash
73
+ value = value[2...-2]
61
74
  end
62
75
 
63
- all_keys_symbols = unnested_hash.keys.all? do |key|
64
- Parser::CurrentRuby.parse(key.to_s).type == :sym
76
+ return unless value.present?
77
+
78
+ "(#{[value].flatten.join(', ')})"
79
+ end
80
+
81
+ def hash(given)
82
+ unnested = given.each_with_object({}) do |(key, val), obj|
83
+ obj[unnest(key)] = unnest(val)
65
84
  end
66
85
 
67
- values = unnested_hash.map do |key, val|
68
- if all_keys_symbols
69
- "#{key[1..-1]}: #{val}"
70
- else
71
- "#{key} => #{val}"
72
- end
86
+ values = unnested.map do |key, val|
87
+ print_hash_pair(key, val, all_keys_symbols?(unnested))
73
88
  end
74
89
 
75
90
  "{ #{values.join(', ')} }"
76
91
  end
77
92
 
93
+ def print_hash_pair(key, val, symbol_keys)
94
+ symbol_keys ? "#{key[1..-1]}: #{val}" : "#{key} => #{val}"
95
+ end
96
+
97
+ def all_keys_symbols?(hash)
98
+ hash.keys.all? do |key|
99
+ Parser::CurrentRuby.parse(key.to_s).type == :sym
100
+ end
101
+ end
102
+ memoize :all_keys_symbols?
103
+
78
104
  def unnest(raw)
79
105
  return raw unless raw.respond_to?(:value)
80
106
 
@@ -84,10 +110,6 @@ module Zapata
84
110
  print(raw)
85
111
  end
86
112
  end
87
-
88
- def to_var_name(name)
89
- name.to_s.split('::').last.underscore.delete('@')
90
- end
91
113
  end
92
114
  end
93
115
  end
@@ -56,7 +56,7 @@ module Zapata
56
56
  end
57
57
 
58
58
  self.class.ivars.each do |ivar|
59
- predicted_value = Predictor::Args.choose_value(ivar.value, ivar)
59
+ predicted_value = Predictor::Value.new(ivar.value, ivar).choose
60
60
  literal_predicted_value = Printer.print(predicted_value.to_raw)
61
61
  write_let(ivar.value, literal_predicted_value)
62
62
  end
@@ -1,3 +1,3 @@
1
1
  module Zapata
2
- VERSION = "0.0.1"
2
+ VERSION = '0.0.2'
3
3
  end
data/lib/zapata.rb CHANGED
@@ -6,6 +6,8 @@ require 'rails'
6
6
  require 'require_all'
7
7
  require 'file/temp'
8
8
  require 'open3'
9
+ require 'rspec'
10
+ require 'memoist'
9
11
 
10
12
  require_rel 'zapata/core'
11
13
  require_rel 'zapata/predictor'
@@ -22,12 +24,9 @@ module Zapata
22
24
  class << self
23
25
  attr_accessor :analysis, :analysis_as_array
24
26
 
25
- def generate(filename)
26
- dirs = %w(app/models)
27
+ def generate(filename, single: false)
28
+ dirs = single ? [] : %w(app/models)
27
29
  file_list = Core::Collector.expand_dirs_to_files(dirs)
28
-
29
- # files = %w(app/models/actual_fragment.rb app/models/ical.rb app/models/calendar/balance_transfer.rb)
30
-
31
30
  new(file_list).generate_rspec_for(filename, spec_filename(filename))
32
31
  end
33
32
 
@@ -55,7 +54,7 @@ module Zapata
55
54
  end
56
55
 
57
56
  def adjusted_current(i, total)
58
- "#{i}".rjust(total.size)
57
+ "#{i + 1}".rjust(total.size)
59
58
  end
60
59
 
61
60
  def generate_rspec_for(filename, spec_filename)
data/spec/send_spec.rb CHANGED
@@ -28,4 +28,28 @@ describe Zapata::Revolutionist do
28
28
  expect(test_send.method_with_calculated_value('Missing "calculated_value"')).to eq('Missing "calculated_value"')
29
29
  })
30
30
  end
31
+
32
+ it '#to_another_object' do
33
+ has_block('#to_another_object', %Q{
34
+ expect(test_send.to_another_object(AnotherObject.my_name)).to eq('Domas')
35
+ })
36
+ end
37
+
38
+ it '#to_another_object_with_params' do
39
+ has_block('#to_another_object_with_params', %Q{
40
+ expect(test_send.to_another_object_with_params(AnotherObject.send_with_params(12))).to eq('Id was 12')
41
+ })
42
+ end
43
+
44
+ it '#not_explicit_with_params' do
45
+ has_block('#not_explicit_with_params', %Q{
46
+ expect(test_send.not_explicit_with_params('Could you find it?')).to eq('Could you find it?')
47
+ })
48
+ end
49
+
50
+ it '#fail_to_understand' do
51
+ has_block('#fail_to_understand', %Q{
52
+ expect(test_send.fail_to_understand('Missing "failure"')).to eq('Missing "failure"')
53
+ })
54
+ end
31
55
  end
data/spec/spec_helper.rb CHANGED
@@ -96,7 +96,7 @@ end
96
96
  def exec_generation(generate_for)
97
97
  stdin, stdout, stderr = Bundler.with_clean_env do
98
98
  Open3.popen3(
99
- "cd #{RAILS_TEST_APP_DIR} && bundle exec zapata generate #{generate_for}"
99
+ "cd #{RAILS_TEST_APP_DIR} && bundle exec zapata generate #{generate_for} -s"
100
100
  )
101
101
  end
102
102
 
@@ -1,15 +1,17 @@
1
1
  PATH
2
2
  remote: ~/Developer/zapata
3
3
  specs:
4
- zapata (0.0.1)
4
+ zapata (0.0.2)
5
5
  andand (~> 1.3)
6
6
  file-temp (~> 1.2)
7
+ memoist
7
8
  parser (~> 2.1)
8
9
  pry (~> 0.9)
9
10
  pry-stack_explorer (~> 0.4)
10
11
  rails (>= 3.0.0)
11
12
  require_all (~> 1.3)
12
- rspec-rails (~> 3.0)
13
+ rspec
14
+ rspec-rails
13
15
  slop (~> 3.4)
14
16
  unparser (~> 0.1)
15
17
 
@@ -84,6 +86,7 @@ GEM
84
86
  mail (2.5.4)
85
87
  mime-types (~> 1.16)
86
88
  treetop (~> 1.4.8)
89
+ memoist (0.9.3)
87
90
  memoizable (0.4.2)
88
91
  thread_safe (~> 0.3, >= 0.3.1)
89
92
  method_source (0.8.2)
@@ -124,6 +127,10 @@ GEM
124
127
  rdoc (4.1.1)
125
128
  json (~> 1.4)
126
129
  require_all (1.3.2)
130
+ rspec (3.0.0)
131
+ rspec-core (~> 3.0.0)
132
+ rspec-expectations (~> 3.0.0)
133
+ rspec-mocks (~> 3.0.0)
127
134
  rspec-core (3.0.3)
128
135
  rspec-support (~> 3.0.0)
129
136
  rspec-expectations (3.0.3)
@@ -146,9 +153,9 @@ GEM
146
153
  sass (~> 3.2.0)
147
154
  sprockets (~> 2.8, <= 2.11.0)
148
155
  sprockets-rails (~> 2.0)
149
- sdoc (0.4.0)
150
- json (~> 1.8)
151
- rdoc (~> 4.0, < 5.0)
156
+ sdoc (0.4.1)
157
+ json (~> 1.7, >= 1.7.7)
158
+ rdoc (~> 4.0)
152
159
  slop (3.6.0)
153
160
  spring (1.1.3)
154
161
  sprockets (2.11.0)
@@ -169,7 +176,7 @@ GEM
169
176
  polyglot (>= 0.3.1)
170
177
  turbolinks (2.2.2)
171
178
  coffee-rails
172
- tzinfo (1.2.1)
179
+ tzinfo (1.2.2)
173
180
  thread_safe (~> 0.1)
174
181
  uglifier (2.5.3)
175
182
  execjs (>= 0.3.0)
@@ -1,6 +1,6 @@
1
1
  # This file is copied to spec/ when you run 'rails generate rspec:install'
2
2
  ENV["RAILS_ENV"] ||= 'test'
3
- # require 'spec_helper'
3
+ require 'spec_helper'
4
4
  require File.expand_path("../../config/environment", __FILE__)
5
5
  require 'rspec/rails'
6
6
 
data/zapata-0.0.1.gem ADDED
Binary file
data/zapata.gemspec CHANGED
@@ -23,12 +23,13 @@ Gem::Specification.new do |spec|
23
23
  spec.add_runtime_dependency 'andand', '~> 1.3'
24
24
  spec.add_runtime_dependency 'pry', '~> 0.9'
25
25
  spec.add_runtime_dependency 'pry-stack_explorer', '~> 0.4'
26
- spec.add_runtime_dependency 'rails', '>=3.0.0'
26
+ spec.add_runtime_dependency 'rails', '>= 3.0.0'
27
27
  spec.add_runtime_dependency 'slop', '~> 3.4'
28
- spec.add_runtime_dependency 'rspec-rails', '~> 3.0'
28
+ spec.add_runtime_dependency 'rspec-rails'
29
29
  spec.add_runtime_dependency 'require_all', '~> 1.3'
30
30
  spec.add_runtime_dependency 'file-temp', '~> 1.2'
31
- spec.add_development_dependency 'rspec', '~> 3.0'
31
+ spec.add_runtime_dependency 'rspec'
32
+ spec.add_runtime_dependency 'memoist'
32
33
  spec.add_development_dependency 'bundler', '~> 1.6'
33
34
  spec.add_development_dependency 'rake', '~> 10.0'
34
35
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zapata
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Domas Bitvinskas
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-11 00:00:00.000000000 Z
11
+ date: 2014-08-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: parser
@@ -112,16 +112,16 @@ dependencies:
112
112
  name: rspec-rails
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - "~>"
115
+ - - ">="
116
116
  - !ruby/object:Gem::Version
117
- version: '3.0'
117
+ version: '0'
118
118
  type: :runtime
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - "~>"
122
+ - - ">="
123
123
  - !ruby/object:Gem::Version
124
- version: '3.0'
124
+ version: '0'
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: require_all
127
127
  requirement: !ruby/object:Gem::Requirement
@@ -154,16 +154,30 @@ dependencies:
154
154
  name: rspec
155
155
  requirement: !ruby/object:Gem::Requirement
156
156
  requirements:
157
- - - "~>"
157
+ - - ">="
158
158
  - !ruby/object:Gem::Version
159
- version: '3.0'
160
- type: :development
159
+ version: '0'
160
+ type: :runtime
161
161
  prerelease: false
162
162
  version_requirements: !ruby/object:Gem::Requirement
163
163
  requirements:
164
- - - "~>"
164
+ - - ">="
165
+ - !ruby/object:Gem::Version
166
+ version: '0'
167
+ - !ruby/object:Gem::Dependency
168
+ name: memoist
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - ">="
172
+ - !ruby/object:Gem::Version
173
+ version: '0'
174
+ type: :runtime
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - ">="
165
179
  - !ruby/object:Gem::Version
166
- version: '3.0'
180
+ version: '0'
167
181
  - !ruby/object:Gem::Dependency
168
182
  name: bundler
169
183
  requirement: !ruby/object:Gem::Requirement
@@ -203,6 +217,7 @@ extra_rdoc_files: []
203
217
  files:
204
218
  - ".gitignore"
205
219
  - ".rspec"
220
+ - ".travis.yml"
206
221
  - CONTRIBUTING.md
207
222
  - Gemfile
208
223
  - LICENSE
@@ -219,12 +234,14 @@ files:
219
234
  - lib/zapata/diver.rb
220
235
  - lib/zapata/predictor/args.rb
221
236
  - lib/zapata/predictor/chooser.rb
237
+ - lib/zapata/predictor/value.rb
222
238
  - lib/zapata/primitive/arg.rb
223
239
  - lib/zapata/primitive/array.rb
224
240
  - lib/zapata/primitive/base.rb
225
241
  - lib/zapata/primitive/basic.rb
226
242
  - lib/zapata/primitive/casgn.rb
227
243
  - lib/zapata/primitive/const.rb
244
+ - lib/zapata/primitive/const_send.rb
228
245
  - lib/zapata/primitive/def.rb
229
246
  - lib/zapata/primitive/defs.rb
230
247
  - lib/zapata/primitive/hash.rb
@@ -330,6 +347,7 @@ files:
330
347
  - spec/support/rails_test_app/test/test_helper.rb
331
348
  - spec/support/rails_test_app/vendor/assets/javascripts/.keep
332
349
  - spec/support/rails_test_app/vendor/assets/stylesheets/.keep
350
+ - zapata-0.0.1.gem
333
351
  - zapata.gemspec
334
352
  homepage: https://github.com/Nedomas/zapata
335
353
  licenses: