rack-remote-configuration 0.0.1 → 0.1.1
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/Gemfile.lock +20 -17
- data/LICENSE +1 -1
- data/README.md +22 -22
- data/lib/rack/remote-configuration.rb +13 -7
- data/lib/rack/remote-configuration/version.rb +7 -0
- data/rack-remote-configuration-0.1.0.gem +0 -0
- data/rack-remote-configuration.gemspec +22 -19
- metadata +48 -45
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7acbe80ccdf7cf70335adb5cb3ec7d69a5ad693c
|
4
|
+
data.tar.gz: 04d9efb8d40ce34f3ef2c0eedb22e03212c68ff2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8fa82bd2a82cc4db79d8436e4eed82e8488fcd77d973ff35ffa92112d1be246c3563bbcc0f64cdadb3a50b01d08a4c15f11becc541ef3b6704917f14d11294e8
|
7
|
+
data.tar.gz: 13741442cc08127842287e86abedc5e941986a36edfb9a739842184b92ae8192d23879b59052fd660d4743f1e48c667ded17360c7787eb1bd0dfae0783857983
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
rack-remote-configuration (0.
|
4
|
+
rack-remote-configuration (0.1.1)
|
5
5
|
json (~> 1.8)
|
6
6
|
plist (~> 3.1)
|
7
7
|
rack (~> 1.4)
|
@@ -11,16 +11,16 @@ PATH
|
|
11
11
|
GEM
|
12
12
|
remote: https://rubygems.org/
|
13
13
|
specs:
|
14
|
-
backports (3.
|
14
|
+
backports (3.15.0)
|
15
15
|
diff-lcs (1.2.4)
|
16
|
-
|
17
|
-
|
18
|
-
plist (3.
|
19
|
-
rack (1.
|
20
|
-
rack-protection (1.5.
|
16
|
+
json (1.8.6)
|
17
|
+
multi_json (1.13.1)
|
18
|
+
plist (3.5.0)
|
19
|
+
rack (1.6.11)
|
20
|
+
rack-protection (1.5.5)
|
21
21
|
rack
|
22
|
-
rack-test (
|
23
|
-
rack (>= 1.0)
|
22
|
+
rack-test (1.1.0)
|
23
|
+
rack (>= 1.0, < 3)
|
24
24
|
rake (10.0.4)
|
25
25
|
rspec (2.13.0)
|
26
26
|
rspec-core (~> 2.13.0)
|
@@ -30,18 +30,18 @@ GEM
|
|
30
30
|
rspec-expectations (2.13.0)
|
31
31
|
diff-lcs (>= 1.1.3, < 2.0)
|
32
32
|
rspec-mocks (2.13.1)
|
33
|
-
sinatra (1.4.
|
34
|
-
rack (~> 1.
|
33
|
+
sinatra (1.4.8)
|
34
|
+
rack (~> 1.5)
|
35
35
|
rack-protection (~> 1.4)
|
36
|
-
tilt (
|
37
|
-
sinatra-contrib (1.4.
|
36
|
+
tilt (>= 1.3, < 3)
|
37
|
+
sinatra-contrib (1.4.7)
|
38
38
|
backports (>= 2.0)
|
39
|
-
|
39
|
+
multi_json
|
40
40
|
rack-protection
|
41
41
|
rack-test
|
42
|
-
sinatra (~> 1.4.
|
43
|
-
tilt (
|
44
|
-
tilt (
|
42
|
+
sinatra (~> 1.4.0)
|
43
|
+
tilt (>= 1.3, < 3)
|
44
|
+
tilt (2.0.9)
|
45
45
|
|
46
46
|
PLATFORMS
|
47
47
|
ruby
|
@@ -50,3 +50,6 @@ DEPENDENCIES
|
|
50
50
|
rack-remote-configuration!
|
51
51
|
rake
|
52
52
|
rspec
|
53
|
+
|
54
|
+
BUNDLED WITH
|
55
|
+
2.0.1
|
data/LICENSE
CHANGED
data/README.md
CHANGED
@@ -1,10 +1,24 @@
|
|
1
|
-
Rack::RemoteConfiguration
|
2
|
-
|
1
|
+
# Rack::RemoteConfiguration
|
2
|
+
|
3
3
|
**Serve property list or JSON configuration files**
|
4
4
|
|
5
|
-
Although mobile and rich web clients consume resources from a server,
|
5
|
+
Although mobile and rich web clients consume resources from a server,
|
6
|
+
there may be some application details
|
7
|
+
that you'd like to coordinate outside of the resource structure of an API.
|
8
|
+
|
9
|
+
**Remote Configuration** is a great way to break out client-specific details
|
10
|
+
into a single, orthogonal endpoint,
|
11
|
+
such as [feature flags](http://code.flickr.com/blog/2009/12/02/flipping-out/),
|
12
|
+
impromptu [A/B tests](http://en.wikipedia.org/wiki/A/B_testing),
|
13
|
+
or a simple ["message of the day"](http://en.wikipedia.org/wiki/Motd_%28Unix%29)
|
14
|
+
|
15
|
+
## Installation
|
6
16
|
|
7
|
-
|
17
|
+
### Gemfile
|
18
|
+
|
19
|
+
````ruby
|
20
|
+
gem 'rack-remote-configuration', require: 'rack/remote-configuration'
|
21
|
+
```
|
8
22
|
|
9
23
|
## Usage
|
10
24
|
|
@@ -16,24 +30,13 @@ run Rack::RemoteConfiguration.new configuration: {
|
|
16
30
|
'Price' => 4.20,
|
17
31
|
'FeatureXIsLaunched' => true
|
18
32
|
}
|
19
|
-
|
33
|
+
````
|
20
34
|
|
21
35
|
### Parameters
|
22
36
|
|
23
37
|
- `configuration`: a `Hash`, or `File` or a `.json` or `.plist` file path with the specified configuration.
|
24
38
|
- `path`: the endpoint to serve the configuration, relative to the mount root of the application. _(defaults to `/configuration`)_
|
25
39
|
|
26
|
-
## iOS Client Integration
|
27
|
-
|
28
|
-
> [GroundControl](https://github.com/mattt/GroundControl) gives you a dead-simple way to remotely configure your app's [User Defaults](http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/NSUserDefaults_Class/).
|
29
|
-
|
30
|
-
```objective-c
|
31
|
-
NSURL *URL = [NSURL URLWithString:@"http://example.com/defaults.plist"];
|
32
|
-
[[NSUserDefaults standardUserDefaults] registerDefaultsWithURL:URL];
|
33
|
-
```
|
34
|
-
|
35
|
-
See the [GroundControl README](https://github.com/mattt/GroundControl/blob/master/README.md) for further guidance on installation & usage.
|
36
|
-
|
37
40
|
## Deployment
|
38
41
|
|
39
42
|
`Rack::RemoteConfiguration` can be deployed to Heroku with the following commands:
|
@@ -45,12 +48,9 @@ $ git push heroku master
|
|
45
48
|
|
46
49
|
## Contact
|
47
50
|
|
48
|
-
Mattt
|
49
|
-
|
50
|
-
- http://github.com/mattt
|
51
|
-
- http://twitter.com/mattt
|
52
|
-
- m@mattt.me
|
51
|
+
[Mattt](https://twitter.com/mattt)
|
53
52
|
|
54
53
|
## License
|
55
54
|
|
56
|
-
Rack::RemoteConfiguration is available under the MIT license.
|
55
|
+
Rack::RemoteConfiguration is available under the MIT license.
|
56
|
+
See the LICENSE file for more info.
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'rack'
|
2
4
|
require 'sinatra/base'
|
3
5
|
require 'sinatra/respond_with'
|
@@ -8,26 +10,30 @@ require 'plist'
|
|
8
10
|
module Rack
|
9
11
|
class RemoteConfiguration
|
10
12
|
def initialize(options = {})
|
11
|
-
raise ArgumentError,
|
13
|
+
raise ArgumentError, 'Missing required :configuration option' unless options[:configuration]
|
12
14
|
|
13
|
-
path = options[:path] ||
|
15
|
+
path = options[:path] || '/configuration'
|
14
16
|
configuration = case options[:configuration]
|
15
17
|
when Hash
|
16
18
|
options[:configuration]
|
17
19
|
when File
|
18
|
-
return new((
|
20
|
+
return new((begin
|
21
|
+
Plist.parse_xml(configuration.path) || JSON.parse(configuration.read)
|
22
|
+
rescue StandardError
|
23
|
+
nil
|
24
|
+
end))
|
19
25
|
when String
|
20
26
|
return new(File.open(configuration)) if File.exist?(configuration)
|
21
27
|
end
|
22
28
|
|
23
|
-
raise ArgumentError,
|
29
|
+
raise ArgumentError, 'Invalid configuration (expected Hash or either .json or .plist File or file path)' if configuration.nil?
|
24
30
|
|
25
31
|
begin
|
26
|
-
[
|
32
|
+
%i[to_json to_plist].each do |serialization|
|
27
33
|
configuration.send(serialization)
|
28
34
|
end
|
29
|
-
rescue NoMethodError =>
|
30
|
-
raise ArgumentError, "Serialization Error: #{
|
35
|
+
rescue NoMethodError => e
|
36
|
+
raise ArgumentError, "Serialization Error: #{e}"
|
31
37
|
end
|
32
38
|
|
33
39
|
@app = Class.new(Sinatra::Base) do
|
Binary file
|
@@ -1,27 +1,30 @@
|
|
1
|
-
#
|
2
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
$LOAD_PATH.push File.expand_path('lib', __dir__)
|
4
|
+
require 'rack/remote-configuration/version'
|
3
5
|
|
4
6
|
Gem::Specification.new do |s|
|
5
|
-
s.name =
|
6
|
-
s.authors = [
|
7
|
-
s.email =
|
8
|
-
s.
|
9
|
-
s.
|
7
|
+
s.name = 'rack-remote-configuration'
|
8
|
+
s.authors = ['Mattt']
|
9
|
+
s.email = 'mattt@me.com'
|
10
|
+
s.license = 'MIT'
|
11
|
+
s.homepage = 'https://mat.tt'
|
12
|
+
s.version = Rack::RemoteConfiguration::VERSION
|
10
13
|
s.platform = Gem::Platform::RUBY
|
11
|
-
s.summary =
|
12
|
-
s.description =
|
14
|
+
s.summary = 'Rack::RemoteConfiguration'
|
15
|
+
s.description = 'Serve property list or JSON configuration files.'
|
13
16
|
|
14
|
-
s.add_dependency
|
15
|
-
s.add_dependency
|
16
|
-
s.add_dependency
|
17
|
-
s.add_dependency
|
18
|
-
s.add_dependency
|
17
|
+
s.add_dependency 'json', '~> 1.8'
|
18
|
+
s.add_dependency 'plist', '~> 3.1'
|
19
|
+
s.add_dependency 'rack', '~> 1.4'
|
20
|
+
s.add_dependency 'sinatra', '~> 1.3'
|
21
|
+
s.add_dependency 'sinatra-contrib', '~> 1.4'
|
19
22
|
|
20
|
-
s.add_development_dependency
|
21
|
-
s.add_development_dependency
|
23
|
+
s.add_development_dependency 'rake'
|
24
|
+
s.add_development_dependency 'rspec'
|
22
25
|
|
23
|
-
s.files = Dir[
|
26
|
+
s.files = Dir['./**/*'].reject { |file| file =~ %r{\./(bin|example|log|pkg|script|spec|test|vendor)} }
|
24
27
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
25
|
-
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
26
|
-
s.require_paths = [
|
28
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
|
29
|
+
s.require_paths = ['lib']
|
27
30
|
end
|
metadata
CHANGED
@@ -1,128 +1,131 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rack-remote-configuration
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
- Mattt
|
7
|
+
- Mattt
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-07-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: json
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '1.
|
19
|
+
version: '1.8'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - ~>
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '1.
|
26
|
+
version: '1.8'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: plist
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - ~>
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '1
|
33
|
+
version: '3.1'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - ~>
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '1
|
40
|
+
version: '3.1'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: rack
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - ~>
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '1.4'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - ~>
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '1.4'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: sinatra
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - ~>
|
59
|
+
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '1.
|
61
|
+
version: '1.3'
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - ~>
|
66
|
+
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '1.
|
68
|
+
version: '1.3'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
70
|
+
name: sinatra-contrib
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - ~>
|
73
|
+
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '
|
75
|
+
version: '1.4'
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- - ~>
|
80
|
+
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: '
|
82
|
+
version: '1.4'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
84
|
+
name: rake
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- -
|
87
|
+
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '0'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- -
|
94
|
+
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
|
-
name:
|
98
|
+
name: rspec
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- -
|
101
|
+
- - ">="
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
version: '0'
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- -
|
108
|
+
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
111
|
description: Serve property list or JSON configuration files.
|
112
|
-
email:
|
112
|
+
email: mattt@me.com
|
113
113
|
executables: []
|
114
114
|
extensions: []
|
115
115
|
extra_rdoc_files: []
|
116
116
|
files:
|
117
|
-
- ./Gemfile
|
118
|
-
- ./Gemfile.lock
|
119
|
-
- ./
|
120
|
-
- ./
|
121
|
-
- ./
|
122
|
-
- ./
|
123
|
-
- ./
|
124
|
-
|
125
|
-
|
117
|
+
- "./Gemfile"
|
118
|
+
- "./Gemfile.lock"
|
119
|
+
- "./LICENSE"
|
120
|
+
- "./README.md"
|
121
|
+
- "./Rakefile"
|
122
|
+
- "./lib/rack/remote-configuration.rb"
|
123
|
+
- "./lib/rack/remote-configuration/version.rb"
|
124
|
+
- "./rack-remote-configuration-0.1.0.gem"
|
125
|
+
- "./rack-remote-configuration.gemspec"
|
126
|
+
homepage: https://mat.tt
|
127
|
+
licenses:
|
128
|
+
- MIT
|
126
129
|
metadata: {}
|
127
130
|
post_install_message:
|
128
131
|
rdoc_options: []
|
@@ -130,17 +133,17 @@ require_paths:
|
|
130
133
|
- lib
|
131
134
|
required_ruby_version: !ruby/object:Gem::Requirement
|
132
135
|
requirements:
|
133
|
-
- -
|
136
|
+
- - ">="
|
134
137
|
- !ruby/object:Gem::Version
|
135
138
|
version: '0'
|
136
139
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
137
140
|
requirements:
|
138
|
-
- -
|
141
|
+
- - ">="
|
139
142
|
- !ruby/object:Gem::Version
|
140
143
|
version: '0'
|
141
144
|
requirements: []
|
142
145
|
rubyforge_project:
|
143
|
-
rubygems_version: 2.
|
146
|
+
rubygems_version: 2.6.14
|
144
147
|
signing_key:
|
145
148
|
specification_version: 4
|
146
149
|
summary: Rack::RemoteConfiguration
|