Commit e2dcc19c451cf821637178fe987945d065ba3a29
1 parent
aa59ba15
Exists in
master
and in
23 other branches
ActionItem918: fixing copyright and authors information
Showing
4 changed files
with
270 additions
and
273 deletions
Show diff stats
COPYING
| 1 | - | |
| 2 | - GNU GENERAL PUBLIC LICENSE | |
| 3 | - Version 3, 29 June 2007 | |
| 1 | + GNU AFFERO GENERAL PUBLIC LICENSE | |
| 2 | + Version 3, 19 November 2007 | |
| 4 | 3 | |
| 5 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> |
| 6 | 5 | Everyone is permitted to copy and distribute verbatim copies |
| 7 | 6 | of this license document, but changing it is not allowed. |
| 8 | 7 | |
| 9 | - Preamble | |
| 8 | + Preamble | |
| 10 | 9 | |
| 11 | - The GNU General Public License is a free, copyleft license for | |
| 12 | -software and other kinds of works. | |
| 10 | + The GNU Affero General Public License is a free, copyleft license for | |
| 11 | +software and other kinds of works, specifically designed to ensure | |
| 12 | +cooperation with the community in the case of network server software. | |
| 13 | 13 | |
| 14 | 14 | The licenses for most software and other practical works are designed |
| 15 | 15 | to take away your freedom to share and change the works. By contrast, |
| 16 | -the GNU General Public License is intended to guarantee your freedom to | |
| 16 | +our General Public Licenses are intended to guarantee your freedom to | |
| 17 | 17 | share and change all versions of a program--to make sure it remains free |
| 18 | -software for all its users. We, the Free Software Foundation, use the | |
| 19 | -GNU General Public License for most of our software; it applies also to | |
| 20 | -any other work released this way by its authors. You can apply it to | |
| 21 | -your programs, too. | |
| 18 | +software for all its users. | |
| 22 | 19 | |
| 23 | 20 | When we speak of free software, we are referring to freedom, not |
| 24 | 21 | price. Our General Public Licenses are designed to make sure that you |
| ... | ... | @@ -27,57 +24,47 @@ them if you wish), that you receive source code or can get it if you |
| 27 | 24 | want it, that you can change the software or use pieces of it in new |
| 28 | 25 | free programs, and that you know you can do these things. |
| 29 | 26 | |
| 30 | - To protect your rights, we need to prevent others from denying you | |
| 31 | -these rights or asking you to surrender the rights. Therefore, you have | |
| 32 | -certain responsibilities if you distribute copies of the software, or if | |
| 33 | -you modify it: responsibilities to respect the freedom of others. | |
| 34 | - | |
| 35 | - For example, if you distribute copies of such a program, whether | |
| 36 | -gratis or for a fee, you must pass on to the recipients the same | |
| 37 | -freedoms that you received. You must make sure that they, too, receive | |
| 38 | -or can get the source code. And you must show them these terms so they | |
| 39 | -know their rights. | |
| 40 | - | |
| 41 | - Developers that use the GNU GPL protect your rights with two steps: | |
| 42 | -(1) assert copyright on the software, and (2) offer you this License | |
| 43 | -giving you legal permission to copy, distribute and/or modify it. | |
| 44 | - | |
| 45 | - For the developers' and authors' protection, the GPL clearly explains | |
| 46 | -that there is no warranty for this free software. For both users' and | |
| 47 | -authors' sake, the GPL requires that modified versions be marked as | |
| 48 | -changed, so that their problems will not be attributed erroneously to | |
| 49 | -authors of previous versions. | |
| 50 | - | |
| 51 | - Some devices are designed to deny users access to install or run | |
| 52 | -modified versions of the software inside them, although the manufacturer | |
| 53 | -can do so. This is fundamentally incompatible with the aim of | |
| 54 | -protecting users' freedom to change the software. The systematic | |
| 55 | -pattern of such abuse occurs in the area of products for individuals to | |
| 56 | -use, which is precisely where it is most unacceptable. Therefore, we | |
| 57 | -have designed this version of the GPL to prohibit the practice for those | |
| 58 | -products. If such problems arise substantially in other domains, we | |
| 59 | -stand ready to extend this provision to those domains in future versions | |
| 60 | -of the GPL, as needed to protect the freedom of users. | |
| 61 | - | |
| 62 | - Finally, every program is threatened constantly by software patents. | |
| 63 | -States should not allow patents to restrict development and use of | |
| 64 | -software on general-purpose computers, but in those that do, we wish to | |
| 65 | -avoid the special danger that patents applied to a free program could | |
| 66 | -make it effectively proprietary. To prevent this, the GPL assures that | |
| 67 | -patents cannot be used to render the program non-free. | |
| 27 | + Developers that use our General Public Licenses protect your rights | |
| 28 | +with two steps: (1) assert copyright on the software, and (2) offer | |
| 29 | +you this License which gives you legal permission to copy, distribute | |
| 30 | +and/or modify the software. | |
| 31 | + | |
| 32 | + A secondary benefit of defending all users' freedom is that | |
| 33 | +improvements made in alternate versions of the program, if they | |
| 34 | +receive widespread use, become available for other developers to | |
| 35 | +incorporate. Many developers of free software are heartened and | |
| 36 | +encouraged by the resulting cooperation. However, in the case of | |
| 37 | +software used on network servers, this result may fail to come about. | |
| 38 | +The GNU General Public License permits making a modified version and | |
| 39 | +letting the public access it on a server without ever releasing its | |
| 40 | +source code to the public. | |
| 41 | + | |
| 42 | + The GNU Affero General Public License is designed specifically to | |
| 43 | +ensure that, in such cases, the modified source code becomes available | |
| 44 | +to the community. It requires the operator of a network server to | |
| 45 | +provide the source code of the modified version running there to the | |
| 46 | +users of that server. Therefore, public use of a modified version, on | |
| 47 | +a publicly accessible server, gives the public access to the source | |
| 48 | +code of the modified version. | |
| 49 | + | |
| 50 | + An older license, called the Affero General Public License and | |
| 51 | +published by Affero, was designed to accomplish similar goals. This is | |
| 52 | +a different license, not a version of the Affero GPL, but Affero has | |
| 53 | +released a new version of the Affero GPL which permits relicensing under | |
| 54 | +this license. | |
| 68 | 55 | |
| 69 | 56 | The precise terms and conditions for copying, distribution and |
| 70 | 57 | modification follow. |
| 71 | 58 | |
| 72 | - TERMS AND CONDITIONS | |
| 59 | + TERMS AND CONDITIONS | |
| 73 | 60 | |
| 74 | 61 | 0. Definitions. |
| 75 | 62 | |
| 76 | - "This License" refers to version 3 of the GNU General Public License. | |
| 63 | + "This License" refers to version 3 of the GNU Affero General Public License. | |
| 77 | 64 | |
| 78 | 65 | "Copyright" also means copyright-like laws that apply to other kinds of |
| 79 | 66 | works, such as semiconductor masks. |
| 80 | - | |
| 67 | + | |
| 81 | 68 | "The Program" refers to any copyrightable work licensed under this |
| 82 | 69 | License. Each licensee is addressed as "you". "Licensees" and |
| 83 | 70 | "recipients" may be individuals or organizations. |
| ... | ... | @@ -510,7 +497,7 @@ actual knowledge that, but for the patent license, your conveying the |
| 510 | 497 | covered work in a country, or your recipient's use of the covered work |
| 511 | 498 | in a country, would infringe one or more identifiable patents in that |
| 512 | 499 | country that you have reason to believe are valid. |
| 513 | - | |
| 500 | + | |
| 514 | 501 | If, pursuant to or in connection with a single transaction or |
| 515 | 502 | arrangement, you convey, or propagate by procuring conveyance of, a |
| 516 | 503 | covered work, and grant a patent license to some of the parties |
| ... | ... | @@ -550,35 +537,45 @@ to collect a royalty for further conveying from those to whom you convey |
| 550 | 537 | the Program, the only way you could satisfy both those terms and this |
| 551 | 538 | License would be to refrain entirely from conveying the Program. |
| 552 | 539 | |
| 553 | - 13. Use with the GNU Affero General Public License. | |
| 540 | + 13. Remote Network Interaction; Use with the GNU General Public License. | |
| 541 | + | |
| 542 | + Notwithstanding any other provision of this License, if you modify the | |
| 543 | +Program, your modified version must prominently offer all users | |
| 544 | +interacting with it remotely through a computer network (if your version | |
| 545 | +supports such interaction) an opportunity to receive the Corresponding | |
| 546 | +Source of your version by providing access to the Corresponding Source | |
| 547 | +from a network server at no charge, through some standard or customary | |
| 548 | +means of facilitating copying of software. This Corresponding Source | |
| 549 | +shall include the Corresponding Source for any work covered by version 3 | |
| 550 | +of the GNU General Public License that is incorporated pursuant to the | |
| 551 | +following paragraph. | |
| 554 | 552 | |
| 555 | 553 | Notwithstanding any other provision of this License, you have |
| 556 | 554 | permission to link or combine any covered work with a work licensed |
| 557 | -under version 3 of the GNU Affero General Public License into a single | |
| 555 | +under version 3 of the GNU General Public License into a single | |
| 558 | 556 | combined work, and to convey the resulting work. The terms of this |
| 559 | 557 | License will continue to apply to the part which is the covered work, |
| 560 | -but the special requirements of the GNU Affero General Public License, | |
| 561 | -section 13, concerning interaction through a network will apply to the | |
| 562 | -combination as such. | |
| 558 | +but the work with which it is combined will remain governed by version | |
| 559 | +3 of the GNU General Public License. | |
| 563 | 560 | |
| 564 | 561 | 14. Revised Versions of this License. |
| 565 | 562 | |
| 566 | 563 | The Free Software Foundation may publish revised and/or new versions of |
| 567 | -the GNU General Public License from time to time. Such new versions will | |
| 568 | -be similar in spirit to the present version, but may differ in detail to | |
| 564 | +the GNU Affero General Public License from time to time. Such new versions | |
| 565 | +will be similar in spirit to the present version, but may differ in detail to | |
| 569 | 566 | address new problems or concerns. |
| 570 | 567 | |
| 571 | 568 | Each version is given a distinguishing version number. If the |
| 572 | -Program specifies that a certain numbered version of the GNU General | |
| 569 | +Program specifies that a certain numbered version of the GNU Affero General | |
| 573 | 570 | Public License "or any later version" applies to it, you have the |
| 574 | 571 | option of following the terms and conditions either of that numbered |
| 575 | 572 | version or of any later version published by the Free Software |
| 576 | 573 | Foundation. If the Program does not specify a version number of the |
| 577 | -GNU General Public License, you may choose any version ever published | |
| 574 | +GNU Affero General Public License, you may choose any version ever published | |
| 578 | 575 | by the Free Software Foundation. |
| 579 | 576 | |
| 580 | 577 | If the Program specifies that a proxy can decide which future |
| 581 | -versions of the GNU General Public License can be used, that proxy's | |
| 578 | +versions of the GNU Affero General Public License can be used, that proxy's | |
| 582 | 579 | public statement of acceptance of a version permanently authorizes you |
| 583 | 580 | to choose that version for the Program. |
| 584 | 581 | |
| ... | ... | @@ -619,9 +616,9 @@ an absolute waiver of all civil liability in connection with the |
| 619 | 616 | Program, unless a warranty or assumption of liability accompanies a |
| 620 | 617 | copy of the Program in return for a fee. |
| 621 | 618 | |
| 622 | - END OF TERMS AND CONDITIONS | |
| 619 | + END OF TERMS AND CONDITIONS | |
| 623 | 620 | |
| 624 | - How to Apply These Terms to Your New Programs | |
| 621 | + How to Apply These Terms to Your New Programs | |
| 625 | 622 | |
| 626 | 623 | If you develop a new program, and you want it to be of the greatest |
| 627 | 624 | possible use to the public, the best way to achieve this is to make it |
| ... | ... | @@ -636,41 +633,29 @@ the "copyright" line and a pointer to where the full notice is found. |
| 636 | 633 | Copyright (C) <year> <name of author> |
| 637 | 634 | |
| 638 | 635 | This program is free software: you can redistribute it and/or modify |
| 639 | - it under the terms of the GNU General Public License as published by | |
| 636 | + it under the terms of the GNU Affero General Public License as published by | |
| 640 | 637 | the Free Software Foundation, either version 3 of the License, or |
| 641 | 638 | (at your option) any later version. |
| 642 | 639 | |
| 643 | 640 | This program is distributed in the hope that it will be useful, |
| 644 | 641 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 645 | 642 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 646 | - GNU General Public License for more details. | |
| 643 | + GNU Affero General Public License for more details. | |
| 647 | 644 | |
| 648 | - You should have received a copy of the GNU General Public License | |
| 645 | + You should have received a copy of the GNU Affero General Public License | |
| 649 | 646 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 650 | 647 | |
| 651 | 648 | Also add information on how to contact you by electronic and paper mail. |
| 652 | 649 | |
| 653 | - If the program does terminal interaction, make it output a short | |
| 654 | -notice like this when it starts in an interactive mode: | |
| 655 | - | |
| 656 | - <program> Copyright (C) <year> <name of author> | |
| 657 | - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. | |
| 658 | - This is free software, and you are welcome to redistribute it | |
| 659 | - under certain conditions; type `show c' for details. | |
| 660 | - | |
| 661 | -The hypothetical commands `show w' and `show c' should show the appropriate | |
| 662 | -parts of the General Public License. Of course, your program's commands | |
| 663 | -might be different; for a GUI interface, you would use an "about box". | |
| 650 | + If your software can interact with users remotely through a computer | |
| 651 | +network, you should also make sure that it provides a way for users to | |
| 652 | +get its source. For example, if your program is a web application, its | |
| 653 | +interface could display a "Source" link that leads users to an archive | |
| 654 | +of the code. There are many ways you could offer source, and different | |
| 655 | +solutions will be better for different programs; see section 13 for the | |
| 656 | +specific requirements. | |
| 664 | 657 | |
| 665 | 658 | You should also get your employer (if you work as a programmer) or school, |
| 666 | 659 | if any, to sign a "copyright disclaimer" for the program, if necessary. |
| 667 | -For more information on this, and how to apply and follow the GNU GPL, see | |
| 660 | +For more information on this, and how to apply and follow the GNU AGPL, see | |
| 668 | 661 | <http://www.gnu.org/licenses/>. |
| 669 | - | |
| 670 | - The GNU General Public License does not permit incorporating your program | |
| 671 | -into proprietary programs. If your program is a subroutine library, you | |
| 672 | -may consider it more useful to permit linking proprietary applications with | |
| 673 | -the library. If this is what you want to do, use the GNU Lesser General | |
| 674 | -Public License instead of this License. But first, please read | |
| 675 | -<http://www.gnu.org/philosophy/why-not-lgpl.html>. | |
| 676 | - | ... | ... |
COPYRIGHT
| 1 | 1 | noosfero - a free web-based social platform |
| 2 | 2 | |
| 3 | -Copyright (c) 2007-2008, | |
| 3 | +Copyright (c) 2007-2009, | |
| 4 | 4 | Cáritas Brasileira <http://www.caritasbrasileira.org/> |
| 5 | -Copyright (c) 2007-2008, | |
| 5 | +Copyright (c) 2007-2009, | |
| 6 | 6 | Ynternet.org Foundation <http://www.ynternet.org/> |
| 7 | -Copyright (c) 2008, | |
| 7 | +Copyright (c) 2008-2009, | |
| 8 | 8 | Colivre <http://www.colivre.coop.br/> |
| 9 | 9 | |
| 10 | 10 | This program is free software: you can redistribute it and/or modify |
| 11 | -it under the terms of the GNU General Public License as published by | |
| 11 | +it under the terms of the GNU Affero General Public License as published by | |
| 12 | 12 | the Free Software Foundation, either version 3 of the License, or |
| 13 | 13 | (at your option) any later version. |
| 14 | 14 | |
| 15 | 15 | This program is distributed in the hope that it will be useful, |
| 16 | 16 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 17 | 17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 18 | -GNU General Public License for more details. | |
| 18 | +GNU Affero General Public License for more details. | |
| 19 | 19 | |
| 20 | -You should have received a copy of the GNU General Public License | |
| 20 | +You should have received a copy of the GNU Affero General Public License | |
| 21 | 21 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 22 | 22 | |
| 23 | 23 | Please see the file COPYING for the full license text of the GNU General Public | ... | ... |
README
| 1 | -== Welcome to Rails | |
| 1 | +noosfero - a web-based social platform | |
| 2 | +====================================== | |
| 2 | 3 | |
| 3 | -Rails is a web-application and persistence framework that includes everything | |
| 4 | -needed to create database-backed web-applications according to the | |
| 5 | -Model-View-Control pattern of separation. This pattern splits the view (also | |
| 6 | -called the presentation) into "dumb" templates that are primarily responsible | |
| 7 | -for inserting pre-built data in between HTML tags. The model contains the | |
| 8 | -"smart" domain objects (such as Account, Product, Person, Post) that holds all | |
| 9 | -the business logic and knows how to persist themselves to a database. The | |
| 10 | -controller handles the incoming requests (such as Save New Account, Update | |
| 11 | -Product, Show Post) by manipulating the model and directing data to the view. | |
| 4 | +:: About the project | |
| 12 | 5 | |
| 13 | -In Rails, the model is handled by what's called an object-relational mapping | |
| 14 | -layer entitled Active Record. This layer allows you to present the data from | |
| 15 | -database rows as objects and embellish these data objects with business logic | |
| 16 | -methods. You can read more about Active Record in | |
| 17 | -link:files/vendor/rails/activerecord/README.html. | |
| 6 | +Homepage: http://www.noosfero.org/ | |
| 18 | 7 | |
| 19 | -The controller and view are handled by the Action Pack, which handles both | |
| 20 | -layers by its two parts: Action View and Action Controller. These two layers | |
| 21 | -are bundled in a single package due to their heavy interdependence. This is | |
| 22 | -unlike the relationship between the Active Record and Action Pack that is much | |
| 23 | -more separate. Each of these packages can be used independently outside of | |
| 24 | -Rails. You can read more about Action Pack in | |
| 25 | -link:files/vendor/rails/actionpack/README.html. | |
| 8 | +:: Authors and copyright | |
| 26 | 9 | |
| 27 | - | |
| 28 | -== Getting started | |
| 29 | - | |
| 30 | -1. Start the web server: <tt>ruby script/server</tt> (run with --help for options) | |
| 31 | -2. Go to http://localhost:3000/ and get "Welcome aboard: You’re riding the Rails!" | |
| 32 | -3. Follow the guidelines to start developing your application | |
| 33 | - | |
| 34 | - | |
| 35 | -== Web servers | |
| 36 | - | |
| 37 | -Rails uses the built-in web server in Ruby called WEBrick by default, so you don't | |
| 38 | -have to install or configure anything to play around. | |
| 39 | - | |
| 40 | -If you have lighttpd installed, though, it'll be used instead when running script/server. | |
| 41 | -It's considerably faster than WEBrick and suited for production use, but requires additional | |
| 42 | -installation and currently only works well on OS X/Unix (Windows users are encouraged | |
| 43 | -to start with WEBrick). We recommend version 1.4.11 and higher. You can download it from | |
| 44 | -http://www.lighttpd.net. | |
| 45 | - | |
| 46 | -If you want something that's halfway between WEBrick and lighttpd, we heartily recommend | |
| 47 | -Mongrel. It's a Ruby-based web server with a C-component (so it requires compilation) that | |
| 48 | -also works very well with Windows. See more at http://mongrel.rubyforge.org/. | |
| 49 | - | |
| 50 | -But of course its also possible to run Rails with the premiere open source web server Apache. | |
| 51 | -To get decent performance, though, you'll need to install FastCGI. For Apache 1.3, you want | |
| 52 | -to use mod_fastcgi. For Apache 2.0+, you want to use mod_fcgid. | |
| 53 | - | |
| 54 | -See http://wiki.rubyonrails.com/rails/pages/FastCGI for more information on FastCGI. | |
| 55 | - | |
| 56 | -== Example for Apache conf | |
| 57 | - | |
| 58 | - <VirtualHost *:80> | |
| 59 | - ServerName rails | |
| 60 | - DocumentRoot /path/application/public/ | |
| 61 | - ErrorLog /path/application/log/server.log | |
| 62 | - | |
| 63 | - <Directory /path/application/public/> | |
| 64 | - Options ExecCGI FollowSymLinks | |
| 65 | - AllowOverride all | |
| 66 | - Allow from all | |
| 67 | - Order allow,deny | |
| 68 | - </Directory> | |
| 69 | - </VirtualHost> | |
| 70 | - | |
| 71 | -NOTE: Be sure that CGIs can be executed in that directory as well. So ExecCGI | |
| 72 | -should be on and ".cgi" should respond. All requests from 127.0.0.1 go | |
| 73 | -through CGI, so no Apache restart is necessary for changes. All other requests | |
| 74 | -go through FCGI (or mod_ruby), which requires a restart to show changes. | |
| 75 | - | |
| 76 | - | |
| 77 | -== Debugging Rails | |
| 78 | - | |
| 79 | -Have "tail -f" commands running on both the server.log, production.log, and | |
| 80 | -test.log files. Rails will automatically display debugging and runtime | |
| 81 | -information to these files. Debugging info will also be shown in the browser | |
| 82 | -on requests from 127.0.0.1. | |
| 83 | - | |
| 84 | - | |
| 85 | -== Breakpoints | |
| 86 | - | |
| 87 | -Breakpoint support is available through the script/breakpointer client. This | |
| 88 | -means that you can break out of execution at any point in the code, investigate | |
| 89 | -and change the model, AND then resume execution! Example: | |
| 90 | - | |
| 91 | - class WeblogController < ActionController::Base | |
| 92 | - def index | |
| 93 | - @posts = Post.find_all | |
| 94 | - breakpoint "Breaking out from the list" | |
| 95 | - end | |
| 96 | - end | |
| 97 | - | |
| 98 | -So the controller will accept the action, run the first line, then present you | |
| 99 | -with a IRB prompt in the breakpointer window. Here you can do things like: | |
| 100 | - | |
| 101 | -Executing breakpoint "Breaking out from the list" at .../webrick_server.rb:16 in 'breakpoint' | |
| 102 | - | |
| 103 | - >> @posts.inspect | |
| 104 | - => "[#<Post:0x14a6be8 @attributes={\"title\"=>nil, \"body\"=>nil, \"id\"=>\"1\"}>, | |
| 105 | - #<Post:0x14a6620 @attributes={\"title\"=>\"Rails you know!\", \"body\"=>\"Only ten..\", \"id\"=>\"2\"}>]" | |
| 106 | - >> @posts.first.title = "hello from a breakpoint" | |
| 107 | - => "hello from a breakpoint" | |
| 108 | - | |
| 109 | -...and even better is that you can examine how your runtime objects actually work: | |
| 110 | - | |
| 111 | - >> f = @posts.first | |
| 112 | - => #<Post:0x13630c4 @attributes={"title"=>nil, "body"=>nil, "id"=>"1"}> | |
| 113 | - >> f. | |
| 114 | - Display all 152 possibilities? (y or n) | |
| 115 | - | |
| 116 | -Finally, when you're ready to resume execution, you press CTRL-D | |
| 117 | - | |
| 118 | - | |
| 119 | -== Console | |
| 120 | - | |
| 121 | -You can interact with the domain model by starting the console through script/console. | |
| 122 | -Here you'll have all parts of the application configured, just like it is when the | |
| 123 | -application is running. You can inspect domain models, change values, and save to the | |
| 124 | -database. Starting the script without arguments will launch it in the development environment. | |
| 125 | -Passing an argument will specify a different environment, like <tt>script/console production</tt>. | |
| 126 | - | |
| 127 | -To reload your controllers and models after launching the console run <tt>reload!</tt> | |
| 128 | - | |
| 129 | - | |
| 130 | - | |
| 131 | -== Description of contents | |
| 132 | - | |
| 133 | -app | |
| 134 | - Holds all the code that's specific to this particular application. | |
| 135 | - | |
| 136 | -app/controllers | |
| 137 | - Holds controllers that should be named like weblog_controller.rb for | |
| 138 | - automated URL mapping. All controllers should descend from | |
| 139 | - ActionController::Base. | |
| 140 | - | |
| 141 | -app/models | |
| 142 | - Holds models that should be named like post.rb. | |
| 143 | - Most models will descend from ActiveRecord::Base. | |
| 144 | - | |
| 145 | -app/views | |
| 146 | - Holds the template files for the view that should be named like | |
| 147 | - weblog/index.rhtml for the WeblogController#index action. All views use eRuby | |
| 148 | - syntax. This directory can also be used to keep stylesheets, images, and so on | |
| 149 | - that can be symlinked to public. | |
| 150 | - | |
| 151 | -app/helpers | |
| 152 | - Holds view helpers that should be named like weblog_helper.rb. | |
| 153 | - | |
| 154 | -app/apis | |
| 155 | - Holds API classes for web services. | |
| 156 | - | |
| 157 | -config | |
| 158 | - Configuration files for the Rails environment, the routing map, the database, and other dependencies. | |
| 159 | - | |
| 160 | -components | |
| 161 | - Self-contained mini-applications that can bundle together controllers, models, and views. | |
| 162 | - | |
| 163 | -db | |
| 164 | - Contains the database schema in schema.rb. db/migrate contains all | |
| 165 | - the sequence of Migrations for your schema. | |
| 166 | - | |
| 167 | -lib | |
| 168 | - Application specific libraries. Basically, any kind of custom code that doesn't | |
| 169 | - belong under controllers, models, or helpers. This directory is in the load path. | |
| 170 | - | |
| 171 | -public | |
| 172 | - The directory available for the web server. Contains subdirectories for images, stylesheets, | |
| 173 | - and javascripts. Also contains the dispatchers and the default HTML files. | |
| 174 | - | |
| 175 | -script | |
| 176 | - Helper scripts for automation and generation. | |
| 177 | - | |
| 178 | -test | |
| 179 | - Unit and functional tests along with fixtures. | |
| 180 | - | |
| 181 | -vendor | |
| 182 | - External libraries that the application depends on. Also includes the plugins subdirectory. | |
| 183 | - This directory is in the load path. | |
| 10 | +Authors: see file AUTHORS | |
| 11 | +Copyright information: see file COPYRIGHT | |
| 12 | +Full license text; see file COPYING | ... | ... |
| ... | ... | @@ -0,0 +1,183 @@ |
| 1 | +== Welcome to Rails | |
| 2 | + | |
| 3 | +Rails is a web-application and persistence framework that includes everything | |
| 4 | +needed to create database-backed web-applications according to the | |
| 5 | +Model-View-Control pattern of separation. This pattern splits the view (also | |
| 6 | +called the presentation) into "dumb" templates that are primarily responsible | |
| 7 | +for inserting pre-built data in between HTML tags. The model contains the | |
| 8 | +"smart" domain objects (such as Account, Product, Person, Post) that holds all | |
| 9 | +the business logic and knows how to persist themselves to a database. The | |
| 10 | +controller handles the incoming requests (such as Save New Account, Update | |
| 11 | +Product, Show Post) by manipulating the model and directing data to the view. | |
| 12 | + | |
| 13 | +In Rails, the model is handled by what's called an object-relational mapping | |
| 14 | +layer entitled Active Record. This layer allows you to present the data from | |
| 15 | +database rows as objects and embellish these data objects with business logic | |
| 16 | +methods. You can read more about Active Record in | |
| 17 | +link:files/vendor/rails/activerecord/README.html. | |
| 18 | + | |
| 19 | +The controller and view are handled by the Action Pack, which handles both | |
| 20 | +layers by its two parts: Action View and Action Controller. These two layers | |
| 21 | +are bundled in a single package due to their heavy interdependence. This is | |
| 22 | +unlike the relationship between the Active Record and Action Pack that is much | |
| 23 | +more separate. Each of these packages can be used independently outside of | |
| 24 | +Rails. You can read more about Action Pack in | |
| 25 | +link:files/vendor/rails/actionpack/README.html. | |
| 26 | + | |
| 27 | + | |
| 28 | +== Getting started | |
| 29 | + | |
| 30 | +1. Start the web server: <tt>ruby script/server</tt> (run with --help for options) | |
| 31 | +2. Go to http://localhost:3000/ and get "Welcome aboard: You’re riding the Rails!" | |
| 32 | +3. Follow the guidelines to start developing your application | |
| 33 | + | |
| 34 | + | |
| 35 | +== Web servers | |
| 36 | + | |
| 37 | +Rails uses the built-in web server in Ruby called WEBrick by default, so you don't | |
| 38 | +have to install or configure anything to play around. | |
| 39 | + | |
| 40 | +If you have lighttpd installed, though, it'll be used instead when running script/server. | |
| 41 | +It's considerably faster than WEBrick and suited for production use, but requires additional | |
| 42 | +installation and currently only works well on OS X/Unix (Windows users are encouraged | |
| 43 | +to start with WEBrick). We recommend version 1.4.11 and higher. You can download it from | |
| 44 | +http://www.lighttpd.net. | |
| 45 | + | |
| 46 | +If you want something that's halfway between WEBrick and lighttpd, we heartily recommend | |
| 47 | +Mongrel. It's a Ruby-based web server with a C-component (so it requires compilation) that | |
| 48 | +also works very well with Windows. See more at http://mongrel.rubyforge.org/. | |
| 49 | + | |
| 50 | +But of course its also possible to run Rails with the premiere open source web server Apache. | |
| 51 | +To get decent performance, though, you'll need to install FastCGI. For Apache 1.3, you want | |
| 52 | +to use mod_fastcgi. For Apache 2.0+, you want to use mod_fcgid. | |
| 53 | + | |
| 54 | +See http://wiki.rubyonrails.com/rails/pages/FastCGI for more information on FastCGI. | |
| 55 | + | |
| 56 | +== Example for Apache conf | |
| 57 | + | |
| 58 | + <VirtualHost *:80> | |
| 59 | + ServerName rails | |
| 60 | + DocumentRoot /path/application/public/ | |
| 61 | + ErrorLog /path/application/log/server.log | |
| 62 | + | |
| 63 | + <Directory /path/application/public/> | |
| 64 | + Options ExecCGI FollowSymLinks | |
| 65 | + AllowOverride all | |
| 66 | + Allow from all | |
| 67 | + Order allow,deny | |
| 68 | + </Directory> | |
| 69 | + </VirtualHost> | |
| 70 | + | |
| 71 | +NOTE: Be sure that CGIs can be executed in that directory as well. So ExecCGI | |
| 72 | +should be on and ".cgi" should respond. All requests from 127.0.0.1 go | |
| 73 | +through CGI, so no Apache restart is necessary for changes. All other requests | |
| 74 | +go through FCGI (or mod_ruby), which requires a restart to show changes. | |
| 75 | + | |
| 76 | + | |
| 77 | +== Debugging Rails | |
| 78 | + | |
| 79 | +Have "tail -f" commands running on both the server.log, production.log, and | |
| 80 | +test.log files. Rails will automatically display debugging and runtime | |
| 81 | +information to these files. Debugging info will also be shown in the browser | |
| 82 | +on requests from 127.0.0.1. | |
| 83 | + | |
| 84 | + | |
| 85 | +== Breakpoints | |
| 86 | + | |
| 87 | +Breakpoint support is available through the script/breakpointer client. This | |
| 88 | +means that you can break out of execution at any point in the code, investigate | |
| 89 | +and change the model, AND then resume execution! Example: | |
| 90 | + | |
| 91 | + class WeblogController < ActionController::Base | |
| 92 | + def index | |
| 93 | + @posts = Post.find_all | |
| 94 | + breakpoint "Breaking out from the list" | |
| 95 | + end | |
| 96 | + end | |
| 97 | + | |
| 98 | +So the controller will accept the action, run the first line, then present you | |
| 99 | +with a IRB prompt in the breakpointer window. Here you can do things like: | |
| 100 | + | |
| 101 | +Executing breakpoint "Breaking out from the list" at .../webrick_server.rb:16 in 'breakpoint' | |
| 102 | + | |
| 103 | + >> @posts.inspect | |
| 104 | + => "[#<Post:0x14a6be8 @attributes={\"title\"=>nil, \"body\"=>nil, \"id\"=>\"1\"}>, | |
| 105 | + #<Post:0x14a6620 @attributes={\"title\"=>\"Rails you know!\", \"body\"=>\"Only ten..\", \"id\"=>\"2\"}>]" | |
| 106 | + >> @posts.first.title = "hello from a breakpoint" | |
| 107 | + => "hello from a breakpoint" | |
| 108 | + | |
| 109 | +...and even better is that you can examine how your runtime objects actually work: | |
| 110 | + | |
| 111 | + >> f = @posts.first | |
| 112 | + => #<Post:0x13630c4 @attributes={"title"=>nil, "body"=>nil, "id"=>"1"}> | |
| 113 | + >> f. | |
| 114 | + Display all 152 possibilities? (y or n) | |
| 115 | + | |
| 116 | +Finally, when you're ready to resume execution, you press CTRL-D | |
| 117 | + | |
| 118 | + | |
| 119 | +== Console | |
| 120 | + | |
| 121 | +You can interact with the domain model by starting the console through script/console. | |
| 122 | +Here you'll have all parts of the application configured, just like it is when the | |
| 123 | +application is running. You can inspect domain models, change values, and save to the | |
| 124 | +database. Starting the script without arguments will launch it in the development environment. | |
| 125 | +Passing an argument will specify a different environment, like <tt>script/console production</tt>. | |
| 126 | + | |
| 127 | +To reload your controllers and models after launching the console run <tt>reload!</tt> | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | +== Description of contents | |
| 132 | + | |
| 133 | +app | |
| 134 | + Holds all the code that's specific to this particular application. | |
| 135 | + | |
| 136 | +app/controllers | |
| 137 | + Holds controllers that should be named like weblog_controller.rb for | |
| 138 | + automated URL mapping. All controllers should descend from | |
| 139 | + ActionController::Base. | |
| 140 | + | |
| 141 | +app/models | |
| 142 | + Holds models that should be named like post.rb. | |
| 143 | + Most models will descend from ActiveRecord::Base. | |
| 144 | + | |
| 145 | +app/views | |
| 146 | + Holds the template files for the view that should be named like | |
| 147 | + weblog/index.rhtml for the WeblogController#index action. All views use eRuby | |
| 148 | + syntax. This directory can also be used to keep stylesheets, images, and so on | |
| 149 | + that can be symlinked to public. | |
| 150 | + | |
| 151 | +app/helpers | |
| 152 | + Holds view helpers that should be named like weblog_helper.rb. | |
| 153 | + | |
| 154 | +app/apis | |
| 155 | + Holds API classes for web services. | |
| 156 | + | |
| 157 | +config | |
| 158 | + Configuration files for the Rails environment, the routing map, the database, and other dependencies. | |
| 159 | + | |
| 160 | +components | |
| 161 | + Self-contained mini-applications that can bundle together controllers, models, and views. | |
| 162 | + | |
| 163 | +db | |
| 164 | + Contains the database schema in schema.rb. db/migrate contains all | |
| 165 | + the sequence of Migrations for your schema. | |
| 166 | + | |
| 167 | +lib | |
| 168 | + Application specific libraries. Basically, any kind of custom code that doesn't | |
| 169 | + belong under controllers, models, or helpers. This directory is in the load path. | |
| 170 | + | |
| 171 | +public | |
| 172 | + The directory available for the web server. Contains subdirectories for images, stylesheets, | |
| 173 | + and javascripts. Also contains the dispatchers and the default HTML files. | |
| 174 | + | |
| 175 | +script | |
| 176 | + Helper scripts for automation and generation. | |
| 177 | + | |
| 178 | +test | |
| 179 | + Unit and functional tests along with fixtures. | |
| 180 | + | |
| 181 | +vendor | |
| 182 | + External libraries that the application depends on. Also includes the plugins subdirectory. | |
| 183 | + This directory is in the load path. | ... | ... |