Skip to content

Upgrade from v2.2.1 to v3.0.0

Andrew De Ponte edited this page Jul 1, 2016 · 11 revisions

Review Feature Toggles Removed

If you had previously setup the Review Feature Toggles feature you need to remove it.

This is necessary because we removed this feature in v3.0.0 and the rake task that provided it because it was not a heavily used feature, and only worked with boolean rules which are already visible in the feature definitions.

This can be done by removing the following from your Rakefile.

namespace :togls do
  task :features => [:environment] do
  end
end

spec = Gem::Specification.find_by_name 'togls'
load "#{spec.gem_dir}/lib/tasks/togls.rake"

Defining Custom Rules

Defining Custom Rules now requires the following:

  • define a class level title method which returns a string title of the custom rule type
  • define a class level description method which returns a string description of the custom rule type and how to use it
  • define a class level target_type method which returns a symbol as an Abstract Target Type

For further details see Custom Rules

Registering Custom Rule Types

Since v3.0.0 you are now required to register custom rule types as follows:

Togls.rule_types do
  register(:my_custom_rule, MyCustomRule)
end

For more details see Custom Rules

Setting the Default Feature Target Type

The following is an example that sets the default feature target type to NONE. This is a relatively sane default. This is generally done in the file that you define your feature toggles.

Togls.default_feature_target_type = Togls::TargetTypes::NONE

For more details on this see Abstract Target Types

Rename Togls.features to Togls.release

In v3.0.0 the Togls.features method was replaced with Togls.release to better communicate the type of toggles that are being defined within the block. The following is a before and after example.

Before v3.0.0

Togls.features do
  feature(:foo, 'desc').off
end

After v3.0.0

Togls.release do
  feature(:foo, 'desc').off
end

Add types to all the feature toggle definitions and rule type definitions

Given that in v3.0.0 Togls now requires feature toggle definitions to have a target_type you will need to go through all of your feature toggle definitions and identify if the default feature target type makes sense, or if you need to specify a target type for that feature toggle. Details on this can be found in Abstract Target Types.

You will also need to go through all the custom rule type definitions and make sure that they have a title, description, and appropriate target_type. Details on this can be found in Custom Rule Types & Rules.

Replace test setup with new test mode and test state changes API

With v3.0.0 comes a more simplified and streamlined set of testing tools. Details on these can be found under Testing with Togls.