overlay 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/overlay/configuration.rb +1 -1
- data/lib/overlay/engine.rb +10 -0
- data/lib/overlay/github.rb +10 -5
- data/lib/overlay/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 13630f419fcc1df76230779d926555c3fe01fd45
|
4
|
+
data.tar.gz: 0da3f0f3557e2d3f72cca034d1851cc9b90f16d5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 64989fa6ca9e932e511db3c9e89c4b4af9a166a722ef8d120cf79ce9c3a392ccb39f73ebe08e0cd72b58b21f71dc449c77caeef0036033101ab5c71089559d7c
|
7
|
+
data.tar.gz: bd629bffc910ffc07ad4b787f2db45826e43b7ad60a155c063db8f01bf8c93e9a2f4f28da0f6c24d1166b29c272676d704222cf19ee0614435ed20d7f164c9da
|
data/lib/overlay/engine.rb
CHANGED
@@ -1,5 +1,15 @@
|
|
1
1
|
module Overlay
|
2
2
|
class Engine < ::Rails::Engine
|
3
3
|
isolate_namespace Overlay
|
4
|
+
|
5
|
+
config.after_initialize do
|
6
|
+
ActionController::Base.class_eval do
|
7
|
+
before_filter do
|
8
|
+
Overlay.configuration.repositories.each do |repo_config|
|
9
|
+
prepend_view_path repo_config[:root_dest_path]
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
4
14
|
end
|
5
15
|
end
|
data/lib/overlay/github.rb
CHANGED
@@ -54,7 +54,10 @@ module Overlay
|
|
54
54
|
def self.overlay_repo repo_config
|
55
55
|
# Get our root entries
|
56
56
|
#
|
57
|
-
|
57
|
+
root = repo_config[:root_source_path] || '/'
|
58
|
+
overlay_directory root, repo_config and return if root != '/'
|
59
|
+
|
60
|
+
root_entries = github_repo.contents.get(repo_config[:user], repo_config[:repo], root, ref: repo_config[:branch]).response.body
|
58
61
|
|
59
62
|
# We aren't pulling anything out of root. Cycle through directories and overlay
|
60
63
|
#
|
@@ -66,9 +69,10 @@ module Overlay
|
|
66
69
|
end
|
67
70
|
|
68
71
|
def self.overlay_directory path, repo_config
|
69
|
-
root_path = repo_config[:
|
72
|
+
root_path = repo_config[:root_dest_path].empty? ? "#{Rails.application.root}" : "#{Rails.application.root}/#{repo_config[:root_dest_path]}"
|
73
|
+
dynamic_path = path.partition(repo_config[:root_source_path]).last
|
70
74
|
|
71
|
-
FileUtils.mkdir_p "#{root_path}/#{
|
75
|
+
FileUtils.mkdir_p "#{root_path}/#{dynamic_path}"
|
72
76
|
directory_entries = github_repo.contents.get(repo_config[:user], repo_config[:repo], path, ref: repo_config[:branch]).response.body
|
73
77
|
|
74
78
|
directory_entries.each do |entry|
|
@@ -81,10 +85,11 @@ module Overlay
|
|
81
85
|
end
|
82
86
|
|
83
87
|
def self.clone_file path, repo_config
|
84
|
-
root_path = repo_config[:
|
88
|
+
root_path = repo_config[:root_dest_path].empty? ? "#{Rails.application.root}" : "#{Rails.application.root}/#{repo_config[:root_dest_path]}"
|
89
|
+
dynamic_path = path.partition(repo_config[:root_source_path]).last
|
85
90
|
|
86
91
|
file = github_repo.contents.get(repo_config[:user], repo_config[:repo], path, ref: repo_config[:branch]).response.body.content
|
87
|
-
File.open("#{root_path}/#{
|
92
|
+
File.open("#{root_path}/#{dynamic_path}", "wb") { |f| f.write(Base64.decode64(file)) }
|
88
93
|
end
|
89
94
|
|
90
95
|
private
|
data/lib/overlay/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: overlay
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Steve Saarinen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-06-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|