Git Product home page Git Product logo

guides's Introduction

The Ruby Ecosystem Guides

Thanks for visiting! This is my (currently little) repository containing my guides about how to work with various tools in the Ruby Ecosystem.

You made a mistake! / I don't understand!

Please file an issue and I'll see what I can do about it. If you don't understand something then I'm Doing It Wrong.

A bit of background

It's no secret: I love writing and I love love Ruby. So why not combine the two? That's how this repository got started.

I discovered the bundle gem command whilst skimming the CHANGELOG for Bundler. It was added in 1.0.0.rc4, the third-to-last RC before Bundler's 1.0.0 release and I was instantly in love with it. I moved my by_star and lookup gems across to it and then I got interested as to how I would go about developing a brand-new gem using Bundler, Thor, RSpec and Cucumber. So that's what I did, documenting the whole process as the "Developing a RubyGem using Bundler" guide.

Who would do such a thing?!

I would do. By writing about how to use a tool, I gain a better understanding of how it works and get to share that knowledge with the rest of the world. I do all of this on my own personal time as a way to promote myself as a Smart Kinda Guy, and also to share what I know with the rest of the world just in case there's an unfortunate moment where I'm unable to from then on.

Whilst writing and researching all these things can be frustrating at some points, I do it because of the high I get when I figure something out.

If you'd like to help out, please buy a copy of Rails 4 in Action. This puts money in my pocket which I can then use to put food on my table which I put in my mouth to power my brain and fingers to write more guides and books.

Helper-outerers

Andre Arko: Discussion about where to put the development dependencies for the "Developing a RubyGem using Bundler" guide. They should go in the .gemspec file by using the add_development_dependency method.

guides's People

Contributors

adammathys avatar anildigital avatar beneggett avatar charlespeach avatar eduardobautista avatar gringocl avatar hauntedhost avatar ivanvanderbyl avatar joshcheek avatar jroes avatar keikun17 avatar kiela avatar lbrapid avatar lenart avatar lloydpick avatar lukeholder avatar martinos avatar nilbus avatar oblakeerickson avatar pixeltrix avatar radar avatar rajeshduggal avatar rakibulislam avatar shime avatar sumbach avatar thejonanshow avatar thepoho avatar x3rax 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  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

guides's Issues

Ember guide: new post path

WARNING: nitpicking ahead. Or what I perceive as issue might be intentional. (excuse me if that's the case)

Assuming we stick to rails conventions, new post path is /posts/new, so to keep it consistent (and familiar) the entry in router.js.coffee should be

@resource 'posts.new', path: '/posts/new'

instead of current '/post/new'

issue with require foodie/food

I don't think it mentions it in the tutorial but I had to add 'require foodie/food' to the top of my foodie.rb file to get my first rspec tests to pass without failing on the uninitialized constant error.

Ember guide: creating a new post bug

section creating a new post, there's a new.js.coffee code ending with

route.transitionToRoute('post', model)

This causes a Uncaught TypeError: Object [object Object] has no method 'transitionToRoute' error messsage.

After some googling I found out that transitionToRoute is available within a controller, but since we're coding inside the router the proper call is transitionTo. And indeed changing the above line to

route.transitionTo('post', model)

makes it work as intended.

dev vrs. production dependency declarations

"Next, we'll specify in our foodie.gemspec file that rspec is a development dependency by adding this line inside the Gem::Specification block:"

Why was it added to the .gemspec and not the Gemfile? I thought you wanted the noob to adhere to placing dev dependency declarations in Gemfile?

I'm just noting what confused me when looking at the guide. Thanks for this guide!

Best practice to put development dependencies in gemspec?

Its debatably better to use s.add_development_dependency in the gemspec rather than putting development dependencies in the Gemfile. If you're going to go the other way, you really need to argue the case or at least link to some sort of justification.

Gem Development guide improvements

This issue is to help me keep track of things I need to help bring up to date in order to use the guide on http://bundler.io.

Todos:

  • bin/foodie -> exe/foodie
  • Mention the CONTRIBUTING.md and README.md files
  • Use the newest version of activesupport and rspec and use the expect syntax instead of should
  • New gems now begin on version 0.1.0 instead of 0.0.1
  • Mention the Bundler version that the guide is being written for (Bundler 1.9 at the moment)

If there are any other issues let me know, I will be going through the tutorial again with the code I rewrite to catch any issues.

aruba tests should use backticks

I found that whenever I tried running the cucumber/aruba tests that I got a warning informing me to use the backticks method instead of double quotes. I think test should look like this:

Scenario: Broccoli is gross
When I run foodie portray broccoli
Then the output should contain "Gross!"

Scenario: Tomato, or Tomato?
When I run foodie pluralize --word Tomato
Then the output should contain "Tomatoes"

Bundler's rake tasks for gem development

Great guide, I really like Bundler's gem template and tools. You may want to mention the build and install rake tasks which were handy in testing locally before pushing my first release.

โšก rake -T
rake build    # Build magic_smoke-0.0.1.gem into the pkg directory
rake install  # Build and install magic_smoke-0.0.1.gem into system gems
rake release  # Create tag v0.0.1 and build and push magic_smoke-0.0.1.gem to Rubygems

README out of date

There's currently only one guide: "Developing a RubyGem using Bundler".

This is totally a lie. ;)

