merlin 0.1.5 → 0.1.6
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 +7 -0
- data/Rakefile +1 -1
- data/{app/models → lib}/merlin/configuration.rb +32 -7
- data/lib/merlin/version.rb +1 -1
- data/lib/merlin.rb +19 -3
- metadata +22 -60
- data/app/assets/javascripts/merlin/application.js +0 -15
- data/app/assets/stylesheets/merlin/application.css +0 -13
- data/app/controllers/merlin/application_controller.rb +0 -4
- data/app/helpers/merlin/application_helper.rb +0 -4
- data/app/views/layouts/merlin/application.html.erb +0 -14
- data/config/routes.rb +0 -2
- data/lib/merlin/engine.rb +0 -25
- data/lib/merlin/webmock.rb +0 -6
- data/lib/ostruct/deep.rb +0 -14
- data/lib/ostruct/extensions.rb +0 -2
- data/lib/ostruct/to_json.rb +0 -7
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 693debc958ce4d513f5fa407075ac12802629b28
|
4
|
+
data.tar.gz: 00cb8ab9c9f0c830879ed55fe666ce8bcd676485
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 6f4503fff50adc805680414d95883093859a5e99b6ea2a32bd3d17f757022513a50f488b192b9bfe149b442610e57fafb0d867be5c8797484b898dbf06719ff3
|
7
|
+
data.tar.gz: 35a383d3bd9463a9961daedbb04abfe711b885da9a907b8f7727401244cf9ceb0ea28761765520bd69c2fad85103f7533524898f46bb481003c3400ede7d056d
|
data/Rakefile
CHANGED
@@ -1,11 +1,37 @@
|
|
1
1
|
require 'yaml'
|
2
|
+
require 'faraday'
|
3
|
+
require 'faraday_middleware'
|
4
|
+
require 'deep_merge' unless {}.respond_to?(:deep_merge)
|
5
|
+
require 'ostruct'
|
6
|
+
require 'json'
|
7
|
+
require 'logger'
|
8
|
+
|
9
|
+
class OpenStruct
|
10
|
+
def to_json
|
11
|
+
table.to_json
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.deep(obj, freeze = false)
|
15
|
+
case obj
|
16
|
+
when Array
|
17
|
+
obj.map {|e| OpenStruct.deep(e, freeze)}
|
18
|
+
when Hash
|
19
|
+
OpenStruct.new(obj.each do |k,v|
|
20
|
+
obj[k] = OpenStruct.deep(v, freeze)
|
21
|
+
end)
|
22
|
+
else
|
23
|
+
obj
|
24
|
+
end.tap { |res| res.freeze if freeze }
|
25
|
+
end
|
26
|
+
end
|
2
27
|
|
3
28
|
module Merlin
|
4
29
|
class Configuration
|
5
30
|
attr_reader :raw
|
6
31
|
|
7
|
-
def initialize(config_file_path, environment =
|
32
|
+
def initialize(config_file_path, environment, logger = Logger.new(STDOUT), connection = nil)
|
8
33
|
@environment = environment
|
34
|
+
@logger = logger
|
9
35
|
@local_raw = from_file(config_file_path)
|
10
36
|
@remote_raw = merlin_server ? from_server(connection) : {}
|
11
37
|
@raw = @remote_raw.deep_merge(@local_raw)
|
@@ -45,10 +71,13 @@ module Merlin
|
|
45
71
|
end
|
46
72
|
|
47
73
|
def production_or_staging
|
48
|
-
["production", "staging"].include?(
|
74
|
+
["production", "staging"].include?(@environment)
|
49
75
|
end
|
50
76
|
|
51
77
|
def dump_config(config)
|
78
|
+
tmp_dir = "tmp"
|
79
|
+
dump_filepath = File.join(tmp_dir, "merlin_offline_dump.yml")
|
80
|
+
FileUtils.mkdir(tmp_dir) unless File.exist?(tmp_dir) && File.directory?(tmp_dir)
|
52
81
|
File.open(dump_filepath, "w") { |file| file.puts(YAML.dump(config)) }
|
53
82
|
end
|
54
83
|
|
@@ -59,14 +88,10 @@ module Merlin
|
|
59
88
|
|
60
89
|
def print_message(message)
|
61
90
|
merlin_message = "MERLIN: #{message}"
|
62
|
-
|
91
|
+
@logger.warn merlin_message
|
63
92
|
puts merlin_message
|
64
93
|
end
|
65
94
|
|
66
|
-
def dump_filepath
|
67
|
-
File.join(::Rails.root, "tmp", "merlin_offline_dump.yml")
|
68
|
-
end
|
69
|
-
|
70
95
|
def merlin_server
|
71
96
|
@local_raw['merlin']
|
72
97
|
end
|
data/lib/merlin/version.rb
CHANGED
data/lib/merlin.rb
CHANGED
@@ -1,8 +1,24 @@
|
|
1
|
-
require "merlin/
|
2
|
-
require "merlin/
|
1
|
+
require "merlin/configuration"
|
2
|
+
require "merlin/version"
|
3
3
|
|
4
4
|
module Merlin
|
5
|
+
|
5
6
|
def self.method_missing(*args, &block)
|
6
|
-
@
|
7
|
+
logger = @logger || Logger.new(STDOUT)
|
8
|
+
raise "Missing configuration path -> Merlin.config_path = '...'" unless @config_path
|
9
|
+
raise "Missing environment -> Merlin.env = :production" unless @env
|
10
|
+
Merlin::Configuration.new(@config_path, @env, logger).send(*args, &block)
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.config_path=(path)
|
14
|
+
@config_path = path
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.env=(env)
|
18
|
+
@env = env
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.logger=(logger)
|
22
|
+
@logger = logger
|
7
23
|
end
|
8
24
|
end
|
metadata
CHANGED
@@ -1,110 +1,83 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: merlin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
5
|
-
prerelease:
|
4
|
+
version: 0.1.6
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Artur Roszczyk
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2013-
|
11
|
+
date: 2013-06-14 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
|
-
- !ruby/object:Gem::Dependency
|
15
|
-
name: rails
|
16
|
-
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
|
-
requirements:
|
19
|
-
- - ~>
|
20
|
-
- !ruby/object:Gem::Version
|
21
|
-
version: 3.2.8
|
22
|
-
type: :runtime
|
23
|
-
prerelease: false
|
24
|
-
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
|
-
requirements:
|
27
|
-
- - ~>
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
version: 3.2.8
|
30
13
|
- !ruby/object:Gem::Dependency
|
31
14
|
name: faraday
|
32
15
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
16
|
requirements:
|
35
|
-
- -
|
17
|
+
- - '>='
|
36
18
|
- !ruby/object:Gem::Version
|
37
19
|
version: '0'
|
38
20
|
type: :runtime
|
39
21
|
prerelease: false
|
40
22
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
23
|
requirements:
|
43
|
-
- -
|
24
|
+
- - '>='
|
44
25
|
- !ruby/object:Gem::Version
|
45
26
|
version: '0'
|
46
27
|
- !ruby/object:Gem::Dependency
|
47
28
|
name: faraday_middleware
|
48
29
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
30
|
requirements:
|
51
|
-
- -
|
31
|
+
- - '>='
|
52
32
|
- !ruby/object:Gem::Version
|
53
33
|
version: '0'
|
54
34
|
type: :runtime
|
55
35
|
prerelease: false
|
56
36
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
37
|
requirements:
|
59
|
-
- -
|
38
|
+
- - '>='
|
60
39
|
- !ruby/object:Gem::Version
|
61
40
|
version: '0'
|
62
41
|
- !ruby/object:Gem::Dependency
|
63
|
-
name:
|
42
|
+
name: deep_merge
|
64
43
|
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
44
|
requirements:
|
67
|
-
- -
|
45
|
+
- - '>='
|
68
46
|
- !ruby/object:Gem::Version
|
69
47
|
version: '0'
|
70
|
-
type: :
|
48
|
+
type: :runtime
|
71
49
|
prerelease: false
|
72
50
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
51
|
requirements:
|
75
|
-
- -
|
52
|
+
- - '>='
|
76
53
|
- !ruby/object:Gem::Version
|
77
54
|
version: '0'
|
78
55
|
- !ruby/object:Gem::Dependency
|
79
|
-
name: rspec
|
56
|
+
name: rspec
|
80
57
|
requirement: !ruby/object:Gem::Requirement
|
81
|
-
none: false
|
82
58
|
requirements:
|
83
|
-
- -
|
59
|
+
- - '>='
|
84
60
|
- !ruby/object:Gem::Version
|
85
61
|
version: '0'
|
86
62
|
type: :development
|
87
63
|
prerelease: false
|
88
64
|
version_requirements: !ruby/object:Gem::Requirement
|
89
|
-
none: false
|
90
65
|
requirements:
|
91
|
-
- -
|
66
|
+
- - '>='
|
92
67
|
- !ruby/object:Gem::Version
|
93
68
|
version: '0'
|
94
69
|
- !ruby/object:Gem::Dependency
|
95
70
|
name: capybara
|
96
71
|
requirement: !ruby/object:Gem::Requirement
|
97
|
-
none: false
|
98
72
|
requirements:
|
99
|
-
- -
|
73
|
+
- - '>='
|
100
74
|
- !ruby/object:Gem::Version
|
101
75
|
version: '0'
|
102
76
|
type: :development
|
103
77
|
prerelease: false
|
104
78
|
version_requirements: !ruby/object:Gem::Requirement
|
105
|
-
none: false
|
106
79
|
requirements:
|
107
|
-
- -
|
80
|
+
- - '>='
|
108
81
|
- !ruby/object:Gem::Version
|
109
82
|
version: '0'
|
110
83
|
description: Client for merlin-server
|
@@ -114,46 +87,35 @@ executables: []
|
|
114
87
|
extensions: []
|
115
88
|
extra_rdoc_files: []
|
116
89
|
files:
|
117
|
-
-
|
118
|
-
- app/assets/stylesheets/merlin/application.css
|
119
|
-
- app/controllers/merlin/application_controller.rb
|
120
|
-
- app/helpers/merlin/application_helper.rb
|
121
|
-
- app/models/merlin/configuration.rb
|
122
|
-
- app/views/layouts/merlin/application.html.erb
|
123
|
-
- config/routes.rb
|
124
|
-
- lib/merlin/engine.rb
|
90
|
+
- lib/merlin/configuration.rb
|
125
91
|
- lib/merlin/version.rb
|
126
|
-
- lib/merlin/webmock.rb
|
127
92
|
- lib/merlin.rb
|
128
|
-
- lib/ostruct/deep.rb
|
129
|
-
- lib/ostruct/extensions.rb
|
130
|
-
- lib/ostruct/to_json.rb
|
131
93
|
- lib/tasks/merlin_tasks.rake
|
132
94
|
- MIT-LICENSE
|
133
95
|
- Rakefile
|
134
96
|
- README.md
|
135
97
|
homepage: http://github.com/sevos/merlin
|
136
98
|
licenses: []
|
99
|
+
metadata: {}
|
137
100
|
post_install_message:
|
138
101
|
rdoc_options: []
|
139
102
|
require_paths:
|
140
103
|
- lib
|
141
104
|
required_ruby_version: !ruby/object:Gem::Requirement
|
142
|
-
none: false
|
143
105
|
requirements:
|
144
|
-
- -
|
106
|
+
- - '>='
|
145
107
|
- !ruby/object:Gem::Version
|
146
108
|
version: '0'
|
147
109
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
148
|
-
none: false
|
149
110
|
requirements:
|
150
|
-
- -
|
111
|
+
- - '>='
|
151
112
|
- !ruby/object:Gem::Version
|
152
113
|
version: '0'
|
153
114
|
requirements: []
|
154
115
|
rubyforge_project:
|
155
|
-
rubygems_version:
|
116
|
+
rubygems_version: 2.0.3
|
156
117
|
signing_key:
|
157
|
-
specification_version:
|
118
|
+
specification_version: 4
|
158
119
|
summary: App configuration made simple
|
159
120
|
test_files: []
|
121
|
+
has_rdoc:
|
@@ -1,15 +0,0 @@
|
|
1
|
-
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
2
|
-
// listed below.
|
3
|
-
//
|
4
|
-
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
5
|
-
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
|
6
|
-
//
|
7
|
-
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
8
|
-
// the compiled file.
|
9
|
-
//
|
10
|
-
// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
|
11
|
-
// GO AFTER THE REQUIRES BELOW.
|
12
|
-
//
|
13
|
-
//= require jquery
|
14
|
-
//= require jquery_ujs
|
15
|
-
//= require_tree .
|
@@ -1,13 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
3
|
-
* listed below.
|
4
|
-
*
|
5
|
-
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
6
|
-
* or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
|
7
|
-
*
|
8
|
-
* You're free to add application-wide styles to this file and they'll appear at the top of the
|
9
|
-
* compiled file, but it's generally better to create a new file per style scope.
|
10
|
-
*
|
11
|
-
*= require_self
|
12
|
-
*= require_tree .
|
13
|
-
*/
|
@@ -1,14 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<title>Merlin</title>
|
5
|
-
<%= stylesheet_link_tag "merlin/application", :media => "all" %>
|
6
|
-
<%= javascript_include_tag "merlin/application" %>
|
7
|
-
<%= csrf_meta_tags %>
|
8
|
-
</head>
|
9
|
-
<body>
|
10
|
-
|
11
|
-
<%= yield %>
|
12
|
-
|
13
|
-
</body>
|
14
|
-
</html>
|
data/config/routes.rb
DELETED
data/lib/merlin/engine.rb
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
module Merlin
|
2
|
-
class Engine < ::Rails::Engine
|
3
|
-
isolate_namespace Merlin
|
4
|
-
|
5
|
-
require 'yaml'
|
6
|
-
require 'ostruct/extensions'
|
7
|
-
require 'faraday'
|
8
|
-
require 'faraday_middleware'
|
9
|
-
|
10
|
-
config.generators do |g|
|
11
|
-
g.test_framework :rspec, fixture: false, view_specs: false,
|
12
|
-
request_specs: false, routing_specs: false
|
13
|
-
g.template_engine false
|
14
|
-
g.stylesheets false
|
15
|
-
g.javascripts false
|
16
|
-
g.helper false
|
17
|
-
end
|
18
|
-
|
19
|
-
initializer 'merlin.load_config', :before => :load_config_initializers do |app|
|
20
|
-
Merlin.instance_eval do
|
21
|
-
@configuration = Merlin::Configuration.new(File.join(::Rails.root, 'config', 'merlin.yml'))
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
data/lib/merlin/webmock.rb
DELETED
data/lib/ostruct/deep.rb
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
require 'ostruct'
|
2
|
-
|
3
|
-
def OpenStruct.deep(obj, freeze = false)
|
4
|
-
case obj
|
5
|
-
when Array
|
6
|
-
obj.map {|e| OpenStruct.deep(e, freeze)}
|
7
|
-
when Hash
|
8
|
-
OpenStruct.new( obj.each do |k,v|
|
9
|
-
obj[k] = OpenStruct.deep(v, freeze)
|
10
|
-
end )
|
11
|
-
else
|
12
|
-
obj
|
13
|
-
end.tap { |res| res.freeze if freeze }
|
14
|
-
end
|
data/lib/ostruct/extensions.rb
DELETED