Why JsDuck ignores excluded directory? - jsduck

I use JsDusk
Version : JSDuck 5.3.4 (Ruby 1.8.7)
OS: Linux ( CentOS 6 )
I want to exclude some directories, but it doesn't work.
--exclude="/Doc/Project1/application/,/Doc/Project1/docs/,/Doc/Project1/docUtil/"
Actually it should works. Here is the jsDuck Code .
I start jsDuck in a script with the command below.
find /Doc/Project1/ -name '*.js' | xargs jsduck --output=/Doc/DocSrc/jsdoc --exclude=/Doc/Project1/application/ext,/Doc/Project1/application/,/Project1/docs,/Doc/Project1/docUtil,/Doc/Project1/framework,/jawaDoc/Project1/info

The commit you're referring to is included to JSDuck 6.0 beta, but you're using 5.3.4.
You can install the beta with:
$ gem install jsduck --prerelease

Related

Renaming files using regular expressions - Linux

I have three files named
file1.txt
file2.txt
file3.txt
I am trying to rename them to
mynewfile-1.txt
mynewfile-2.txt
mynewfile-3.txt
How would I go about this using regular expressions?
Like this :
rename -n 's/^file/mynewfile-/' *.txt
or from comments :
rename -n 's/^file(\d+)/mynewfile-${1}-test/' *.txt
___ ____
^ ^
capturing group |
captured group
Drop -n switch when the output looks good to rename for real.
There are other tools with the same name which may or may not be able to do this, so be careful.
The rename command that is part of the util-linux package, won't.
If you run the following command (GNU)
$ rename
and you see perlexpr, then this seems to be the right tool.
If not, to make it the default (usually already the case) on Debian and derivative like Ubuntu :
$ sudo apt install rename
$ sudo update-alternatives --set rename /usr/bin/file-rename
For archlinux:
pacman -S perl-rename
For RedHat-family distros:
yum install prename
The 'prename' package is in the EPEL repository.
For Gentoo:
emerge dev-perl/rename
For *BSD:
pkg install p5-File-Rename
For Mac users:
brew install rename
If you don't have this command with another distro, search your package manager to install it or do it manually
Or you can use perl CPAN:
cpan -i File::Rename
Old standalone version can be found here
man rename
This tool was originally written by Larry Wall, the Perl's dad.

clang-format not working under gVim

