kindlegen 3.0.2 → 3.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 954381b740829273dcc51f45cba3843514d5d7e2
4
- data.tar.gz: 87b5468e96c2e5b182e4b7dd682cc3ba69c9a43e
2
+ SHA256:
3
+ metadata.gz: 429e8b1357f7cfccb98126e33cce7949b61263ce1739b3785b3fa7e8cf54adfd
4
+ data.tar.gz: e5e7a6adf9ea504443f7032ebfbf6912a3475a47562ed9ce07238340ea535be4
5
5
  SHA512:
6
- metadata.gz: 3e5944a39a3d9de49e378b29b6afac8f4c9267a6df5f8deb544ff5196b474d1f3e1e6cdf34f1143077f6bba22776a17464e0e3f320215cd1f30763b0f3e0d58d
7
- data.tar.gz: f23ec67c5f42262b7260567e024274c7bd10eb35bbb75ff3073462519c272506dacfe19d42dc61ba47bd11db4f9aacb363bee636b5de39e4e54d207c7eda9d1a
6
+ metadata.gz: 0c5ce8434ec59ade59563f0e76ed2ca6f27a89a411295e828d4149f8770e1907c23964ef7dbf943927cfa0f3085a4db8c237ad57e26bf05507dae6a9f6f80661
7
+ data.tar.gz: 5de495290ee07d96d8a0e72fa2bb235e5787e7a954cd745c5a41cfe6262521521d5539414c256d192be8b96b957882bc4b0ac2929b83c0dd53e25b5707338288
@@ -0,0 +1,19 @@
1
+ name: CI
2
+ on: [push, pull_request]
3
+
4
+ jobs:
5
+ build:
6
+ strategy:
7
+ matrix:
8
+ ruby: [2.5, 2.6, 2.7, 3.0]
9
+ # TODO: https://github.com/tdtds/kindlegen/issues/36
10
+ # Add macos-latest when kindlegen is fixed to work on Catalina
11
+ platform: [ubuntu-latest, windows-latest]
12
+ runs-on: ${{ matrix.platform }}
13
+ steps:
14
+ - uses: actions/checkout@v2
15
+ - uses: ruby/setup-ruby@v1
16
+ with:
17
+ ruby-version: ${{ matrix.ruby }}
18
+ - run: bundle install --jobs 4 --retry 3
19
+ - run: bundle exec rake build test
@@ -0,0 +1,18 @@
1
+ name: Publish to RubyGems.org
2
+ on:
3
+ push:
4
+ tags:
5
+ - '*'
6
+ jobs:
7
+ build:
8
+ runs-on: ubuntu-latest
9
+ steps:
10
+ - uses: actions/checkout@v2
11
+ - name: Set up Ruby
12
+ uses: ruby/setup-ruby@v1
13
+ with:
14
+ ruby-version: '3.0'
15
+ - name: Publish to RubyGems.org
16
+ uses: dawidd6/action-publish-gem@v1
17
+ with:
18
+ api_key: ${{ secrets.RUBYGEMS_API_KEY }}
data/.gitignore CHANGED
@@ -2,6 +2,7 @@
2
2
  *.swp
3
3
  /pkg
4
4
  /.bundle
5
+ /.idea
5
6
  /vendor/bundle
6
7
  /Gemfile.lock
7
8
  /.ruby-version
data/ext/Rakefile CHANGED
@@ -4,8 +4,8 @@
4
4
  #
5
5
  require 'rbconfig'
6
6
  require 'fileutils'
7
+ require 'open-uri'
7
8
 
8
- AMAZON = 'http://kindlegen.s3.amazonaws.com'
9
9
  BINDIR = '../bin'
10
10
 
11
11
  def create_default_task(target)
@@ -18,29 +18,42 @@ def create_default_task(target)
18
18
  end
19
19
 
20
20
  def create_task_for_unix(config)
21
+ require 'rubygems/package'
22
+ require 'zlib'
23
+
21
24
  tarball = config[:tarball]
