Give copyright in Ruby on Rails files - ruby-on-rails-3

I want provide to copyright notice at start of files in my Ruby on Rails project. Can I give copyright notice in all Ruby on Rails files including auto generated files like application.rb, routes.rb. ?

I have seen this in some ruby files available online such ashttps://github.com/diaspora/diaspora/blob/develop/app/models/account_deletion.rb
I needed to do the same, but I needed a tool to automate adding it to all .rb files.
I have written the following script for this reason
https://gist.github.com/modsaid/5435473

You would need to review the MIT-license for that: http://www.opensource.org/licenses/mit-license.php
but if my understanding is correct, yes you can put a copyright notice on your files.

Related

Is there a way to put copyright content in the generated js file using rollup?

There are options to put copyright content while generating bundle using gulp etc. Is there some support provided by rollup for the same?
You probably want to add a banner.

Sphinx PDF output using latexpdf

I am trying to build Sphinx doc output as PDF rather than HTML. I can only use the tools which come with Sphinx, i.e. I cannot download additionl tools like rst2pdf. I have tried using 'make latexpdf', per the Sphinx documentation, which states it will produce pdf in addition to the .tex files. However I am only getting .tex. What am I missing? The Sphinx documentation states that PDF files will be produced.
Sphinx uses Latex to export the documentation as a PDF file.
Thus one needs the basic Latex dependencies used to write a pdf on the system.
For example, on a system running Ubuntu 16.04, they can be downloaded and installed by :
apt-get install texlive-latex-recommended texlive-latex-extra texlive-fonts-recommended
If running Sphinx 1.6 or above on GNU/Linux or OSX, you may also need the latexmk package.
Reference: sphinx.builders.latex.LaTeXBuilder documentation.
After installing the above packages, running make latexpdf in the sphinx project directory generates the documentation output as the PDF file ./_build/latex/<sphinx-project-name>.pdf>
Note: In the current scenario where you do not see a PDF file on your system after running make latexpdf, check the output of the command for any errors regarding missing latex tools/files. Use the system package manager to identify the missing packages and install them.

What is the difference between 7zip's 7z.sfx and 7zsd.sfx?

I can't figure out what the difference is between the 7z.sfx file available with 7zip and the downloadable 7zsd.sfx from the developer's site, which is not bundled with 7zip. The 7z.sfx appears not to honor my request to include the config.txt file I created for it, but the 7zsd.sfx inclusion method works perfectly.
7zip comes with 7z.sfx bundled. The application history.txt in the program files directory shows that 7zsd.sfx used to be bundled with 7zip back in 2005. 7z.sfx is referred to as "uncompressed SFX" in the history.txt file as well.
This is the config used:
;!#Install#!UTF-8!
InstallPath="C:\\ProgramData\\IT"
GUIMode="2"
;!#InstallEnd#!
This is the syntax I'm using and the responding behavior:
C:\Users\<me>\Desktop\Updater\Recorder>copy /b 7z.sfx + config.txt + "RecorderVer0.0.0.4".7z "RecorderVer0.0.0.4".exe
7z.sfx
config.txt
RecorderVer0.0.0.4.7z
1 file(s) copied.
The same response occurs with the use of 7zsd.sfx indicating that indeed the config file included is being utilized. However, when executing the 7z.sfx created RecorderVer0.0.0.4".exe the prompt for where to install the contents of the 7z archive is prompted for. Using the 7zsd.sfx created RecorderVer0.0.0.4.exe version directs files to the config set location without any prompting as desired.
To my knowledge 7z.sfx is not downloadable via the developer's site, but I may be wrong. His official page is no longer available, but the information provided from the Internet Archive should be adequate.
I had this previously posted as a comment to my own question.
I found the answer to my question in 7-Zip documentation of all places! :) Looks like there are a total of 4 sfx modules and these are the differences:
SFX_Module : Description
7z.sfx : Windows version.
7zCon.sfx : Console version.
7zS.sfx : Windows version for installers.
7zSD.sfx : Windows version for installers (uses MSVCRT.dll).
Source: http://sevenzip.sourceforge.jp/chm/cmdline/switches/sfx.htm
Acquiring the 7zS.sfx and/or 7zSD.sfx stuffs is easy:
The installers are on the official download page. Just look for keyword 7-Zip Extra. Version 9.20 for example is https://www.7-zip.org/a/7z920_extra.7z
Just in case anybody stumbles across this post looking for the 7zS.sfx and 7zSD.sfx, you can find the 7z_extra files for the (currently) latest version at http://sourceforge.net/projects/sevenzip/files/7-Zip/9.22/7z922_extra.7z/download.
I was also looking for the other sfx modules and managed to find them in the related LZMA SDK archive on the actual 7-zip website:
https://www.7-zip.org/sdk.html
Download the latest version of the LZMA SDK and look in the bin folder.

Vim go to ruby class declaration

