sorcerer 0.0.4 → 0.0.5

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.
data/Rakefile CHANGED
@@ -13,7 +13,7 @@ end
13
13
 
14
14
  PROJ = 'sorcerer'
15
15
  RUBY = ENV['RUBY19'] || 'ruby19'
16
- PKG_VERSION = '0.0.4'
16
+ PKG_VERSION = '0.0.5'
17
17
 
18
18
  PKG_FILES = FileList[
19
19
  'README.textile',
@@ -32,19 +32,34 @@ module Sorcerer
32
32
 
33
33
  def tagged_sexp(sexp)
34
34
  case sexp.first
35
- when :var_ref, :binary, :call, :array, :hash, :unary
35
+ when :var_ref, :binary, :array, :hash, :unary
36
36
  @result << sexp
37
37
  list_sexp(sexp)
38
38
  when :aref
39
39
  @result << sexp
40
40
  recur(sexp[2])
41
- when :method_add_arg
41
+ when :brace_block
42
+ # ignore
43
+ when :call, :method_add_block, :method_add_arg
42
44
  @result << sexp
43
- recur(sexp[1][1])
44
- list_sexp(sexp[2])
45
+ method_sexp(sexp)
45
46
  else
46
47
  list_sexp(sexp)
47
48
  end
48
49
  end
50
+
51
+ def method_sexp(sexp)
52
+ case sexp.first
53
+ when :call
54
+ recur(sexp[1])
55
+ when :method_add_block
56
+ method_sexp(sexp[1])
57
+ when :method_add_arg
58
+ recur(sexp[2])
59
+ method_sexp(sexp[1])
60
+ else
61
+ recur(sexp)
62
+ end
63
+ end
49
64
  end
50
65
  end
@@ -0,0 +1,13 @@
1
+
2
+ namespace "git" do
3
+ desc "Tag the current version of the project as #{PROJ}-#{PKG_VERSION}"
4
+ task :tag do
5
+ sh "git tag #{PROJ}-#{PKG_VERSION}"
6
+ end
7
+
8
+ desc "Build and Push the current gem"
9
+ task :push => :gem do
10
+ sh "gem push pkg/#{PROJ}-#{PKG_VERSION}.gem"
11
+ end
12
+
13
+ end
@@ -38,13 +38,18 @@ class SubexpressionTest < Test::Unit::TestCase
38
38
  def test_method_calls_with_args
39
39
  assert_subexpressions "o.f()", ["o.f()", "o"]
40
40
  assert_subexpressions "o.f(a, b)", [
41
- "o.f(a, b)", "o", "a", "b"
41
+ "o.f(a, b)", "a", "b", "o"
42
42
  ]
43
43
  assert_subexpressions "f(a, b)", [
44
44
  "f(a, b)", "a", "b"
45
45
  ]
46
46
  end
47
47
 
48
+ def test_method_calls_with_blocks
49
+ assert_subexpressions "o.f { a }", ["o.f { a }", "o"]
50
+ assert_subexpressions "o.f(z) { a }", ["o.f(z) { a }", "z", "o"]
51
+ end
52
+
48
53
  def test_array_reference
49
54
  assert_subexpressions "a[i]", ["a[i]", "i"]
50
55
  end
@@ -66,13 +71,13 @@ class SubexpressionTest < Test::Unit::TestCase
66
71
  end
67
72
 
68
73
  def test_complex_expression
69
- assert_subexpressions "o.f(a+b, c*d, x.y, z(k, 2, 3))", [
70
- "o.f(a + b, c * d, x.y, z(k, 2, 3))",
71
- "o",
74
+ assert_subexpressions "o.f(a+b, c*d, x.y, z(k, 2, 3)) { xx }", [
75
+ "o.f(a + b, c * d, x.y, z(k, 2, 3)) { xx }",
72
76
  "a + b", "a", "b",
73
77
  "c * d", "c", "d",
74
78
  "x.y", "x",
75
79
  "z(k, 2, 3)", "k",
80
+ "o",
76
81
  ]
77
82
  end
78
83
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sorcerer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jim Weirich
@@ -25,6 +25,7 @@ files:
25
25
  - README.textile
26
26
  - Rakefile
27
27
  - doc/jamis.rb
28
+ - rakelib/git.rake
28
29
  - rakelib/readme.rake
29
30
  - lib/sorcerer/resource.rb
30
31
  - lib/sorcerer/subexpression.rb