green_flag 0.1.2 → 0.2.0

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: f12a08a6b744c18fb705f7356a78ac0f692a6d1e
4
- data.tar.gz: c3b66b1ade6c2d4ff6bedbe5f06987619f64c1d6
3
+ metadata.gz: 366ef4d077f8895abd6f88ffd0f1701804380153
4
+ data.tar.gz: f2f7f937a13d53f4d0f7307ac96b364caf75c3d7
5
5
  SHA512:
6
- metadata.gz: 57a139c4c7e59e024102cc74393b0432dd8efcb83f371a02179659d61b5bb9a85384ff83ad1b7d550faa5cf7d9e0f0b6377f9ccab9dcdfb2ab3760b956ed9565
7
- data.tar.gz: dc1ff913fd24537eb19d7da71ce78483d56bf5678b6fc92d669d82385767b55369d2bfcdb8197b0e292e4d9bb83b8e1c81ae4da4a49e5c1a2625136b2d96841a
6
+ metadata.gz: a267fc407e2a75453e3ecb8434d113ba8c692d767ff71dfa9d30ce29b5207e9b97e8724c72105b9efa295d8135b6b05f48aa8b75bd286af292c27383630a063b
7
+ data.tar.gz: 8e3da9d2345fdbb2574245d8d5e34b6def57605dad8e90bfabf4fa17ab4096f3ba5d0ed9f68cbc878d263403b4f1f8598b3594bbfee7461e4e8e68fb9fb6fa95
data/.codeclimate.yml ADDED
@@ -0,0 +1,50 @@
1
+ # This is a sample .codeclimate.yml configured for Engine analysis on Code
2
+ # Climate Platform. For an overview of the Code Climate Platform, see here:
3
+ # http://docs.codeclimate.com/article/300-the-codeclimate-platform
4
+
5
+ # Under the engines key, you can configure which engines will analyze your repo.
6
+ # Each key is an engine name. For each value, you need to specify enabled: true
7
+ # to enable the engine as well as any other engines-specific configuration.
8
+
9
+ # For more details, see here:
10
+ # http://docs.codeclimate.com/article/289-configuring-your-repository-via-codeclimate-yml#platform
11
+
12
+ # For a list of all available engines, see here:
13
+ # http://docs.codeclimate.com/article/296-engines-available-engines
14
+
15
+ engines:
16
+ # to turn on an engine, add it here and set enabled to `true`
17
+ # to turn off an engine, set enabled to `false` or remove it
18
+ rubocop:
19
+ enabled: true
20
+ golint:
21
+ enabled: false
22
+ gofmt:
23
+ enabled: false
24
+ eslint:
25
+ enabled: true
26
+ csslint:
27
+ enabled: true
28
+
29
+ # Engines can analyze files and report issues on them, but you can separately
30
+ # decide which files will receive ratings based on those issues. This is
31
+ # specified by path patterns under the ratings key.
32
+
33
+ # For more details see here:
34
+ # http://docs.codeclimate.com/article/289-configuring-your-repository-via-codeclimate-yml#platform
35
+
36
+ # Note: If the ratings key is not specified, this will result in a 0.0 GPA on your dashboard.
37
+
38
+ # ratings:
39
+ # paths:
40
+ # - app/**
41
+ # - lib/**
42
+ # - "**.rb"
43
+ # - "**.go"
44
+
45
+ # You can globally exclude files from being analyzed by any engine using the
46
+ # exclude_paths key.
47
+
48
+ #exclude_paths:
49
+ #- spec/**/*
50
+ #- vendor/**/*
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- green_flag (0.1.1)
4
+ green_flag (0.2.0)
5
5
  activerecord-concurrent-index
6
6
  pg
7
7
  rails (~> 3.2)
@@ -54,6 +54,7 @@ GEM
54
54
  factory_girl_rails (4.1.0)
55
55
  factory_girl (~> 4.1.0)
56
56
  railties (>= 3.0.0)
57
+ gem-release (0.7.4)
57
58
  hike (1.2.3)
58
59
  i18n (0.7.0)
59
60
  journey (1.0.4)
