featureomatic 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: cc4d45fbd7dcbdadf66e3b333bb2f104364607c664b4bd446f68be29ed900210
4
+ data.tar.gz: 6c5fb6b3560bf4fc8511f46d814986ffeead205a5a4becfd7f4af7c0f198c3fc
5
+ SHA512:
6
+ metadata.gz: 20dc8a1b115ca6edd1640793a001e93869519c8e4a74814803b8d2540f52b80528c1b18bff466048af0d1ba3acad253bdf5e0728c6b4e31992d1fd0a556d197a
7
+ data.tar.gz: e8396ecc9e32f83769c49478a60218d938b4eeac21c2981f03d2bc9e8f4fac5f0fd15f484c552431272c5167368d81cac6cec61497cc88858e882b7942991609
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright 2022 Brad Gessler
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,72 @@
1
+ # Featureomatic
2
+
3
+ Features are simple boolean flags that say whether or not they're enabled, right? RIGHT!? WRONG! Features can get quite complicated.
4
+
5
+ This gem makes reasoning through those complexities much more sane by isolating them all into the `app/features` folder as plain 'ol Ruby objects (POROS), that way your team can reason through the features available in an app much better, test them, and do really complicated stuff when needed.
6
+
7
+ # Use cases
8
+
9
+ Here's why you'd want to use Featureomatic:
10
+
11
+ ## Turbo app built by a solopreneur deployed to the Apple App Store
12
+
13
+ If you're deploying a simple Rails Turbo application to the web you might have 20 features that are available for purchase, but when deployed to the Apple App Store, you have to disable certain parts of your website to comply with their draconian app store policies. Featureomatic could disable the features that upset Apple, like links to your support and pricing, so that your app can get approved and stay in compliance.
14
+
15
+ ## B2B Rails app built by a 50 person engineering team for multinational enterprises
16
+
17
+ Enterprise use-cases are even more complicated. If a package is sold to a multi-national customer with 200 features, they may want to disable 30 of those features for certain teams/groups within that organization for compliance reasons. You end up with a hierarchy that can get as complicated as, "The Zig Bang feature is available to MegaCorp on the Platimum plan, but only for their US entities if their team administrators turn that feature on because of weird compliance reasons".
18
+
19
+ ## Installation
20
+
21
+ Install the gem by executing the following from your Rails root:
22
+
23
+ ```bash
24
+ $ bundle add featureomatic
25
+ ```
26
+
27
+ Then run
28
+
29
+ ```bash
30
+ $ rails generate featureomatic:install
31
+ ```
32
+
33
+ Restart your server and it's off to the races!
34
+
35
+ First thing you'll want to checkout is the `./app/features/application_feature.rb` file:
36
+
37
+ ```ruby
38
+ class ApplicationFeature < Featureomatic::Base
39
+ attr_reader :user
40
+
41
+ def initialize(user)
42
+ @user = user
43
+ end
44
+
45
+ def enabled?
46
+ user.paid?
47
+ end
48
+ end
49
+ ```
50
+
51
+ ## Usage
52
+
53
+ Ready to add a new feature? Sweet! Just run this:
54
+
55
+ ```bash
56
+ $ rails generate featureomatic:new ModerationFeature
57
+ ```
58
+
59
+ This creates the following file:
60
+
61
+ ```ruby
62
+ # ./app/features/my_kewl_feature.rb
63
+ class ModerationFeature < ApplicationFeature
64
+ def name
65
+ "Moderation"
66
+ end
67
+ end
68
+ ```
69
+
70
+ ## License
71
+
72
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ require "bundler/setup"
2
+
3
+ APP_RAKEFILE = File.expand_path("spec/dummy/Rakefile", __dir__)
4
+ load "rails/tasks/engine.rake"
5
+
6
+ load "rails/tasks/statistics.rake"
7
+
8
+ require "bundler/gem_tasks"
@@ -0,0 +1 @@
1
+ //= link_directory ../stylesheets/featureomatic .css
@@ -0,0 +1,15 @@
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 any plugin's vendor/assets/stylesheets directory 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 bottom of the
9
+ * compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
10
+ * files in this directory. Styles in this file should be added after the last require_* statement.
11
+ * It is generally better to create a new file per style scope.
12
+ *
13
+ *= require_tree .
14
+ *= require_self
15
+ */
@@ -0,0 +1,4 @@
1
+ module Featureomatic
2
+ class ApplicationController < ActionController::Base
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module Featureomatic
2
+ module ApplicationHelper
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module Featureomatic
2
+ class ApplicationJob < ActiveJob::Base
3
+ end
4
+ end
@@ -0,0 +1,6 @@
1
+ module Featureomatic
2
+ class ApplicationMailer < ActionMailer::Base
3
+ default from: "from@example.com"
4
+ layout "mailer"
5
+ end
6
+ end
@@ -0,0 +1,5 @@
1
+ module Featureomatic
2
+ class ApplicationRecord < ActiveRecord::Base
3
+ self.abstract_class = true
4
+ end
5
+ end
@@ -0,0 +1,15 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Featureomatic</title>
5
+ <%= csrf_meta_tags %>
6
+ <%= csp_meta_tag %>
7
+
8
+ <%= stylesheet_link_tag "featureomatic/application", media: "all" %>
9
+ </head>
10
+ <body>
11
+
12
+ <%= yield %>
13
+
14
+ </body>
15
+ </html>
data/config/routes.rb ADDED
@@ -0,0 +1,2 @@
1
+ Featureomatic::Engine.routes.draw do
2
+ end
@@ -0,0 +1,5 @@
1
+ module Featureomatic
2
+ class Engine < ::Rails::Engine
3
+ isolate_namespace Featureomatic
4
+ end
5
+ end
@@ -0,0 +1,3 @@
1
+ module Featureomatic
2
+ VERSION = "0.1.0"
3
+ end
@@ -0,0 +1,5 @@
1
+ require "featureomatic/version"
2
+ require "featureomatic/engine"
3
+
4
+ module Featureomatic
5
+ end
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :featureomatic do
3
+ # # Task goes here
4
+ # end
metadata ADDED
@@ -0,0 +1,78 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: featureomatic
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Brad Gessler
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2022-06-19 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rails
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 7.0.3
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: 7.0.3
27
+ description: Features can get really complicated when you have to cascade them from
28
+ global, account, policy, group, and policy levels. Featureomatic makes that easy!
29
+ email:
30
+ - bradgessler@gmail.com
31
+ executables: []
32
+ extensions: []
33
+ extra_rdoc_files: []
34
+ files:
35
+ - MIT-LICENSE
36
+ - README.md
37
+ - Rakefile
38
+ - app/assets/config/featureomatic_manifest.js
39
+ - app/assets/stylesheets/featureomatic/application.css
40
+ - app/controllers/featureomatic/application_controller.rb
41
+ - app/helpers/featureomatic/application_helper.rb
42
+ - app/jobs/featureomatic/application_job.rb
43
+ - app/mailers/featureomatic/application_mailer.rb
44
+ - app/models/featureomatic/application_record.rb
45
+ - app/views/layouts/featureomatic/application.html.erb
46
+ - config/routes.rb
47
+ - lib/featureomatic.rb
48
+ - lib/featureomatic/engine.rb
49
+ - lib/featureomatic/version.rb
50
+ - lib/tasks/featureomatic_tasks.rake
51
+ homepage: https://github.com/rocketshipio/featureomatic
52
+ licenses:
53
+ - MIT
54
+ metadata:
55
+ allowed_push_host: https://rubygems.org
56
+ homepage_uri: https://github.com/rocketshipio/featureomatic
57
+ source_code_uri: https://github.com/rocketshipio/featureomatic
58
+ changelog_uri: https://github.com/rocketshipio/featureomatic
59
+ post_install_message:
60
+ rdoc_options: []
61
+ require_paths:
62
+ - lib
63
+ required_ruby_version: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ version: '0'
68
+ required_rubygems_version: !ruby/object:Gem::Requirement
69
+ requirements:
70
+ - - ">="
71
+ - !ruby/object:Gem::Version
72
+ version: '0'
73
+ requirements: []
74
+ rubygems_version: 3.3.15
75
+ signing_key:
76
+ specification_version: 4
77
+ summary: Powerful cascading feature flags in Rails.
78
+ test_files: []