radar / guides Goto Github PK
View Code? Open in Web Editor NEWGuides for Ruby and Elixir and whatever else I feel like
Guides for Ruby and Elixir and whatever else I feel like
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?
Aruba no longer raises an error on "When I run ...". The correct step is now "When I successfully run ...".
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.
There's currently only one guide: "Developing a RubyGem using Bundler".
This is totally a lie. ;)
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
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.
"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!
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.
I strictly following the guide, reaching the creating a new post section but meet following error.
I'm newbie to EmberJS, so may I make some mistake, so can anyone check my code and point out if the guide/me missing something?
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'
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.
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?
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.
The Gem Development guide says that the Gemfile.lock
file "should always be checked into version control." However, this is NOT true for Gems. For Applications, like your Rails apps, Sinatra apps, etc., it is true. The same does not go for Gems.
For clarification, please see Yehuda's guidance on the roles of .gemspec
, Gemfile
, and Gemfile.lock
files: Clarifying the roles of .gemspec and Gemfile
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'
Instead of "bundle exec rspec spec", I think it's more user-friendly to use rspec's built-in rake SpecTask detailed here:
http://rspec.info/documentation/tools/rake.html
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.
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
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
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.
Bro i'm going to disrupt your life if you push my fucking buttons
Is the ember.md
guide moved elsewhere?
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"
The <a {{action='destroy'}}>Destroy</a>
will cause a precompilation error.
<a {{action 'destroy'}}>Destroy</a>
makes it work as intended (I guess).
not rake install
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:
CONTRIBUTING.md
and README.md
filesexpect
syntax instead of should
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.
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.
In this guide the API for posts and comments isn't in routes.rb in the rails app that is cloned.
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!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.