hardcode 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.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/hardcode/cli.rb +12 -11
- data/lib/hardcode/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 921bda9f1b321ac30529bc4558dc90df4fe1864d
|
4
|
+
data.tar.gz: 062807c88672714e6b54d252b617d70946adc1da
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7d0ae056e91181112d239e4cc79b0b228e1587130c3cb2e217dd6c5548a7df962641a0bc5c2ccca11b5abcaac1e5bb705f07b108a9e28791429ee35ff9d4ec0d
|
7
|
+
data.tar.gz: 1f5ad1544082b1960e428176ae73f45c347aef1fba006a9e55eba12d5758cb7aa089004efa3bcd893dc6e1a8e66cbc61a285933f29dcc303609d864408106b63
|
data/README.md
CHANGED
@@ -20,7 +20,7 @@ run `harcode help` for instructions
|
|
20
20
|
|
21
21
|
### Example: Enqueue Encoding Jobs to RabbitMQ
|
22
22
|
|
23
|
-
Scan a directory for multimedia
|
23
|
+
Scan a directory for multimedia files, move them to the tmp directory and enqueue transcoding jobs if needed:
|
24
24
|
|
25
25
|
```bash
|
26
26
|
hardcode enqueue /home/media/import --destination /var/www/videos
|
data/lib/hardcode/cli.rb
CHANGED
@@ -25,17 +25,21 @@ module Hardcode
|
|
25
25
|
package_name "hardcode"
|
26
26
|
map %w(-v --version) => :version
|
27
27
|
|
28
|
+
class_option :amqp_url,
|
29
|
+
desc: "AMQP URL",
|
30
|
+
default: ENV['AMQP_URL'] ||'amqp://guest:guest@localhost:5672'
|
31
|
+
|
28
32
|
desc "version", "Outputs the version number"
|
29
33
|
def version
|
30
34
|
say "hardcode v#{Hardcode::VERSION}"
|
31
35
|
end
|
32
36
|
|
33
37
|
desc "enqueue DIR", "Scans a source directory, moves the files to tmp and enqueues transcoding jobs to rabbitmq"
|
34
|
-
|
38
|
+
method_option :destination,
|
35
39
|
desc: "destination directory",
|
36
40
|
aliases: '-d',
|
37
41
|
default: '/var/www/'
|
38
|
-
|
42
|
+
method_option :tmp_dir,
|
39
43
|
desc: "temporary directory",
|
40
44
|
aliases: '-t',
|
41
45
|
default: '/tmp'
|
@@ -49,7 +53,7 @@ module Hardcode
|
|
49
53
|
|
50
54
|
begin
|
51
55
|
FileUtils.touch LOCK_FILE
|
52
|
-
conn = Bunny.new
|
56
|
+
conn = Bunny.new(options[:amqp_url])
|
53
57
|
conn.start
|
54
58
|
ch = conn.create_channel
|
55
59
|
q = ch.queue('stack_encode', durable: true)
|
@@ -76,15 +80,12 @@ module Hardcode
|
|
76
80
|
end
|
77
81
|
|
78
82
|
desc "work", "Start the sneakers based workers"
|
79
|
-
|
80
|
-
desc: "AMPQ URL",
|
81
|
-
default: 'amqp://guest:guest@localhost:5672'
|
82
|
-
option :debug,
|
83
|
+
method_option :debug,
|
83
84
|
desc: "Enable debug output",
|
84
85
|
type: :boolean
|
85
86
|
def work
|
86
87
|
Sneakers.configure(
|
87
|
-
amqp: options[:
|
88
|
+
amqp: options[:amqp_url],
|
88
89
|
daemonize: false,
|
89
90
|
log: STDOUT,
|
90
91
|
metrics: Sneakers::Metrics::LoggingMetrics.new
|
@@ -95,17 +96,17 @@ module Hardcode
|
|
95
96
|
end
|
96
97
|
|
97
98
|
desc "watch DIR", "Watch a source directory for new files, moves the files to tmp and enqueues transcoding jobs to rabbitmq"
|
98
|
-
|
99
|
+
method_option :destination,
|
99
100
|
desc: "destination directory",
|
100
101
|
aliases: '-d',
|
101
102
|
default: '/var/www/'
|
102
|
-
|
103
|
+
method_option :tmp_dir,
|
103
104
|
desc: "temporary directory",
|
104
105
|
aliases: '-t',
|
105
106
|
default: '/tmp'
|
106
107
|
def watch(source_dir)
|
107
108
|
FileUtils.touch LOCK_FILE
|
108
|
-
conn = Bunny.new
|
109
|
+
conn = Bunny.new(options[:amqp_url])
|
109
110
|
conn.start
|
110
111
|
ch = conn.create_channel
|
111
112
|
q = ch.queue('stack_encode', durable: true)
|
data/lib/hardcode/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hardcode
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- niwo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-12-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -162,7 +162,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
162
162
|
version: '0'
|
163
163
|
requirements: []
|
164
164
|
rubyforge_project:
|
165
|
-
rubygems_version: 2.
|
165
|
+
rubygems_version: 2.2.2
|
166
166
|
signing_key:
|
167
167
|
specification_version: 4
|
168
168
|
summary: stack-encode on steroids (using a rabbitmq worker queue)
|