rgloader 1.0

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.
Files changed (42) hide show
  1. data/Gemfile +4 -0
  2. data/LICENSE.txt +22 -0
  3. data/README.md +19 -0
  4. data/Rakefile +48 -0
  5. data/lib/rgloader.rb +72 -0
  6. data/lib/rgloader/version.rb +3 -0
  7. data/rgloader/rgloader.darwin.bundle +0 -0
  8. data/rgloader/rgloader.freebsd.so +0 -0
  9. data/rgloader/rgloader.freebsd.x86_64.so +0 -0
  10. data/rgloader/rgloader.linux.so +0 -0
  11. data/rgloader/rgloader.linux.x86_64.so +0 -0
  12. data/rgloader/rgloader.mingw.so +0 -0
  13. data/rgloader/rgloader.mswin.so +0 -0
  14. data/rgloader/rgloader.openbsd.so +0 -0
  15. data/rgloader/rgloader.openbsd.x86_64.so +0 -0
  16. data/rgloader/rgloader19.darwin.bundle +0 -0
  17. data/rgloader/rgloader19.freebsd.so +0 -0
  18. data/rgloader/rgloader19.freebsd.x86_64.so +0 -0
  19. data/rgloader/rgloader19.linux.so +0 -0
  20. data/rgloader/rgloader19.linux.x86_64.so +0 -0
  21. data/rgloader/rgloader19.mswin.so +0 -0
  22. data/rgloader/rgloader19.openbsd.so +0 -0
  23. data/rgloader/rgloader19.openbsd.x86_64.so +0 -0
  24. data/rgloader/rgloader191.mingw.so +0 -0
  25. data/rgloader/rgloader191.mswin.so +0 -0
  26. data/rgloader/rgloader192.darwin.bundle +0 -0
  27. data/rgloader/rgloader192.freebsd.so +0 -0
  28. data/rgloader/rgloader192.freebsd.x86_64.so +0 -0
  29. data/rgloader/rgloader192.linux.so +0 -0
  30. data/rgloader/rgloader192.linux.x86_64.so +0 -0
  31. data/rgloader/rgloader192.mingw.so +0 -0
  32. data/rgloader/rgloader192.mswin.so +0 -0
  33. data/rgloader/rgloader192.openbsd.so +0 -0
  34. data/rgloader/rgloader192.openbsd.x86_64.so +0 -0
  35. data/rgloader/rgloader193.darwin.bundle +0 -0
  36. data/rgloader/rgloader193.freebsd.so +0 -0
  37. data/rgloader/rgloader193.freebsd.x86_64.so +0 -0
  38. data/rgloader/rgloader193.linux.so +0 -0
  39. data/rgloader/rgloader193.linux.x86_64.so +0 -0
  40. data/rgloader/rgloader193.mingw.so +0 -0
  41. data/rgloader/rgloader193.mswin.so +0 -0
  42. metadata +86 -0
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in rgloader.gemspec
4
+ gemspec
@@ -0,0 +1,22 @@
1
+ © 2012, Alexey Bondar
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,19 @@
1
+ # RGloader
2
+
3
+ Gemified version of RubyEncoder loaders.
4
+
5
+ ## Usage
6
+
7
+ While encoding pass the following code to `-j` argument when encoding your scripts with RubyEncoder:
8
+
9
+ "begin;require \"rubygems\";require \"rgloader\";_f=\"rgloader\";break;rescue ::LoadError;raise \"Please install RubyEncoder loaders gem: gem install rgloader\";end;"
10
+
11
+ Then just add `gem "rgloader"` in your Gemfile. Now you can just use RubyEncoded files, without caring about where to place `rgloader` folder.
12
+
13
+ ## Contributing
14
+
15
+ 1. Fork it
16
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
17
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
18
+ 4. Push to the branch (`git push origin my-new-feature`)
19
+ 5. Create new Pull Request
@@ -0,0 +1,48 @@
1
+ require "bundler/gem_tasks"
2
+ require "fileutils"
3
+ require 'net/http'
4
+ require 'rubygems/package'
5
+ require 'zlib'
6
+
7
+ task :prepare do
8
+ archive_name = "rgloader.tar.gz"
9
+
10
+ root = Pathname.new(File.expand_path(File.dirname(__FILE__)))
11
+ # Remove current versions of RGLoaders
12
+ puts "Cleaning files..."
13
+ FileUtils.rm_rf root.join("lib").join("rgloader").join("ext")
14
+ FileUtils.rm_rf root.join(archive_name)
15
+
16
+ # Download rgloaders from RubyEncoder website
17
+ Net::HTTP.start("rubyencoder.com") do |http|
18
+ puts "Downloading #{archive_name} http://rubyencoder.com/support/files/#{archive_name}"
19
+ target = open root.join(archive_name), "w"
20
+
21
+ begin
22
+ http.request_get("/support/files/#{archive_name}") do |resp|
23
+ resp.read_body do |segment|
24
+ target.write(segment)
25
+ end
26
+ end
27
+ ensure
28
+ target.close
29
+ end
30
+ end
31
+
32
+ puts "Extracting archive..."
33
+ gzip = Zlib::GzipReader.open(root.join(archive_name))
34
+
35
+ # Unpack archive
36
+ Gem::Package::TarReader.new(gzip).each do |entry|
37
+ FileUtils.mkdir_p File.dirname(entry.full_name)
38
+
39
+ target = open entry.full_name, "wb"
40
+ target.write entry.read
41
+ end
42
+
43
+ puts "Removing archive..."
44
+
45
+ FileUtils.rm_rf root.join(archive_name)
46
+
47
+ FileUtils.rm_rf root.join("rgloader").join("loader.rb")
48
+ end
@@ -0,0 +1,72 @@
1
+ # RubyEncoder v1.0 loader
2
+ #
3
+ # Get the version and platform information for requiring loading proper
4
+ # loader native module.
5
+ #
6
+ # For ruby 1.8.x there no prefix in module name. So module name will be
7
+ #
8
+ # * rgloader.<platform>.[x68_64]
9
+ #
10
+ # As far I understand, for 1.9.x there two types of modules. Generic and
11
+ # Specific one.
12
+ #
13
+ # From my personal expirience (Oct, 2012) Generic modules, if they really
14
+ # designed to work with all versions in 1.9.x branch, not allways works.
15
+ #
16
+ # For example, when there was no loaders for 1.9.3, generic module raised
17
+ # and exception, if you tried to load it. But anyway, from original loader
18
+ # code it's clear that RubyEncoder tries to find Specific module, but if
19
+ # it fails it tries to load Generic one.
20
+ #
21
+ # For Generic modules "19" prefix is used:
22
+ #
23
+ # * rgloader19.<platform>.[x68_64]
24
+ #
25
+ # For Specific modules "19x" prefix is used. For example, for 1.9.3 it
26
+ # will be something like:
27
+ #
28
+ # * rgloader193.<platform>.[x68_64]
29
+ #
30
+ module RubyEncoderLoader
31
+ # Add a RubyEncoderLoader::LoadError class, to be able to catch
32
+ # RubyEncoder Loader load errors apart of other possible load
33
+ # errors.
34
+ class LoadError < ::LoadError; end
35
+
36
+ ruby_version_prefix = RUBY_VERSION.split('.').join
37
+ ruby_version_prefix = '' if ruby_version_prefix.to_i < 190
38
+
39
+ # Get the platform name. Ex: "darwin" or "mingw"
40
+ platform_integer, platform_name = RUBY_PLATFORM.scan(/^([A-Za-z0-9_]+)-([A-Za-z_]+)/)[0]
41
+
42
+ root = File.expand_path(File.dirname(__FILE__))
43
+
44
+ basepath = File.expand_path File.join(root, "..", "rgloader")
45
+
46
+ lookups = [
47
+ # 193, darwin, x86_64
48
+ [ruby_version_prefix, platform_name, platform_integer],
49
+ # 193, darwin
50
+ [ruby_version_prefix, platform_name],
51
+ # 19, darwin, x86_64
52
+ [ruby_version_prefix.chop, platform_name, platform_integer],
53
+ # 19, darwin
54
+ [ruby_version_prefix.chop, platform_name]
55
+ ]
56
+
57
+ lookups.map! {|signature| File.join(basepath, "rgloader#{signature.join(".")}") }
58
+
59
+ loaded = false
60
+ lookups.each do |path|
61
+ begin
62
+ require path
63
+ loaded = true
64
+ break
65
+ rescue ::LoadError => e
66
+ end
67
+ end
68
+
69
+ if not loaded
70
+ raise LoadError, "The RubyEncoder loader is not avaliable for this ruby version (#{RUBY_VERSION}) or this platform (#{platform_name}). Please visit the RubyEncoder site (http://www.rubyencoder.com/loaders/) and check that required loader is avaliable and file issue on gem's github page (http://github.com/y8/rgloader). We tried to load:\n\t#{lookups.join("\n\t")}"
71
+ end
72
+ end
@@ -0,0 +1,3 @@
1
+ module RubyEncoderLoader
2
+ VERSION = "1.0"
3
+ end
metadata ADDED
@@ -0,0 +1,86 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rgloader
3
+ version: !ruby/object:Gem::Version
4
+ version: '1.0'
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Alexey Bondar
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-11-15 00:00:00.000000000 Z
13
+ dependencies: []
14
+ description: Gemified RubyEncoder loaders.
15
+ email:
16
+ - y8@ya.ru
17
+ executables: []
18
+ extensions: []
19
+ extra_rdoc_files: []
20
+ files:
21
+ - Gemfile
22
+ - LICENSE.txt
23
+ - Rakefile
24
+ - README.md
25
+ - lib/rgloader.rb
26
+ - lib/rgloader/version.rb
27
+ - rgloader/rgloader.darwin.bundle
28
+ - rgloader/rgloader.freebsd.so
29
+ - rgloader/rgloader.freebsd.x86_64.so
30
+ - rgloader/rgloader.linux.so
31
+ - rgloader/rgloader.linux.x86_64.so
32
+ - rgloader/rgloader.mingw.so
33
+ - rgloader/rgloader.mswin.so
34
+ - rgloader/rgloader.openbsd.so
35
+ - rgloader/rgloader.openbsd.x86_64.so
36
+ - rgloader/rgloader19.darwin.bundle
37
+ - rgloader/rgloader19.freebsd.so
38
+ - rgloader/rgloader19.freebsd.x86_64.so
39
+ - rgloader/rgloader19.linux.so
40
+ - rgloader/rgloader19.linux.x86_64.so
41
+ - rgloader/rgloader19.mswin.so
42
+ - rgloader/rgloader19.openbsd.so
43
+ - rgloader/rgloader19.openbsd.x86_64.so
44
+ - rgloader/rgloader191.mingw.so
45
+ - rgloader/rgloader191.mswin.so
46
+ - rgloader/rgloader192.darwin.bundle
47
+ - rgloader/rgloader192.freebsd.so
48
+ - rgloader/rgloader192.freebsd.x86_64.so
49
+ - rgloader/rgloader192.linux.so
50
+ - rgloader/rgloader192.linux.x86_64.so
51
+ - rgloader/rgloader192.mingw.so
52
+ - rgloader/rgloader192.mswin.so
53
+ - rgloader/rgloader192.openbsd.so
54
+ - rgloader/rgloader192.openbsd.x86_64.so
55
+ - rgloader/rgloader193.darwin.bundle
56
+ - rgloader/rgloader193.freebsd.so
57
+ - rgloader/rgloader193.freebsd.x86_64.so
58
+ - rgloader/rgloader193.linux.so
59
+ - rgloader/rgloader193.linux.x86_64.so
60
+ - rgloader/rgloader193.mingw.so
61
+ - rgloader/rgloader193.mswin.so
62
+ homepage: http://github.com/y8/rgloader
63
+ licenses: []
64
+ post_install_message:
65
+ rdoc_options: []
66
+ require_paths:
67
+ - lib
68
+ required_ruby_version: !ruby/object:Gem::Requirement
69
+ none: false
70
+ requirements:
71
+ - - ! '>='
72
+ - !ruby/object:Gem::Version
73
+ version: '0'
74
+ required_rubygems_version: !ruby/object:Gem::Requirement
75
+ none: false
76
+ requirements:
77
+ - - ! '>='
78
+ - !ruby/object:Gem::Version
79
+ version: '0'
80
+ requirements: []
81
+ rubyforge_project:
82
+ rubygems_version: 1.8.24
83
+ signing_key:
84
+ specification_version: 3
85
+ summary: RubyEncoder loaders in form of gems
86
+ test_files: []