arethusa-cli 0.0.8 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 11fcf19408f38b511c33177560caae15e237f36f
4
- data.tar.gz: b167c4e8f49a6519b7b2becac5f17ba22f150a54
3
+ metadata.gz: 9ac1bc40b8ef2ef392ada7d3fe4a674e2d568581
4
+ data.tar.gz: 9c7917a91dd38ca053b7fd5923f78c6e6abf971f
5
5
  SHA512:
6
- metadata.gz: a9ff6b90537de8daca6860d0f818858682738cd1fadaa1f183d59314d3db98f4f7a940f1f9fb9a1fad7aa331e16915eb33fd4ad788574bd502ed0800dc8aabd2
7
- data.tar.gz: 3309e0d573736ead9ed4011aae20c099967be683a7895afd5564504579aac8bc74c8decec91face04788adf0f1a1383f0921b618091978d2ea92a4fc6958c3a3
6
+ metadata.gz: e78620b35260072614306ad5e1bef3b203e317b5bdd005bd9ac812ef665b2a975c58ac5808ee4f3b61826b8f542eac1ccccf6c7141ed8ef09673b7be28e53b75
7
+ data.tar.gz: dfa9d3b5fd584b6072cd5f319d53541d7222e4fb0009250d0d2b2ed30858e3de4ba3ae73d00b493545e0c3d9c351ac0d06715493c6358982069d4f19681e3c5d
data/lib/arethusa/cli.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  require 'thor'
2
+ require 'json'
2
3
 
3
4
  module Arethusa
4
5
  class CLI < Thor
@@ -59,6 +60,14 @@ EOF
59
60
  say_status(:deployed, "at #{@address} - #{@directory}")
60
61
  end
61
62
 
63
+ desc 'merge FILE', 'Merge Arethusa configuration files'
64
+ def merge(file)
65
+ @conf = read_conf(file)
66
+ traverse_and_include(@conf)
67
+
68
+ puts JSON.pretty_generate(@conf, indent: ' ')
69
+ end
70
+
62
71
  no_commands do
63
72
  def minify
64
73
  if `grunt minify:css minify`
@@ -130,6 +139,35 @@ EOF
130
139
  def commit_sha
131
140
  `git rev-parse --short HEAD`.strip
132
141
  end
142
+
143
+ # methods for merging
144
+ def app_dir
145
+ "app"
146
+ end
147
+
148
+ def traverse_and_include(conf)
149
+ inside app_dir do
150
+ traverse(conf)
151
+ end
152
+ end
153
+
154
+ def traverse(conf)
155
+ clone = conf.clone
156
+ clone.each do |key, value|
157
+ if value.is_a?(Hash)
158
+ traverse(conf[key])
159
+ elsif key == 'fileUrl'
160
+ additional_conf = read_conf(value)
161
+ conf.delete(key)
162
+ conf.merge!(additional_conf)
163
+ traverse(additional_conf)
164
+ end
165
+ end
166
+ end
167
+
168
+ def read_conf(path)
169
+ JSON.parse(File.read(path))
170
+ end
133
171
  end
134
172
  end
135
173
  end
@@ -1,5 +1,5 @@
1
1
  module Arethusa
2
2
  class CLI
3
- VERSION = "0.0.8"
3
+ VERSION = "0.0.9"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: arethusa-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - LFDM
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-26 00:00:00.000000000 Z
11
+ date: 2014-08-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler