bt-tools 0.3.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.
@@ -0,0 +1,47 @@
1
+ module Tools
2
+ class InvalidCommandException < StandardError
3
+ # InvalidCommandException indicates to the user that the specified command is not supported.
4
+ # @param command [Symbol] The command that the user passed to this program.
5
+ # @param available_commands [Array] The commands that they are able to pass to this program.
6
+ def initialize(command, available_commands)
7
+ @command = command
8
+ @available_commands = available_commands
9
+ end
10
+
11
+ def message
12
+ %(Invalid command "#{@command}". Available commands: #{available_commands_string}.)
13
+ end
14
+
15
+ private
16
+
17
+ # Concatenates the available commands together into a pretty string
18
+ # @return [String] All available commands separated by commas.
19
+ def available_commands_string
20
+ @available_commands.join(', ')
21
+ end
22
+ end
23
+
24
+ class MissingConfigurationException < StandardError
25
+ # MissingConfigurationException indicates to the user that they are missing their configuration file.
26
+ end
27
+
28
+ class MissingKeysException < StandardError
29
+ # MissingKeysException indicates to the user that their configuration JSON is missing critical required keys.
30
+ # @param required_keys [Array] Keys that they are missing.
31
+ def initialize(required_keys)
32
+ @required_keys = required_keys
33
+ end
34
+
35
+ def message
36
+ %(Your configuration file is missing the following required keys: #{required_keys_string})
37
+ end
38
+
39
+ private
40
+
41
+ # Concatenates the required keys together into a pretty string
42
+ # @return [String] All required keys separated by commas.
43
+ def required_keys_string
44
+ @required_keys.map { |key| %('#{key}') }.join(', ')
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,12 @@
1
+ module Tools
2
+ module Support
3
+ module Execution
4
+ # Execute a console command
5
+ # @param [String] Command to execute.
6
+ # @return [String] Output of the execution.
7
+ def execute_command(command)
8
+ `#{command}`
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,17 @@
1
+ module Tools
2
+ module Support
3
+ module Manifest
4
+ private
5
+
6
+ # Extract list of files to process from manifest JSON
7
+ # @param manifest [String] Path to JSON configuration file that lists all files to be proceesed.
8
+ # @return [Array] File paths that were contained within the manifest file.
9
+ def extract_files(manifest)
10
+ contents = File.read(manifest)
11
+ json = JSON.parse(contents)
12
+
13
+ json['files']
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,3 @@
1
+ module Tools
2
+ VERSION = '0.3.0'
3
+ end
data/lib/tools.rb ADDED
@@ -0,0 +1,18 @@
1
+ require 'tools/api'
2
+ require 'tools/cli'
3
+
4
+ require 'tools/support/exceptions'
5
+ require 'tools/support/execution'
6
+ require 'tools/support/manifest'
7
+
8
+ require 'tools/formats/format'
9
+ require 'tools/formats/f_320'
10
+ require 'tools/formats/f_v0'
11
+ require 'tools/formats/f_v2'
12
+
13
+ require 'tools/actions/create'
14
+ require 'tools/actions/transcode'
15
+
16
+ module Tools
17
+ extend Tools::API
18
+ end
metadata ADDED
@@ -0,0 +1,174 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: bt-tools
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.3.0
5
+ platform: ruby
6
+ authors:
7
+ - Andrew Page
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-01-21 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: activesupport
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 4.2.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 4.2.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
+ - !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: pry
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
+ - !ruby/object:Gem::Dependency
70
+ name: rspec
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: aruba
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: codeclimate-test-reporter
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ description: Collection of tools for provisioning, managing, and automating BitTorrent
112
+ seedboxes.
113
+ email:
114
+ - andrew@andrewpage.me
115
+ executables:
116
+ - bt-tools
117
+ extensions: []
118
+ extra_rdoc_files: []
119
+ files:
120
+ - ".codeclimate.yml"
121
+ - ".gitignore"
122
+ - ".rubocop.yml"
123
+ - ".travis.yml"
124
+ - Gemfile
125
+ - LICENSE.txt
126
+ - README.md
127
+ - Rakefile
128
+ - bin/bt-tools
129
+ - bin/console
130
+ - bin/setup
131
+ - bt-tools.gemspec
132
+ - example-config/configuration.json
133
+ - example-config/create.json
134
+ - example-config/transcode-320.json
135
+ - example-config/transcode-V0.json
136
+ - example-config/transcode-V2.json
137
+ - lib/tools.rb
138
+ - lib/tools/actions/create.rb
139
+ - lib/tools/actions/transcode.rb
140
+ - lib/tools/api.rb
141
+ - lib/tools/cli.rb
142
+ - lib/tools/formats/f_320.rb
143
+ - lib/tools/formats/f_v0.rb
144
+ - lib/tools/formats/f_v2.rb
145
+ - lib/tools/formats/format.rb
146
+ - lib/tools/support/exceptions.rb
147
+ - lib/tools/support/execution.rb
148
+ - lib/tools/support/manifest.rb
149
+ - lib/tools/version.rb
150
+ homepage:
151
+ licenses:
152
+ - MIT
153
+ metadata: {}
154
+ post_install_message:
155
+ rdoc_options: []
156
+ require_paths:
157
+ - lib
158
+ required_ruby_version: !ruby/object:Gem::Requirement
159
+ requirements:
160
+ - - ">="
161
+ - !ruby/object:Gem::Version
162
+ version: '0'
163
+ required_rubygems_version: !ruby/object:Gem::Requirement
164
+ requirements:
165
+ - - ">="
166
+ - !ruby/object:Gem::Version
167
+ version: '0'
168
+ requirements: []
169
+ rubyforge_project:
170
+ rubygems_version: 2.4.5.1
171
+ signing_key:
172
+ specification_version: 4
173
+ summary: Collection of tools for automating BitTorrent.
174
+ test_files: []