neri 0.9.0 → 0.9.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 5c6c2f6b6dad9643634b34c873219f02c7507828
4
- data.tar.gz: c491cd7f829aa66a13edeaab659d73ff7703968f
2
+ SHA256:
3
+ metadata.gz: bed9920dd2236f60526c9e0374ce6e32fcbd95a80fb33059f88312d1f17ff403
4
+ data.tar.gz: a28147392e1e54aa6cbdd77c39862f4707b3312ed3cf19e5c1a8decf80579b3d
5
5
  SHA512:
6
- metadata.gz: 73e8ae13f438b7891a20dfcececde76bc12a95a1df2c16f3c69db10b45fbcc597aa52b88eb9964ac9fe32f8c97a116a348c78cabd283978e98c6e28b1863640e
7
- data.tar.gz: 3c568b9700a5229007571809484236e07d20f49adc56d881bdfd63f0d70508f878c3826da10022412c7d71f130901e68ed4d7b3e87f47fed050a3517ba2d9d63
6
+ metadata.gz: 1ebecbfccb0f97928d97a29ef58ef1680c1a37317d9d708c0f6270e5f2088c8655615f4a4d122f0c1752255479b450470907082cf921a37633a5bfdcbc14dec1
7
+ data.tar.gz: 2a2d02cbf53664e2abe985253fa907d09eb064eac168bf790515a7465224d6534612c0afa731c82cd9cb32b9953640867a6babc9d3a750bb578689cfd75a00af
data/README.ja.md CHANGED
@@ -11,7 +11,7 @@ Neri は、Ruby スクリプトを Ruby 未インストール環境向けに配
11
11
  - ただし Ruby のバージョンによっては、日本語を含むパス上では起動できない。(この点は OCRA も同様。)
12
12
  - OCRA に比べての短所
13
13
  - exe ファイルを作成するには、次のどちらかが必要。
14
- - gcc と windres(Ruby の拡張ライブラリをコンパイルできる環境ならばおそらく大丈夫。)
14
+ - gcc と windres(Ruby Installer 2 With Devkit を使用している場合、使用前に `ridk enable` を実行してパスを通す必要があるかもしれません。)
15
15
  - [Bat To Exe Converter](http://www.f2ko.de/en/b2e.php) ver.3
16
16
 
17
17
  ## インストール
data/Rakefile CHANGED
@@ -1,2 +1,4 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "bundler/gem_tasks"
2
- task :default => :spec
4
+ task default: %i[]
data/lib/neri/ayame.rb CHANGED
@@ -6,7 +6,7 @@ module Neri
6
6
  module Ayame
7
7
  def new(filename)
8
8
  if Neri.exist_in_datafile?(filename)
9
- ayame = load_from_memory(Neri.file_read(path))
9
+ ayame = load_from_memory(Neri.file_read(filename))
10
10
  return ayame
11
11
  else
12
12
  return super
data/lib/neri/build.rb CHANGED
@@ -320,6 +320,9 @@ options:
320
320
  unless options[:enable_did_you_mean]
321
321
  @rubyopt += " --disable-did_you_mean" unless @rubyopt.index("--disable-did_you_mean")
322
322
  end
323
+ if @data_files.size > 1 || options[:encryption_key]
324
+ options[:datafile] ||= basename + ".dat"
325
+ end
323
326
  end
324
327
 
325
328
 
@@ -588,9 +591,10 @@ options:
588
591
  @echo off
589
592
  setlocal
590
593
  set PATH=%~dp0#{options[:system_dir]}\\#{relative_path(bindir)};%PATH%
594
+ set NERI_EXECUTABLE=%~0
591
595
  #{chdir}
592
596
  if %~x0 == .exe ( shift )
593
- #{ruby_command("%~dp0")} %1 %2 %3 %4 %5 %6 %7 %8 %9
597
+ #{ruby_command(options[:chdir_first] ? "" : "%~dp0")} %1 %2 %3 %4 %5 %6 %7 %8 %9
594
598
  #{pause_command}
595
599
  endlocal
596
600
  EOF
@@ -613,6 +617,7 @@ endlocal
613
617
  open(c_file, "w:#{options[:external_encoding]}") do |f|
614
618
  f.puts <<-EOF
615
619
  #include <stdio.h>
620
+ #include <stdlib.h>
616
621
  #include <windows.h>
617
622
  #include <unistd.h>
618
623
 
@@ -634,12 +639,13 @@ int main(int argc, char *argv[])
634
639
  } else {
635
640
  exit(EXIT_FAILURE);
636
641
  }
637
- sprintf(paths, "PATH=%s%s#{system_dir}bin;%s", drive, dir, getenv("PATH"));
642
+ snprintf(paths, sizeof(paths), "NERI_EXECUTABLE=%s", exepath);
643
+ putenv(paths);
644
+ snprintf(paths, sizeof(paths), "PATH=%s%s#{system_dir}bin;%s", drive, dir, getenv("PATH"));
638
645
  putenv(paths);
639
- #{options[:chdir_first] ? 'sprintf(paths, "%s%s", drive, dir);chdir(paths);' : ''}
640
- sprintf(runruby, "#{escape_cstr(ruby_command("%s%s"))} %s %s %s %s %s %s %s %s %s",
641
- drive,
642
- dir,
646
+ #{options[:chdir_first] ? 'snprintf(paths, sizeof(paths), "%s%s", drive, dir);chdir(paths);' : ''}
647
+ snprintf(runruby, sizeof(runruby), "#{escape_cstr(ruby_command(options[:chdir_first] ? "" : "%s%s"))} %s %s %s %s %s %s %s %s %s",
648
+ #{options[:chdir_first] ? "" : "drive, dir,"}
643
649
  argc > 1 ? argv[1] : "",
644
650
  argc > 2 ? argv[2] : "",
645
651
  argc > 3 ? argv[3] : "",
@@ -717,7 +723,7 @@ END
717
723
  ruby_code = "Neri.key='#{@encryption_key}';" if @encryption_key
718
724
  if options[:datafile]
719
725
  ruby_code += "Neri.datafile='#{system_dir}' + #{unpack_filename(options[:datafile])};"
720
- ruby_code += "load File.expand_path(#{unpack_filename(File.basename(scriptfile))})"
726
+ ruby_code += "load #{unpack_filename(File.basename(scriptfile))}"
721
727
  else
722
728
  ruby_code += "load File.expand_path('#{system_dir}' + #{unpack_filename(scriptfile)})"
723
729
  end
data/lib/neri/runtime.rb CHANGED
@@ -39,7 +39,7 @@ module Neri
39
39
 
40
40
  def require(feature)
41
41
  filepath = nil
42
- load_path.each do |path|
42
+ (feature.match?(/\A([a-z]:|\\|\/|\.)/i) ? [""] : load_path).each do |path|
43
43
  ["", ".rb"].each do |ext|
44
44
  next unless exist_in_datafile?(path + feature + ext)
45
45
  filepath = adjust_path(path + feature + ext)
@@ -49,7 +49,7 @@ module Neri
49
49
  if filepath
50
50
  return false if $LOADED_FEATURES.index(filepath)
51
51
  code = load_code(filepath)
52
- eval(code, nil, filepath)
52
+ eval(code, TOPLEVEL_BINDING, filepath)
53
53
  $LOADED_FEATURES.push(filepath)
54
54
  return true
55
55
  else
@@ -68,7 +68,7 @@ module Neri
68
68
  if priv
69
69
  Module.new.module_eval(code, filepath)
70
70
  else
71
- eval(code, nil, filepath)
71
+ eval(code, TOPLEVEL_BINDING, filepath)
72
72
  end
73
73
  else
74
74
  _neri_orig_load(filepath || file, priv)
@@ -130,8 +130,9 @@ module Neri
130
130
  end
131
131
 
132
132
  def load_path()
133
- return $LOAD_PATH unless @system_dir
134
- return $LOAD_PATH.map{|path| path.sub(@system_dir, "*neri*#{File::SEPARATOR}") + File::SEPARATOR }
133
+ paths = $LOAD_PATH.map { |path| path.encode(Encoding::UTF_8) }
134
+ return paths unless @system_dir
135
+ paths.map { |path| path.sub(@system_dir, "*neri*#{File::SEPARATOR}") + File::SEPARATOR }
135
136
  end
136
137
 
137
138
  def load_code(file)
data/lib/neri/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Neri
2
- VERSION = "0.9.0"
2
+ VERSION = "0.9.1"
3
3
  end
data/neri.gemspec CHANGED
@@ -1,36 +1,35 @@
1
- # coding: utf-8
2
- lib = File.expand_path("../lib", __FILE__)
3
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require "neri/version"
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "lib/neri/version"
5
4
 
6
5
  Gem::Specification.new do |spec|
7
6
  spec.name = "neri"
8
7
  spec.version = Neri::VERSION
9
8
  spec.authors = ["nodai2hITC"]
10
9
  spec.email = ["nodai2h.itc@gmail.com"]
11
-
10
+
12
11
  spec.summary = %q{One-Click Ruby Application Builder}
13
12
  spec.description = %q{Neri builds Windows batfile or exefile from Ruby script.}
14
13
  spec.homepage = "https://github.com/nodai2hITC/neri"
15
14
  spec.license = "MIT"
16
-
17
- # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
18
- # to allow pushing to a single host or delete this section to allow pushing to any host.
19
- if spec.respond_to?(:metadata)
20
- # spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'"
21
- else
22
- raise "RubyGems 2.0 or newer is required to protect against " \
23
- "public gem pushes."
24
- end
25
-
26
- spec.files = `git ls-files -z`.split("\x0").reject do |f|
27
- f.match(%r{^(test|spec|features)/})
15
+ spec.required_ruby_version = ">= 2.4.0"
16
+
17
+ # spec.metadata["allowed_push_host"] = "TODO: Set to 'https://mygemserver.com'"
18
+
19
+ spec.metadata["homepage_uri"] = spec.homepage
20
+ spec.metadata["source_code_uri"] = spec.homepage
21
+ # spec.metadata["changelog_uri"] = "TODO: Put your gem's CHANGELOG.md URL here."
22
+
23
+ # Specify which files should be added to the gem when it is released.
24
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
25
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
26
+ `git ls-files -z`.split("\x0").reject do |f|
27
+ (f == __FILE__) || f.match(%r{\A(?:(?:test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
28
+ end
28
29
  end
29
30
  spec.bindir = "exe"
30
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
31
+ spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
31
32
  spec.require_paths = ["lib"]
32
-
33
- spec.add_development_dependency "bundler", "~> 1.15"
34
- spec.add_development_dependency "rake", "~> 10.0"
35
- spec.add_development_dependency "pry"
33
+
34
+ spec.add_dependency "win32api"
36
35
  end
metadata CHANGED
@@ -1,51 +1,23 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: neri
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.9.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - nodai2hITC
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-08-16 00:00:00.000000000 Z
11
+ date: 2021-10-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: bundler
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - "~>"
18
- - !ruby/object:Gem::Version
19
- version: '1.15'
20
- type: :development
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - "~>"
25
- - !ruby/object:Gem::Version
26
- version: '1.15'
27
- - !ruby/object:Gem::Dependency
28
- name: rake
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - "~>"
32
- - !ruby/object:Gem::Version
33
- version: '10.0'
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - "~>"
39
- - !ruby/object:Gem::Version
40
- version: '10.0'
41
- - !ruby/object:Gem::Dependency
42
- name: pry
14
+ name: win32api
43
15
  requirement: !ruby/object:Gem::Requirement
44
16
  requirements:
45
17
  - - ">="
46
18
  - !ruby/object:Gem::Version
47
19
  version: '0'
48
- type: :development
20
+ type: :runtime
49
21
  prerelease: false
50
22
  version_requirements: !ruby/object:Gem::Requirement
51
23
  requirements:
@@ -60,7 +32,6 @@ executables:
60
32
  extensions: []
61
33
  extra_rdoc_files: []
62
34
  files:
63
- - ".gitignore"
64
35
  - Gemfile
65
36
  - LICENSE.txt
66
37
  - README.ja.md
@@ -81,8 +52,10 @@ files:
81
52
  homepage: https://github.com/nodai2hITC/neri
82
53
  licenses:
83
54
  - MIT
84
- metadata: {}
85
- post_install_message:
55
+ metadata:
56
+ homepage_uri: https://github.com/nodai2hITC/neri
57
+ source_code_uri: https://github.com/nodai2hITC/neri
58
+ post_install_message:
86
59
  rdoc_options: []
87
60
  require_paths:
88
61
  - lib
@@ -90,16 +63,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
90
63
  requirements:
91
64
  - - ">="
92
65
  - !ruby/object:Gem::Version
93
- version: '0'
66
+ version: 2.4.0
94
67
  required_rubygems_version: !ruby/object:Gem::Requirement
95
68
  requirements:
96
69
  - - ">="
97
70
  - !ruby/object:Gem::Version
98
71
  version: '0'
99
72
  requirements: []
100
- rubyforge_project:
101
- rubygems_version: 2.6.12
102
- signing_key:
73
+ rubygems_version: 3.2.27
74
+ signing_key:
103
75
  specification_version: 4
104
76
  summary: One-Click Ruby Application Builder
105
77
  test_files: []
data/.gitignore DELETED
@@ -1,9 +0,0 @@
1
- /.bundle/
2
- /.yardoc
3
- /Gemfile.lock
4
- /_yardoc/
5
- /coverage/
6
- /doc/
7
- /pkg/
8
- /spec/reports/
9
- /tmp/