ryan 1.0.0 → 1.1.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: 291fea61132de8ec31f0e70fda31c930a41fc86a
4
- data.tar.gz: 9ec06895b0fbd8e8f24cb4333ef443d1e88ffdac
3
+ metadata.gz: 311a79ef6392e001d28be5a320a3239400af79f6
4
+ data.tar.gz: 591f03e947a54f8483f5e5e835ad40153b72049c
5
5
  SHA512:
6
- metadata.gz: df0bd56e2f47a7887c2dc5d84c5076665c5343a34cd3971a15efac6be4f323802e2dd6f7b55756d74a27d4ae41784805730d86e66336e967c5d374dc014d68bd
7
- data.tar.gz: 309d0f95cf4f7e952d6af7054300402cfb0b8282580179126fddbd8d74beb9df188062526396ccf0dc8ac7f6fb1b003970799716d3397d1c8f4fd234143f15c9
6
+ metadata.gz: ea141cb6dfe9455381111d6e39337b05c2512ec45fa336f59af7214276fcb8fc80fbcdff1dd2a2b338c024d117b6ffd6ce44ae1e5ad9085384bc2ac28486d7f9
7
+ data.tar.gz: b47dc507eb3a0f5d16080df33873560a73ad57747894fee7fcff4ac539d38b21aac59c71e7585b24774142f19e78f7cc09de0a1e4dc5c1aaf9fa50b930dbd6c3
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --color
2
+ --require spec_helper
3
+ --format documentation
@@ -1,4 +1,6 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.2.1
3
+ - 1.9.3
4
+ - 2.2.5
5
+ - 2.4.0
4
6
  before_install: gem install bundler -v 1.10.4
