rasm 0.0.1

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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: e53809f6f8b08b801973b09592bbbba0cdd0f0fd
4
+ data.tar.gz: 82cd8287f580bedb991aaa8625cdbacf7cdd9a74
5
+ SHA512:
6
+ metadata.gz: 685d9619e126dbb4052ee0302cd9ea729fb2209cea2abbe413de6d7eefc3cd8064db1f6530e006bc5b4949efeb4c2014aabcf6eababdaa7456408ecad516b868
7
+ data.tar.gz: b112018494288f163b63e661e4fdded80a9d2799bed17253e6eb4c45d7925523a188ce0f3f25b8eb7bf655eb5ac458103b450f620007405b213386bad7a80169
@@ -0,0 +1,19 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.bundle
11
+ *.so
12
+ *.o
13
+ *.a
14
+ mkmf.log
15
+
16
+ *.gem
17
+
18
+
19
+ /lib/tmp
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --color
2
+ --format progress
3
+ --require spec_helper
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in rasm.gemspec
4
+ gemspec
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 James Zhan
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,31 @@
1
+ # Rasm
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'rasm'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install rasm
20
+
21
+ ## Usage
22
+
23
+ TODO: Write usage instructions here
24
+
25
+ ## Contributing
26
+
27
+ 1. Fork it ( https://github.com/jameszhan/rasm/fork )
28
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
29
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
30
+ 4. Push to the branch (`git push origin my-new-feature`)
31
+ 5. Create a new Pull Request
@@ -0,0 +1,2 @@
1
+ require 'bundler/gem_tasks'
2
+
@@ -0,0 +1,11 @@
1
+ require 'rasm/version'
2
+ require 'rasm/core_ext'
3
+
4
+
5
+ module Rasm
6
+ autoload :Ref, 'rasm/ref'
7
+
8
+ module Java
9
+ autoload :Bytecode, 'rasm/java/bytecode'
10
+ end
11
+ end
@@ -0,0 +1,3 @@
1
+ Dir["#{File.dirname(__FILE__)}/core_ext/*.rb"].each do |path|
2
+ require path
3
+ end
@@ -0,0 +1,16 @@
1
+ class Hash
2
+
3
+ def ref(selector, options = {})
4
+ Rasm::Ref.new(self, selector, options)
5
+ end
6
+
7
+ def respond_to_missing?(method, *)
8
+ self.key?(method) || super
9
+ end
10
+
11
+ def method_missing(method, *args)
12
+ return self[method] if args.empty? && self.include?(method)
13
+ super
14
+ end
15
+
16
+ end
@@ -0,0 +1,78 @@
1
+ module Rasm
2
+ module Java
3
+
4
+ module Accessable
5
+ ACC_PUBLIC = 0x0001 # class, field, method
6
+ ACC_PRIVATE = 0x0002 # class, field, method
7
+ ACC_PROTECTED = 0x0004 # class, field, method
8
+ ACC_STATIC = 0x0008; # field, method
9
+ ACC_FINAL = 0x0010; # class, field, method
10
+ ACC_SUPER = 0x0020; # class
11
+ ACC_SYNCHRONIZED = 0x0020; # method
12
+ ACC_VOLATILE = 0x0040; # field
13
+ ACC_BRIDGE = 0x0040; # method
14
+ ACC_VARARGS = 0x0080; # method
15
+ ACC_TRANSIENT = 0x0080; # field
16
+ ACC_NATIVE = 0x0100; # method
17
+ ACC_INTERFACE = 0x0200; # class
18
+ ACC_ABSTRACT = 0x0400; # class, method
19
+ ACC_STRICT = 0x0800; # method
20
+ ACC_SYNTHETIC = 0x1000; # class, field, method
21
+ ACC_ANNOTATION = 0x2000; # class
22
+ ACC_ENUM = 0x4000; # class(?) field inner
23
+
24
+ ACC_DEPRECATED = 0x20000; # class, field, method
25
+
26
+
27
+ TYPES = {
28
+ Z: 'boolean',
29
+ B: 'byte',
30
+ C: 'char',
31
+ S: 'short',
32
+ I: 'int',
33
+ F: 'float',
34
+ J: 'long',
35
+ D: 'double',
36
+ L: lambda{|ref| "#{ref}"},
37
+ '['.to_sym => lambda{|type| "#{type}[]"}
38
+ }
39
+
40
+ TYPEPATTERN = /^([ZBCSIFJDL\[])([^;<]*(<[^>]+>)?);?$/
41
+
42
+ def typeof(decriptor)
43
+ if m = TYPEPATTERN.match(decriptor)
44
+ type = TYPES[m[1].to_sym]
45
+ if type.respond_to? :call
46
+ type.call(typeof(m[2]))
47
+ else
48
+ type
49
+ end
50
+ else
51
+ decriptor
52
+ end
53
+ end
54
+
55
+ def access_desc
56
+ access = access_flags & ~ ACC_SUPER
57
+ str = ''
58
+ str << 'public ' if ((access & ACC_PUBLIC) != 0)
59
+ str << 'private ' if ((access & ACC_PRIVATE) != 0)
60
+ str << 'protected ' if ((access & ACC_PROTECTED) != 0)
61
+ str << 'final ' if ((access & ACC_FINAL) != 0)
62
+ str << 'static ' if ((access & ACC_STATIC) != 0)
63
+ str << 'synchronized ' if ((access & ACC_SYNCHRONIZED) != 0)
64
+ str << 'volatile ' if ((access & ACC_VOLATILE) != 0)
65
+ str << 'transient ' if ((access & ACC_TRANSIENT) != 0)
66
+ str << 'abstract ' if ((access & ACC_ABSTRACT) != 0)
67
+ str << 'strictfp ' if ((access & ACC_STRICT) != 0)
68
+ str << 'synthetic ' if ((access & ACC_SYNTHETIC) != 0)
69
+ str << 'enum ' if ((access & ACC_ENUM) != 0)
70
+ str
71
+ end
72
+
73
+ attr_accessor :name, :access_flags
74
+
75
+ end
76
+
77
+ end
78
+ end
@@ -0,0 +1,25 @@
1
+ module Rasm
2
+ module Java
3
+ class Attribute
4
+ attr_reader :name
5
+ def initialize(cp, name, data)
6
+ @cp, @name, @data = cp, name, data
7
+ end
8
+
9
+ def value
10
+ @cp[@data.unpack('n')[0]].val
11
+ end
12
+
13
+ class << self
14
+ def of(cp, name, data)
15
+ case name
16
+ when 'Code'
17
+
18
+ else
19
+ Attribute.new(cp, name, data)
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,140 @@
1
+ require 'rasm/java/constant_type'
2
+ require 'rasm/java/structure'
3
+ require 'rasm/java/accessable'
4
+ require 'rasm/java/attributes'
5
+
6
+ module Rasm
7
+ module Java
8
+ #
9
+ # ClassFile {
10
+ # u4 magic;
11
+ # u2 minor_version;
12
+ # u2 major_version;
13
+ # u2 constant_pool_count;
14
+ # cp_info constant_pool[constant_pool_count-1];
15
+ # u2 access_flags;
16
+ # u2 this_class;
17
+ # u2 super_class;
18
+ # u2 interfaces_count;
19
+ # u2 interfaces[interfaces_count];
20
+ # u2 fields_count;
21
+ # field_info fields[fields_count];
22
+ # u2 methods_count;
23
+ # method_info methods[methods_count];
24
+ # u2 attributes_count;
25
+ # attribute_info attributes[attributes_count];
26
+ # }
27
+ #
28
+ class Bytecode
29
+ include Accessable
30
+
31
+ attr_reader :version, :super_class, :interfaces, :fields, :methods, :attributes
32
+
33
+ def initialize(class_file)
34
+ open class_file, 'rb' do|io|
35
+ magic = io.read(4).unpack('N')[0]
36
+ if magic == 0xCAFEBABE
37
+ @version = io.read(4).unpack('nn').reverse.join('.')
38
+ pull_cp_info(io)
39
+ self.access_flags, this_class, super_class, interfaces_count = io.read(8).unpack('n*')
40
+ @interfaces = interfaces_count > 0 ? io.read(2 * interfaces_count).unpack('n*').map{|item| constant_pool[item].val} : []
41
+ self.name, @super_class = constant_pool[this_class].val, constant_pool[super_class].val
42
+
43
+ @fields = pull_list(io, FieldInfo)
44
+ @methods = pull_list(io, MethodInfo)
45
+ @attributes = pull_attributes(io)
46
+ else
47
+ raise "magic #{magic} is not valid java class file."
48
+ end
49
+ end
50
+ end
51
+
52
+ def to_s
53
+ access = access_flags
54
+ str = ''
55
+ if access & ACC_DEPRECATED != 0
56
+ str << "//DEPRECATED\n"
57
+ end
58
+ str << "// access flags 0x%x\n" % access
59
+ str << access_desc
60
+ if (access & ACC_ANNOTATION) != 0
61
+ str << '@interface '
62
+ elsif (access & ACC_INTERFACE) != 0
63
+ str << 'interface ';
64
+ elsif (access & ACC_ENUM) == 0
65
+ str << 'class '
66
+ end
67
+ str << name
68
+ str << " extends #{super_class} " if super_class && super_class != 'java/lang/Object'
69
+ str << " implements %s {\n" % interfaces.join(',') unless interfaces.empty?
70
+ fields.each do|f|
71
+ str << "#{f}\n"
72
+ end
73
+ str << "\n}"
74
+ str
75
+ end
76
+
77
+
78
+ def constant_pool
79
+ @constant_pool ||= {}
80
+ end
81
+
82
+ def cp_info
83
+ str = "cp_info (#{@constant_pool_count}) \n"
84
+ constant_pool.each do|i, e|
85
+ if e.is_a? Ref
86
+ str << "#%02d = %-16s %-20s %s\n" % [i, e.name, e, ("//#{e.val}" if e.is_a?(Ref))]
87
+ else
88
+ str << "#%02d = %-16s %-20s\n" % [i, e.name, e.val]
89
+ end
90
+
91
+ end
92
+ str
93
+ end
94
+
95
+ private
96
+ def pull_cp_info(io)
97
+ @constant_pool_count = io.read(2).unpack('n')[0]
98
+ i = 1
99
+ while i < @constant_pool_count
100
+ tag = io.read(1).unpack('C')[0]
101
+ constant_type = CONSTANT_TYPES[tag]
102
+ if constant_type
103
+ target = constant_type.value_at(io)
104
+ constant_pool[i] = target.respond_to?(:call) ? target.call(constant_pool) : target
105
+ end
106
+ i += 1 if tag == 5 || tag == 6
107
+ i += 1
108
+ end
109
+ end
110
+
111
+ def pull_list(io, type)
112
+ fields_count = io.read(2).unpack('n')[0]
113
+ items = []
114
+ if fields_count > 0
115
+ fields_count.times do
116
+ access_flags, name_index, descriptor_index = io.read(6).unpack('n*')
117
+ attributes = pull_attributes(io)
118
+ item = type.new(constant_pool[descriptor_index].val, attributes)
119
+ item.access_flags, item.name = access_flags, constant_pool[name_index].val
120
+ items << item
121
+ end
122
+ end
123
+ items
124
+ end
125
+
126
+ def pull_attributes(io)
127
+ attributes_count = io.read(2).unpack('n')[0]
128
+ attributes = []
129
+ attributes_count.times do
130
+ attribute_name_index, attribute_length = io.read(6).unpack('nN')
131
+ name = constant_pool[attribute_name_index].val
132
+ attributes << Attribute.of(constant_pool, name, io.read(attribute_length))
133
+ end
134
+ attributes
135
+ end
136
+ end
137
+
138
+
139
+ end
140
+ end
@@ -0,0 +1,65 @@
1
+ module Rasm
2
+ module Java
3
+
4
+
5
+
6
+ ConstantType = Struct.new(:name, :tag, :rule) do
7
+
8
+ def value(val)
9
+ {tag: tag, name: name, val: val}
10
+ end
11
+
12
+ def value_at(io)
13
+ rule.call(io)
14
+ end
15
+
16
+ class << self
17
+ def val(name, tag, len, flag)
18
+ ConstantType.new(name, tag, val_lambda(name, tag, len, flag))
19
+ end
20
+
21
+ def ref(name, tag, len)
22
+ ConstantType.new(name, tag, ref_lambda(name, tag, len))
23
+ end
24
+
25
+ private
26
+ def val_lambda(name, tag, len, flag)
27
+ lambda do|io|
28
+ length = len.respond_to?(:call) ? len.call(io) : len
29
+ bytes = io.read(length)
30
+ val = flag.respond_to?(:call) ? flag.call(bytes) : bytes.unpack(flag)[0]
31
+ {val: val, name: name, tag: tag}
32
+ end
33
+ end
34
+
35
+ def ref_lambda(name, tag, len)
36
+ lambda do|io|
37
+ selector = len == 2 ? io.read(len).unpack('n')[0] : io.read(len).unpack('nn')
38
+ lambda{|cp| cp.ref(selector).bind(name: name, tag: tag)}
39
+ end
40
+ end
41
+ end
42
+
43
+ end
44
+
45
+
46
+ CONSTANT_TYPES = [
47
+ nil,
48
+ ConstantType.val(:Utf8, 1, lambda{|io| io.read(2).unpack('n')[0]}, 'a*'),
49
+ nil,
50
+ ConstantType.val(:Integer ,3, 4, 'N'),
51
+ ConstantType.val(:Float, 4, 4, 'g'),
52
+ ConstantType.val(:Long, 5, 8, lambda{|bytes| h, l = bytes.unpack('NN'); (h << 32) + l}),
53
+ ConstantType.val(:Double, 6, 8, 'G'),
54
+ ConstantType.ref(:Class, 7, 2),
55
+ ConstantType.ref(:String, 8, 2),
56
+ ConstantType.ref(:Fieldref, 9, 4),
57
+ ConstantType.ref(:Methodref, 10, 4),
58
+ ConstantType.ref(:InterfaceMethodref, 11, 4),
59
+ ConstantType.ref(:NameAndType, 12, 4)
60
+ ]
61
+
62
+
63
+
64
+ end
65
+ end
@@ -0,0 +1,38 @@
1
+ require 'rasm/java/accessable'
2
+ module Rasm
3
+ module Java
4
+
5
+ class FieldInfo
6
+ include Accessable
7
+ attr_reader :descriptor, :attributes
8
+ def initialize(descriptor, attributes)
9
+ @descriptor, @attributes = descriptor, attributes
10
+ end
11
+
12
+ def to_s
13
+ access = access_flags
14
+ str = ''
15
+ str << "\t// DEPRECATED\n" if access & ACC_DEPRECATED != 0
16
+ str << "\t// access flags 0x%x\n" % access
17
+ signature, constant_value = attribute_of('Signature'), attribute_of('ConstantValue')
18
+ if signature
19
+ str << "\t#{access_desc} #{typeof(signature.value)} #{name}"
20
+ else
21
+ str << "\t#{access_desc} #{typeof(descriptor)} #{name}"
22
+ end
23
+ str << " = #{constant_value.value}" if constant_value
24
+
25
+ str
26
+ end
27
+
28
+ def attribute_of(name)
29
+ attributes.detect{|attr| attr.name == name}
30
+ end
31
+
32
+ end
33
+
34
+ MethodInfo = Struct.new(:access_flags, :name, :descriptor, :attributes) do
35
+
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,63 @@
1
+ module Rasm
2
+
3
+ class Ref
4
+ attr_reader :scope, :selector, :options
5
+ def initialize(scope, selector, options = {})
6
+ @scope = scope
7
+ @selector = selector
8
+ @options = options
9
+ end
10
+
11
+ def bind(defs)
12
+ data.merge!(defs)
13
+ self
14
+ end
15
+
16
+ def [](key)
17
+ data[key]
18
+ end
19
+
20
+ def []=(key, value)
21
+ data[key] = value
22
+ end
23
+
24
+ def to_s
25
+ prefix = options[:prefix] || '#'
26
+ if selector.is_a? Array
27
+ split = options[:split] || ':'
28
+ selector.map{|item| "#{prefix}#{item}"}.join(split)
29
+ else
30
+ "#{prefix}#{selector}"
31
+ end
32
+ end
33
+
34
+ def val
35
+ split = options[:split] || ':'
36
+ if selector.respond_to? :map
37
+ selector.map{|item| find(scope, item) }.join(split)
38
+ else
39
+ find(scope, selector)
40
+ end
41
+ end
42
+
43
+ def respond_to_missing?(method, *)
44
+ data.include?(method) || super
45
+ end
46
+
47
+ def method_missing(method, *args)
48
+ return data[method] if args.empty? && data.include?(method)
49
+ super
50
+ end
51
+
52
+ private
53
+ def data
54
+ @data ||= {}
55
+ end
56
+
57
+ def find(scope, selector)
58
+ value = scope[selector]
59
+ value.respond_to?(:val) ? value.val : value
60
+ end
61
+ end
62
+
63
+ end
@@ -0,0 +1,3 @@
1
+ module Rasm
2
+ VERSION = '0.0.1'
3
+ end
@@ -0,0 +1,24 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'rasm/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'rasm'
8
+ spec.version = Rasm::VERSION
9
+ spec.authors = ['James Zhan']
10
+ spec.email = ['zhiqiangzhan@gmail.com']
11
+ spec.summary = %q{A x86 assembler}
12
+ spec.description = %q{A x86 assembler implemented by Ruby.}
13
+ spec.homepage = 'https://github.com/jameszhan/rasm'
14
+ spec.license = 'MIT'
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ['lib']
20
+
21
+ spec.add_development_dependency 'bundler'
22
+ spec.add_development_dependency 'rake'
23
+ spec.add_development_dependency 'rspec'
24
+ end
@@ -0,0 +1,21 @@
1
+ describe Rasm do
2
+
3
+ describe 'Bytecode' do
4
+ it 'it can analyze java class bytecode' do
5
+ root_dir = '/u/workdir/codes/rfsc/codegen/target/test-classes'
6
+ clazz = 'com.mulberry.athena.asm.DemoClass'
7
+
8
+
9
+ class_file = "#{root_dir}/#{clazz.gsub('.', '/')}.class"
10
+
11
+ bytecode = Rasm::Java::Bytecode.new class_file
12
+ puts bytecode.version
13
+ puts bytecode.cp_info
14
+ puts bytecode
15
+ puts bytecode.fields
16
+ puts bytecode.methods
17
+ puts bytecode.attributes
18
+ end
19
+ end
20
+
21
+ end
@@ -0,0 +1,94 @@
1
+ require 'rubygems'
2
+ require 'bundler/setup'
3
+
4
+ require 'rasm'
5
+
6
+ # This file was generated by the `rspec --init` command. Conventionally, all
7
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
8
+ # The generated `.rspec` file contains `--require spec_helper` which will cause this
9
+ # file to always be loaded, without a need to explicitly require it in any files.
10
+ #
11
+ # Given that it is always loaded, you are encouraged to keep this file as
12
+ # light-weight as possible. Requiring heavyweight dependencies from this file
13
+ # will add to the boot time of your test suite on EVERY test run, even for an
14
+ # individual file that may not need all of that loaded. Instead, consider making
15
+ # a separate helper file that requires the additional dependencies and performs
16
+ # the additional setup, and require it from the spec files that actually need it.
17
+ #
18
+ # The `.rspec` file also contains a few flags that are not defaults but that
19
+ # users commonly want.
20
+ #
21
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
22
+ RSpec.configure do |config|
23
+ # rspec-expectations config goes here. You can use an alternate
24
+ # assertion/expectation library such as wrong or the stdlib/minitest
25
+ # assertions if you prefer.
26
+ config.expect_with :rspec do |expectations|
27
+ # This option will default to `true` in RSpec 4. It makes the `description`
28
+ # and `failure_message` of custom matchers include text for helper methods
29
+ # defined using `chain`, e.g.:
30
+ # be_bigger_than(2).and_smaller_than(4).description
31
+ # # => "be bigger than 2 and smaller than 4"
32
+ # ...rather than:
33
+ # # => "be bigger than 2"
34
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
35
+ end
36
+
37
+ # rspec-mocks config goes here. You can use an alternate test double
38
+ # library (such as bogus or mocha) by changing the `mock_with` option here.
39
+ config.mock_with :rspec do |mocks|
40
+ # Prevents you from mocking or stubbing a method that does not exist on
41
+ # a real object. This is generally recommended, and will default to
42
+ # `true` in RSpec 4.
43
+ mocks.verify_partial_doubles = true
44
+ end
45
+
46
+ # The settings below are suggested to provide a good initial experience
47
+ # with RSpec, but feel free to customize to your heart's content.
48
+ =begin
49
+ # These two settings work together to allow you to limit a spec run
50
+ # to individual examples or groups you care about by tagging them with
51
+ # `:focus` metadata. When nothing is tagged with `:focus`, all examples
52
+ # get run.
53
+ config.filter_run :focus
54
+ config.run_all_when_everything_filtered = true
55
+
56
+ # Limits the available syntax to the non-monkey patched syntax that is recommended.
57
+ # For more details, see:
58
+ # - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
59
+ # - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
60
+ # - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching
61
+ config.disable_monkey_patching!
62
+
63
+ # This setting enables warnings. It's recommended, but in some cases may
64
+ # be too noisy due to issues in dependencies.
65
+ config.warnings = true
66
+
67
+ # Many RSpec users commonly either run the entire suite or an individual
68
+ # file, and it's useful to allow more verbose output when running an
69
+ # individual spec file.
70
+ if config.files_to_run.one?
71
+ # Use the documentation formatter for detailed output,
72
+ # unless a formatter has already been configured
73
+ # (e.g. via a command-line flag).
74
+ config.default_formatter = 'doc'
75
+ end
76
+
77
+ # Print the 10 slowest examples and example groups at the
78
+ # end of the spec run, to help surface which specs are running
79
+ # particularly slow.
80
+ config.profile_examples = 10
81
+
82
+ # Run specs in random order to surface order dependencies. If you find an
83
+ # order dependency and want to debug it, you can fix the order by providing
84
+ # the seed, which is printed after each run.
85
+ # --seed 1234
86
+ config.order = :random
87
+
88
+ # Seed global randomization in this process using the `--seed` CLI option.
89
+ # Setting this allows you to use `--seed` to deterministically reproduce
90
+ # test failures related to randomization by passing the same `--seed` value
91
+ # as the one that triggered the failure.
92
+ Kernel.srand config.seed
93
+ =end
94
+ end
metadata ADDED
@@ -0,0 +1,107 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rasm
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - James Zhan
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-11-28 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ description: A x86 assembler implemented by Ruby.
56
+ email:
57
+ - zhiqiangzhan@gmail.com
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - ".gitignore"
63
+ - ".rspec"
64
+ - Gemfile
65
+ - LICENSE.txt
66
+ - README.md
67
+ - Rakefile
68
+ - lib/rasm.rb
69
+ - lib/rasm/core_ext.rb
70
+ - lib/rasm/core_ext/hash.rb
71
+ - lib/rasm/java/accessable.rb
72
+ - lib/rasm/java/attributes.rb
73
+ - lib/rasm/java/bytecode.rb
74
+ - lib/rasm/java/constant_type.rb
75
+ - lib/rasm/java/structure.rb
76
+ - lib/rasm/ref.rb
77
+ - lib/rasm/version.rb
78
+ - rasm.gemspec
79
+ - spec/bytecode_spec.rb
80
+ - spec/spec_helper.rb
81
+ homepage: https://github.com/jameszhan/rasm
82
+ licenses:
83
+ - MIT
84
+ metadata: {}
85
+ post_install_message:
86
+ rdoc_options: []
87
+ require_paths:
88
+ - lib
89
+ required_ruby_version: !ruby/object:Gem::Requirement
90
+ requirements:
91
+ - - ">="
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
94
+ required_rubygems_version: !ruby/object:Gem::Requirement
95
+ requirements:
96
+ - - ">="
97
+ - !ruby/object:Gem::Version
98
+ version: '0'
99
+ requirements: []
100
+ rubyforge_project:
101
+ rubygems_version: 2.2.2
102
+ signing_key:
103
+ specification_version: 4
104
+ summary: A x86 assembler
105
+ test_files:
106
+ - spec/bytecode_spec.rb
107
+ - spec/spec_helper.rb