@@ -133,6 +134,10 @@ PLATFORMS
133
134
  DEPENDENCIES
134
135
  capybara
135
136
  factory_girl_rails
137
+ gem-release
136
138
  green_flag!
137
139
  jquery-rails
138
140
  rspec-rails
141
+
142
+ BUNDLED WITH
143
+ 1.10.6
@@ -16,6 +16,10 @@
16
16
  white-space: nowrap;
17
17
  }
18
18
 
19
+ .well {
20
+ margin-top: 5px;
21
+ }
22
+
19
23
  ul.decisions-made-summary {
20
24
 
21
25
  padding: 0;
@@ -3,7 +3,7 @@ class GreenFlag::Admin::FeaturesController < ApplicationController
3
3
  layout 'green_flag/application'
4
4
 
5
5
  def index
6
- @features = GreenFlag::Feature.all
6
+ @features = GreenFlag::Feature.order(:created_at).all
7
7
  end
8
8
 
9
9
  def show
@@ -53,6 +53,14 @@ class GreenFlag::Feature < ActiveRecord::Base
53
53
 
54
54
  last_rule.present? ? last_rule.version_number : version_number
55
55
  end
56
+
57
+ def fully_enabled?
58
+ rules.count > 0 && rules.all? { |rule| rule.percentage == 100 }
59
+ end
60
+
61
+ def fully_disabled?
62
+ rules.count == 0 || rules.all? { |rule| rule.percentage == 0 }
63
+ end
56
64
 
57
65
  private
58
66
 
@@ -6,8 +6,19 @@
6
6
  <div class="row">
7
7
  <% @features.each do |feature| %>
8
8
  <div class="col-md-6">
9
- <h4><%= link_to feature.code, admin_feature_path(feature) %></h4>
10
- <p><%= feature.description %></p>
9
+ <div class="well">
10
+ <h4>
11
+ <%= link_to feature.code, admin_feature_path(feature) %>
12
+ <% if feature.fully_enabled? %><span class="label label-success">100%</span><% end %>
13
+ <% if feature.fully_disabled? %><span class="label label-danger">0%</span><% end %>
14
+ </h4>
15
+
16
+ <div class="help-block">
17
+ <div>Created on <strong><%= feature.created_at.strftime("%d %b %Y") %></strong></div>
18
+ </div>
19
+
20
+ <p><%= feature.description %></p>
21
+ </div>
11
22
  </div>
12
23
  <% end %>
13
24
 
data/green_flag.gemspec CHANGED
@@ -7,7 +7,7 @@ require "green_flag/version"
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "green_flag"
9
9
  s.version = GreenFlag::VERSION
10
- s.authors = ["Tim Morton"]
10
+ s.authors = ["Tim Morton", "Jason Nappier", "Adeel Raza"]
11
11
  s.email = ["tim@timothymorton.com"]
12
12
  s.homepage = "https://github.com/websdotcom/green_flag"
13
13
  s.summary = "A feature-flag system."
@@ -31,4 +31,5 @@ Gem::Specification.new do |s|
31
31
  s.add_development_dependency 'rspec-rails'
32
32
  s.add_development_dependency 'factory_girl_rails'
33
33
  s.add_development_dependency 'capybara'
34
+ s.add_development_dependency 'gem-release'
34
35
  end
@@ -1,3 +1,3 @@
1
1
  module GreenFlag
2
- VERSION = "0.1.2"
2
+ VERSION = "0.2.0"
3
3
  end
@@ -0,0 +1,14 @@
1
+ GreenFlag::VisitorGroup.define do
2
+
3
+ # Basic Groups
4
+ group "Everyone", "This is everyone!" do
5
+ true
6
+ end
7
+ group "New visitors", "These are visitors who have never logged in. (This does not include users who have signed out)" do |site_visitor|
8
+ !site_visitor.user
9
+ end
10
+ group "Pre-existing Visitors", "Visitors that were created before this feature was deployed. They might have seen the old version." do |visitor, rule|
11
+ visitor.first_visited_at < rule.created_at
12
+ end
13
+
14
+ end