helioth 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +22 -0
- data/Rakefile +28 -0
- data/lib/helioth.rb +25 -0
- data/lib/helioth/action.rb +23 -0
- data/lib/helioth/controller_additions.rb +39 -0
- data/lib/helioth/controller_resource.rb +34 -0
- data/lib/helioth/dsl.rb +116 -0
- data/lib/helioth/feature.rb +40 -0
- data/lib/helioth/features.rb +15 -0
- data/lib/helioth/model_additions.rb +49 -0
- data/lib/helioth/relation.rb +27 -0
- data/lib/helioth/role.rb +19 -0
- data/lib/helioth/version.rb +3 -0
- data/spec/controller_additions_spec.rb +116 -0
- data/spec/dsl_spec.rb +142 -0
- data/spec/feature_spec.rb +49 -0
- data/spec/features_spec.rb +37 -0
- data/spec/fixtures/invalid_dsl.rb +3 -0
- data/spec/fixtures/valid_dsl.rb +48 -0
- data/spec/helioth_spec.rb +19 -0
- data/spec/model_additions_spec.rb +146 -0
- data/spec/relation_spec.rb +56 -0
- data/spec/role_spec.rb +31 -0
- data/spec/schema.rb +25 -0
- data/spec/spec_helper.rb +21 -0
- metadata +179 -0
@@ -0,0 +1,56 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Helioth::Relation do
|
4
|
+
|
5
|
+
before(:all) do
|
6
|
+
@relation = Helioth::Relation.new do
|
7
|
+
feature :disabled
|
8
|
+
|
9
|
+
feature :beta do
|
10
|
+
instance :beta
|
11
|
+
user :beta
|
12
|
+
end
|
13
|
+
|
14
|
+
feature :pre_release do
|
15
|
+
instance :beta, :standard
|
16
|
+
user :beta
|
17
|
+
end
|
18
|
+
|
19
|
+
feature :production do
|
20
|
+
instance :beta, :standard, :critical
|
21
|
+
user :beta, :standard
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
describe "@feature" do
|
27
|
+
it "should be a Hash" do
|
28
|
+
expect(@relation.instance_variable_get(:@feature)).to be_an_instance_of(Hash)
|
29
|
+
end
|
30
|
+
|
31
|
+
it "should contain all feature status as hash keys" do
|
32
|
+
expect(@relation.instance_variable_get(:@feature).keys).to contain_exactly(:beta, :pre_release, :production)
|
33
|
+
end
|
34
|
+
|
35
|
+
it "should contain for each keys a hash" do
|
36
|
+
@relation.instance_variable_get(:@feature).each{|k,v|
|
37
|
+
expect(v).to be_an_instance_of(Hash)
|
38
|
+
}
|
39
|
+
end
|
40
|
+
|
41
|
+
it "should contain for each keys a hash with :instance and :user keys" do
|
42
|
+
@relation.instance_variable_get(:@feature).each{|k,v|
|
43
|
+
expect(v.keys).to contain_exactly(:user, :instance)
|
44
|
+
}
|
45
|
+
end
|
46
|
+
|
47
|
+
it "should match all relations described in the DSL" do
|
48
|
+
expect(@relation.instance_variable_get(:@feature)[:beta][:instance]).to contain_exactly(:beta)
|
49
|
+
expect(@relation.instance_variable_get(:@feature)[:pre_release][:instance]).to contain_exactly(:beta, :standard)
|
50
|
+
expect(@relation.instance_variable_get(:@feature)[:production][:instance]).to contain_exactly(:beta, :standard, :critical)
|
51
|
+
expect(@relation.instance_variable_get(:@feature)[:beta][:user]).to contain_exactly(:beta)
|
52
|
+
expect(@relation.instance_variable_get(:@feature)[:pre_release][:user]).to contain_exactly(:beta)
|
53
|
+
expect(@relation.instance_variable_get(:@feature)[:production][:user]).to contain_exactly(:beta, :standard)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
data/spec/role_spec.rb
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Helioth::Role do
|
4
|
+
|
5
|
+
before(:all) do
|
6
|
+
@role = Helioth::Role.new do
|
7
|
+
user :beta, :standard
|
8
|
+
instance :beta, :standard, :critical
|
9
|
+
feature :disabled, :beta, :pre_release, :production
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
describe "#user" do
|
14
|
+
it "should find all user roles" do
|
15
|
+
expect(@role.user).to be == [:beta, :standard]
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
describe "#instance" do
|
20
|
+
it "should find all instance roles" do
|
21
|
+
expect(@role.instance).to be == [:beta, :standard, :critical]
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
describe "#feature" do
|
26
|
+
it "should find all feature roles" do
|
27
|
+
expect(@role.feature).to be == [:disabled, :beta, :pre_release, :production]
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
data/spec/schema.rb
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
ActiveRecord::Schema.define do
|
2
|
+
self.verbose = false
|
3
|
+
|
4
|
+
create_table :users, :force => true do |t|
|
5
|
+
t.string :role
|
6
|
+
t.references :instance
|
7
|
+
t.timestamps
|
8
|
+
end
|
9
|
+
|
10
|
+
create_table :instances, :force => true do |t|
|
11
|
+
t.string :role
|
12
|
+
t.timestamps
|
13
|
+
end
|
14
|
+
|
15
|
+
create_table :user2s, :force => true do |t|
|
16
|
+
t.string :status
|
17
|
+
t.references :instance2
|
18
|
+
t.timestamps
|
19
|
+
end
|
20
|
+
|
21
|
+
create_table :instance2s, :force => true do |t|
|
22
|
+
t.string :status
|
23
|
+
t.timestamps
|
24
|
+
end
|
25
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'coveralls'
|
2
|
+
Coveralls.wear!
|
3
|
+
|
4
|
+
require 'pry'
|
5
|
+
|
6
|
+
ENV["RAILS_ENV"] = "test"
|
7
|
+
require File.expand_path("../../test/dummy/config/environment.rb", __FILE__)
|
8
|
+
|
9
|
+
require 'active_record'
|
10
|
+
|
11
|
+
ActiveRecord::Base.establish_connection adapter: "sqlite3", database: ":memory:"
|
12
|
+
|
13
|
+
load File.dirname(__FILE__) + '/schema.rb'
|
14
|
+
|
15
|
+
I18n.available_locales = [:en]
|
16
|
+
|
17
|
+
RSpec.configure do |config|
|
18
|
+
config.expect_with :rspec do |c|
|
19
|
+
c.syntax = :expect
|
20
|
+
end
|
21
|
+
end
|
metadata
ADDED
@@ -0,0 +1,179 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: helioth
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Guillaume Montard
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-09-11 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: activerecord
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '3.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '3.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: i18n
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rails
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 4.1.5
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 4.1.5
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: sqlite3
|
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: pry
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rspec-rails
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 3.0.0
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 3.0.0
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: coveralls
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
description: Simple way to manage feature rollout / flipping
|
112
|
+
email:
|
113
|
+
- guillaume.montard@gmail.com
|
114
|
+
executables: []
|
115
|
+
extensions: []
|
116
|
+
extra_rdoc_files: []
|
117
|
+
files:
|
118
|
+
- MIT-LICENSE
|
119
|
+
- Rakefile
|
120
|
+
- lib/helioth.rb
|
121
|
+
- lib/helioth/action.rb
|
122
|
+
- lib/helioth/controller_additions.rb
|
123
|
+
- lib/helioth/controller_resource.rb
|
124
|
+
- lib/helioth/dsl.rb
|
125
|
+
- lib/helioth/feature.rb
|
126
|
+
- lib/helioth/features.rb
|
127
|
+
- lib/helioth/model_additions.rb
|
128
|
+
- lib/helioth/relation.rb
|
129
|
+
- lib/helioth/role.rb
|
130
|
+
- lib/helioth/version.rb
|
131
|
+
- spec/controller_additions_spec.rb
|
132
|
+
- spec/dsl_spec.rb
|
133
|
+
- spec/feature_spec.rb
|
134
|
+
- spec/features_spec.rb
|
135
|
+
- spec/fixtures/invalid_dsl.rb
|
136
|
+
- spec/fixtures/valid_dsl.rb
|
137
|
+
- spec/helioth_spec.rb
|
138
|
+
- spec/model_additions_spec.rb
|
139
|
+
- spec/relation_spec.rb
|
140
|
+
- spec/role_spec.rb
|
141
|
+
- spec/schema.rb
|
142
|
+
- spec/spec_helper.rb
|
143
|
+
homepage: https://github.com/gmontard/helioth
|
144
|
+
licenses:
|
145
|
+
- MIT
|
146
|
+
metadata: {}
|
147
|
+
post_install_message:
|
148
|
+
rdoc_options: []
|
149
|
+
require_paths:
|
150
|
+
- lib
|
151
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
152
|
+
requirements:
|
153
|
+
- - ">="
|
154
|
+
- !ruby/object:Gem::Version
|
155
|
+
version: '2.0'
|
156
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
157
|
+
requirements:
|
158
|
+
- - ">="
|
159
|
+
- !ruby/object:Gem::Version
|
160
|
+
version: '0'
|
161
|
+
requirements: []
|
162
|
+
rubyforge_project:
|
163
|
+
rubygems_version: 2.2.2
|
164
|
+
signing_key:
|
165
|
+
specification_version: 4
|
166
|
+
summary: Feature rollout and flipping
|
167
|
+
test_files:
|
168
|
+
- spec/controller_additions_spec.rb
|
169
|
+
- spec/dsl_spec.rb
|
170
|
+
- spec/feature_spec.rb
|
171
|
+
- spec/features_spec.rb
|
172
|
+
- spec/fixtures/invalid_dsl.rb
|
173
|
+
- spec/fixtures/valid_dsl.rb
|
174
|
+
- spec/helioth_spec.rb
|
175
|
+
- spec/model_additions_spec.rb
|
176
|
+
- spec/relation_spec.rb
|
177
|
+
- spec/role_spec.rb
|
178
|
+
- spec/schema.rb
|
179
|
+
- spec/spec_helper.rb
|