gem2exe 0.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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 97b38555a372b2b0c11df30fb582e5972c7303be11739699b73e09f6c29c5630
4
+ data.tar.gz: 071321bced7fefe7376adea68eec4817a3fd5ccb0450c809b8fe3bbd7d482c3f
5
+ SHA512:
6
+ metadata.gz: c49f85d1de61cb458f5c1a6a8c011a55147f9e6fb5563bd5f5f946332225162b1ddc5f1fab79ed2ee9be8533e95ecf75acbf45cf306495cd82d392ac01ae1c94
7
+ data.tar.gz: 6964e9996c450167a91f097cdb2f3d716219aeda4cecc9b0761087be185ec704a395de9282bb4637a27fcc29ef084c5830fb8c5b56e319a35557f662b5802b92
data/.gitignore ADDED
@@ -0,0 +1,11 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.travis.yml ADDED
@@ -0,0 +1,28 @@
1
+ sudo: true
2
+
3
+ services:
4
+ - docker
5
+
6
+ env:
7
+ - DOCKER_COMPOSE_VERSION=1.23.2
8
+
9
+ before_install:
10
+ - sudo rm /usr/local/bin/docker-compose
11
+ - curl -L https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-`uname -s`-`uname -m` > docker-compose
12
+ - chmod +x docker-compose
13
+ - sudo mv docker-compose /usr/local/bin
14
+ script:
15
+ - docker-compose build
16
+ - docker create --name gem2exe mattipaksula/gem2exe
17
+ - mkdir releases
18
+ - docker cp gem2exe:/app/gem2exe releases/gem2exe-linux-amd64-${TRAVIS_TAG}
19
+ - gzip releases/gem2exe-linux-amd64-${TRAVIS_TAG}
20
+
21
+ deploy:
22
+ provider: releases
23
+ api_key: "GITHUB OAUTH TOKEN"
24
+ file_glob: true
25
+ file: releases/*
26
+ skip_cleanup: true
27
+ on:
28
+ tags: true
data/Dockerfile ADDED
@@ -0,0 +1,19 @@
1
+ FROM ruby:2.6.0 as builder
2
+
3
+ RUN apt-get update && apt-get install -y squashfs-tools build-essential bison curl openssl
4
+
5
+ RUN curl -sL https://github.com/kontena/ruby-packer/releases/download/0.5.0%2Bextra7/rubyc-0.5.0+extra7-linux-amd64.gz | gunzip > /usr/local/bin/rubyc
6
+ RUN chmod +x /usr/local/bin/rubyc
7
+
8
+ RUN update-ca-certificates
9
+
10
+ WORKDIR /app
11
+ COPY . .
12
+
13
+ RUN rubyc --openssl-dir=/etc/ssl -o gem2exe -d /tmp/build --make-args="-j$((`nproc`+1))" gem2exe
14
+
15
+ # -----------
16
+ FROM ubuntu:18.04
17
+ COPY --from=builder /app/gem2exe /usr/local/bin
18
+ RUN /usr/local/bin/gem2exe setup
19
+ ENTRYPOINT [ "/usr/local/bin/gem2exe" ]
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source "https://rubygems.org"
2
+
3
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ # Specify your gem's dependencies in gem2exe.gemspec
6
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,37 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ gem2exe (0.1.0)
5
+ clamp (= 1.3.0)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ clamp (1.3.0)
11
+ diff-lcs (1.3)
12
+ rake (10.5.0)
13
+ rspec (3.8.0)
14
+ rspec-core (~> 3.8.0)
15
+ rspec-expectations (~> 3.8.0)
16
+ rspec-mocks (~> 3.8.0)
17
+ rspec-core (3.8.0)
18
+ rspec-support (~> 3.8.0)
19
+ rspec-expectations (3.8.2)
20
+ diff-lcs (>= 1.2.0, < 2.0)
21
+ rspec-support (~> 3.8.0)
22
+ rspec-mocks (3.8.0)
23
+ diff-lcs (>= 1.2.0, < 2.0)
24
+ rspec-support (~> 3.8.0)
25
+ rspec-support (3.8.0)
26
+
27
+ PLATFORMS
28
+ ruby
29
+
30
+ DEPENDENCIES
31
+ bundler (~> 1.16)
32
+ rake (~> 10.0)
33
+ rspec (~> 3.0)
34
+ gem2exe!
35
+
36
+ BUNDLED WITH
37
+ 1.16.6
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2019 Matti Paksula
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,39 @@
1
+ # Gem2exe
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/gem2exe`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'gem2exe'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install gem2exe
22
+
23
+ ## Usage
24
+
25
+ TODO: Write usage instructions here
26
+
27
+ ## Development
28
+
29
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
+
31
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
+
33
+ ## Contributing
34
+
35
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/gem2exe.
36
+
37
+ ## License
38
+
39
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "gem2exe"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,6 @@
1
+ version: '3.7'
2
+
3
+ services:
4
+ gem2exe:
5
+ build: .
6
+ image: mattipaksula/gem2exe
data/exe/gem2exe ADDED
@@ -0,0 +1,13 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ STDOUT.sync = true
5
+
6
+ # add lib to libpath (only needed when running from the sources)
7
+ require 'pathname'
8
+ lib_path = File.expand_path('../../lib', Pathname.new(__FILE__).realpath)
9
+ $LOAD_PATH.unshift lib_path unless $LOAD_PATH.include?(lib_path)
10
+
11
+ require 'Gem2exe'
12
+ require 'Gem2exe/cli'
13
+ Gem2exe::Cli::RootCommand.run
data/gem2exe.gemspec ADDED
@@ -0,0 +1,30 @@
1
+
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "gem2exe/version"
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "gem2exe"
8
+ spec.version = Gem2exe::VERSION
9
+ spec.authors = ["Matti Paksula"]
10
+ spec.email = ["matti.paksula@iki.fi"]
11
+
12
+ spec.summary = "gem2exe"
13
+ spec.homepage = "https://github.com/matti/gem2exe"
14
+ spec.license = "MIT"
15
+
16
+ # Specify which files should be added to the gem when it is released.
17
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
18
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
19
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
20
+ end
21
+ spec.bindir = "exe"
22
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
23
+ spec.require_paths = ["lib"]
24
+
25
+ spec.add_runtime_dependency "clamp", "1.3.0"
26
+
27
+ spec.add_development_dependency "bundler", "~> 1.16"
28
+ spec.add_development_dependency "rake", "~> 10.0"
29
+ spec.add_development_dependency "rspec", "~> 3.0"
30
+ end
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "tmpdir"
4
+
5
+ module Gem2exe
6
+ module Cli
7
+ class BuildCommand < Clamp::Command
8
+ parameter "NAME", "name"
9
+ option "--cache-dir", "CACHE_DIR", "build cache dir"
10
+
11
+ def execute
12
+ cores = Gem2exe.cores + 1
13
+ tmpdir = if cache_dir
14
+ cache_dir
15
+ else
16
+ Dir.mktmpdir
17
+ end
18
+
19
+ if Gem2exe.platform == "darwin"
20
+ `"#{Gem2exe.rubyc_path}" --openssl-dir=/usr/local/etc/openssl -o "#{name}" -d "#{tmpdir}" --make-args="-j#{cores} --silent" #{name}`
21
+ else
22
+ `"#{Gem2exe.rubyc_path}" --openssl-dir=/etc/ssl rubyc -o "#{name}" -d "#{tmpdir}" --make-args="-j#{cores}" #{name}`
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "build_command"
4
+
5
+ module Gem2exe
6
+ module Cli
7
+ class RootCommand < Clamp::Command
8
+ banner "🔆 gem2exe #{Gem2exe::VERSION}"
9
+
10
+ option ['-v', '--version'], :flag, "Show version information" do
11
+ puts Gem2exe::VERSION
12
+ exit 0
13
+ end
14
+
15
+ subcommand ["setup"], "setup", SetupCommand
16
+ subcommand ["uninstall"], "uninstall", UninstallCommand
17
+
18
+ subcommand ["build"], "build", BuildCommand
19
+ subcommand ["version"], "Show version information", VersionCommand
20
+
21
+ def self.run
22
+ super
23
+ rescue StandardError => exc
24
+ warn exc.message
25
+ warn exc.backtrace.join("\n")
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Gem2exe
4
+ module Cli
5
+ class SetupCommand < Clamp::Command
6
+ def execute
7
+ Gem2exe.ensure_rubyc
8
+
9
+ puts "ready"
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Gem2exe
4
+ module Cli
5
+ class UninstallCommand < Clamp::Command
6
+ def execute
7
+ Gem2exe.uninstall
8
+
9
+ puts "done"
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Gem2exe
4
+ module Cli
5
+ class VersionCommand < Clamp::Command
6
+ def execute
7
+ puts Gem2exe::VERSION
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,8 @@
1
+ require 'clamp'
2
+
3
+ require_relative "cli/version_command"
4
+ require_relative "cli/setup_command"
5
+ require_relative "cli/uninstall_command"
6
+
7
+ require_relative "cli/build_command"
8
+ require_relative "cli/root_command"
@@ -0,0 +1,3 @@
1
+ module Gem2exe
2
+ VERSION = "0.1.0"
3
+ end
data/lib/gem2exe.rb ADDED
@@ -0,0 +1,50 @@
1
+ require "fileutils"
2
+
3
+ module Gem2exe
4
+ def self.cores
5
+ Integer(`sysctl -n hw.ncpu`)
6
+ end
7
+
8
+ def self.uninstall
9
+ FileUtils.rm_rf install_path
10
+ end
11
+
12
+ def self.ensure_rubyc
13
+ return if File.exists? self.rubyc_path
14
+ FileUtils.mkdir_p File.dirname(self.rubyc_path)
15
+
16
+ rubyc_url = if self.platform == "darwin"
17
+ # "https://github.com/kontena/ruby-packer/releases/download/2.6.0-0.6.0/rubyc-2.6.0-0.6.0-osx-amd64.gz"
18
+ "https://dl.bintray.com/kontena/ruby-packer/0.5.0-dev/rubyc-0.5.0-extra2-darwin-amd64.gz"
19
+ else
20
+ "https://github.com/kontena/ruby-packer/releases/download/2.6.0-0.6.0/rubyc-2.6.0-0.6.0-linux-amd64.gz"
21
+ end
22
+
23
+ $stderr.puts "downloading rubyc from #{rubyc_url}"
24
+ `sh -c "curl -sL #{rubyc_url} | gunzip > #{self.rubyc_path}"`
25
+ `chmod +x #{self.rubyc_path}`
26
+ $stderr.puts "installed in #{self.rubyc_path}"
27
+ end
28
+
29
+ def self.rubyc_path
30
+ install_path_parts = [self.install_path]
31
+ install_path_parts << self.platform
32
+ install_path_parts << "rubyc-for-gem2exe-#{Gem2exe::VERSION}"
33
+
34
+ File.join install_path_parts
35
+ end
36
+
37
+ def self.platform
38
+ if /darwin/ =~ RUBY_PLATFORM
39
+ "darwin"
40
+ else
41
+ "linux"
42
+ end
43
+ end
44
+
45
+ def self.install_path
46
+ File.join Dir.home, ".gem2exe"
47
+ end
48
+ end
49
+
50
+ require_relative "gem2exe/version"
metadata ADDED
@@ -0,0 +1,123 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: gem2exe
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Matti Paksula
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2019-01-20 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: clamp
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '='
18
+ - !ruby/object:Gem::Version
19
+ version: 1.3.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '='
25
+ - !ruby/object:Gem::Version
26
+ version: 1.3.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.16'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.16'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '10.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '10.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '3.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '3.0'
69
+ description:
70
+ email:
71
+ - matti.paksula@iki.fi
72
+ executables:
73
+ - gem2exe
74
+ extensions: []
75
+ extra_rdoc_files: []
76
+ files:
77
+ - ".gitignore"
78
+ - ".rspec"
79
+ - ".travis.yml"
80
+ - Dockerfile
81
+ - Gemfile
82
+ - Gemfile.lock
83
+ - LICENSE.txt
84
+ - README.md
85
+ - Rakefile
86
+ - bin/console
87
+ - bin/setup
88
+ - docker-compose.yml
89
+ - exe/gem2exe
90
+ - gem2exe.gemspec
91
+ - lib/gem2exe.rb
92
+ - lib/gem2exe/cli.rb
93
+ - lib/gem2exe/cli/build_command.rb
94
+ - lib/gem2exe/cli/root_command.rb
95
+ - lib/gem2exe/cli/setup_command.rb
96
+ - lib/gem2exe/cli/uninstall_command.rb
97
+ - lib/gem2exe/cli/version_command.rb
98
+ - lib/gem2exe/version.rb
99
+ homepage: https://github.com/matti/gem2exe
100
+ licenses:
101
+ - MIT
102
+ metadata: {}
103
+ post_install_message:
104
+ rdoc_options: []
105
+ require_paths:
106
+ - lib
107
+ required_ruby_version: !ruby/object:Gem::Requirement
108
+ requirements:
109
+ - - ">="
110
+ - !ruby/object:Gem::Version
111
+ version: '0'
112
+ required_rubygems_version: !ruby/object:Gem::Requirement
113
+ requirements:
114
+ - - ">="
115
+ - !ruby/object:Gem::Version
116
+ version: '0'
117
+ requirements: []
118
+ rubyforge_project:
119
+ rubygems_version: 2.7.8
120
+ signing_key:
121
+ specification_version: 4
122
+ summary: gem2exe
123
+ test_files: []