GithubHelp home page GithubHelp logo

tbpgr / ruboty-gen Goto Github PK

View Code? Open in Web Editor NEW

This project forked from blockgiven/ruboty-gen

0.0 1.0 0.0 117 KB

generators for creating ruboty plugin.

Home Page: https://rubygems.org/gems/ruboty-gen

License: MIT License

Ruby 100.00%

ruboty-gen's Introduction

Ruboty::Gen

generators for creating ruboty plugin.

Installation

Add this line to your application's Gemfile:

gem 'ruboty-gen'

And then execute:

$ bundle

Or install it yourself as:

$ gem install ruboty-gen

Usage

  ∩ ∩  ∠ i’m at ~/src/github.com/blockgiven
( ╹x╹) ruboty-gen gem yo action1 action2
      create  ruboty-yo/Gemfile
      create  ruboty-yo/Rakefile
      create  ruboty-yo/LICENSE.txt
      create  ruboty-yo/README.md
      create  ruboty-yo/.gitignore
      create  ruboty-yo/ruboty-yo.gemspec
      create  ruboty-yo/lib/ruboty/yo.rb
      create  ruboty-yo/lib/ruboty/yo/version.rb
Initializing git repo in /Users/block_given/src/github.com/blockgiven/ruboty-yo
      create  ruboty-yo/lib/ruboty/handlers/yo.rb
      create  ruboty-yo/lib/ruboty/yo/actions/action1.rb
      create  ruboty-yo/lib/ruboty/yo/actions/action2.rb
  ∩ ∩  ∠ i’m at ~/src/github.com/blockgiven
( ╹x╹) cd ruboty-yo
  ∩ ∩  ∠ i’m at ~/src/github.com/blockgiven/ruboty-yo [master] ✗
( ╹x╹) tree
.
├── Gemfile
├── LICENSE.txt
├── README.md
├── Rakefile
├── lib
│   └── ruboty
│       ├── handlers
│       │   └── yo.rb
│       ├── yo
│       │   ├── actions
│       │   │   ├── action1.rb
│       │   │   └── action2.rb
│       │   └── version.rb
│       └── yo.rb
└── ruboty-yo.gemspec

5 directories, 10 files
  • ./lib/ruboty/yo.rb (generated code)
require "ruboty/yo/version"
require "ruboty/handlers/yo"

module Ruboty
  module Yo
    # Your code goes here...
  end
end
  • ./lib/ruboty/handlers/yo.rb (generated code)
require "ruboty/yo/actions/action1"
require "ruboty/yo/actions/action2"

module Ruboty
  module Handlers
    class Yo < Base
      on /yo action1/, name: 'action1', description: 'TODO: write your description'
      on /yo action2/, name: 'action2', description: 'TODO: write your description'

      def action1(message)
        Ruboty::Yo::Actions::Action1.new(message).call
      end

      def action2(message)
        Ruboty::Yo::Actions::Action2.new(message).call
      end
    end
  end
end
  • ./lib/ruboty/yo/actions/action1.rb (generated code)
module Ruboty
  module Yo
    module Actions
      class Action1 < Ruboty::Actions::Base
        def call
          message.reply("TODO: write a message.")
        end
      end
    end
  end
end
  • ./lib/ruboty/yo/actions/action2.rb (generated code)
module Ruboty
  module Yo
    module Actions
      class Action2 < Ruboty::Actions::Base
        def call
          message.reply("TODO: write a message.")
        end
      end
    end
  end
end

Contributing

  1. Fork it ( https://github.com/blockgiven/ruboty-gen/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

ruboty-gen's People

Contributors

blockgiven avatar tbpgr avatar

Watchers

 avatar

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.