22
- unzip = config[:unzip]
23
25
  target = config[:target]
24
- url = "#{AMAZON}/#{tarball}"
26
+ url = ENV['KINDLEGEN_TARBALL_URL'] || config[:url]
25
27
 
26
28
  create_default_task(target)
27
29
 
28
30
  file target => tarball do
29
- sh "#{unzip} #{tarball}"
30
- sh "chmod +x #{target}"
31
+ Gem::Package::TarReader.new(Zlib::GzipReader.open(tarball)) do |tar|
32
+ tar.each do |entry|
33
+ next unless entry.file?
34
+ next if File.exist?(entry.full_name)
35
+
36
+ dir = File.dirname(entry.full_name)
37
+ FileUtils.mkpath(dir) if dir != '.' && !File.exist?(dir)
38
+ File.open(entry.full_name, 'wb') do |f|
39
+ f.write(entry.read)
40
+ end
41
+ end
42
+ end
43
+ File.chmod(0o755, target)
31
44
  end
32
45
 
33
46
  file tarball do
34
- sh "curl #{url} -L -o #{tarball}"
47
+ curl(url, tarball)
35
48
  end
36
49
  end
37
50
 
38
- # curl for windows
39
51
  def curl(url, tarball)
40
52
  puts "open(#{url})"
41
53
  puts "save to #{tarball}"
42
- data = open(url, 'rb').read
43
- open(tarball, 'wb').write(data)
54
+ URI.open(url) do |file|
55
+ IO.copy_stream(file, tarball)
56
+ end
44
57
  end
45
58
 
46
59
  # unzip for windows
@@ -49,17 +62,16 @@ def unzip(tarball)
49
62
  Zip::File.open(tarball).each do |entry|
50
63
  dir = File.dirname(entry.name)
51
64
  FileUtils.mkpath(dir) if dir != '.' && !File.exist?(dir)
52
- entry.extract unless File.exist?(entry.name)
65
+ entry.extract(dest_path=entry.name) unless File.exist?(entry.name)
53
66
  end
54
67
  end
55
68
 
56
69
  def create_task_for_windows(config)
57
- require 'open-uri'
58
70
  require 'zip'
59
71
 
60
72
  tarball = config[:tarball]
61
73
  target = config[:target]
62
- url = "#{AMAZON}/#{tarball}"
74
+ url = ENV['KINDLEGEN_TARBALL_URL'] || config[:url]
63
75
 
64
76
  create_default_task(target)
65
77
 
@@ -76,17 +88,18 @@ case RbConfig::CONFIG['host_os']
76
88
  when /mac|darwin/i
77
89
  create_task_for_unix(
78
90
  { tarball: 'KindleGen_Mac_i386_v2_9.zip',
79
- unzip: 'unzip',
80
- target: 'kindlegen' })
91
+ target: 'kindlegen',
92
+ url: 'https://web.archive.org/web/20200814013519/https://kindlegen.s3.amazonaws.com/KindleGen_Mac_i386_v2_9.zip' })
81
93
  when /linux|cygwin/i
82
94
  create_task_for_unix(
83
95
  { tarball: 'kindlegen_linux_2.6_i386_v2_9.tar.gz',
84
- unzip: 'tar -zx --no-same-owner -f',
85
- target: 'kindlegen' })
96
+ target: 'kindlegen',
97
+ url: 'https://web.archive.org/web/20150803131026/https://kindlegen.s3.amazonaws.com/kindlegen_linux_2.6_i386_v2_9.tar.gz' })
86
98
  when /mingw32|mswin32/i
87
99
  create_task_for_windows(
88
100
  { tarball: 'kindlegen_win32_v2_9.zip',
89
- target: 'kindlegen.exe' })
101
+ target: 'kindlegen.exe',
102
+ url: 'https://web.archive.org/web/20150407060917/https://kindlegen.s3.amazonaws.com/kindlegen_win32_v2_9.zip' })
90
103
  else
