rbbcc 0.6.2 → 0.6.3

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
  SHA256:
3
- metadata.gz: fb13ef05006088db3a3d16fdf3b5f444cd36a51c1d88278d5ddcb3ccb9e69663
4
- data.tar.gz: 9cded3bc218135ef79af4376a8973dedad2e3614ab5c93f49850799842c0e5c2
3
+ metadata.gz: ca8253cb2fb2d8bd3824d294d54f13d5e34a9326d25244ce7ea4d4fddc202978
4
+ data.tar.gz: 71796d5a508760ed617347d2275f30e90fb9a8b9d68354aba884b33d4625cd3e
5
5
  SHA512:
6
- metadata.gz: a05af6a130f05942ce7f9901afc8d65434b7b5851483522f875ef3a9d75d1bcb30cafb1b8ce972feea2b273329e736182740d1cc99e561139d82fd1cccd297c4
7
- data.tar.gz: '0938ed389aa2b4159618c2c79ebd841e9c74160a8b40877b54075dff9590713f6ccc1d67c27593c13bd0e1bf9fe57d4296eb1a7d58e7f357526de7144e0b8ba4'
6
+ metadata.gz: b36369cea2736423e7722b8cf087460b3966d0f73b6b9579b98aba643e0c4f6eef3bcd0f0089d0f25da61df3b2b612165ad8d1d25911511138b4b228eb94a6e5
7
+ data.tar.gz: 6e8047c3928dd676218a88c618c8546ae20de8a499acd6d700df0d0a1f4363fbee26cb168fd1190de879f939a57fc4a43cfaa453cecf50c52c0ab105f080b04f
data/Gemfile CHANGED
@@ -7,3 +7,11 @@ gem "bundler", "~> 2.0"
7
7
  gem "rake", "~> 13.0"
8
8
  gem "pry", "~> 0.12"
9
9
  gem "minitest", ">= 5"
10
+
11
+ group :omnibus_package do
12
+ gem "appbundler"
13
+ end
14
+
15
+ group :plugin_dev do
16
+ gem "rbbcc-hello", git: "https://github.com/udzura/rbbcc-hello.git"
17
+ end
@@ -1,14 +1,28 @@
1
+ GIT
2
+ remote: https://github.com/udzura/rbbcc-hello.git
3
+ revision: 2e1af47d22e7cc92e970dc6c058e113cf00821db
4
+ specs:
5
+ rbbcc-hello (0.1.0)
6
+ rbbcc
7
+
1
8
  PATH
2
9
  remote: .
3
10
  specs:
4
- rbbcc (0.6.2)
11
+ rbbcc (0.6.3)
5
12
 
6
13
  GEM
7
14
  remote: https://rubygems.org/
8
15
  specs:
16
+ appbundler (0.13.2)
17
+ mixlib-cli (>= 1.4, < 3.0)
18
+ mixlib-shellout (>= 2.0, < 4.0)
19
+ chef-utils (16.6.14)
9
20
  coderay (1.1.3)
10
21
  method_source (1.0.0)
11
22
  minitest (5.14.2)
23
+ mixlib-cli (2.1.8)
24
+ mixlib-shellout (3.2.2)
25
+ chef-utils
12
26
  pry (0.13.1)
13
27
  coderay (~> 1.1)
14
28
  method_source (~> 1.0)
@@ -18,11 +32,13 @@ PLATFORMS
18
32
  ruby
19
33
 
20
34
  DEPENDENCIES
35
+ appbundler
21
36
  bundler (~> 2.0)
22
37
  minitest (>= 5)
23
38
  pry (~> 0.12)
24
39
  rake (~> 13.0)
25
40
  rbbcc!
41
+ rbbcc-hello!
26
42
 
27
43
  BUNDLED WITH
28
44
  2.1.4