@@ -0,0 +1,14 @@
1
+ # Change Log
2
+ All notable changes to this project will be documented in this file.
3
+
4
+ The format is based on [Keep a Changelog](http://keepachangelog.com/)
5
+ and this project adheres to [Semantic Versioning](http://semver.org/).
6
+
7
+ ## [1.1.0] - 2017-02-20
8
+ ### Added
9
+ - Explicit Ruby version requirement with `spec.required_ruby_version = '>= 1.9.3'`
10
+ - Allowed `Ryan.new` initializer to also accept raw ruby code string instead of just path to file
11
+ - Ryan.root method to make things easier
12
+
13
+ ## [1.0.0] - 2015-12-05
14
+ - Core functionality
data/Gemfile CHANGED
@@ -2,5 +2,3 @@ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in ryan.gemspec
4
4
  gemspec
5
-
6
- gem 'byebug'
data/README.md CHANGED
@@ -1,21 +1,21 @@
1
- # Ryan
1
+ # Ryan [![Gem Version](https://badge.fury.io/rb/ryan.svg)](http://badge.fury.io/rb/ryan) [![Build Status](https://travis-ci.org/ridiculous/ryan.svg)](https://travis-ci.org/ridiculous/ryan)
2
2
 
3
- A wrapper around the awesome [RubyParser](https://github.com/seattlerb/ruby_parser) gem that provides an OO interface for
3
+ A wrapper around the awesome [RubyParser](https://github.com/seattlerb/ruby_parser) gem that provides an OO interface for
4
4
  reading Ruby code.
5
5
 
6
6
  ## Installation
7
7
 
8
8
  ```ruby
9
- gem 'ryan'
9
+ gem 'ryan', '~> 1.1.0'
10
10
  ```
11
11
 
12
12
  ## Usage
13
13
 
14
- Give Ryan a Ruby file to play with. Test it out in an IRB session with `bin/console`
14
+ Give Ryan a Ruby file or code string to play with. Test it out in an IRB session with `bin/console`
15
15
 
16
16
  ```ruby
17
- ryan = Ryan.new FIXTURE_ROOT.join('report.rb')
18
- ryan.name
17
+ ryan = Ryan.new FIXTURE_ROOT.join('report.rb') # or Ryan.new("<valid ruby code here>")
18
+ ryan.name
19
19
  #=> "Report"
20
20
  ryan.class?
21
21
  #=> true
@@ -23,11 +23,11 @@ ryan.module?
23
23
  #=> false
24
24
  ryan.initialization_args
25
25
  #=> [:message]
26
- ryan.funcs.length
26
+ ryan.funcs.length
27
27
  #=> 12
28
- ryan.funcs.reject(&:private?).length
28
+ ryan.funcs.reject(&:private?).length
29
29
  #=> 10
30
- ryan.funcs.first.name
30
+ ryan.funcs.first.name
31
31
  #=> :enqueue
32
32
  ```
33
33
 
@@ -92,7 +92,7 @@ nested_condition.if_text
92
92
 
93
93
  ## Development
94
94
 
95
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake` to run the tests.
95
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake` to run the tests.
96
96
  You can also run `bin/console` for an interactive prompt that will allow you to experiment.
97
97
 
98
98
  ## Contributing
@@ -18,9 +18,15 @@ class Ryan
18
18
  def_delegators :const,
19
19
  :name, :funcs, :type, :initialization_args, :func_by_name, :class?, :module?
20
20
 
21
- # @param [Pathname, String] file
22
- def initialize(file)
23
- @sexp = RubyParser.new.parse File.read(file)
21
+ def self.root
22
+ Pathname.new File.expand_path('../..', __FILE__)
23
+ end
24
+
25
+ # @note Attempts to read a file if a path is given, otherwise threats input as ruby code string
26
+ # @param [Pathname, String] input
27
+ def initialize(input)
28
+ input = File.read(input) if File.file?(input)
29
+ @sexp = RubyParser.new.parse(input)
24
30
  @const = Const.new(sexp)
25
31
  end
26
32
  end
@@ -1,3 +1,3 @@
1
1
  class Ryan
2
- VERSION = '1.0.0'.freeze
2
+ VERSION = '1.1.0'.freeze
3
3
  end
@@ -18,10 +18,13 @@ Gem::Specification.new do |spec|
18
18
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
19
19
  spec.require_paths = ["lib"]
20
20
 
21
- spec.add_development_dependency "bundler", "~> 1.10"
22
- spec.add_development_dependency "rake", "~> 10.0"
23
- spec.add_development_dependency "rspec", ">= 3.2", "< 4"
21
+ spec.required_ruby_version = '>= 1.9.3'
24
22
 
25
23
  spec.add_dependency 'ruby_parser', '>= 3.7.0', '< 4.0.0'
26
24
  spec.add_dependency 'ruby2ruby', '~> 2.2'
25
+
26
+ spec.add_development_dependency "bundler", "~> 1.10"
27
+ spec.add_development_dependency "rake", "~> 10.0"
28
+ spec.add_development_dependency "rspec", ">= 3.2", "< 4"
29
+ spec.add_development_dependency 'pry', '~> 0.10.4'
27
30
  end
metadata CHANGED
@@ -1,15 +1,49 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ryan
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Buckley
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-12-05 00:00:00.000000000 Z
11
+ date: 2017-02-20 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: ruby_parser
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 3.7.0
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: 4.0.0
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ version: 3.7.0
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: 4.0.0
33
+ - !ruby/object:Gem::Dependency
34
+ name: ruby2ruby
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: '2.2'
40
+ type: :runtime
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - "~>"
45
+ - !ruby/object:Gem::Version
46
+ version: '2.2'
13
47
  - !ruby/object:Gem::Dependency
14
48
  name: bundler
15
49
  requirement: !ruby/object:Gem::Requirement
@@ -59,39 +93,19 @@ dependencies:
59
93
  - !ruby/object:Gem::Version
60
94
  version: '4'
61
95
  - !ruby/object:Gem::Dependency
62
- name: ruby_parser
63
- requirement: !ruby/object:Gem::Requirement
64
- requirements:
65
- - - ">="
66
- - !ruby/object:Gem::Version
67
- version: 3.7.0
68
- - - "<"
69
- - !ruby/object:Gem::Version
70
- version: 4.0.0
71
- type: :runtime
72
- prerelease: false
73
- version_requirements: !ruby/object:Gem::Requirement
74
- requirements:
75
- - - ">="
76
- - !ruby/object:Gem::Version
77
- version: 3.7.0
78
- - - "<"
79
- - !ruby/object:Gem::Version
80
- version: 4.0.0
81
- - !ruby/object:Gem::Dependency
82
- name: ruby2ruby
96
+ name: pry
83
97
  requirement: !ruby/object:Gem::Requirement
84
98
  requirements:
85
99
  - - "~>"
86
100
  - !ruby/object:Gem::Version
87
- version: '2.2'
88
- type: :runtime
101
+ version: 0.10.4
102
+ type: :development
89
103
  prerelease: false
90
104
  version_requirements: !ruby/object:Gem::Requirement
91
105
  requirements:
92
106
  - - "~>"
93
107
  - !ruby/object:Gem::Version
94
- version: '2.2'
108
+ version: 0.10.4
95
109
  description: A wrapper around the RubyParser gem
96
110
  email:
97
111
  - arebuckley@gmail.com
@@ -100,9 +114,11 @@ extensions: []
100
114
  extra_rdoc_files: []
101
115
  files:
102
116
  - ".gitignore"
117
+ - ".rspec"
103
118
  - ".ruby-gemset"
104
119
  - ".ruby-version"
105
120
  - ".travis.yml"
121
+ - CHANGELOG.md
106
122
  - Gemfile
107
123
  - README.md
108
124
  - Rakefile
@@ -129,7 +145,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
129
145
  requirements:
130
146
  - - ">="
131
147
  - !ruby/object:Gem::Version
132
- version: '0'
148
+ version: 1.9.3
133
149
  required_rubygems_version: !ruby/object:Gem::Requirement
134
150
  requirements:
135
151
  - - ">="