roku 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +29 -0
- data/Rakefile +1 -0
- data/bin/roku +5 -0
- data/lib/roku.rb +48 -0
- data/lib/roku/config.rb +41 -0
- data/lib/roku/exception.rb +7 -0
- data/lib/roku/version.rb +3 -0
- data/lib/roku/zip.rb +45 -0
- data/roku.gemspec +28 -0
- metadata +127 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: f907f79c82881fb79baaf6ea402696daf5279ac3
|
4
|
+
data.tar.gz: bb2c02192e9b199e9271494e03b6eddc09ed9c01
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 451903448a40d429c3ca9940975884d6242a18ec8eddd7210b6387c8bac7672b2e39aadbd46949baf07e5dc2260ef340ebdb34808c4dd661293e074453d97b72
|
7
|
+
data.tar.gz: 0b6ca39b5a8b446b71914e0df6afee35858fd57383647972fdb5733efe2c37f8eded7fe5cff2e8b7679d4f6a78267f4d73d0bab4229503191f0b9a873dce515d
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2015 Stephen Baldwin
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# Roku
|
2
|
+
|
3
|
+
TODO: Write a gem description
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'roku'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install roku
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
TODO: Write usage instructions here
|
22
|
+
|
23
|
+
## Contributing
|
24
|
+
|
25
|
+
1. Fork it ( http://github.com/<my-github-username>/roku/fork )
|
26
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
27
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
28
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
29
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/bin/roku
ADDED
data/lib/roku.rb
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
require "roku/version"
|
2
|
+
require "roku/config"
|
3
|
+
require 'mechanize'
|
4
|
+
require 'fileutils'
|
5
|
+
require 'pry'
|
6
|
+
|
7
|
+
module Roku
|
8
|
+
autoload :Zip, "roku/zip"
|
9
|
+
autoload :Exception, "roku/exception"
|
10
|
+
|
11
|
+
extend Config, self
|
12
|
+
|
13
|
+
ensure_config!
|
14
|
+
|
15
|
+
def run
|
16
|
+
build
|
17
|
+
deploy
|
18
|
+
end
|
19
|
+
|
20
|
+
def build
|
21
|
+
puts "Build started."
|
22
|
+
|
23
|
+
FileUtils.rm build_output if File.exists? build_output
|
24
|
+
Zip.generate directory, build_output
|
25
|
+
|
26
|
+
puts "Build complete! Build available at #{build_output}"
|
27
|
+
end
|
28
|
+
|
29
|
+
def deploy
|
30
|
+
raise Exception::NotBuilt, "No build found at #{build_output}" unless File.exists? build_output
|
31
|
+
|
32
|
+
puts "Deployment started."
|
33
|
+
|
34
|
+
mount = "http://#{config['ip']}"
|
35
|
+
|
36
|
+
agent = Mechanize.new
|
37
|
+
agent.add_auth mount, config['username'], config['password']
|
38
|
+
agent.get mount # Roku does not respond unless the page has been viewed first
|
39
|
+
|
40
|
+
agent.post "#{mount}/plugin_install", {
|
41
|
+
archive: File.new(build_output),
|
42
|
+
mysubmit: "Replace"
|
43
|
+
}
|
44
|
+
|
45
|
+
puts "Deployment complete."
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
data/lib/roku/config.rb
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
# This concern is abstracted only for readability within roku.rb
|
2
|
+
require 'yaml'
|
3
|
+
require 'tmpdir'
|
4
|
+
|
5
|
+
module Roku
|
6
|
+
module Config
|
7
|
+
|
8
|
+
def ensure_config!
|
9
|
+
config # TODO: Clean up
|
10
|
+
end
|
11
|
+
|
12
|
+
private
|
13
|
+
|
14
|
+
def config
|
15
|
+
(@config ||= fetch_config).tap do |config|
|
16
|
+
@directory = config['directory'] if config['directory']
|
17
|
+
end
|
18
|
+
rescue Errno::ENOENT
|
19
|
+
raise Exception::NotConfigured, "Please configure gem. See https://github.com/stephenbaldwin/roku#configuration for more information"
|
20
|
+
end
|
21
|
+
|
22
|
+
def directory
|
23
|
+
@directory ||= dir_cmd
|
24
|
+
end
|
25
|
+
|
26
|
+
def dir_cmd
|
27
|
+
Dir.pwd # TODO: Check Windows compatibility of Dir.pwd VS File.expand_path File.dirname(__FILE__)
|
28
|
+
end
|
29
|
+
|
30
|
+
def build_output
|
31
|
+
@build_output ||= "#{Dir.tmpdir}/roku.zip" # TODO: Check Windows compatibility
|
32
|
+
end
|
33
|
+
|
34
|
+
def fetch_config
|
35
|
+
YAML.load_file(dir_cmd + '/roku.yml')
|
36
|
+
rescue Errno::ENOENT
|
37
|
+
YAML.load_file(ENV['HOME'] + '/roku.yml')
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
41
|
+
end
|
data/lib/roku/version.rb
ADDED
data/lib/roku/zip.rb
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
# This example is pulled straight from https://github.com/rubyzip/rubyzip/blob/master/samples/example_recursive.rb
|
2
|
+
# With the exception of a minor class method addition on line 8
|
3
|
+
require 'zip'
|
4
|
+
|
5
|
+
module Roku
|
6
|
+
class Zip
|
7
|
+
|
8
|
+
def self.generate(input, output); new(input, output).write; end
|
9
|
+
|
10
|
+
# Initialize with the directory to zip and the location of the output archive.
|
11
|
+
def initialize(inputDir, outputFile)
|
12
|
+
@inputDir = inputDir
|
13
|
+
@outputFile = outputFile
|
14
|
+
end
|
15
|
+
|
16
|
+
# Zip the input directory.
|
17
|
+
def write
|
18
|
+
entries = Dir.entries(@inputDir); entries.delete("."); entries.delete("..")
|
19
|
+
io = ::Zip::File.open(@outputFile, ::Zip::File::CREATE);
|
20
|
+
|
21
|
+
writeEntries(entries, "", io)
|
22
|
+
io.close;
|
23
|
+
end
|
24
|
+
|
25
|
+
# A helper method to make the recursion work.
|
26
|
+
private
|
27
|
+
def writeEntries(entries, path, io)
|
28
|
+
|
29
|
+
entries.each { |e|
|
30
|
+
zipFilePath = path == "" ? e : ::File.join(path, e)
|
31
|
+
diskFilePath = ::File.join(@inputDir, zipFilePath)
|
32
|
+
puts "Deflating " + diskFilePath
|
33
|
+
if File.directory?(diskFilePath)
|
34
|
+
io.mkdir(zipFilePath)
|
35
|
+
subdir = Dir.entries(diskFilePath); subdir.delete("."); subdir.delete("..")
|
36
|
+
writeEntries(subdir, zipFilePath, io)
|
37
|
+
else
|
38
|
+
io.get_output_stream(zipFilePath) { |f| f.puts(File.open(diskFilePath, "rb").read())}
|
39
|
+
end
|
40
|
+
}
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
data/roku.gemspec
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'roku/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "roku"
|
8
|
+
spec.version = Roku::VERSION
|
9
|
+
spec.authors = ["Stephen Baldwin"]
|
10
|
+
spec.email = ["stephenbaldwin@me.com"]
|
11
|
+
spec.summary = %q{Roku Dev Tools}
|
12
|
+
spec.description = %q{Roku Dev Tools in ruby}
|
13
|
+
spec.homepage = ""
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_dependency "rubyzip"
|
22
|
+
|
23
|
+
spec.add_development_dependency "bundler", "~> 1.5"
|
24
|
+
spec.add_development_dependency "rake"
|
25
|
+
spec.add_development_dependency "pry"
|
26
|
+
|
27
|
+
spec.add_dependency 'mechanize'
|
28
|
+
end
|
metadata
ADDED
@@ -0,0 +1,127 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: roku
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Stephen Baldwin
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-06-28 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rubyzip
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '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'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.5'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.5'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '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: mechanize
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
description: Roku Dev Tools in ruby
|
84
|
+
email:
|
85
|
+
- stephenbaldwin@me.com
|
86
|
+
executables:
|
87
|
+
- roku
|
88
|
+
extensions: []
|
89
|
+
extra_rdoc_files: []
|
90
|
+
files:
|
91
|
+
- ".gitignore"
|
92
|
+
- Gemfile
|
93
|
+
- LICENSE.txt
|
94
|
+
- README.md
|
95
|
+
- Rakefile
|
96
|
+
- bin/roku
|
97
|
+
- lib/roku.rb
|
98
|
+
- lib/roku/config.rb
|
99
|
+
- lib/roku/exception.rb
|
100
|
+
- lib/roku/version.rb
|
101
|
+
- lib/roku/zip.rb
|
102
|
+
- roku.gemspec
|
103
|
+
homepage: ''
|
104
|
+
licenses:
|
105
|
+
- MIT
|
106
|
+
metadata: {}
|
107
|
+
post_install_message:
|
108
|
+
rdoc_options: []
|
109
|
+
require_paths:
|
110
|
+
- lib
|
111
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
112
|
+
requirements:
|
113
|
+
- - ">="
|
114
|
+
- !ruby/object:Gem::Version
|
115
|
+
version: '0'
|
116
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
117
|
+
requirements:
|
118
|
+
- - ">="
|
119
|
+
- !ruby/object:Gem::Version
|
120
|
+
version: '0'
|
121
|
+
requirements: []
|
122
|
+
rubyforge_project:
|
123
|
+
rubygems_version: 2.2.2
|
124
|
+
signing_key:
|
125
|
+
specification_version: 4
|
126
|
+
summary: Roku Dev Tools
|
127
|
+
test_files: []
|