GithubHelp home page GithubHelp logo

stop_active_support_anywhere's Introduction

Stop ActiveSupport Anywhere

Goal

We love ruby and ruby community. We can find excellent web (and not only web) frameworks like rails, hanami, grape, sinatra, dry-wb, roda, etc. But sometimes some developers use rails dependency in gems which not related to use only with rails. That's why the main idea of this repo is to collect all libraries which you can use instead using ActiveSupport

Some Problems with ActiveSupport

ActiveSupport is a "toolkit of support libraries and Ruby core extensions extracted from the Rails framework". Core extensions is a prettier name for monkey-patches of Ruby core classes. Monkey-patching breaks fundamental contracts with the language core - with deadly consequences.

Monkey-patching hinders interoperability. Any piece of Ruby software is written to work either in the monkey-patch-free environment, or in the monkey-patched one. Sure: with a bit of luck, many work in both. But won't your gem break with the next release of ActiveRecord (which it itself doesn't rely on at all)? Noone can say in advance.

When it is Permissible to Depend on ActiveSupport?

"You are definitely allowed to shoot yourself in the foot, if you really want to." It is only responsible to rely on ActiveSupport (or another similar ton of monkey-patches) if you are in position of the "lord of the stack", i.e., if you are developing an application, and you are the only one who decides forever, which components will interoperate. Libraries, aiming to be general tools, maximally interoperable with others, as well as applications open to extensions, must never pollute the runtime environment by monkey-patching.

Blog Posts

TODO

  1. collect all gems or solutions which can replace some parts of AS (current status)
  2. filter all this information
  3. create list of not only rails gems which use AS and try to fix it

Table of contents

Features

date formatters

ActiveSupport::ArrayInquirer

Link to rails docs

Alternatives

# instead of:
[:blue, :green].blue?

# do this:
[:blue, :green].include?(:blue)

ActiveSupport::BacktraceCleaner

Link to rails docs

Alternatives

  1. gem: Morozzzko/backtrace_cleaner link

ActiveSupport::Callbacks

Link to rails docs

Alternatives

  1. gem: delner/hollerback link
  2. gem: PragTob/after_do link
  3. sources: RSpec::Core::Hooks link

ActiveSupport::Configurable

Link to rails docs

Alternatives

  1. gem: dry-configurable link
  2. gem: markevans/configurable link
  3. gem: ged/configurability link
  4. post: Ruby Gem Configuration Patterns link
  5. post: MyGem.configure Block link

ActiveSupport::Concurrency

Link to rails docs

Alternatives

  1. ruby-concurrency link

ActiveSupport::Deprecation

Link to rails docs

Alternatives

  1. core library: Gem::Deprecate link
  2. gem: Hanami::Deprecation link
  3. gem: erikh/deprecated link
  4. gem: cbeer/deprecation link

ActiveSupport::Duration

Link to rails docs

Alternatives

  1. gem: zverok/time_math2 link
  2. gem: zverok/time_calc link
  3. gem: janko-m/as-duration link

ActiveSupport::Gzip

Link to rails docs

Alternatives

  1. core library: zlib link
  2. SO question: How to decompress Gzip string in ruby? link

ActiveSupport::HashWithIndifferentAccess

Link to rails docs

Alternatives

  1. core library: OpenStruct link

ActiveSupport::Inflector

Link to rails docs

Alternatives

  1. gem: linguistics link
  2. gem: dry-inflector link

ActiveSupport::LazyLoadHooks

Link to rails docs

Alternatives

none

ActiveSupport::Notifications

Link to rails docs

Alternatives

  1. gem: dry-monitor link
  2. gem: dry-events: link

ActiveSupport::NumberHelper

Link to rails docs

Alternatives

  1. core library: Kernel#sprintf link

ActiveSupport::NumericWithFormat

Link to rails docs

Alternatives

none

ActiveSupport::RangeWithFormat

Link to rails docs

Alternatives

none

ActiveSupport::TimeWithZone

Link to rails docs

Alternatives

  1. gem: et-orbi link
  2. Ruby 2.6 added timezone support to core link

ActiveSupport::CoreExtensions

Integer

Not rails specific gems which use AS as dependency

Contribute

Contributions welcome!

stop_active_support_anywhere's People

Contributors

amerov avatar davydovanton avatar dependabot[bot] avatar ekremkaraca avatar fenec avatar ferdinandrosario avatar ianks avatar igneus avatar ijackua avatar janko avatar jmettraux avatar katafrakt avatar shiroginne avatar skryukov avatar solnic avatar vladislav-yashin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

stop_active_support_anywhere's Issues

Goal is clearly stated, but ...

... not it's value: why should it be better to depend on Hashie rather than ActiveSupport when you need hash with indifferent access? ... It's definitely worth explaining in the README.

Automation

In order to make a campaing like this effective, it would be nice to have a few tools:

  • a tool for authors of ruby gems which checks gemspec/Gemfile for both direct and indirect dependency on AS
  • "AS free" badge for use on project websites (similar to "gem version", "build passing" etc.; it would also significantly help to raise awareness, if adopted by some higher-profile projects like e.g. hanami)
  • website with automatically generated list of gems which depend on AS

Is this merely focused on bashing ActiveSupport?

The destructive communication is sad. There is a bigger focus on making an anti ActiveSupport campaign than adding ruby gem alternatives.

Although I agree with parts of the initial concept of this project, I can't git commit on a project named stop_active_support_anywhere. Sounds irresponsible.

Also, seeing you're an @hanami core member (Rails alternative), so you have a bigger responsability on this project. /cc @jodosha
I know @hanami since Lotus, and use hanami-utils daily, so I do appreciate and recommend it.

I'll leave 2 written contributions below.


  1. Text like this on your README should be reviewed:

ActiveSupport is Evil

There may be better alternatives to AS depending on situations/contexts

"You are definitely allowed to shoot yourself in the foot, if you really want to."

I couldn't walk today considering the amount of times in the last 10+ years of my Ruby consultancy experience I've successfully used ActiveSupport to help designing REST API Clients, Data Parsers / Importers, Form Objects, Service Objects, etc, ...

"if you are developing an application, and you are the only one who decides forever"

What's a "only one who decides forever" role?


  1. More alternatives to the list
  • ActiveSupport::Validations
    • dry-validations
  • ActiveSupport::Attributes // ActiveSupport::Types (related to the Rails 5 Attributes API)
    • dry-types
    • virtus

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.