Les deux révisions précédentesRévision précédenteProchaine révision | Révision précédente |
issue79:c_c [2014/03/21 17:19] – [1] frangi | issue79:c_c [2014/04/05 15:08] (Version actuelle) – andre_domenech |
---|
==== 1 ==== | ==== 1 ==== |
** | ** |
Early in December I was spending some time working on a website that will eventually become my website for my freelance IT business. I started off using Bolt CMS and ended up with a design I quite liked, and overall, Bolt did everything I wanted. However, it did a lot more than I needed as well, and I have slight reservations for using a blog-oriented CMS to manage the content of a web page. Instead, I decided to give Ruby on Rails a shot, to see which option I would ultimately go with. I had previously spent a while learning both Ruby and Ruby on Rails, so jumping in wasn't quite as daunting. This month's article is for anyone hesitating about diving in, and for anyone interested in web design who would like to pick up some new skills. | If you've been a long-time reader, you may have noticed my apparent lack of interest in typical desktop Environments – KDE, GNOME, Unity, XFCE, LXDE, etc. In reality, I used to run GNOME 2 on my workstations, but since the introduction of GNOME 3, I've been running lightweight window managers (openbox, XMonad, awesomeWM, etc) instead. The reason for this is simple – I have no interest in having to pull up an overlay and waste processing power on fancy effects in order to use my computer – and GNOME 3 generally requires more of this than any other desktop environment I've ever used. If you're in the same boat as me – generally unhappy with the desktop environments present today, then you'll be happy to know that, this month, I'm going to cover a desktop environment I am quite happy with now: Cinnamon. |
** | |
| |
Au début Décembre, je passais du temps à travailler sur un site web qui deviendra finalement le site web pour mon entreprise d'indépendant en informatique. J'ai débuté avec Bolt CMS et terminé avec une conception que j'aimais bien, et dans l'ensemble, Bolt a fait tout ce que je voulais. Mais, il a aussi fait beaucoup plus que ce dont j'avais besoin, et j'ai de légères réserves sur l'utilisation d'un CMS [en français SGC Système de Gestion de Contenu] conçu pour les blogs, pour gérer le contenu d'une page web. Au lieu de cela, j'ai décidé de jeter un oeil à Ruby on Rails, pour voir quelle option je choisirai finalement. J'avais déjà passé un certain temps d'apprentissage à la fois sur Ruby et Ruby on Rails, donc plonger dedans n'était pas très intimidant. L'article de ce mois est pour tous ceux qui hésitent à sauter le pas, et pour quiconque s'intéressant à la conception web et qui voudraient prendre quelques nouvelles compétences. | What is it? |
| |
| It's a fork (you can think of it as a TV show spinoff) of GNOME 3, but with the intention of acting more like GNOME 2. If you've ever used Linux Mint when it was still running GNOME 2, you should have an idea what to expect: A single panel, a menu, and a layout vaguely similar to the typical Windows experience, or most LXDE experiences. |
** | ** |
Prerequisites | |
| |
The ruby package must be installed before using Rails. The current one in Ubuntu is version 1.9.2 (package: ruby1.9.1). The current version is actually 2.0.0-p353, so it may be better to install ruby-rvm (ruby version manager), and use that to install/manage your ruby versions. For anyone who needs to install it in other operating systems too, there are good instructions here: https://www.ruby-lang.org/en/downloads/ | Si vous êtes un lecteur de longue date, vous avez sans doute remarqué mon manque d'intérêt apparent pour les environnements de bureau classique (KDE, GNOME, Unity, XFCE, LXDE, etc.). En réalité, j'avais l'habitude d'utiliser GNOME 2 sur mes postes de travail, mais, depuis l'introduction de GNOME 3, j'utilise des gestionnaires de fenêtre légers (openbox, XMonad, awesomeWM, etc.) à la place. La raison en est simple : je n'ai aucun intérêt à devoir afficher une sur-couche et gaspiller de la puissance de traitement avec des effets visuels pour pouvoir utiliser mon ordinateur ; GNOME 3 en nécessite généralement plus que n'importe quel autre environnement de bureau que j'ai déjà utilisé. Si vous êtes dans la même galère que moi : généralement mécontent des environnements de bureau disponibles aujourd'hui, alors vous serez heureux de savoir que, ce mois-ci, je vais écrire un article sur un environnement de bureau qui me plaît beaucoup : Cinnamon. |
| |
| Qu'est-ce que c'est ? |
| |
| C'est une branche (un peu comme une série TV dérivée) de GNOME 3, mais avec l'intention de fonctionner plus comme GNOME 2. Si vous avez déjà utilisé Linux Mint quand il était encore sous GNOME 2, vous devriez avoir une idée de ce à quoi vous attendre : Un seul panneau, un menu et une mise en page vaguement similaire à l'expérience Windows typique ou à la plupart des expériences LXDE. |
| |
Rails installation instructions: http://rubyonrails.org/download | |
** | ** |
| How do I get it? |
| |
Prérequis | It's in the universe repository – simply running sudo apt-get install cinnamon should be all you need. I'm happy with my current desktop environment/window manager – why should I switch? I'm also quite happy with my AwesomeWM setup, and haven't switched to cinnamon myself – instead, I decided to use Cinnamon and ArchLinux for an older laptop I loaned out to a guest for his stay at my home. I do, however, use Nemo (Cinnamon's file manager) in my AwesomeWM setup. If you're supplying a Linux-based computer to someone accustomed to Windows, this may be a nice solution for you. Where's Cinnamon's Display Manager (Login Window)? Cinnamon does not supply it's own display manager (as far as I know). However, it works nicely with any of the desktop managers you might use – including lightdm in Ubuntu, or Gnome Display Manager (GDM). Simply choose the correct session when logging in. |
| ** |
| |
Le paquet rubis doit être installé avant d'utiliser Rails. Le paquet actuel dans Ubuntu est une version 1.9.2 (paquet: ruby1.9.1). La version actuelle est en fait 2.0.0-p353, donc il peut être préférable d'installer rubis-rvm (rubis version manager), et l'utiliser pour installer et gérer vos versions de rubis. Pour ceux qui ont besoin de l'installer dans d'autres systèmes d'exploitation aussi, il y a de bonnes instructions ici : https://www.ruby-lang.org/en/downloads/ | Comment se le procurer ? |
| |
| C'est dans les dépôts universe : lancer simplement sudo apt-get install cinnamon devrait suffire. Je suis heureux avec mon environnement de bureau ou gestionnaire de fenêtres actuel : pourquoi devrais-je en changer? Je suis également très heureux avec AwesomeWM et je n'ai pas changé pour Cinnamon moi-même. En fait, j'ai décidé d'utiliser Cinnamon et ArchLinux pour un assez vieil ordinateur portable que j'ai prêté à un invité pendant son séjour chez moi. Toutefois, j'utilise Nemo (le gestionnaire de fichiers de Cinnamon) dans mon installation de AwesomeWM. Si vous proposez un ordinateur basé sur Linux à quelqu'un habitué à Windows, cela peut être une bonne solution. Où est le gestionnaire d'affichage de Cinnamon (La fenêtre de connexion) ? Cinnamon ne fournit pas son propre gestionnaire d'affichage (pour autant que je sache). Mais, il fonctionne très bien avec l'un des gestionnaires d'affichage que vous pourriez utiliser, y compris lightdm dans Ubuntu ou Gnome Display Manager (GDM). Il suffit de choisir la bonne session lorsque vous vous connectez. |
| |
Rails instructions d'installation : http://rubyonrails.org/download | |
| |
==== 2 ==== | ==== 2 ==== |
** | ** |
Ruby on Rails – What is it? | How can I get it if I'm installing Linux? |
| |
Ruby on Rails is a framework designed in Ruby to make the generation of complex websites much easier. It's designed with the idea in mind that a programmer can focus on convention over configuration, while still designing the website they originally had in mind. | Linux Mint are the creators of Cinnamon, and as such it's offered on their liveCD. For anyone who doesn't know, Linux Mint is based off Ubuntu. The latest release is Version 15 (codename “Olivia”), and will be supported until January 2014 (though following the 6-month release cycle, there should be a new release soon). The downloads can be found here: http://www.linuxmint.com/download.php. As you can see, there are plenty of options for desktop environments, with Cinnamon at the top of the list. If you prefer to use your own version of Linux (be it ArchLinux, Ubuntu, Debian, or anything else), you can simply install the package after installing the system. |
| |
Ruby on Rails – Why should I try it? | Where can I find new themes for it? |
• By default it uses SCSS for its stylesheets, allowing for cleaner formatting in your stylesheets (it's automatically parsed to css when running the server). | |
• Integrates a server setup, which can be started with “rails server” or “rails s”, and polls for changes to the files, while serving up your website on localhost:3000 (port 3000, by default). Naturally, this can also be used in a production environment with an actual domain. | Most theme sites should carry some Cinnamon themes, but the best listing I have found is on the Cinnamon website: http://cinnamon- spices.linuxmint.com/themes. |
• Allows for easy extensibility by editing the Gemfile. | |
• Has modules for certain tasks (i.e. User authentification) which you can easily add to your own project, and helps to avoid feature overload. | This presents themes from all over the internet, and look very thorough to me. |
** | ** |
| |
Ruby on Rails - Qu'est-ce que c'est? | Comment puis-je l'obtenir si j'installe Linux ? |
| |
Ruby on Rails est un structure conçue en Ruby pour rendre la génération de sites Web complexes beaucoup plus facile. Il est conçu avec l'idée que le programmeur peut se concentrer sur le codage par convention plutôt que sur la configuration, tout en concevant le site qu'il avait à l'esprit à l'origine. | Linux Mint est le créateur de Cinnamon et il est donc offert sur leur liveCD. Pour ceux qui ne le savent pas, Linux Mint est basé sur Ubuntu. La dernière version est la version 15 (nom de code « Olivia ») et sera maintenue jusqu'en janvier 2014 (bien que, suivant le cycle de sorties bi-annuel, il devrait y avoir une nouvelle version bientôt). Les téléchargements peuvent être trouvés ici : http://www.linuxmint.com/download.php. Comme vous pouvez le voir, il y a beaucoup d'options pour les environnements de bureau, avec Cinnamon en tête de liste. Si vous préférez utiliser votre propre version de Linux (que ce soit ArchLinux, Ubuntu, Debian, ou tout autre), vous pouvez tout simplement installer le paquet après l'installation du système. |
| |
Ruby on Rails - Pourquoi devrais-je essayer? | Où puis-je trouver de nouveaux thèmes ? |
• Par défaut, il utilise SCSS pour ses feuilles de style, permettant un mise en forme plus propre dans vos feuilles de style (c'est automatiquement transformé en CSS lors de l'exécution du serveur). | |
• Il intègre une configuration de serveur, qui peut être démarré avec « rails server » ou « rails s », et vérifie régulièrement les modifications apportées aux fichiers, tout en publiant votre site sur localhost:3000 (port 3000 par défaut). Naturellement, on peut également l'utiliser dans un environnement de production avec un domaine réel. | |
• Il permet l'extensibilité facile en éditant le Gemfile. | |
• Il a des modules pour certaines tâches (par exemple l'authentification de l'utilisateur) que vous pouvez facilement ajouter à votre propre projet, et contribue à éviter la surcharge de fonction. | |
| |
** | La plupart des sites de thèmes devraient proposer quelques thèmes de Cinnamon, mais la meilleure liste que j'ai trouvée est sur le site de Cinnamon : http://cinnamon-spices.linuxmint.com/themes. |
• You can create your own classes and controllers, so that only items you actually use are saved in your database. | |
• Error handling – This is a bit subjective, but I find that Rails' approach to throwing errors and debug information is a lot more helpful/cleaner than most other web-based languages. | |
• Large community – odds are you'll be able to find a solution to most of your problems online, and some areas may even have Rails/Ruby meet-ups. | |
• Integrates with Git very well, allowing for clean revision control of your website's code. It can also be used to upload your site to hosts like Heroku, without the need to use FTP. | |
• Includes a routing table, allowing you immense control over the URL formatting and restrictions. | |
** | |
| |
• Vous pouvez créer vos propres classes et contrôleurs, afin que seuls les éléments que vous utilisez réellement soient enregistrés dans votre base de données. | Il présente des thèmes venant de partout sur l'internet et me semble très complet. |
• Gestion des erreurs - C'est un peu subjectif, mais je trouve que l'approche de Rails pour lever les erreurs et les informations de débogage est beaucoup plus utile ou plus propre que la plupart des autres langages sur le Web. | |
• Grandes communautés - Il y a des chances que vous soyez en mesure de trouver en ligne une solution à la plupart de vos problèmes, et certaines régions peuvent même avoir des rencontres Rails/Ruby. | |
• Très bonne intégration avec Git, vous permettant un contrôle propre de la révision du code de votre site web. Il peut également être utilisé pour télécharger votre site vers des hôtes comme Heroku, sans la nécessité d'utiliser FTP. | |
• Il comprend une table de routage, ce qui vous permet un immense contrôle sur le formatage et les restrictions d'URL. | |
| |
==== 2 ==== | |
** | |
Possible hardships: | |
• Very programming-focused – if this isn't your forte and you're not interested in learning, you may very well struggle. | |
• Requires a basic knowledge of Ruby – since Rails uses the Ruby syntax for controllers, models and helpers, it's highly recommended you have a working knowledge of it. However, something like http://tryruby.org/ could be sufficient, if you're willing to refine your knowledge as you work in Rails. | |
• Unless you follow a tutorial for your first project, you may run into issues where you're unsure what to Google, due to the errors being specific to your custom models. | |
• The rails generate command can be slightly confusing at first, especially when it results in rake db:migrate errors. However, once you work your way through one error, you should have a good understanding of how to fix future ones. | |
• If you don't know about SCSS, you will lose out on the benefit of it, but it won't impact your CSS generation. | |
** | ** |
| What about someone who doesn't want a desktop environment? |
| |
| If you're not interested in Cinnamon or any of the other desktop environments I've mentioned, then the following may be helpful: |
| • Do you prefer a typical “floating” layout (á la GNOME/KDE), or would you like to have all open windows |
| on a workspace stack, so they're all visible (tiled)? |
| • If you're going for floating: fluxbox, openbox, icewm, Compiz |
| • If tiling sounds interesting, there are two options: dynamic (tiling is done by the system), or manual(you assign each window a size and position as you like). My preference is dynamic, but you may prefer the extra control. |
| • Dynamic: AwesomeWM, XMonad, DWM |
| • Manual: herbstluftwm, ion3, wmfs There are many, many more that I haven't listed, and not all of them may be available through official repositories, but it's definitely a start. |
** | ** |
You've sold me! Where do I start? | |
| |
The first stop I'd recommend is http://tryruby.org, in order to learn/freshen up on Ruby. Once you've completed that, Code School also offers a free course in Rails, called Rails for Zombies (http://railsforzombies.org). While it may seem silly at points, it is actually a great resource for an introduction to Rails. There are also countless books that cover Ruby on Rails (admittedly, I haven't read any, and as such don't feel I can make a recommendation). | Et si quelqu'un ne veut pas d'environnement de bureau? |
| |
Once you've read up on Rails and have done a tutorial of some sort, be sure to pick out a specific thing you'd like to achieve (i.e. Design a class/controller to handle pages and their content). Then look into the rails generate scaffold command. My only tip here is to make sure you integrate all the variables you'll need from the get-go in the scaffold command. An example command could be: | Si vous n'êtes pas intéressé par Cinnamon ou par l'un des autres environnements de bureau que j'ai mentionnés, ce qui suit peut alors vous être utile : |
| • Préférez-vous une disposition typique « flottante » (à la GNOME/KDE) ou voulez-vous avoir toutes les fenêtres ouvertes sur une pile d'espace de travail, de sorte qu'elles soient toutes visibles (en mosaïque)? |
| • Si vous préférez le flottant : fluxbox, openbox, icewm, Compiz. |
| • Si la mosaïque vous semble intéressante, il y a deux options : dynamique (la mosaïque se fait par le système) ou manuel (vous affectez à chaque fenêtre une taille et une position voulues). Je préfère l'option dynamique, mais vous pouvez préférer le contrôle supplémentaire. |
| • Dynamique : AwesomeWM, xmonad, DWM. |
| • Manuel : herbstluftwm, ion3, wmfs. Il y en a beaucoup, beaucoup plus, que je n'ai pas cités et il ne sont pas tous disponibles via les dépôts officiels, mais voilà c'est un début. |
| |
rails generate scaffold Page title:string content:string slug:string | |
| |
This will generate the controller, model and views required for Page, and configure it to have a title, content, and slug attribute in the database, which you can input through the edit page. Since this article isn't intended to be a detailed how-to, I will leave you with just two more hints: | |
•In the above example, after running the server, you can see your pages by going to http://localhost:3000/pages | |
• Once you've used the scaffold command and have the files, it works best if you then generate specific controllers or models as you need them. To see a full list, type rails generate -h | |
** | ** |
| How can I try it? |
| |
| You can boot the Linux Mint liveCD to try it out without touching your actual system. Or you can simply install it alongside your actual desktop environment and try it out for a while. If you don't like it, simply uninstall it again. |
| |
==== 3 ==== | I hope at least a few readers have found this article interesting – and if you've found a window manager or desktop environment that works for you and I haven't listed, feel free to email me the name and a screenshot. If I see some interesting ones, I'll post an article highlighting a few. If anyone has questions, suggestions, |
| comments, or requests for articles, feel free to email me at lswest34+fcm@gmail.com. |
** | ** |
It still seems kind of daunting - can I really do this? | |
| |
Titre : Ruby on Rails | Comment puis-je essayer? |
| |
If you want a success story, the one that first jumps to mind is the creator of Freelancify, who learned Ruby on Rails in 12 weeks (specifically, from the time he began learning Ruby on Rails and the time he put Freelancify online was 12 weeks). According to his blog post, he wasn't a programmer at all before jumping into Ruby on Rails. | Vous pouvez lancer le liveCD de Linux Mint pour l'essayer sans toucher à votre système actuel. Ou vous pouvez tout simplement l'installer à côté de votre environnement de bureau réel et l'essayer pendant un moment. Si vous ne l'aimez pas, il suffit de le désinstaller. |
| |
Source: http://www.jamesfend.com/learned-ruby-rails-12-weeks-launch-freelancify | J'espère qu'au moins quelques lecteurs auront trouvé cet article intéressant - et, si vous avez trouvé un gestionnaire de fenêtres ou un environnement de bureau qui vous convient et que je n'ai pas cité, n'hésitez pas à m'en envoyer le nom et une capture d'écran par mail. Si j'en vois d'intéressants, je les présenterai dans un article. Si vous avez des questions, des suggestions, des commentaires ou des demandes d'article, n'hésitez pas à m'écrire à lswest34+fcm@gmail.com. |
| |
Will you be doing a tutorial on how to set up Rails? | |
| |
While I find the Ruby on Rails documentation is excellent, and there are some guides online as well, I can understand if some people prefer an up-to-date step-by-step guide from me. If that's the case, let me know in an email at lswest34+fcm@gmail.com and I will happily cover setting up Rails 4.0.2 and getting a project started. | |
| |
As always, I hope you've found this article interesting, and that I have enticed one or two of you into trying Ruby on Rails. If you have any comments, questions, suggestions or requests, you're welcome to contact me at lswest34+fcm@gmail.com. I'd also be happy to hear about any experiences with Ruby or Ruby on Rails you've had. | |
** | |