data/exe/rbbcc CHANGED
@@ -1,4 +1,16 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- binpath = File.readlink "/proc/self/exe"
4
- exec binpath, *ARGV
3
+ if ARGV[0] == '-v' || ARGV[0] == '--version'
4
+ require 'rbbcc/version'
5
+ print "RbBCC: version "
6
+ puts RbBCC::VERSION
7
+ print "Using "
8
+ puts RUBY_DESCRIPTION
9
+ elsif ARGV[0] == '--invoke'
10
+ require 'rbbcc/invoker'
11
+ ARGV.shift
12
+ RbBCC::Invoker.new(ARGV).run
13
+ else
14
+ binpath = File.readlink "/proc/self/exe"
15
+ exec binpath, *ARGV
16
+ end
@@ -1,9 +1,10 @@
1
+ module RbBCC
2
+ autoload :Plugin, 'rbbcc/plugin'
3
+ end
4
+
1
5
  require "rbbcc/fiddle_ext"
2
6
  require "rbbcc/bcc"
3
7
  require "rbbcc/clib"
4
8
  require "rbbcc/usdt"
5
9
  require "rbbcc/symbol_cache"
6
10
  require "rbbcc/version"
7
-
8
- module RbBCC
9
- end
@@ -0,0 +1,28 @@
1
+ require 'rubygems'
2
+ require 'rbbcc/plugin'
3
+
4
+ module RbBCC
5
+ class Invoker
6
+ def initialize(args)
7
+ @command = args.shift
8
+ raise "Invalid option. Please specify script name" unless @command
9
+
10
+ args.shift if args[0] == '--'
11
+ @args = args
12
+ end
13
+
14
+ def run
15
+ plugins = Gem::Specification
16
+ .find_all
17
+ .select{|s| s.name =~ /^rbbcc-/ }
18
+ .map(&:name)
19
+ plugins.each {|n| require n }
20
+
21
+ script = RbBCC::Plugin.find_script_name(@command)
22
+ raise Errno::ENOENT, "Script not found: #{@command}" unless script
23
+
24
+ binpath = File.readlink "/proc/self/exe"
25
+ Process.exec binpath, script, *@args
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,28 @@
1
+ module RbBCC
2
+ module Plugin
3
+ ScriptLocation = Struct.new(:name, :location)
4
+
5
+ def self.scripts
6
+ @scripts ||= []
7
+ end
8
+
9
+ def self.find_script_name(name)
10
+ scripts.find{|s|
11
+ s.name == name || "#{s.name}.rb" == name
12
+ }&.location
13
+ end
14
+
15
+ def self.register!
16
+ caller_loc = caller[0].split(':')[0]
17
+ plugin_loc = File.expand_path("../../script", caller_loc)
18
+ unless File.directory?(plugin_loc)
19
+ raise "Cannot find a script directory #{plugin_loc}. Maybe an invalid project"
20
+ end
21
+
22
+ found = Dir.glob("#{plugin_loc}/*.rb")
23
+ .map{|path| ScriptLocation.new File.basename(path, '.rb'), path }
24
+ self.scripts.concat found
25
+ self.scripts
26
+ end
27
+ end
28
+ end
@@ -1,3 +1,3 @@
1
1
  module RbBCC
2
- VERSION = "0.6.2"
2
+ VERSION = "0.6.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rbbcc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.2
4
+ version: 0.6.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Uchio Kondo
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-11-19 00:00:00.000000000 Z
11
+ date: 2020-11-20 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: BCC port for MRI. See https://github.com/iovisor/bcc
14
14
  email:
@@ -87,6 +87,8 @@ files:
87
87
  - lib/rbbcc/debug.rb
88
88
  - lib/rbbcc/disp_helper.rb
89
89
  - lib/rbbcc/fiddle_ext.rb
90
+ - lib/rbbcc/invoker.rb
91
+ - lib/rbbcc/plugin.rb
90
92
  - lib/rbbcc/symbol_cache.rb
91
93
  - lib/rbbcc/table.rb
92
94
  - lib/rbbcc/usdt.rb