Git Product home page Git Product logo

cogy's People

Contributors

agis avatar apostergiou avatar bill-kolokithas avatar charkost avatar fragoulis avatar gnanou avatar iridakos avatar rpk0 avatar

Stargazers

 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

nikosvlagoidis

cogy's Issues

Generators

Things we could generate:

  • initializer
  • possibly the route
  • a cogy folder inside the app with a README

Default options `required` to false

Or require them to be defined explicitly. If we go the "not-required by default" way, then maybe we should also support a default description in commands, so that :desc isn't required.

Also update examples in README and docs.

Implement an authentication scheme

We should somehow only accept requests from the cogy executable. This could be done by generating a token from the host application and send it in the config section of the bundle config YAML.

For this, we need operable/cog#1143 to be fixed first.

Customizable user helpers

We should provide a way for users to define their own helpers, like user or something, that will be available inside commands and will return the Rails User object. It should be configurable like this:

Cogy.configure do |c|
  c.user_lambda = ->(id) { User.find(id) }
end

Then the helper could just call this lambda with the Cogy ENV as the argument.

Blocked on #35.

Find a better alternative to `next`

Right now, since all the user-defined commands are eventually turn into Proc objects, we can't use return. So we are forced to use next instead, but it's not intuitive.

Implement a web interface

This will list all the available commands and provide the ability to execute them from the browser.

Create cogy bundle

This bundle will:

  • ship the cogy executable that should be placed in the Relays (#5)
    • the URL that it hits should be configurable using a dynamic configuration
  • provide the install command that accepts the inventory endpoint as a URL and install the bundle to Cog

Supersedes #5.

Use dynamic configuration for providing Cogy host URLs

This could be done by injecting a cog_url option in all the generated commands. Then the executable will read this option and act accordingly.

If we do this, then we can also get rid of the hardcoded URLs inside the executable and make it totally Rails-app-agnostic.

Blocked by #5.

cli: Test commands from the terminal

Ship an executable from the gem, that can be used to test cogy commands from the terminal.

It should probably share the same code with the Relay executable that we'll ship eventually, so this depends on #5.

Get rid of Handler for Context

Handler does not make much sense now, plus we need a class to hold the execution context for a command invocation. That way we could also have an env method, similar to how ActionPack has.

Meaningful backtraces

When an error occurs inside a command, the backtrace is not useful due to eval. We should fix this.

Support JSON responses and templates

We should add support for easily returning JSON to Cog and also define templates for commands.

Proposal

JSON responses

We could detect if the result of a command invocation is a Hash, and if it is, then inject the "JSON" line in the response and possibly call render :json instead of render :text.

Templates

Templates are defined in separate files (without an extension), named after their corresponding command. For example, for a command named "foo", Cogy would search in app/cogy/templates/**/* for a file named foo and, if found, it would use it when generating the bundle config.

Defining templates

(TBD)

Add API documentation

  • Cogy
  • Command
  • Handler
  • controller & views
  • Integrate yardoc tasks and gem
  • link from README

Test with Rails 5

This is a matter of testing with a Rails 5 dummy and update the dependency constraints. It should mostly be fine for Rails 5.

deployment: Add capistrano tasks and sample Cog trigger

Document the recommended deployment flow and provide:

  • capistrano tasks for invoking the trigger
  • possibly configuration options for controlling those
  • a sample Cog trigger (using our 'cogutils' bundle)
    • we have to release cogutils first
  • capistrano 2
  • capistrano 3

Inject 'COGY_BACKEND' in the config section

Right now users have to set the COGY_BACKEND environment variable in order to use Cogy (see here). Ideally, this shouldn't be necessary.

When operable/cog#1143 is fixed, we can inject COGY_BACKEND from the Cogy configuration into the inventory so that it passes through to the cogy executable. Even better, we could generate it automatically, or have a sane default.

  • use the new setting also in Capistrano task

Add diagram illustrating the flow

It should illustrate the typical workflow of writing a new command:

  1. writing a bundle
  2. deploying the app
  3. capistrano task
  4. cog trigger
  5. cogy:install

Also how calling a command works:

  1. user typing in Slack
  2. Cog invoking cogy executable
  3. executable hitting the application etc.

Install generator

It should:

  1. add the route
  2. create a cogy folder and place a README
  3. create the initializer (reuse the existing generator)

Add tests

This should be closed once we add tests that test the expected results of commands.

bundle_version & executable_path shouldn't raise error if unset

The generators added in cd3ac72 are effectively unusable because Cogy will throw an error on boot if bundle_version and executable_path configuration options aren't set (which aren't, if the user haven't done so manually).

We should just warn or do nothing at all if those configs aren't set. We should instead default them to something, like all the other configuration values.

Make the request a POST

The executable should do a POST instead of a GET.

It's more intuitive that it's a POST that triggers a command that may change the state of the application and we won't clutter the URL with all the environment info we want to share in the future.

Automate bundle version bump

Right now, we provide a way to bump the version automatically when a file changes (using the grit gem). We should instead provide a portable way to do this without having to copy/paste code from our documentation.

Loosen rails deps.

We should probably support everything in the 4.2 series. Also update README accordingly.

Command namespaces

Right now all commands are under a single bundle. This probably won't scale well when different teams start adding team-specific commands.

We need a way to namespace individual commands.

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.