zencoder-cli 0.1.3 → 0.1.4
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.
data/lib/zencoder-cli.rb
CHANGED
data/lib/zencoder-cli/cli.rb
CHANGED
@@ -43,15 +43,15 @@ command_options = Trollop::options do
|
|
43
43
|
banner <<-EOS
|
44
44
|
#{head}
|
45
45
|
#{
|
46
|
-
if flat_commands[command][:help]
|
46
|
+
if flat_commands[command] && flat_commands[command][:help]
|
47
47
|
"\n"+flat_commands[command][:help]+"\n"
|
48
48
|
end
|
49
49
|
}
|
50
50
|
== Usage
|
51
51
|
|
52
|
-
zencoder [global-options] #{command}#{" [args]" if flat_commands[command][:arguments]} [options]
|
52
|
+
zencoder [global-options] #{command}#{" [args]" if flat_commands[command] && flat_commands[command][:arguments]} [options]
|
53
53
|
#{
|
54
|
-
if flat_commands[command][:arguments]
|
54
|
+
if flat_commands[command] && flat_commands[command][:arguments]
|
55
55
|
"\n== Arguments\n\n"+
|
56
56
|
(1..flat_commands[command][:arguments].size).to_a.map{|i|
|
57
57
|
"#{i}: #{flat_commands[command][:arguments][i-1].to_s}"
|
data/lib/zencoder-cli/command.rb
CHANGED
@@ -11,15 +11,15 @@ module Zencoder::CLI
|
|
11
11
|
|
12
12
|
def run(command, args, global_options={}, command_options={})
|
13
13
|
Zencoder::CLI::Auth.require_authentication(global_options[:environment]) unless command[/^setup/]
|
14
|
-
|
15
|
-
|
14
|
+
names = command.split(":")
|
15
|
+
klass_name = "Zencoder::CLI::Command::#{names.map(&:camelize).join("::")}"
|
16
|
+
if klass_name.constant?
|
16
17
|
method_name = :run
|
17
|
-
|
18
|
+
klass = klass_name.constantize
|
18
19
|
else
|
19
|
-
method_name =
|
20
|
-
|
20
|
+
method_name = names.pop
|
21
|
+
klass = "Zencoder::CLI::Command::#{names.map(&:camelize).join("::")}".constantize
|
21
22
|
end
|
22
|
-
klass = "Zencoder::CLI::Command::#{klass_name}".constantize
|
23
23
|
if klass.respond_to?(method_name)
|
24
24
|
klass.send(method_name, args, global_options, command_options)
|
25
25
|
else
|
@@ -6,11 +6,15 @@ module Zencoder::CLI::Command
|
|
6
6
|
t.opt :number, "Number of jobs returned per page. Default 10.", :type => Integer
|
7
7
|
t.opt :page, "Jobs page number. Default 1.", :type => Integer
|
8
8
|
t.opt :long, "Will not truncate filenames.", :default => false
|
9
|
+
t.opt :state, "Filter the job list by job state", :type => String
|
9
10
|
}}
|
10
11
|
class << self
|
11
12
|
|
12
13
|
def run(args, global_options, command_options)
|
13
|
-
jobs = Zencoder::Job.list(:base_url => Zencoder.base_url(global_options[:environment]),
|
14
|
+
jobs = Zencoder::Job.list(:base_url => Zencoder.base_url(global_options[:environment]),
|
15
|
+
:per_page => command_options[:number] || 10,
|
16
|
+
:page => command_options[:page] || 1,
|
17
|
+
:state => command_options[:state].try(:downcase)).process_for_cli.body
|
14
18
|
if jobs.any?
|
15
19
|
jobs_table = table do |t|
|
16
20
|
t.headings = ["ID", "Created", "Filename", "Duration", "Size", "Test", "State"]
|
@@ -0,0 +1,14 @@
|
|
1
|
+
unless String.method_defined?(:constant?)
|
2
|
+
class String
|
3
|
+
def constant?
|
4
|
+
names = self.split('::')
|
5
|
+
names.shift if names.empty? || names.first.empty?
|
6
|
+
constant = Object
|
7
|
+
names.all? do |name|
|
8
|
+
constant = constant.const_get(name)
|
9
|
+
end
|
10
|
+
rescue NameError
|
11
|
+
false
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
data/lib/zencoder-cli/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zencoder-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 19
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 4
|
10
|
+
version: 0.1.4
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Brandon Arbini
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-11-
|
18
|
+
date: 2010-11-20 00:00:00 -06:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -26,12 +26,12 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - ~>
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
hash:
|
29
|
+
hash: 1
|
30
30
|
segments:
|
31
31
|
- 2
|
32
32
|
- 3
|
33
|
-
-
|
34
|
-
version: 2.3.
|
33
|
+
- 1
|
34
|
+
version: 2.3.1
|
35
35
|
type: :runtime
|
36
36
|
version_requirements: *id001
|
37
37
|
- !ruby/object:Gem::Dependency
|
@@ -85,6 +85,7 @@ files:
|
|
85
85
|
- lib/zencoder-cli/commands/outputs.rb
|
86
86
|
- lib/zencoder-cli/commands/plugins.rb
|
87
87
|
- lib/zencoder-cli/commands/setup.rb
|
88
|
+
- lib/zencoder-cli/extensions.rb
|
88
89
|
- lib/zencoder-cli/helpers.rb
|
89
90
|
- lib/zencoder-cli/plugin.rb
|
90
91
|
- lib/zencoder-cli/response.rb
|