91
104
  STDERR.puts "Host OS unsupported!"
92
105
  exit(1)
data/kindlegen.gemspec CHANGED
@@ -6,7 +6,7 @@ Gem::Specification.new do |s|
6
6
  s.name = "kindlegen"
7
7
  s.version = Kindlegen::VERSION
8
8
  s.platform = Gem::Platform::RUBY
9
- s.required_ruby_version = '>= 2.0.0'
9
+ s.required_ruby_version = '>= 2.5.0'
10
10
 
11
11
  s.authors = ["TADA Tadashi"]
12
12
  s.email = ["t@tdtds.jp"]
@@ -23,9 +23,9 @@ Gem::Specification.new do |s|
23
23
  s.extensions = ['ext/Rakefile']
24
24
 
25
25
  s.add_dependency 'rubyzip'
26
+ s.add_dependency "rake"
26
27
 
27
28
  # specify any dependencies here; for example:
28
- s.add_development_dependency "rake"
29
29
  s.add_development_dependency "pry"
30
30
  s.add_development_dependency "test-unit"
31
31
  end
@@ -1,3 +1,3 @@
1
1
  module Kindlegen
2
- VERSION = '3.0.2' unless const_defined?(:VERSION)
2
+ VERSION = '3.1.1' unless const_defined?(:VERSION)
3
3
  end
@@ -9,7 +9,7 @@ class KindlegenTest < Test::Unit::TestCase
9
9
  kindlegen_lib_dir = nil
10
10
  gem_version = File.read(File.join(KINDLEGEN_PROJECT_DIR, 'lib/kindlegen/version.rb')).match(/VERSION = ["'](.*?)["']/)[1]
11
11
  gem_file = File.join(KINDLEGEN_PROJECT_DIR, 'pkg', %(kindlegen-#{gem_version}.gem))
12
- result = Gem::Installer.at(gem_file).install rescue Gem::Installer.new(gem_file).install
12
+ result = Gem::Installer.at(gem_file).install rescue Gem::Installer.new(gem_file).install rescue Gem::Installer.new(Gem::Package.new gem_file).install
13
13
  begin
14
14
  require 'kindlegen'
15
15
  rescue ::LoadError
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kindlegen
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.2
4
+ version: 3.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - TADA Tadashi
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-12-31 00:00:00.000000000 Z
11
+ date: 2021-04-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubyzip
@@ -31,7 +31,7 @@ dependencies:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
- type: :development
34
+ type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
@@ -76,9 +76,10 @@ extensions:
76
76
  - ext/Rakefile
77
77
  extra_rdoc_files: []
78
78
  files:
79
+ - ".github/workflows/ci.yml"
80
+ - ".github/workflows/release.yml"
79
81
  - ".gitignore"
80
82
  - ".tachikoma.yml"
81
- - ".travis.yml"
82
83
  - Gemfile
83
84
  - LICENSE
84
85
  - README.md
@@ -101,15 +102,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
101
102
  requirements:
102
103
  - - ">="
103
104
  - !ruby/object:Gem::Version
104
- version: 2.0.0
105
+ version: 2.5.0
105
106
  required_rubygems_version: !ruby/object:Gem::Requirement
106
107
  requirements:
107
108
  - - ">="
108
109
  - !ruby/object:Gem::Version
109
110
  version: '0'
110
111
  requirements: []
111
- rubyforge_project:
112
- rubygems_version: 2.6.8
112
+ rubygems_version: 3.2.15
113
113
  signing_key:
114
114
  specification_version: 4
115
115
  summary: Installing kindlegen command.
data/.travis.yml DELETED
@@ -1,9 +0,0 @@
1
- language: ruby
2
- sudo: false
3
- cache: bundler
4
- rvm:
5
- - 2.1.10
6
- - 2.2.6
7
- - 2.3.3
8
- # NOTE the build step is required to run the tests
9
- script: bundle exec rake build test