Skip to content

gracejhnoh/Cowmazing_demo

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cowmazing!

Are you in the moooooooood to learn how to make a gem?

The COWMAZING gem has a method called 'moo'. It accepts a text string and returns an html string that can be rendered to show a cow saying the text string. It is fun and easy!

alt_text


TO USE THIS GEM

      in the Gemfile for your app:

            gem 'cowmazing', path: "../gems/cowmazing
            (note that a local path was specified, since this gem has not yet been published)

      in your ruby code:

            require 'cowmazing'
            puts Cowmazing.moo('Hello World')

      or

            require 'cowmazing'
            @cow_info = Cowmazing.moo('Hello World')
            erb :index


TO CREATE THIS GEM

  1. set up the correct directory structure for a gem and modify to suit your needs:

   cowmazing/
          bin/
               cowmazing (an executable file, loaded into the user's PATH when the gem is installed)
         lib/
               cowmazing.rb (where our gem code resides - the MEAT of the gem - we wrote a class method called moo in our gem)
         test/
               test_cowmazing.rb (contains tests)
         README.md
         Rakefile
         cowmazing.gemspec (contains info about gem files, platform, version #, author info, etc.)

  1. build the gem: from the cowmazing project directory at the terminal,

      gem build cowmazing.gemspec

  1. install the gem: from the cowmazing project directory at the terminal,

      gem install ./cowmazing-0.0.2.gem, where 0.0.2 is the version number specified in your gemspec file

This gem has not been published, but to publish it, take these steps:

      1. Setup a rubygems.org account

      2. Push out the gem: gem push cowmazing-0.0.2.gem


Create your own:

http://guides.rubygems.org/make-your-own-gem/

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Ruby 66.2%
  • HTML 30.6%
  • CSS 1.8%
  • JavaScript 1.4%