fssm. It's a cross-platform adaptor that uses inotify on Linux, FSevents on a Mac, and plain polling otherwise.
FSSM.watch('stylesheets') do update { |file| system "less #{file}" } create { ... } delete { ... } end
https://github.com/ttilley/fssm
http://rubygems.org/gems/fssm
Not bad, congratulations on releasing your first gem :) Always great to see someone else joining in, and (hopefully) finding that packaging ruby code as a gem is pretty straight forward
A few pointers on gem packaging itself:
I don't think nokogiri's that bad. When I google "nokogiri" the first page is only get results related to the gem. The name alone doesn't tell you what it does but since its unique its easy to google and its common enough.
Hoe goes with rake so that makes sense too.
I'm surprised the "poorly chosen" list doesn't include Sphincter although it works with sphinx and I've been told the body has many sphincters.
Copy/paste from the DR Discord. Thanks Romsca!
>How to setup GLITCH
>1) https://github.com/rcuhljr/dr-lich - You must run through the top part via SF and properly do that first to >ensure Lich gets setup correctly. >2) When you goto install Lich which is step 3 under: https://lichproject.org/download.html#win_storm_wiz_lich, >before you double click and run lich on step 5, type the following command: gem source -a http://rubygems.org/ >(( Make sure to run as Admin )) >3) So proceed with starting Lich for the first time and the packages will all install CORRECTLY.
>NOTES: Make sure you install RUBY 2.0 and ensure you install as PATH variable and associate files
Like oldman says, it's probably not a good tutorial and you're better off with hartl's one. That being said, here are some explanations for your problems.
>Ok, whatever. Finally have my files on my computer. I try to start the server via the "rails server" command and it doesn't work. Apparently the computer just doesn't know where to find the gems. So I have to go through each gem and do "gem install [gem name] -v [version] --source http://rubygems.org/"
You indeed need to install gems before using them. Nobody manually installs gems anymore, esp. for rails projects. You'll need to use bundler and a Gemfile. If the tut didn't explain this, it's a bad tut.
>However, it's not loading the right page. When I switch to another workspace folder, it loads the same page. And so does the next one. And the next one.
You need to set up routes, in config/routes.rb. Else you'll just visit the same page. I don't know what you mean with different workspace folders. There is no such concept in rails.
>I try to create a new page using the command "rails new testpage". I open the page and... its the same page. What the heck is going on?
This is a new project, not a new page. Where did you do this? It's pretty clear your frustrations are caused by the quality of the tutorial you use.
>I. Don't. Get. It. Why is the template the default template for everything? I never told it to do that! Why is this all so complicated! I just want to learn how to make websites! I feel like I'm just wasting my time finiking with all of this stuff when I should just be learning how to use Ruby and Rails!
You probably set it as something called a layout. The default is in app/views/layout/application.html.erb IIRC. You are probably still in the same project and that's why you see the same page all the time.
So, start with hartl. From the start. To unlearn any mistakes from your current tutorial. It's here: https://www.railstutorial.org/book
awesome_print kind of like pp but way, way prettier. It makes even complicated object graphs, arrays, and hashes much easier to comprehend. Also can hook into your logger to add a logger.ap method to make pretter/more readable logs.
Put your site in version control. I like Git, and GitHub rocks. Next, use something like Capistrano to do deploys. You can run it on your server, or locally if you aren't able to get Capistrano installed on your server. Now all you have to worry about is the database, and uploads (which shouldn't be in version control). For the database, you can set up a script which does a command line database dump on your server, pulls the file down to your local machine using scp
or rsync
, and then imports it. For files, use an rsync script. You should be running something like MAMP or XAMPP locally (Apache, MySQL, PHP, all wrapped up nicely). Then you can use your hosts file to point your domain to your local loopback IP address (127.0.0.1
). I have a Ruby gem called localdev which I use to switch between local dev and remote dev (have to restart Chrome though, since it has its own DNS cache).
Here's how you'd work:
sudo localdev on
).git add new-file
for any new files.git commit -am 'commit message'
to commit your changes locally.git push origin master
to push your changes up to GitHub (or wherever).cap deploy
.Someday I'll do a big in-depth tutorial on how I do all this, but those ideas should at least get you started on the right path.
Additionally, you could use the Chars Ruby library:
Chars.alpha_numeric.random_string(10) # => "vFlwgeS4Na"
(Chars.alpha_numeric + Chars.punctuation).random_string(10) # => "d2O4Jqy-90"
Do you have Rubygems installed? If not, you can get it here. Installation instructions are on the page as well, near the bottom.
When Rubygems is installed, you can install the json gem. Open a terminal window and type: gem install json
If you get an error, try sudo gem install json
I guess i should have made this script into a gem as well, so it would automatically download and install the json dependency. I'll see how that works and i might update stuff a bit.
Your Gem structure is pretty standard from what I can tell. Not bad there. Actual functionality seems alright, so that looks good as well.
As for ordered options... I don't like ordered flags so much. Subcommands would be better in my opinion. There is a gem called Subcommand that lets you do just that. You can call gojira issues open --list 15
would be different than gojira issues list 15 --open
or whatever you want.
Having ordered flags, while easy to type, are difficult to remember without a detailed help file and are very difficult to interpret. Diverging from UNIX-style command usage would be confusing for a lot of users.
If you really want to look at gem structure, then browse http://rubygems.org/ and find some popular ones, then check out the source.
> What else should I know as a first-timer to Oauth?
Use a library
Use a library
Eat your greens... Just kidding, use a library.
If you are using ruby then the Omniauth gem and its provider plugins are perfect, for other languages try and find an analogue.
It is good that you have studied OAuth and have a good idea how it works, but do not re-implement what has already been done by others.
Answered via PM, but I'll give a little more detail here.
It's written in Ruby, uses a MySQL database (gotta migrate to PostresQL soon), and runs via cron jobs. All data is pulled from the same source as MLB Gameday via my MLB Gameday gem. Reddit functionality comes from the Snoo gem.
We launched Rack support in March 2009: https://blog.heroku.com/archives/2009/3/5/32_deploy_merb_sinatra_or_any_rack_app_to_heroku
Heroku was 1.5 years old at that point, and it looks like the first version of Rack dates back to 2007: http://rubygems.org/gems/rack/versions
You can support multiple ruby versions in a gemspec file like so:
s.platform = Gem::Platform::RUBY
Then create a gemfiles
directory and add something like:
source 'http://rubygems.org'
gem 'activesupport', '>= 5.0.0'
gem 'actionpack', '>= 5.0.0'
gem 'activemodel', '>= 5.0.0'
gemspec path: '../'
edit: I'm doing this here: https://github.com/toadkicker/railsstrap
bundler can't install rake because it can't verify ssl on the remote server (possibly because you're getting MITM'ed, you've got an ancient cacerts bundle, or something else is going on).
you can:
disable ssl verification via .gemrc (add ':ssl_verify_mode: 0' to your .gemrc)
disable ssl by removing the https source and adding the http-only source (gem source -r https://rubygems.org; gem source -a http://rubygems.org)
trust the MITM proxy ca cert by adding it in your ruby home's lib/ruby/<maj version>/rubygems/ssl_certs directory
I tend to sidestep all of these by running my own trusted internal rubygems mirror.
Are you using my snoo gem?
If so, its pretty simple.
require 'snoo'
client = Snoo::Client.new
subscribers = client.subreddit_info('ruby')['data']['subscribers']
replace ruby with whatever subreddit you want.
This gem is a little rough, it was my first gem and I haven't been able to work on the rewrite i've been meaning to, but it still gets the job done nicely
I'm pretty sure in needs to be a header. An example for headers in HTTParty would be:
HTTParty.post("http://rubygems.org/api/v1/gems/httparty/owners", :query => { :email => "" }, :headers => { "Authorization" => "THISISMYAPIKEYNOREALLY"})
That's what I found online here for headers in HTTParty
My preference is the annotate gem.
Then run as bundle exec annotate -m -i -s -f bare -p after --force
for models and bundle exec annotate -r
for routes. Those are my preferences but you can play around with how they appear in the models.
Yes, I'm almost certain it can be done with Church and some elbow grease, but passing the relevant data as parameters instead of real input always feels like cheating a bit. Still, it's too damned fun, so I'm pretty sure I'll be posting a non-alphanumeric solution sometime later today. I'm thrilled you enjoyed the interpreter, and thanks for the motivation!
Hey, thanks for the interest! :D
I wasn't actually thinking of making it online. It was sort of an offline generator, so people could see graphics from their own accounts and generate images and stuff. I thought of making it a binary Ruby Gem (like Artii).
That's because I don't know anything about Rails and I think learning an API, coordinating a group work and creating graphics will be enough of a challenge.
The point is to actually learn, that's why it wouldn't be an issue to be yet another Last.fm Timeline clone. I'm confident that with the knowledge we get from this we may be able to do even more cooler things than LastGraph.
A minimal step-by-step could be something like this:
But, what the heck? If enough of a group joins in, who knows which direction this project could take?
If you look at RubyGems, chef has a strong lead:
Plenty of people don't install either via gem
. Chef's recommended installation is Omnibus, which downloads straight from Opscode's website.
In both Ruby and Python, Source code cannot be synthesised from the internal representation. You can make a bytecode parser for YARV that produces Ruby code, but it won't be the source code, and it will probably be a lot of work. For Ruby, you may want to take a look at this.
Sadly, Python doesn't have an internal representation; CPython has one that is accessible to C modules (and in it you can thus unexec), but not for python programs. Other Python implementations will naturally have other internal representations.
WebForms is a huge fails for www (although it is very suitable for intranet).
Well, when .Net MVC arrives? RoR is here since 2004 year.
Masterpage? How much it differs from app/views/layout/application.html.erb
:) and take a look to cells
Layout for pages, huge usage of clientside javascript, active record pattern for database access, database migrations, REST, HAML style templates, compilers for CSS (LESS and SASS/SCSS) - this patterns become main stream in web development because of RoR (and I believe, even more, but I'm not the expert)
About .Net size: with ruby you have thousands of gems, which solves > 95% of web application creator's needs. (but to search for them, you'd better use Google: 'rails authorization', 'rails authentication', 'activemerchant' and others) . So that, I can clearly say: Rails have really huge ecosystem.
I'm saying you should try to find and fix the performance problems.
Many C extensions provide Java counterparts which provide similar performance. The JSON gem, for example, is actually authored in an FSM language called Ragel, and it's capable of generating both C and Java backends, which is exactly how the JSON gem is implemented. You'll note there's a -java version of the same gem which is generated from the same Ragel source code:
Many gems which use C extensions also provide Java extensions. Nokogiri is another notable example. When I benchmarked Nokogiri's C versus Java backends, the Java backend was actually faster:
Hey, I don't think your code is all that bad. It looks like you have not done any coding before ?!? Of course there is always a way to do things better, but you've solved the problem you initially had - me thinks ;-)
Anyhow, the best way to get better at coding is to look at other people's stuff. Look at some simple gems and are popular. You can get an indication on rubygems.org for the popular ones, browse github, or just get one of the well written books for Ruby (amazon might be your friend here).
Also, you may know this already: ask the community. reddit is a good place, but I think if you head over to the ruby forum or rails forum people will not be as critical with beginners code ;-)
I guess its one of those things you have to experience to find out.
Pro's:
Cons:
I personally use some of these tools, it's also a case of scalability, take the extra bit of time at the start to set things up right and you will save in the long run, big time. Of course this only really applies to medium and large projects, and WordPress doesn't often fit into that.
Thanks for the YQL and Movies table lead. Unfortunately that API is only returning 3 movies per zipcode query when I try it. I think it's a limitation by Google on the iGoogle widget API it's using.
The Google Showtimes gem I've been testing is a scrapper so it's been getting all the movies that Google Movies lists in each location.
I am somewhat using this as an excuse to learn more about server-side applications, so I'll think about adding database functionality. Maybe implement users and authentication to allow the schedules to be saved, etc.?
Put the DLL in the "bin" directory under your ruby installation dir. Note also that the binaries on that page are sqlite version 3.x which means you need sqlite3-ruby which is a different gem than the one named sqlite-ruby which is for 2.x.
Although there are already many other respectable commenting gems out there, I created this gem to unify duplicate commenting code from an existing application.
After tackling the learning curve of how gems work and the concepts of Rails Engines the gem is working great.
I'm using Jeweler to manage the basic gem tasks. It also takes care of releasing the gem to rubygems
It includes generators to have custom views and even can install an override controller into the app to customize how loudmouth functions.
tl;dr: a commenting gem. first gem == hard but great experience
Man, I meant to upgrade my system's gems and accidentally upgraded RubyGems. Didn't understand what all the talk was about until I upgraded and now everything I do in the console has to flood me with deprecation messages.
Not sure how anyone can consider this usable. Possessing only moderate experience with Ruby, I don't know much about the intricacies of things like gems. The appeal of gems was always that they just work. Reading the related fallout about new RubyGems, it seems like the onus is on me and the developers of the gems I use to stop the deprecation messages. the 'pristine' commands don't fix anything for me. Not everyone using RubyGems is an experienced developer, and I'm certain a small minority has even ever posted an issue on an issue tracker before.
I'll [try to] try SlimGems out.
dan@crunchbang$ sudo gem install slimgems ERROR: Could not find a valid gem 'slimgems' (>= 0) in any repository ERROR: Possible alternatives: allgems, plugems, singem, sitges, slippers
dan@crunchbang$ gem sources *** CURRENT SOURCES *** http://rubygems.org/ http://gems.github.com
Anyone know why slimgems can't be found?
> IMO Nokogiri is the best thing that's happened to Ruby since sliced cheese.
Nokogiri: found this at rubyforge and this at rubygems. (Why 2 different places?)
Unable to find the SlicedCheese gem you mentioned though. ... ( kidding ;) )
Since you didn't mention it, and it's quite new, you might have a look at http://rubygems.org/gems/rubygems-test
This is endorsed by drbrain (rubygems developer / maintainer) and seems like an emerging best practice for gem development.
Whoever wrote that code isn't familiar with Ruby because it's not packaged as a gem. That means gem install ...
isn't going to work.
I can tell this because the code for a Ruby gem should come with a gemspec
file, containing information about how to build and install the gem. They should then publish the gem package to http://rubygems.org, which is where gem install
looks when installing gems.
So, alas, there's no easy way to use the code in that repository short of copying it into your project repository.
The most primary reason for packaging (Ruby, etc.) software is to enable it to run, hassle-free, on machines other than the one the software was developed upon. The primary features that packaging manages for you:
You need these features. You can try to hand-roll them yourself, or you can rely on standard package management tooling. There is an initial investment to be made, in terms of learning the package tooling and structure, but it pays off when the number of non-local execution environments scales beyond, say N=2.
Also note that you can build packages and distribute them on your own, without publicly releasing them on http://rubygems.org/
I get this on my Windows laptop as well. I'm not sure of the exact reasoning behind the error, but I do know the fix:
gem sources -r https://rubygems.org/ gem sources -a http://rubygems.org/
This disables the HTTPS connection and uses plain HTTP, because Windows doesn't like the SSL certificate used by rubygems.org. You should then be able to proceed as normal and install your gems.
I once tried a tool which allowed to write CloudFormation templates in YAML and thereafter convert them to JSON but I forgot its name.
EDIT: I tried to find it but found this instead http://rubygems.org/gems/aws-cfn-yats
ActiveJob is currently available only for rails 4.2 , it API changed since we moved it from rails/activejob.
The gem is actually published http://rubygems.org/gems/activejob/versions/4.2.0.beta1
I'm going to look if we can change dependency to 4.1+ for beta2
You can really build anything in rails to be honest. Sure if you are building something that takes 5 minutes to run, your request will probably time out, but that's just HTTP not really rails. It's just a tool to help you build stuff. Often those stuffs are things that help people do something via HTTP requests and HTML documents.
Look into building something of your own first. Getting into open source is always really awesome, but it's hard. Depending on the reviewer / community the quality requirements might be really high and you might get really frustrated if you are new, simply because you'll be making mistakes.
This is to be expected, it's part of learning. Instead just build some dumb toys. Maybe take the defacto "starting programming" examples and make a blog, or news aggregator or social network or whatever. If that doesn't get your fancy, look into building something you'd want.
Some buddies and I are building a Rails app that "integrates" with a service we use all the time. It's really more of a scraper that uses some of their ghetto APIs, but it's a good time. They are having fun building it, and I get to teach while it's going on.
Dumb/toy projects also give you a chance to go out and try crazy stuff you'd never do with a real production app. I'm using agent for some async stuff and it's been pretty fun and a good learning experience for myself as well.
Emacs-based in the historical sense; I think Emacs was (one of) the first clients. A quick search for "emacs" in the repo brings up a number of references (eg here) to El4R, an Emacs-to-Ruby bridge. And the author maintains the non-abandoned version of El4R.
Anyway, choosing Ruby was probably a smart decision, because it should make supporting other editors easier.
Plus, from the Kickstarter page: > Currently the Aquamacs and Emacs Xiki plugins are fully supported, and async commands can run in the text editor window. For Sublime and Vim, Xiki will send async commands to an external terminal app to run them (iTerm or Terminal.app on OSX).
You can use either something free like testflight:
a better and paid service like hockeyapp:
or, you can use something like this ruby gem if you have your own server for deployment:
http://rubygems.org/gems/combat
Considering you're a rookie, I'd go with one of the first two options, depending on your available funds.
A fraction of those downloads are thanks to web crawlers that ignore robots.txt
. I'm a bit sceptical that actual people downloaded the 80ae2fe5c929b7d0a00bdee2d710fa9e gem ~900 times.
Of course. Ruby has a packaging system called RubyGems and there are tens of thousands of gems available for usage. I wouldn't be surprised if people's various gems made up the bulk of all the Ruby projects at Github, where Ruby is the second most-used language.
One downside to VisualRuby, is it uses the gtk2 gem, which requires a compiler and many other GTK libraries/headers, in order to build it's C-extensions. Although, I believe the gtk2 rubygem has been re-packaged as .deb
/ .rpm
packages available on Ubuntu/Fedora.
Likewise, however I'd say Ruby has much more in common w/ JavaScript than it does PHP. I did dozens of PHP projects before biting the bullet and going w/ RoR, and haven't looked back.
One thing that drew me to Rails was Haml. Even if you're adverse to picking up new languages/frameworks, it's insanely easy and I found the benefit to be mind-blowing. Then there's the gems, open-source modules/packages that are installed via a single terminal command. I'm not a Rails coder by trade nor hobby, but I can't stress enough how much of an improvement is over PHP (language + frameworks).
You can parse YAML without having to eval potentially malicious Ruby code, which would be a problem for rubygems.org. In fact, you can represent all of the information from your gemspec as pure-YAML.
This library seems to be very similar in concept to VCR, except that it's got more modular storage engines (Redis, Memcached, or memory vs just the filesystem). I understand that VCR is primarily used for stubbing requests in a test environment, but there's nothing stopping you from using it in other environments, if necessary. Why put the effort into creating web instead of possibly extending VCR?
Interesting new features. I'm wondering if signal support and and delta tracking can be combined into something like mongoid-history (or is such a feature already available for the Python drivers?).
Yeah, I'm having the same issue today. My mac is working fine, but my Ubuntu box is borked. I can get to rubygems.org just fine. They're both RVM systems, I've tried with a number of 1.8.7 builds now.
mike@mike-desktop:~/src/tracks$ gem update --system ERROR: While executing gem ... (Gem::RemoteFetcher::FetchError) SocketError: getaddrinfo: Name or service not known (http://rubygems.org/latest_specs.4.8.gz)
Sounds like you're missing some gems. Which are the equivalent to cpan modules or eggs if your a python guy. Without knowing much about your setup typically you would run gem install <gemname> to install a gem you need.
That being said for your program to already be working, I'm wondering why it's saying you're missing some when you try to run console. Be sure to run the commands as the same user who owns the files, it's possible they are bundled under that usernames home directory.
Other wise you want to run gem install sqlite3 for example to install the sqlite3 gem.
Again depending on your setup you may want to use your distros packages for these gems you need instead. It's hard to give you the correct advice not knowing how things were set up in the first place. If you're missing irb, this typically comes with ruby but if not you will need to install it.
I just googled centos +irb and it looks like irb comes as it's own package there, so that would probably be the same for redhat and fedora. You'll have to do some research depending on what you run.
Once you figure out the dependency issues you are going to want to go back and run the following.
RAILS_ENV="production" script/console
Be sure to run console not dbconsole, dbconsole will want you to edit the sql by hand and this is not want you want to do here.
Let me know if I can be more of a hand.