I installed clang-format-3.8 via apt-get.
Now I try to use it in gVim, but it is not working.
I checked and clang-format-3.8 exists in the folder /usr/share/vim/addons/syntax.
But when I enter :pyf /usr/share/vim/addons/syntax/clang-format-3.8.py in my vim command line, it returns:
E319: Sorry, the command is not available in this version.
I use gVim 7.4 under Ubuntu 16.04.
Dahn's answer is correct that the Vim binary that ships with Ubuntu 16.04 is compiled with Python 3 rather than Python 2. The clang-format-3.8.py script in the Ubuntu 16.04 clang-format-3.8 package is not compatible with Python 3.
But the latest clang-format.py does work with Python 3. You can get it here:
https://llvm.org/svn/llvm-project/cfe/trunk/tools/clang-format/clang-format.py
I think it was just a matter of putting parentheses around the print statements.
Save this file somewhere on your computer such as /usr/local/share/vim/addons/syntax/.
This script uses clang-format as the binary name, so you'll want to install the clang-format package, which installs the clang-format command as a symlink to clang-format-3.8.
Since Vim is now loading a Python 3 script, replace your :pyf (not available) command with :py3f:
:py3f /usr/local/share/vim/addons/syntax/clang-format.py
The Vim binary shipped with Ubuntu 16.04 is compiled with Python 3. The vim addons of clang-format is written by Python 2.
You need to either:
write your own addon by Python 3
Compile your own vim with Python 2, which is the easiest way
The instructions to build vim with Python can be found by Google.
In addition to the above answers I had to do a few more things. I downloaded a new python file and changed the key mapping recommended by in the clang python file to the following in my .vimrc:
map <C-I> :py3file <path-to-this-file>/clang-format.py<cr>
imap <C-I> <c-o>:py3file <path-to-this-file>/clang-format.py<cr>
This solved the E319 problem I was getting.
I solved the problem differently using a combination of bash and vim commands.
First, I installed clang-format package
# apt-get install clang-format-3.5
(I choose version 3.5 but you can choose a different one)
Second, Test if clang-format is working
$ clang-format-3.5 -style=Google test.cpp
Then, run vim
$ vim test.cpp
vim allows to run an external command and print it's output into current buffer
:r ! clang-format-3.5 -style=Google %
(more details about external commands in vim https://www.linux.com/learn/vim-tips-working-external-commands)
This will append the output of clang-format into current buffer. To replace current buffer, which is the desirable effect, specify the lines to output into
:%! clang-format-3.5 -style=Google %
(the first % means all line in current file)
You can make this process more productive by defining new commands in vim (using command) for both visual and command-line modes.

How to list current package versions in OPAM?

opam list -a lists all packages currently available at OPAM, but does not display the version number for packages which are not currently installed, as per the opam list --help output:
(...) the output format displays one package per line, and each line contains the name of the package, the installed version or -- if the package is not installed, (...)
How can I list all packages including their version numbers?
Use opam info <packagename>.
I guess opam list does only prints the versions of already installed packages because of the package dependencies. Listing the latest versions of packages, for example, of not-yet-installed packages is not quite useful.
A refined (and quicker) version of anol's answer is to give the whole list of packages to opam show in one pass (asking opam to output both package and version field), and to process the result with sed, as apparently show outputs each field on its own line:
opam show -f package,version $(opam list -a -s) \
| sed -e '/ *package:/N; s/ *package: \([^\n]*\)\n *version: \([^\n]*\)/\1: \2/'
This is not an ideal solution, but using camlspotter's recommandation, I manually queried each package for its version field, using the following shell loop:
for p in $(opam list -a -s); do echo "$p $(opam show -f version $p)"; done
It works, but it takes ~85 seconds to complete on my machine (querying over 1000 packages currently available).

Rails 4 server fails, Ruby 2.0 segmentation fault, Abort trap 6

I just started going through railstutorial.org and getting my development environment setup. When I got to the section 1.2.5 to run rails server for the fist_app, I type the command and the following printed out:
$ rails server
/Users/aaronpflower/.rvm/gems/ruby-2.0.0-p481#railstutorial_rails_4_0/gems/sqlite3- < 1.3.8/lib/sqlite3/sqlite3_native.bundle: [BUG] Segmentation fault ruby 2.0.0p481 (2014-05-08 revision 45883) [x86_64-darwin13.2.0]
Then followed by 500 lines of text
0 enumerator.so
1 /Users/aaronpflower/.rvm/rubies/ruby-2.0.0-p481/lib/ruby/2.0.0/x86_64-darwin13.2.0/enc/encdb.bundle
2 /Users/aaronpflower/.rvm/rubies/ruby-2.0.0-p481/lib/ruby/2.0.0/x86_64-darwin13.2.0/enc/trans/transdb.bundle
3 /Users/aaronpflower/.rvm/rubies/ruby-2.0.0-p481/lib/ruby/2.0.0/x86_64-darwin13.2.0/rbconfig.rb
4 /Users/aaronpflower/.rvm/rubies/ruby-2.0.0-p481/lib/ruby/site_ruby/2.0.0/rubygems/compatibility.rb
5 /Users/aaronpflower/.rvm/rubies/ruby-2.0.0-p481/lib/ruby/site_ruby/2.0.0/rubygems/defaults.rb
6 /Users/aaronpflower/.rvm/rubies/ruby-2.0.0-p481/lib/ruby/site_ruby/2.0.0/rubygems/deprecate.rb
7 /Users/aaronpflower/.rvm/rubies/ruby-2.0.0-p481/lib/ruby/site_ruby/2.0.0/rubygems/errors.rb
8 /Users/aaronpflower/.rvm/rubies/ruby-2.0.0-p481/lib/ruby/site_ruby/2.0.0/rubygems/version.rb
9 /Users/aaronpflower/.rvm/rubies/ruby-2.0.0-p481/lib/ruby/site_ruby/2.0.0/rubygems/requirement.rb
Which ended with:
[NOTE]
You may have encountered a bug in the Ruby interpreter or extension libraries.
Bug reports are welcome.
For details: http://www.ruby-lang.org/bugreport.html
Abort trap: 6
When this first happened double checked the steps leading up to this in the tutorial, since being a beginner that was a high possibility. I typed the follow commands and everything checkout. (I'm also using OS 10.9.3)
$ rails -v
Rails 4.0.5
$ ruby -v
2.0.0p481
$ rvm -v
1.25.27
$ brew doctor
system ready to brew
Through searching some posts have suggested to uninstall sqlite3 and then re-install but I still got the same seg fault message. Not sure of the next step.
Your Rails -v and Ruby -v are correct for this tutorial.
I can also see from the input that your gemfile has gem 'sqlite3', '1.3.8' in it.
1: Have you bundled?
When was the last time you ran bundle update or bundle install?
How did you go about uninstalling sqlite3? Did you use $ gem uninstall sqlite3?
Try uninstalling and then reinstalling the gem.
2: - What version manager?
Did you use rvm, rbenv or homebrew to install? Using different version managers for different pieces can create communication issues.
3: Did you install Xcode?
This is taken from http://www.railstutorial.org:
"As a prerequisite, OS X users may need to install the Xcode developer tools. To avoid the (huge) full installation, I recommend the much smaller Command Line Tools for Xcode.
To install Xcode (my recommendation), look it up in the AppStore.
To install Command Line Tools (MHartl's recommendation) - https://developer.apple.com/downloads/
4: Are you using `bundle exec`?
Try bundle exec rails c and bundle exec rails s
5: Try 'refreshing' your bundle directory
If bundle exec doesn't work
Remove the .bundle/ directory and re-bundle with
rm -rf .bundle/ && bundle
I experienced the same issue, I just switched to a different ruby version
e.g;
rvm use 1.9.3-p484
and then bundle again.

upgrade ocsigen error

I want to upgrade the ocsigen to 2.1 in my freebsd box.
$pkg_info | grep -i ocsigen
ocsigen-1.1.0_1 Web programming framework for OCaml
$cat /usr/ports/www/ocsigen/Makefile | grep -i version
POPORTVERSION= 2.1
$sudo pormaster ocsigen
...
===> Building for ocaml-tyxml-2.1
gmagmake: *** no rule to create “files/META.in” needed by “files/META”。 Stop
StoStop in /usr/ports/textproc/ocaml-tyxml.
...
===>>> You can restart from the point of failure with this command line
porportmaster <flags> www/ocsigen textproc/ocaml-tyxml
Maybe it is a simple error, but i cannot fix it by myself.
Sincerely!
You should now use OPAM, the "standard" tool for managing source distributions of OCaml packages. OPAM is available here:
http://opam.ocamlpro.com/