mruby_utils 1.2.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: b126ef66ac596b390505b1005b0e0d841542fd166e9e23b222361c4ed35f15c4
4
+ data.tar.gz: 57b5653e18feb414972b6e17f6bf5b91945e9e75a24b433aa1d0716392ff0ddb
5
+ SHA512:
6
+ metadata.gz: 4d731c603dd9be961af0efefbe447edcf6b177dea6fbfe5013d26c336ff681312f8e7bfb2d7f85b829a5c3ff9945a1c866342cf5774b5cb621a14dc7854dde4d
7
+ data.tar.gz: de595661cd16a4e102afcbe90f3a99f9c86ba53ba61b1c5bb15a978a0b8122f348e4644025ee2101970da669fa716297a23e2515370b7fa73a26e19f9653b301
@@ -0,0 +1,81 @@
1
+ # The MIT License (MIT)
2
+ #
3
+ # Copyright (c) 2019 Sebastian Katzer
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.
22
+
23
+ module MRuby
24
+ class Build
25
+ # Enable compiler optimizations.
26
+ #
27
+ # @return [ Void ]
28
+ def enable_optimizations
29
+ [cc, cxx].each do |cc|
30
+ cc.flags << (toolchains.include?('clang') ? '-Oz' : '-Os')
31
+ end
32
+ end
33
+
34
+ alias enable_optimisations enable_optimizations
35
+
36
+ # Set to true to enable static build instead of dynamic linking.
37
+ #
38
+ # @param [ Boolean ] value
39
+ #
40
+ # @return [ Void ]
41
+ def static=(value)
42
+ linker.flags_before_libraries << "-Wl,-B#{value ? 'static' : 'dynamic'}"
43
+ linker.flags_after_libraries << '-Wl,-Bdynamic'
44
+ end
45
+
46
+ # Set the proper include headers to ensure that the binary
47
+ # wont depend on newer versions of glibc.
48
+ #
49
+ # param [ String ] version The maximun supported glibc version.
50
+ #
51
+ # @return [ Void ]
52
+ def glibc_version=(version)
53
+ return if !ENV['GLIBC_HEADERS'] || is_a?(MRuby::CrossBuild)
54
+
55
+ [cc, cxx].each do |cc|
56
+ cc.flags << "-include #{ENV['GLIBC_HEADERS']}/x64/force_link_glibc_#{version}.h"
57
+ end
58
+ end
59
+
60
+ # Configures how to compile libssh2.
61
+ #
62
+ # @param [ Symbol ] openssl Link to openssl instead of mbedtls
63
+ # Defaults to: false
64
+ # @param [ Boolean ] threading Enable threading support
65
+ # Defaults to: false
66
+ # @param [ Boolean ] zlib Enable zlib support
67
+ # Defaults to: true
68
+ # @param [ Boolean ] tiny Build with tiny ssh support for sftp
69
+ # Defaults to: false
70
+ def configure_libssh2(openssl: false, threading: false, zlib: true, tiny: false)
71
+ linker.libraries << 'crypto' if openssl
72
+
73
+ [cc, cxx].each do |cc|
74
+ cc.defines << 'MRB_SSH_TINY' if tiny
75
+ cc.defines += %w[LIBSSH2_HAVE_ZLIB ZLIB_STATIC HAVE_UNISTD_H] if zlib
76
+ cc.defines += %w[MRB_SSH_LINK_CRYPTO LIBSSH2_OPENSSL] if openssl
77
+ cc.defines += %w[MBEDTLS_THREADING_PTHREAD MBEDTLS_THREADING_C] if threading
78
+ end
79
+ end
80
+ end
81
+ end
@@ -0,0 +1,36 @@
1
+ # The MIT License (MIT)
2
+ #
3
+ # Copyright (c) 2019 Sebastian Katzer
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.
22
+
23
+ require 'open3'
24
+
25
+ ENV['MRUBY_CLI_LOCAL'] ||= '1' if ENV['OS'] == 'Windows_NT'
26
+ ENV['TOOLCHAIN'] ||= 'gcc' if ENV['OS'] == 'Windows_NT'
27
+
28
+ def in_a_docker_container?
29
+ Open3.capture2e('grep -q docker /proc/self/cgroup')[-1].success?
30
+ end
31
+
32
+ def docker_run(cmd, ver = ENV['MRUBY_VERSION'])
33
+ sh "MRUBY_VERSION=#{ver} docker-compose run #{cmd}"
34
+ end
35
+
36
+ Dir["#{__dir__}/../tasks/**/*.rake"].each { |file| load file }
@@ -0,0 +1,32 @@
1
+ # The MIT License (MIT)
2
+ #
3
+ # Copyright (c) 2019 Sebastian Katzer
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.
22
+
23
+ desc 'clean build artefacts'
24
+ task clean: 'environment' do
25
+ if File.directory? ENV['MRUBY_ROOT']
26
+ if in_a_docker_container? || ENV['MRUBY_CLI_LOCAL']
27
+ %w[environment clean].each { |t| Rake::Task["mruby:#{t}"].invoke }
28
+ else
29
+ docker_run 'clean'
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,30 @@
1
+ # The MIT License (MIT)
2
+ #
3
+ # Copyright (c) 2019 Sebastian Katzer
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.
22
+
23
+ desc 'compile binary'
24
+ task compile: 'environment' do
25
+ if in_a_docker_container? || ENV['MRUBY_CLI_LOCAL']
26
+ %w[setup tuneup all strip].each { |t| Rake::Task["mruby:#{t}"].invoke }
27
+ else
28
+ docker_run 'compile'
29
+ end
30
+ end
@@ -0,0 +1,56 @@
1
+ # The MIT License (MIT)
2
+ #
3
+ # Copyright (c) 2019 Sebastian Katzer
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.
22
+
23
+ desc 'create docker-compose.yml file'
24
+ task dockerize: 'docker-compose.yml'
25
+
26
+ file 'docker-compose.yml' do
27
+ IO.write 'docker-compose.yml', <<-CONTENT
28
+ compile: &defaults
29
+ image: appplant/mruby-cli
30
+ working_dir: /home/mruby/code
31
+ volumes:
32
+ - .:/home/mruby/code:rw
33
+ environment:
34
+ MRUBY_VERSION: ${MRUBY_VERSION}
35
+ MRUBY_CONFIG: build_config.rb
36
+ command: rake compile
37
+ test:
38
+ <<: *defaults
39
+ command: rake test
40
+ bintest:
41
+ <<: *defaults
42
+ command: rake test:bintest
43
+ mtest:
44
+ <<: *defaults
45
+ command: rake test:mtest
46
+ clean:
47
+ <<: *defaults
48
+ command: rake clean
49
+ shell:
50
+ <<: *defaults
51
+ command: bash
52
+ release:
53
+ <<: *defaults
54
+ command: rake release
55
+ CONTENT
56
+ end
@@ -0,0 +1,27 @@
1
+ # The MIT License (MIT)
2
+ #
3
+ # Copyright (c) 2019 Sebastian Katzer
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.
22
+
23
+ task :environment do
24
+ ENV['MRUBY_VERSION'] ||= '2.0.1'
25
+ ENV['MRUBY_ROOT'] = File.expand_path('mruby')
26
+ ENV['MRUBY_CONFIG'] = File.expand_path(ENV['MRUBY_CONFIG'] || 'build_config.rb')
27
+ end
@@ -0,0 +1,27 @@
1
+ # The MIT License (MIT)
2
+ #
3
+ # Copyright (c) 2019 Sebastian Katzer
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.
22
+
23
+ task 'mruby:environment' => 'rake:environment' do
24
+ Dir.chdir('mruby') { namespace(:mruby) { load 'Rakefile' } }
25
+ load 'mrbgem.rake'
26
+ MRuby::Gem.current.tap { |spec| spec.build ||= MRuby::Build.current }.setup
27
+ end
@@ -0,0 +1,35 @@
1
+ # The MIT License (MIT)
2
+ #
3
+ # Copyright (c) 2019 Sebastian Katzer
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.
22
+
23
+ file :mruby do
24
+ case ENV['MRUBY_VERSION']&.downcase
25
+ when 'head'
26
+ sh 'git clone --depth 1 git://github.com/mruby/mruby.git'
27
+ when 'stable', nil
28
+ sh 'git clone --depth 1 git://github.com/mruby/mruby.git -b stable'
29
+ else
30
+ sh "curl -L --fail --retry 3 --retry-delay 1 https://github.com/mruby/mruby/archive/#{ENV['MRUBY_VERSION']}.tar.gz -s -o - | tar zxf -" # rubocop:disable LineLength
31
+ mv "mruby-#{ENV['MRUBY_VERSION']}", 'mruby'
32
+ end
33
+ end
34
+
35
+ task 'mruby:setup' => %w[rake:environment rake:mruby mruby:environment]
@@ -0,0 +1,35 @@
1
+ # The MIT License (MIT)
2
+ #
3
+ # Copyright (c) 2019 Sebastian Katzer
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.
22
+
23
+ task 'mruby:strip' => 'mruby:environment' do
24
+ MRuby.targets.each_pair do |name, spec|
25
+ Dir["#{spec.build_dir}/bin/#{MRuby::Gem.current.name}*"].each do |bin|
26
+ if RbConfig::CONFIG['host_os'].include? 'darwin'
27
+ sh "strip -u -r -arch all #{bin}"
28
+ elsif name.include? 'darwin'
29
+ sh "x86_64-apple-darwin17-strip -u -r -arch all #{bin}"
30
+ else
31
+ sh "strip --strip-unneeded #{bin}"
32
+ end
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,41 @@
1
+ # The MIT License (MIT)
2
+ #
3
+ # Copyright (c) 2019 Sebastian Katzer
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.
22
+
23
+ task 'mruby:tuneup' => 'mruby:environment' do
24
+ MRuby.targets.keep_if do |name, spec|
25
+ case "#{ARGV.join(' ')} local=#{ENV['MRUBY_CLI_LOCAL'].to_i}"
26
+ when /local=1/ then name == 'host'
27
+ when /compile/ then true
28
+ when /bintest/ then spec.bintest_enabled?
29
+ when /test/ then spec.bintest_enabled? || spec.test_enabled?
30
+ else true
31
+ end
32
+ end
33
+
34
+ MRuby.each_target
35
+ .reject { |conf| conf.bintest_enabled? || conf.test_enabled? }
36
+ .each { |conf| conf.mrbc.compile_options << ' --remove-lv' }
37
+
38
+ Rake::Task['mruby:all'].prerequisites.keep_if do |p|
39
+ MRuby.targets.any? { |(n)| p =~ %r{mruby/bin|/#{n}/} }
40
+ end
41
+ end
@@ -0,0 +1,51 @@
1
+ # The MIT License (MIT)
2
+ #
3
+ # Copyright (c) 2019 Sebastian Katzer
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.
22
+
23
+ desc 'generate a release tarball'
24
+ task release: 'environment' do
25
+ if in_a_docker_container? || ENV['MRUBY_CLI_LOCAL']
26
+ Rake::Task['compile'].invoke
27
+
28
+ spec = MRuby::Gem.current
29
+ version = spec.version || 'unknown'
30
+ release_dir = "releases/v#{version}"
31
+ release_path = Dir.pwd + "/#{release_dir}"
32
+ app_name = "#{spec.name}-#{version}"
33
+
34
+ FileUtils.mkdir_p(release_path)
35
+
36
+ MRuby.each_target do
37
+ bin = "#{build_dir}/bin/#{exefile(spec.name)}"
38
+ arch = "#{app_name}-#{name}"
39
+
40
+ FileUtils.mkdir_p(name)
41
+ FileUtils.cp(bin, name)
42
+
43
+ puts "Writing #{release_dir}/#{arch}.tgz"
44
+ `tar czf #{release_path}/#{arch}.tgz #{name}`
45
+
46
+ FileUtils.rm_rf(name)
47
+ end
48
+ else
49
+ docker_run 'release'
50
+ end
51
+ end
@@ -0,0 +1,26 @@
1
+ # The MIT License (MIT)
2
+ #
3
+ # Copyright (c) 2019 Sebastian Katzer
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.
22
+
23
+ unless in_a_docker_container?
24
+ desc 'open shell'
25
+ task(shell: 'environment') { docker_run 'shell' }
26
+ end
@@ -0,0 +1,24 @@
1
+ # The MIT License (MIT)
2
+ #
3
+ # Copyright (c) 2019 Sebastian Katzer
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.
22
+
23
+ desc 'start sshd'
24
+ task(:sshd) { sh '. $HOME/.sshdrc' }
@@ -0,0 +1,31 @@
1
+ # The MIT License (MIT)
2
+ #
3
+ # Copyright (c) 2019 Sebastian Katzer
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.
22
+
23
+ desc 'run all tests'
24
+ task test: 'environment' do
25
+ if in_a_docker_container? || ENV['MRUBY_CLI_LOCAL']
26
+ %w[setup tuneup].each { |t| Rake::Task["mruby:#{t}"].invoke }
27
+ Dir.chdir('mruby') { Rake::Task['mruby:test'].invoke }
28
+ else
29
+ docker_run 'test'
30
+ end
31
+ end
@@ -0,0 +1,31 @@
1
+ # The MIT License (MIT)
2
+ #
3
+ # Copyright (c) 2019 Sebastian Katzer
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.
22
+
23
+ desc 'run integration tests'
24
+ task 'test:bintest' => :environment do
25
+ if in_a_docker_container? || ENV['MRUBY_CLI_LOCAL']
26
+ %w[mruby:setup mruby:tuneup compile].each { |t| Rake::Task[t].invoke }
27
+ Dir.chdir('mruby') { MRuby.each_target { run_bintest if bintest_enabled? } }
28
+ else
29
+ docker_run 'bintest'
30
+ end
31
+ end
@@ -0,0 +1,34 @@
1
+ # The MIT License (MIT)
2
+ #
3
+ # Copyright (c) 2019 Sebastian Katzer
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.
22
+
23
+ desc 'run unit tests'
24
+ task 'test:mtest' => :environment do
25
+ if in_a_docker_container? || ENV['MRUBY_CLI_LOCAL']
26
+ %w[mruby:setup mruby:tuneup compile].each { |t| Rake::Task[t].invoke }
27
+ MRuby.each_target do |t|
28
+ t.enable_bintest = false
29
+ t.run_test if t.test_enabled?
30
+ end
31
+ else
32
+ docker_run 'mtest'
33
+ end
34
+ end
@@ -0,0 +1,24 @@
1
+ # The MIT License (MIT)
2
+ #
3
+ # Copyright (c) 2019 Sebastian Katzer
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.
22
+
23
+ desc 'update mruby and all mrbgems'
24
+ task update: %w[update:mruby update:mgems]
@@ -0,0 +1,29 @@
1
+ # The MIT License (MIT)
2
+ #
3
+ # Copyright (c) 2019 Sebastian Katzer
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.
22
+
23
+ desc 'update all git based mrbgems'
24
+ task 'update:mgems' => :environment do
25
+ Dir.glob("#{ENV['MRUBY_ROOT']}/build/mrbgems/*")
26
+ .keep_if { |dir| File.directory? "#{dir}/.git" }
27
+ .map! { |dir| [dir, `git symbolic-ref --short HEAD`.strip] }
28
+ .each { |dir, branch| chdir(dir) { sh "git pull origin #{branch}" } }
29
+ end
@@ -0,0 +1,28 @@
1
+ # The MIT License (MIT)
2
+ #
3
+ # Copyright (c) 2019 Sebastian Katzer
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.
22
+
23
+ desc 'update mruby'
24
+ task 'update:mruby': :environment do
25
+ Dir.chdir(ENV['MRUBY_ROOT']) do
26
+ sh "git pull origin #{`git symbolic-ref --short HEAD`.strip}"
27
+ end if File.exist? "#{ENV['MRUBY_ROOT']}/.git"
28
+ end
@@ -0,0 +1,26 @@
1
+ # The MIT License (MIT)
2
+ #
3
+ # Copyright (c) 2019 Sebastian Katzer
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.
22
+
23
+ desc 'show version'
24
+ task version: 'mruby:environment' do
25
+ puts MRuby::Gem.current.version || 'unknown'
26
+ end
metadata ADDED
@@ -0,0 +1,94 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: mruby_utils
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.2.0
5
+ platform: ruby
6
+ authors:
7
+ - Sebastián Katzer
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2019-06-14 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rake
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 11.0.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: 11.0.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: '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
+ description: Rake tasks and build helpers for mruby
42
+ email:
43
+ - katzer@appplant.de
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - lib/mruby_utils/build_helpers.rb
49
+ - lib/mruby_utils/rake_tasks.rb
50
+ - lib/tasks/clean.rake
51
+ - lib/tasks/compile.rake
52
+ - lib/tasks/dockerize.rake
53
+ - lib/tasks/environment.rake
54
+ - lib/tasks/mruby/environment.rake
55
+ - lib/tasks/mruby/setup.rake
56
+ - lib/tasks/mruby/strip.rake
57
+ - lib/tasks/mruby/tuneup.rake
58
+ - lib/tasks/release.rake
59
+ - lib/tasks/shell.rake
60
+ - lib/tasks/sshd.rake
61
+ - lib/tasks/test.rake
62
+ - lib/tasks/test/bintest.rake
63
+ - lib/tasks/test/mtest.rake
64
+ - lib/tasks/update.rake
65
+ - lib/tasks/update/mgems.rake
66
+ - lib/tasks/update/mruby.rake
67
+ - lib/tasks/version.rake
68
+ homepage: https://github.com/appPlant/mruby_utils
69
+ licenses:
70
+ - MIT
71
+ metadata:
72
+ homepage_uri: https://github.com/appPlant/mruby_utils
73
+ source_code_uri: https://github.com/appPlant/mruby_utils.git
74
+ changelog_uri: https://github.com/appPlant/mruby_utils/blob/master/CHANGELOG.md
75
+ post_install_message:
76
+ rdoc_options: []
77
+ require_paths:
78
+ - lib
79
+ required_ruby_version: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - ">="
82
+ - !ruby/object:Gem::Version
83
+ version: 2.0.0
84
+ required_rubygems_version: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - ">="
87
+ - !ruby/object:Gem::Version
88
+ version: '0'
89
+ requirements: []
90
+ rubygems_version: 3.0.3
91
+ signing_key:
92
+ specification_version: 4
93
+ summary: Utilities for developing mruby projects
94
+ test_files: []