rubrowser 0.1.4 → 0.1.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0be17d7b269962a4124e4c71d0960ee14612f32d
4
- data.tar.gz: 8b24607f58b580bae77e5e9d39b0fe71ab6fd2cc
3
+ metadata.gz: badb6ddb134dfb84c78ca1f1fccf87adca07323e
4
+ data.tar.gz: 876d60b83c0df6d6edaee25064b141cb9ff05929
5
5
  SHA512:
6
- metadata.gz: a4eef0ad580d87429db8b111dedca2a9e7258e094adf0694f9243a3ec2e7b323c4f47cf21458f300cbaaf594dc849eb6ab1c4f9b6d2b3f4c130d8a7b8815a83a
7
- data.tar.gz: 5849d5b884678343377d5c670f0055bdbd42865a637f983da412a39ef9e6b4d4b06b628be8690fc4f4c1de5090b80a60ebdcbf53d3d0059f4bdea9fa822e988c
6
+ metadata.gz: 6a178d00941b0ebb744f0c999cf5ca0f530c3e5f27b2c052279dc6e0bc4296c54d6d78200438ad0f5e7cee4b34fc3d6a8760e0c8bb4feab356195a87f25e5287
7
+ data.tar.gz: 8c2b27697a86960346f7e8c1edf04763166ddd02625a46974bb2862a6aba857c58e8d269f5f6a2f3a2c7bee7344079c7d59b0c69aad039857662f017147b3eff
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rubrowser (0.1.4)
4
+ rubrowser (0.1.5)
5
5
  parser (~> 2.3, >= 2.3.0)
6
6
 
7
7
  GEM
data/bin/rubrowser CHANGED
@@ -1,5 +1,31 @@
1
1
  #!/usr/bin/env ruby
2
2
  $LOAD_PATH.push File.expand_path('../../lib', __FILE__)
3
3
 
4
+ require 'optparse'
5
+ require 'rubrowser'
6
+
7
+ OPTIONS = {
8
+ port: 9000,
9
+ files: ARGV.empty? ? ['.'] : ARGV
10
+ }
11
+
12
+ OptionParser.new do |opts|
13
+ opts.banner = "Usage: #{__FILE__} [options] [file] ..."
14
+
15
+ opts.on('-pPORT', '--port=PORT', 'Specify port number for server, default = 9000') do |port|
16
+ OPTIONS[:port] = port.to_i
17
+ end
18
+
19
+ opts.on('-v', '--version', 'Print Rubrowser version') do
20
+ puts "Rubrowser #{Rubrowser::VERSION}"
21
+ exit
22
+ end
23
+
24
+ opts.on('-h', '--help', 'Prints this help') do
25
+ puts opts
26
+ exit
27
+ end
28
+ end.parse!
29
+
4
30
  require 'server'
5
- Rubrowser::Server.start(ARGV.empty? ? ['.'] : ARGV)
31
+ Rubrowser::Server.start(OPTIONS)
data/lib/rubrowser.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Rubrowser
2
- VERSION = '0.1.4'.freeze
2
+ VERSION = '0.1.5'.freeze
3
3
  end
data/lib/server.rb CHANGED
@@ -7,14 +7,14 @@ module Rubrowser
7
7
  class Server < WEBrick::HTTPServer
8
8
  include ERB::Util
9
9
 
10
- def self.start(paths)
11
- new(paths).start
10
+ def self.start(options = {})
11
+ new(options).start
12
12
  end
13
13
 
14
- def initialize(paths)
15
- super Port: 9000
14
+ def initialize(options)
15
+ super Port: options[:port]
16
16
 
17
- @data = Rubrowser::Data.new(paths)
17
+ @data = Rubrowser::Data.new(options[:files])
18
18
  @data.parse
19
19
 
20
20
  mount_proc '/' do |req, res|
data/readme.md CHANGED
@@ -16,20 +16,28 @@ the idea is that the project opens every `.rb` file and parse it with `parser` g
16
16
  * it statically analyze the code so meta programming is out of question in here
17
17
  * rails associations are meta programming so forget it :smile:
18
18
 
19
- ## Usage
19
+ ## Installation
20
+
20
21
 
21
22
  ```
22
23
  gem install rubrowser
23
- rubrowser /path/to/project/or/file
24
24
  ```
25
25
 
26
- or you can just visualize current directory
26
+ ## Usage
27
+
27
28
 
28
29
  ```
29
- rubrowser
30
+ Usage: bin/rubrowser [options] [file] ...
31
+ -p, --port=PORT Specify port number for server, default = 9000
32
+ -v, --version Print Rubrowser version
33
+ -h, --help Prints this help
30
34
  ```
31
35
 
32
- it'll analyze the project and open port 9000, so you can access the graph from `localhost:9000`
36
+ if you run it without any options
37
+ ```
38
+ rubrowser
39
+ ```
40
+ it'll analyze the current directory and open port 9000, so you can access the graph from `localhost:9000`
33
41
 
34
42
  ## Features
35
43
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubrowser
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Emad Elsaid
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-08-26 00:00:00.000000000 Z
11
+ date: 2016-08-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: parser