I want to follow from
class ApplicationController < ActionController::Base
to
/home/slavik/.rvm/gems/ruby-1.9.2-p290/gems/actionpack-3.1.0.rc6/lib/action_controller/base.rb
and look to commented reference of possible usage this class
Yes, there is at least one way. You can use exuberant ctags in combination with the tags option of Vim. Pratically, you have to execute ctags in the /home/slavik/.rvm/gems/ruby-1.9.2-p290/gems/ like :
ctags -R tags
See ctags --help if you want to dig into tags customization. Then you have to add this file to your tags path in vim. Using something like the following:
:set tag+=/home/slavik/.rvm/gems/ruby-1.9.2-p290/gems/tags
In order to understand how powerful this vim features is take a look at Browsing_programs_with_tags.
There are couple of issues with ctags which has pretty old and ugly parser:
Ctags doesn't deal with: module A::B
Ctags doesn't tag (at least some of) the operator methods like ==
Ctags doesn't support qualified tags, -type=+
Ctags doesn't output tags for constants or attributes.
I would recommend better project ripper-tags based on official Ruby parser called Ripper which is included in Ruby. It is fast and accurate: https://github.com/tmm1/ripper-tags
You can also install gem-ripper-tags to have tags files automatically generated after gem installation: https://github.com/lzap/gem-ripper-tags
Please note that these days, August 2013, there is a big refactoring of ripper-tags which can lead to change of command line options or gem-ripper-tags interface. If things are not working, update both gems in couple of days and read help screen to learn new options.
ripper-tags sounds great but is having issues as of today (November 2013).
I ended up using exuberant ctags (with a few tricks)
1- install exuberant ctags. If you're using osx, this article shows a little trick:
http://www.runtime-era.com/2012/05/exuberant-ctags-in-osx-107.html
2- If you only wish to include the ctags for the files in your directory only, run this command in your directory:
ctags -R
This will create a "tags" file for you.
3- If you wish to include the ctags for your gems (this has been really helpful for me with RubyMotion and local gems that I have developed), do the following:
ctags --exclude=.git --exclude='*.log' -R * `bundle show --paths`
credit: https://coderwall.com/p/lv1qww
(Note that I removed the -e option which generates tags for emacs instead of vim)
4- Add the following line to your ~/.vimrc
set autochdir
set tags+=./tags;
(Why the semi colon: http://vim.wikia.com/wiki/Single_tags_file_for_a_source_tree )
5- Go to the word you'd like to follow and hit ctrl+] . hit ctrl+o to go back (https://stackoverflow.com/a/53929/226255)

How to keep synchronized, per-version documentation?

I am working on a small toy project who is getting more and more releases. Until now, the documentation was just a set of pages in the wordpress blog I setup for the project. However, as time passes, new releases are out and I should update the online documentation to match the most recent release.
Unfortunately, if I do so, the docs for the previous releases will "disappear" as my doc pages are updated to the most recent version, therefore I decided to include the documentation in the release package and to keep the most recent documentation available online as a web page as well.
A trivial idea would be to wget the current docs from the wordpress pages, save them into the svn and therefore into the release package, repeating the procedure at every new release. Unfortunately, the HTML I get must be hacked by hand to fix the links (or I should hack wordpress to use BASE so that the HTML code is easily relocatable, something I don't want to do).
How should I handle the requirements of having at the same time:
user-browsable documentation for the proper version included in the downloadable package
most recent documentation available online (and properly styled with my web theme)
keep synchronized between the svn and the actual online contents (in wordpress, or something else that fits nicely with my wordpress setup)
easy to use
Thanks
Edit: started a bounty to see if I can lure more answers. I think this is a quite important issue, and it would be nice to have multiple hints and opinions for future readers.
I would check your pages into SVN, and then have your webserver update from its local SVN working copy when you're ready to release. Put everything into SVN--wordpress, CSS, HTML, etc.
WGet can convert all the links in the document for you. See the convert-links option:
http://www.gnu.org/software/wget/manual/html_node/Advanced-Usage.html
Using this in conjuction with the other methods could yield a solution.
I think there are two problems to be solved here
how and where to keep the documentation aligned with the code
where to publish the documentation
For 1 i think it's best to:
keep the documentation in a repository (SVN or git or whatever you already use for the code) as a set of files, instead of in a db as it is easier to keep a history of changes (an possibly to stay in par with the code releases
use an approach where the documentation is generated from a set of source files (you'd keep the sources in the repository) from which the html files for the distribution package or for publishing on the web are generated. The two could possibly differ, as on the web you'd need to keep some version information (in the URL) that you don't need when packaging a single release.
To do "2" there are several tools that may generate a static site. One of them is Jekyll it's in ruby and looks quite complete and customizable.
Assuming that you use a tool like jekyll and keep the files and source in SVN you might setup your repo in this way:
repo/
tags/
rel1.0/
source/
documentation/
rel2.0/
source/
documentation/
rel3.0/
source/
documentation/
trunk/
source/
documentation/
That is:
You keep the current documentation beside the source in the trunk
When you do a release you create a tag for the release
you configure your documentation generator to generate documentation for each of the repo/tags//documentation directory such that the documentation for each release is put in documentation_site/ directory
So to publish the documentation (point 2 above):
you copy on the server the contents of the documentation_site directory, putting it in the same base dir of your wordpress install or linking from that, such that each release doc can be accessed as: http://yoursite/project/docs/relXX/
you create a link to the current release documentation such that it can always be reached as http://yoursite/project/docs/current
The trick here is to publish the documentation always under a proper release identifier (in the URL, on the filesystem) and use a link (or a redirect) to make sure that the "current documentation" on the web server points to the current release.
I have seen some programs use help & manual. But I am a Mac user and I have no experience with it to know if it's any good. I'm looking for a solution myself for Mac.
For my own projects, if that were a need, I would create a sub-dir for the documentation, and have all the files refer from the known-base of there relatively. For example,
index.html -- refers to images/example.jpg
README
-- subdirs....
images/example.jpg
section/index.html -- links back to '../index.html',
-- refers to ../images/example.jpg
If the docs are included in the SVN/tarball download, then they are readable as-is. If they are generated from some original files, they would be pre-generated for a downloadable version.
Archive versions of the documentation can be unpacked/generated and placed into named directorys (eg docs/v1.05/)
Its a simple PHP script that can be written to get a list the subdirs of the /docs/ directory from the local disk and display a list, and highlighting the most recent, for example.