ast_utils 0.1.0 → 0.2.0

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: e1090f235aaa912ae5a85844b1e10463faaf584d
4
- data.tar.gz: 14426ab5c982587d9e8a2dcc910addf95af061df
3
+ metadata.gz: 8840d3eb5e7151059ca38ed971ea7c07b083123c
4
+ data.tar.gz: 9b900680e8eaf48e832b951cfcf95721a815be8f
5
5
  SHA512:
6
- metadata.gz: d699fb6c01dd21bdb32a4c95d4786167aa4a8581ef49c1facab6ee2e1fbd885f2e36dcdb6e71e8d8e20e686d75fa9bb7265c96c4896541a43e3e28a770c7fb7b
7
- data.tar.gz: f8b6a0131c03bb38afcaa03cca9724afba47f6af3e0127aa8b8dac838d884eb6a9d0172b65fe98908cf916c8e0f384f3a6d676edc4df4a98d04b4228c785c0b9
6
+ metadata.gz: cfe1bc0be475e270d5fda5dcd3ebbd0764afe56d6a084aca7fd3d1520d26ff450815c5f7c5535aa3209de6d2500d6ad4517bacb26f2cb42aa876044c1738514e
7
+ data.tar.gz: f4b5a629c841623b06764f0d50f78bdd106d55dc30839db36cb2318bed271ab787cd8e8a3376c0455feb35730ca674dfde196e23e91057606948abfec64ea2fd
data/.travis.yml CHANGED
@@ -1,5 +1,6 @@
1
1
  sudo: false
2
2
  language: ruby
3
3
  rvm:
4
- - 2.4.0
5
- before_install: gem install bundler -v 1.13.7
4
+ - 2.4.3
5
+ - 2.5.0
6
+ before_install: gem install bundler
data/README.md CHANGED
@@ -28,6 +28,7 @@ In Ruby, local variable scope can be nested, and identification on local variabl
28
28
  This utility give labels to identify local variables.
29
29
 
30
30
  ```rb
31
+ require "parser/current"
31
32
  require "ast_utils"
32
33
 
33
34
  node = Parser::CurrentRuby.parse(source)
@@ -39,6 +40,7 @@ labeled = ASTUtils::Labeling.translate(node: node)
39
40
  `AST` has `children` but no pointer to its parent.
40
41
 
41
42
  ```rb
43
+ require "parser/current"
42
44
  require "ast_utils"
43
45
 
44
46
  node = Parser::CurrentRuby.parse(source)
@@ -54,6 +56,7 @@ parent = navigation.parent(child_node)
54
56
  It associates outer scope and its inner scope.
55
57
 
56
58
  ```rb
59
+ require "parser/current"
57
60
  require "ast_utils"
58
61
 
59
62
  node = Parser::CurrentRuby.parse(source)
data/ast_utils.gemspec CHANGED
@@ -25,5 +25,5 @@ Gem::Specification.new do |spec|
25
25
  spec.add_development_dependency "minitest", "~> 5.0"
26
26
 
27
27
  spec.add_runtime_dependency "parser", "~> 2.4"
28
- spec.add_runtime_dependency "thor", "~> 0.19.4"
28
+ spec.add_runtime_dependency "thor", "~> 0.19"
29
29
  end
data/exe/ast_utils CHANGED
@@ -1,6 +1,10 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  $LOAD_PATH << File.join(__dir__, "../lib")
4
+ require "parser/ruby25"
5
+ Parser::Builders::Default.emit_lambda = true
6
+ Parser::Builders::Default.emit_procarg0 = true
7
+
4
8
  require "ast_utils"
5
9
  require "ast_utils/cli"
6
10
 
data/lib/ast_utils/cli.rb CHANGED
@@ -6,7 +6,7 @@ module ASTUtils
6
6
  def label(*scripts)
7
7
  scripts.map {|script| Pathname(script) }.each do |path|
8
8
  puts "Parsing #{path}..."
9
- node = Parser::CurrentRuby.parse(path.read, path.to_s)
9
+ node = Parser::Ruby25.parse(path.read, path.to_s)
10
10
  puts "Translating node..."
11
11
  labeled = Labeling.translate(node: node)
12
12
  puts "#{labeled.inspect}"
@@ -1,3 +1,3 @@
1
1
  module ASTUtils
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
data/lib/ast_utils.rb CHANGED
@@ -1,6 +1,5 @@
1
1
  require "ast_utils/version"
2
2
 
3
- require "parser/current"
4
3
  require "pathname"
5
4
  require "set"
6
5
 
@@ -10,6 +9,3 @@ require "ast_utils/partial_map"
10
9
  require "ast_utils/labeling"
11
10
  require "ast_utils/navigation"
12
11
  require "ast_utils/scope"
13
-
14
- Parser::Builders::Default.emit_lambda = true
15
- Parser::Builders::Default.emit_procarg0 = true
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ast_utils
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Soutaro Matsumoto
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-09-15 00:00:00.000000000 Z
11
+ date: 2018-03-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -72,14 +72,14 @@ dependencies:
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: 0.19.4
75
+ version: '0.19'
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: 0.19.4
82
+ version: '0.19'
83
83
  description: Ruby AST Utility
84
84
  email:
85
85
  - matsumoto@soutaro.com
@@ -125,7 +125,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
125
125
  version: '0'
126
126
  requirements: []
127
127
  rubyforge_project:
128
- rubygems_version: 2.6.8
128
+ rubygems_version: 2.6.13
129
129
  signing_key:
130
130
  specification_version: 4
131
131
  summary: Ruby AST Utility