thinreports-cli 0.9.0.pre.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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: bacb4e24edf59a5578d8b80f005ba0860a5f44c2
4
+ data.tar.gz: fecc8b20f99d42c71ae7df43f0f647d1b093bbf0
5
+ SHA512:
6
+ metadata.gz: d14c295a7ac9c983e569f3eac4e3bd8922a259e4537f49f17b42b91010303f12eaa6fb5d2d4cd9da0700e44f420a6fb7b569d75d3470e4bf4956ddb5320647fe
7
+ data.tar.gz: 7adc888417792ccddb91647b0e4355844abaea5d11fdde762c3f504c5bc1ced949b408315ee609d3ff6f9d19d2cdf60cf046bbffa64d4242b4017c0d637a7194
@@ -0,0 +1 @@
1
+ /Gemfile.lock
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2016 Katsuya Hidaka
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,34 @@
1
+ # Thinreports::CLI
2
+
3
+ **Unofficial** and **Experimental** Thinreports command-line tool.
4
+
5
+ ## Installation
6
+
7
+ $ gem install thinreports-cli --pre
8
+
9
+ ## Commands
10
+
11
+ ### $ thinreports upgrade
12
+
13
+ Upgrade .tlf schema to 0.9.x from 0.8.x:
14
+
15
+ ```
16
+ $ thinreports upgrade /path/to/old-0.8.x.tlf /path/to/new-0.9.x.tlf
17
+ ```
18
+
19
+ ## Requirements
20
+
21
+ - Ruby 2.0.0+
22
+ - thinreports 0.9.x
23
+
24
+ ## Contributing
25
+
26
+ Bug reports and pull requests are welcome on GitHub at https://github.com/hidakatsuya/thinreports-cli.
27
+
28
+ ## Todo
29
+
30
+ - [ ] Write tests
31
+
32
+ ## Copyright
33
+
34
+ Copyright © 2016 Katsuya Hidaka. See MIT-LICENSE for further details.
@@ -0,0 +1,2 @@
1
+ require 'bundler/gem_tasks'
2
+ task default: :spec
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require_relative '../lib/thinreports/cli'
4
+ Thinreports::Cli::Commands.start
@@ -0,0 +1,4 @@
1
+ require 'thinreports'
2
+
3
+ require_relative 'cli/version'
4
+ require_relative 'cli/commands'
@@ -0,0 +1,48 @@
1
+ require 'json'
2
+
3
+ module Thinreports
4
+ module Cli
5
+ module Command
6
+ class Upgrade
7
+ DESTINATION_VERSION = '0.9.0'
8
+
9
+ def initialize(source, destination)
10
+ @source = source
11
+ @destination = destination
12
+ end
13
+
14
+ def call
15
+ schema = JSON.parse(File.read(source, encoding: 'UTF-8'))
16
+
17
+ raise Thor::Error, 'Unupgradable version' unless upgradable?(schema['version'])
18
+
19
+ upgraded_schema = LegacySchemaUpgrader.new(schema).upgrade
20
+ File.write(destination, JSON.pretty_generate(upgraded_schema), encoding: 'UTF-8')
21
+ end
22
+
23
+ private
24
+
25
+ attr_reader :source, :destination
26
+
27
+ def upgradable?(source_version)
28
+ source_version >= '0.8.0' && source_version < DESTINATION_VERSION
29
+ end
30
+
31
+ class LegacySchemaUpgrader < Thinreports::Layout::LegacySchema
32
+ def upgrade
33
+ super.merge 'version' => DESTINATION_VERSION
34
+ end
35
+
36
+ def list_item_schema(legacy_element)
37
+ super.merge(
38
+ 'x' => legacy_element.attributes['x'].to_f,
39
+ 'y' => legacy_element.attributes['y'].to_f,
40
+ 'width' => legacy_element.attributes['width'].to_f,
41
+ 'height' => legacy_element.attributes['height'].to_f
42
+ )
43
+ end
44
+ end
45
+ end
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,13 @@
1
+ require 'thor'
2
+ require_relative 'command/upgrade'
3
+
4
+ module Thinreports
5
+ module Cli
6
+ class Commands < Thor
7
+ desc 'upgrade', 'Upgrade .tlf to 0.9.x from 0.8.x.'
8
+ def upgrade(source, destination)
9
+ Command::Upgrade.new(source, destination).call
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,5 @@
1
+ module Thinreports
2
+ module Cli
3
+ VERSION = '0.9.0.pre.1'
4
+ end
5
+ end
@@ -0,0 +1,29 @@
1
+ lib = File.expand_path('../lib', __FILE__)
2
+ $:.unshift(lib) unless $:.include?(lib)
3
+
4
+ require 'thinreports/cli/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'thinreports-cli'
8
+ spec.version = Thinreports::Cli::VERSION
9
+ spec.authors = ['Katsuya HIDAKA']
10
+ spec.email = ['hidakatsuya@gmail.com']
11
+
12
+ spec.platform = Gem::Platform::RUBY
13
+
14
+ spec.summary = 'Unofficial and Experimental Thinreports command-line tool'
15
+ spec.description = 'Unofficial and Experimental Thinreports command-line tool.'
16
+ spec.homepage = 'https://github.com/hidakatsuya/thinreports-cli'
17
+
18
+ spec.files = `git ls-files`.split("\n")
19
+ spec.bindir = 'exe'
20
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
21
+ spec.extra_rdoc_files = ['README.md']
22
+ spec.require_paths = ['lib']
23
+
24
+ spec.add_dependency 'thinreports', '~> 0.9.0'
25
+ spec.add_dependency 'thor', '>= 0.19.0'
26
+
27
+ spec.add_development_dependency 'bundler', '>= 1.0.0'
28
+ spec.add_development_dependency 'rake', '>= 0'
29
+ end
metadata ADDED
@@ -0,0 +1,113 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: thinreports-cli
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.9.0.pre.1
5
+ platform: ruby
6
+ authors:
7
+ - Katsuya HIDAKA
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2016-08-31 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: thinreports
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 0.9.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 0.9.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: thor
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 0.19.0
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: 0.19.0
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: 1.0.0
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: 1.0.0
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ description: Unofficial and Experimental Thinreports command-line tool.
70
+ email:
71
+ - hidakatsuya@gmail.com
72
+ executables:
73
+ - thinreports
74
+ extensions: []
75
+ extra_rdoc_files:
76
+ - README.md
77
+ files:
78
+ - ".gitignore"
79
+ - Gemfile
80
+ - MIT-LICENSE
81
+ - README.md
82
+ - Rakefile
83
+ - exe/thinreports
84
+ - lib/thinreports/cli.rb
85
+ - lib/thinreports/cli/command/upgrade.rb
86
+ - lib/thinreports/cli/commands.rb
87
+ - lib/thinreports/cli/version.rb
88
+ - thinreports-cli.gemspec
89
+ homepage: https://github.com/hidakatsuya/thinreports-cli
90
+ licenses: []
91
+ metadata: {}
92
+ post_install_message:
93
+ rdoc_options: []
94
+ require_paths:
95
+ - lib
96
+ required_ruby_version: !ruby/object:Gem::Requirement
97
+ requirements:
98
+ - - ">="
99
+ - !ruby/object:Gem::Version
100
+ version: '0'
101
+ required_rubygems_version: !ruby/object:Gem::Requirement
102
+ requirements:
103
+ - - ">"
104
+ - !ruby/object:Gem::Version
105
+ version: 1.3.1
106
+ requirements: []
107
+ rubyforge_project:
108
+ rubygems_version: 2.5.1
109
+ signing_key:
110
+ specification_version: 4
111
+ summary: Unofficial and Experimental Thinreports command-line tool
112
+ test_files: []
113
+ has_rdoc: