# -*- encoding: utf-8 -*- # stub: flux_capacitor 0.1.2 ruby lib Gem::Specification.new do |s| s.name = "flux_capacitor".freeze s.version = "0.1.2".freeze s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version= s.require_paths = ["lib".freeze] s.authors = ["Raphael Eidus".freeze] s.bindir = "exe".freeze s.date = "2017-06-22" s.description = "[![Gem Version](https://badge.fury.io/rb/flux_capacitor.svg)](https://badge.fury.io/rb/flux_capacitor)\n\n# FluxCapacitor\n\nSometimes you want to change a feature or deploy a new feature but doing so all at once might take down some service. Enter Flux Capacitor. It allows you to gradually include more historical content in the new feature while allowing all future content to start out with the new feature already live.\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'flux_capacitor'\n```\n\nAnd then execute:\n\n $ bundle\n\nOr install it yourself as:\n\n $ gem install flux_capacitor\n\n## Usage\n\n```ruby\nrequire 'flux_capacitor'\n\npivot = DateTime.parse('2017/08/14 00:00:00-000') # when do you want to start rolling out the feature\noldest = MyModel.first.created_at # If you are using active record finding your oldest item is pretty easy\n# otherwise if you know the date of your first item, just use that\nend_point = DateTime.parse('2017/09/14') # The point where the feature is fully rolled out/safe to remove the Flux Capacitor.\n# This dictates how quickly the feature rolls out. If you are concerned about overloading a required service set this to farther in the future\n\nFEATURE_1_CAPACITOR = Flux::Capacitor.new(pivot, end_point, oldest)\n\ndef controller_method\n model = MyModel.find(params[:id])\n if FEATURE_1_CAPACITOR.travel_to?(model.created_at)\n use_new_feature\n else\n use_old_feature\n end\nend\n```\n\nIf your feature doesn't map well to something where you have a date for each piece of content you can still use flux capacitor. It can also take strings and distribute them evenly over your rollout period using the murmur3 hashing algorithm.\n```ruby\nrequire 'flux_capacitor'\npivot = DateTime.parse('2017/08/14 00:00:00-000') # when do you want to start rolling out the feature\nend_point = DateTime.parse('2017/09/14') # when do you want the rollout to finish\n\n# NOTE: We don't need an oldest date when using strings\nFEATURE_1_CAPACITOR = Flux::Capacitor.new(pivot, end_point)\n\ndef controller_method\n model = MyModel.find(params[:id])\n if FEATURE_1_CAPACITOR.travel_to?(model.uuid)\n use_new_feature\n else\n use_old_feature\n end\nend\n```\n\nOne note about using the string hashing method, new content could get the old feature for a while.\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.\n\nTo install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/raphaeleidus/flux_capacitor.\n".freeze s.email = ["raphaeleidus@gmail.com".freeze] s.files = [".gitignore".freeze, ".rspec".freeze, ".travis.yml".freeze, "Gemfile".freeze, "README.md".freeze, "Rakefile".freeze, "bin/console".freeze, "bin/setup".freeze, "flux_capacitor.gemspec".freeze, "lib/flux_capacitor.rb".freeze, "lib/flux_capacitor/version.rb".freeze] s.homepage = "https://github.com/raphaeleidus/flux_capacitor".freeze s.rubygems_version = "3.5.10".freeze s.summary = "Utility for progressively rolling out a feature to existing content".freeze s.specification_version = 4 s.add_runtime_dependency(%q.freeze, [">= 0".freeze]) s.add_development_dependency(%q.freeze, ["~> 1.15".freeze]) s.add_development_dependency(%q.freeze, ["~> 10.0".freeze]) s.add_development_dependency(%q.freeze, ["~> 3.0".freeze]) end