Post show route defined incorrectly

You define the route for viewing an individual post like the following:

Blorgh.Router.map ()->
  @resource 'post', path: '/posts/:id'

This route is not incorrect in and of itself, but it won't automatically try to use the find method defined on the post model. For that to happen, it needs to be defined using :post_id rather than :id, like so:

Blorgh.Router.map ()->
  @resource 'post', path: '/posts/:post_id'

More info in the dynamic segments section of the ember routing guide at http://emberjs.com/guides/routing/defining-your-routes/

Otherwise, this is a really awesome guide ๐Ÿ‘ Great introduction to another JS framework for me.

Routing error in Chrome inspector during Ember guide

When I open the Chrome inspector per the tutorial I should see this:
https://github.com/radar/guides/blob/master/ember/chrome_console.png

I apparently have some sort of routing error and I don't know enough about Ember yet to debug it. So far I've cloned the repo, run the generator and made the application.js.coffee and blorgh.js.coffee changes.

router:main application.js?body=1:8
application:main application.js?body=1:8
DEBUG: ------------------------------- ember.js?body=1:3522
DEBUG: Ember      : 1.5.0 ember.js?body=1:3522
DEBUG: Ember Data : 1.0.0-beta.7+canary.f482da04 ember.js?body=1:3522
DEBUG: Handlebars : 1.3.0 ember.js?body=1:3522
DEBUG: jQuery     : 1.11.0 ember.js?body=1:3522
DEBUG: ------------------------------- ember.js?body=1:3522
store:main application.js?body=1:8
event_dispatcher:main application.js?body=1:8
router:main application.js?body=1:8
location:hash application.js?body=1:8
route:basic application.js?body=1:8
Attempting URL transition to / ember.js?body=1:3522
route:application application.js?body=1:8
route:application application.js?body=1:8
route:index application.js?body=1:8
Transition #0: application: calling beforeModel hook ember.js?body=1:3522
Transition #0: application: calling deserialize hook ember.js?body=1:3522
Transition #0: application: calling afterModel hook ember.js?body=1:3522
Transition #0: index: calling beforeModel hook ember.js?body=1:3522
Transition #0: index: calling deserialize hook ember.js?body=1:3522
model:post application.js?body=1:8
adapter:post application.js?body=1:8
adapter:application application.js?body=1:8
adapter:-rest application.js?body=1:8
serializer:post application.js?body=1:8
serializer:application application.js?body=1:8
serializer:-rest application.js?body=1:8
template:loading application.js?body=1:8
route:loading application.js?body=1:8
DEBUG: For more advanced debugging, install the Ember Inspector from https://chrome.google.com/webstore/detail/ember-inspector/bmdblncegkenkacieihfhpjfppoconhi ember.js?body=1:3522
model:0 application.js?body=1:8
template:error application.js?body=1:8
route:error application.js?body=1:8
Error while loading route: Error: No model was found for '0'
    at new Error (native)
    at Error.Ember.Error (http://localhost:3000/assets/ember.js?body=1:911:19)
    at Ember.Object.extend.modelFor (http://localhost:3000/assets/ember-data.js?body=1:9806:33)
    at JSONSerializer.extend.extractArray (http://localhost:3000/assets/ember-data.js?body=1:3173:28)
    at superWrapper (http://localhost:3000/assets/ember.js?body=1:1293:16)
    at Ember.Object.extend.extractFindAll (http://localhost:3000/assets/ember-data.js?body=1:2381:21)
    at Ember.Object.extend.extract (http://localhost:3000/assets/ember-data.js?body=1:2366:37)
    at http://localhost:3000/assets/ember-data.js?body=1:10397:34
    at invokeCallback (http://localhost:3000/assets/ember.js?body=1:10014:19)
    at publish (http://localhost:3000/assets/ember.js?body=1:9684:9)
    at publishFulfillment (http://localhost:3000/assets/ember.js?body=1:10104:7) ember.js?body=1:3522
Transition #0: index: transition was aborted 

clarification about Bundler.require

Thanks for this useful write-up.

One thing I'm not clear on is if you want your gem to be used either with or without bundler, it's great that bundler now picks up on the .gemspec dependencies but don't you still need to rescue every time you require 'bundler' and Bundler.require() ? I think it would be helpful to have an example of that here. Unless I'm missing something.

Gem development and Spring!

It might help someone out to make a note about spring.

If you are developing a gem for Rails 4 with Spring its very easy to get caught out by changes not making their way into your application. Spring does not watch changes to gems and therefore does not reload the Rails stack. A bundle update 'your-gem' will not work, you will need to $ spring stop to force it to reload the full Rails app next time you run rails.

Hope this helps someone!

require 'aruba' should be require 'aruba/cucumber'

Not sure if things changed since you wrote this excellent tutorial, but I could not get the features part to work until I changed setup.rb to have require 'aruba/cucumber' instead of the specified require 'aruba'

ember.md Posts array

In app/assets/javascripts/models/post.js.coffee something with this code

Blorgh.Post = Ember.Object.extend({})

Blorgh.Post.reopenClass
  findAll: ->
    posts = Em.A()
    $.getJSON('/api/posts').then (data) ->
      $.each data.posts, (post) ->
        posts.pushObject(data)
    posts

is giving me an TypeError in Jquery

Uncaught TypeError: Cannot read property 'length' of undefined

Too Many Gems...

When I run gem bump, everything is fine. When I run gem release, I get

ERROR:  While executing gem ... (Gem::CommandLineError)
    Too many gem names (/usr/local/bin, /usr/local/bin); please specify only one

Assistance?

Gem development: Cucumber not running executable in bin

In regards to gem-development tutorial, under Testing a command line interface (https://github.com/radar/guides/blob/master/gem-development.md#testing-a-command-line-interface):

I suppose it's my error, not the tutorial's, but perhaps you can help me in either case:

When I call bundle exec cucumber features/, I don't get an error reading 'pending', nor any yellow output. Rather, the task appears to run to completion, terminating with:

2 scenarios (2 failed)
4 steps (2 failed, 2 skipped)

I went ahead and created bin/foodie anyway, but it doesn't get run. (No print "nothing" executed.)

I'm using Windows7. I've tried this in the default shell as well as using msys. Is that my problem?

gem-development.md `gem bump` Unknown command bump

Hi Ryan,

Thanks for great guides!

I've noticed you're mentioning gem bump command in your gem-development.md guide.

Such command is not available in rubygems by default. I assume it's taken from gem-relase gem.

This info could be added to the guide.

Git-add not mentioned in gem development guide

It would be good to mention in gem development guide that if you are using Git, you have to do git add after adding new files like lib/foodie/food.rb. Otherwise those files won't get included in gem, because gemspec file uses git ls-files to include the files.

ember.md

In this guide the API for posts and comments isn't in routes.rb in the rails app that is cloned.

gem-development.md: You don't have i18n installed in your application

I can't get the last RSpec task to successfully run, see using-other-gems:

macbuech:foodie josh$ bundle install
Fetching gem metadata from https://rubygems.org/........
Using activesupport (3.0.17) 
Using diff-lcs (1.1.3) 
Using foodie (0.0.1) from source at /Users/josh/Documents/Work/Sientia/foodie 
Using rspec-core (2.11.1) 
Using rspec-expectations (2.11.3) 
Using rspec-mocks (2.11.2) 
Using rspec (2.11.0) 
Using bundler (1.2.0) 
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
macbuech:foodie josh$ bundle exec rspec spec
You don't have i18n installed in your application. Please add it to your Gemfile and run bundle install
/Users/josh/.rvm/gems/ruby-1.9.3-p0/gems/activesupport-3.0.17/lib/active_support/i18n.rb:2:in `require': cannot load such file -- i18n (LoadError)

I'm tempted to add 'i18n' to my gemspec file like this:

gem.add_dependency "i18n"

But I'm not 100% confident whether this is the right way to go? Thanks anyway for this nice tutorial.

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.