source-tools 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. data/.gitignore +6 -0
  2. data/CHANGES +10 -0
  3. data/README +54 -0
  4. data/Rakefile +53 -0
  5. data/TODO +4 -0
  6. data/bin/source-tools +3 -0
  7. data/lib/source-tools.rb +112 -0
  8. data/lib/source-tools/bin.rb +7 -0
  9. data/lib/source-tools/default.rb +5 -0
  10. data/lib/source-tools/tasks.rb +4 -0
  11. data/lib/source-tools/tasks/chmod.rb +19 -0
  12. data/lib/source-tools/tasks/html_wrap.rb +15 -0
  13. data/lib/source-tools/tasks/ruby_magic_encoding.rb +17 -0
  14. data/lib/source-tools/tasks/strip.rb +31 -0
  15. data/lib/source-tools/tasks/template.rb +29 -0
  16. data/lib/source-tools/templates/t.bashrc.erb +5 -0
  17. data/lib/source-tools/templates/t.config/fish/config.fish.erb +6 -0
  18. data/lib/source-tools/templates/t.gemrc.erb +4 -0
  19. data/lib/source-tools/templates/t.git/hooks/post-receive.erb +7 -0
  20. data/lib/source-tools/templates/t.gitconfig.erb +14 -0
  21. data/lib/source-tools/templates/t.gitignore.erb +15 -0
  22. data/lib/source-tools/templates/t.profile.erb +39 -0
  23. data/lib/source-tools/templates/t.screenrc.erb +1 -0
  24. data/lib/source-tools/templates/t.vimrc.erb +37 -0
  25. data/lib/source-tools/templates/tRakefile.erb +47 -0
  26. data/lib/source-tools/templates/tconfig/mime.types.erb +104 -0
  27. data/lib/source-tools/templates/tconfig/nginx.conf.erb +178 -0
  28. data/lib/source-tools/version.rb +3 -0
  29. data/source-tools.gemspec +35 -0
  30. data/tasks/ann.rake +80 -0
  31. data/tasks/bones.rake +20 -0
  32. data/tasks/gem.rake +201 -0
  33. data/tasks/git.rake +40 -0
  34. data/tasks/notes.rake +27 -0
  35. data/tasks/post_load.rake +34 -0
  36. data/tasks/rdoc.rake +51 -0
  37. data/tasks/rubyforge.rake +55 -0
  38. data/tasks/setup.rb +292 -0
  39. data/tasks/spec.rake +54 -0
  40. data/tasks/svn.rake +47 -0
  41. data/tasks/test.rake +40 -0
  42. data/tasks/zentest.rake +36 -0
  43. metadata +126 -0
@@ -0,0 +1,39 @@
1
+
2
+ # common setting
3
+ export PATH=\
4
+ ~/bin:\
5
+ ~/.gem/ruby/1.9.1/bin/:\
6
+ ~/.gem/ruby/1.8/bin/:\
7
+ $PATH
8
+
9
+ export LC_ALL=en_US.UTF-8
10
+ export LANG=en_US.UTF-8
11
+
12
+ export EDITOR=vim
13
+ export DISPLAY=localhost:0.0
14
+ export TERM=xterm-color
15
+
16
+ # bash specific
17
+ function bash_prompt {
18
+ git=`show_git_branch`
19
+ where='\033[1;32m'`pwd | sed 's/.*\///g'`'\033[0m'
20
+ if test $git; then
21
+ # bash need echo -e to make color work
22
+ echo -e $where' \033[1;36m'$git'\033[0m$ '
23
+ else
24
+ echo -e `whoami`@`hostname -s` $where'$ '
25
+ fi
26
+ }
27
+
28
+ function show_git_dirty {
29
+ # how queer in test we can't use `` to do sub
30
+ if test "$(git status 2> /dev/null | tail -n1)" != 'nothing to commit (working directory clean)' 2> /dev/null; then
31
+ echo '*'
32
+ fi
33
+ }
34
+
35
+ function show_git_branch {
36
+ git symbolic-ref HEAD 2> /dev/null | sed 's/refs\/heads\/\(.*\)/'`show_git_dirty`'\1/'
37
+ }
38
+
39
+ export PS1='`bash_prompt`'
@@ -0,0 +1 @@
1
+ termcapinfo xterm*|xs|rxvt ti@:te@
@@ -0,0 +1,37 @@
1
+ scriptencoding utf-8
2
+
3
+ set encoding=utf-8
4
+ set fileencoding=utf-8
5
+ set fenc=utf-8
6
+ set termencoding=utf-8
7
+
8
+ set noautoindent " this is annoying when pasting from clipboard
9
+ set nocompatible " don't simulate vi
10
+
11
+ set backspace=indent,eol,start " more powerful backspacing
12
+ set bs=2 " backspace
13
+ set softtabstop=2 " soft tab
14
+ set scrolloff=3 " keep 3 lines between scroll
15
+ set history=1000 " undo history
16
+ set cmdheight=2
17
+ set shiftwidth=2 " tab width?
18
+ set cmdheight=2
19
+
20
+ syntax on
21
+ filetype on
22
+ filetype plugin on
23
+ filetype indent on
24
+
25
+ set wildmenu " i need friendly menu
26
+ set wildmode=list:longest
27
+
28
+ set ruler " show line, col info
29
+ set hidden " what's this?
30
+ set ignorecase " ignore case when searching
31
+ set smartcase " ignore case when searching lower cases
32
+
33
+ set backupdir=~/tmp,/tmp
34
+ set directory=~/tmp,/tmp
35
+ "set nobackup
36
+ "set nowritebackup
37
+ "set noswapfile
@@ -0,0 +1,47 @@
1
+ # encoding: utf-8
2
+
3
+ SUDO = '' # this prevent `rake gem:install` to use sudo
4
+
5
+ require 'bones'
6
+ Bones.setup
7
+
8
+ PROJ.name = '<%= args[:project] %>'
9
+ PROJ.authors = '<%= args[:author] %>'
10
+ PROJ.email = '<%= args[:author] %>@<%= args[:author] %>.org'
11
+ PROJ.url = 'http://github.com/<%= args[:author] %>/<%= args[:project] %>'
12
+ PROJ.rubyforge.name = '<%= args[:project] %>'
13
+
14
+ # PROJ.gem.dependencies << ['source-tools', '>=0.5.0']
15
+ # PROJ.gem.development_dependencies << ['minitest', '>=1.3.0']
16
+ # PROJ.gem.executables = ["bin/#{PROJ.name}"]
17
+
18
+ # PROJ.ruby_opts.delete '-w'
19
+
20
+ PROJ.description = PROJ.summary = paragraphs_of('README', 'description').join("\n\n")
21
+ PROJ.changes = paragraphs_of('CHANGES', 0..1).join("\n\n")
22
+ PROJ.version = File.read("lib/#{PROJ.name}/version.rb").gsub(/.*VERSION = '(.*)'.*/m, '\1')
23
+
24
+ PROJ.exclude += ['^tmp', 'tmp$', '^pkg', '^\.gitignore$',
25
+ '^ann-', '\.sqlite3$', '\.db$']
26
+
27
+ PROJ.rdoc.remote_dir = PROJ.name
28
+
29
+ PROJ.readme_file = 'README'
30
+ PROJ.rdoc.main = 'README'
31
+ PROJ.rdoc.exclude += ['Rakefile', '^tasks', '^test']
32
+ PROJ.rdoc.include << '\w+'
33
+ # PROJ.rdoc.opts << '--diagram' if !Rake::Win32 and `which dot` =~ %r/\/dot/
34
+ PROJ.rdoc.opts += ['--charset=utf-8', '--inline-source',
35
+ '--line-numbers', '--promiscuous']
36
+
37
+ PROJ.spec.opts << '--color'
38
+
39
+ PROJ.ann.file = "ann-#{PROJ.name}-#{PROJ.version}"
40
+ PROJ.ann.paragraphs.concat %w[LINKS SYNOPSIS REQUIREMENTS INSTALL LICENSE]
41
+
42
+ CLEAN.include Dir['**/*.rbc']
43
+
44
+ task :default do
45
+ Rake.application.options.show_task_pattern = /./
46
+ Rake.application.display_tasks_and_comments
47
+ end
@@ -0,0 +1,104 @@
1
+ types {
2
+ # text
3
+ text/plain txt;
4
+ text/html html htm shtml;
5
+ text/css css;
6
+ text/xml xml;
7
+
8
+ # images
9
+ image/gif gif;
10
+ image/jpeg jpeg jpg;
11
+ image/png png;
12
+ image/tiff tif tiff;
13
+ image/vnd.microsoft.icon ico;
14
+
15
+ # common application
16
+ application/atom+xml atom;
17
+ application/rss+xml rss;
18
+ application/xhtml+xml xhtml;
19
+
20
+ application/javascript js;
21
+ application/postscript ps eps ai;
22
+ application/rtf rtf;
23
+
24
+ application/x-shockwave-flash swf;
25
+ application/pdf pdf;
26
+ application/java-archive jar war ear;
27
+
28
+ application/zip zip;
29
+ application/x-gzip gz;
30
+ application/x-tar tar;
31
+ application/x-rar-compressed rar;
32
+
33
+ application/vnd.mozilla.xul+xml xul;
34
+ application/msword doc;
35
+ application/vnd.ms-excel xls;
36
+ application/vnd.ms-powerpoint ppt;
37
+
38
+ # audio
39
+ audio/midi mid midi kar;
40
+ audio/mpeg mp3;
41
+ audio/ogg ogg;
42
+ audio/aac m4a;
43
+
44
+ audio/vnd.rn-realaudio ra;
45
+
46
+ audio/x-wav wav;
47
+ audio/x-ms-wma wma;
48
+
49
+ # video
50
+ video/mpeg mpeg mpg;
51
+ video/quicktime mov;
52
+ video/mp4 mp4;
53
+
54
+ video/x-ms-wmv wmv;
55
+ video/x-ms-asf asx asf;
56
+ video/x-aif aif aiff aifc;
57
+ video/x-msvideo avi;
58
+
59
+ # others
60
+ text/mathml mml;
61
+ text/vnd.sun.j2me.app-descriptor jad;
62
+ text/vnd.wap.wml wml;
63
+ text/x-component htc;
64
+
65
+ image/x-portable-pixmap ppm;
66
+ image/x-portable-graymap pgm;
67
+ image/x-portable-bitmap pbm;
68
+ image/x-portable-anymap pnm;
69
+ image/x-xwindowdump xwd;
70
+ image/x-xpixmap xpm;
71
+ image/x-xbitmap xbm;
72
+
73
+ image/vnd.wap.wbmp wbmp;
74
+ image/x-jng jng;
75
+ image/x-ms-bmp bmp;
76
+
77
+ video/3gpp 3gpp 3gp;
78
+ video/x-flv flv;
79
+ video/x-mng mng;
80
+
81
+ application/mac-binhex40 hqx;
82
+ application/vnd.wap.wmlc wmlc;
83
+
84
+ application/x-cocoa cco;
85
+ application/x-java-archive-diff jardiff;
86
+ application/x-java-jnlp-file jnlp;
87
+ application/x-makeself run;
88
+ application/x-perl pl pm;
89
+ application/x-pilot prc pdb;
90
+
91
+ application/x-redhat-package-manager rpm;
92
+ application/x-sea sea;
93
+ application/x-stuffit sit;
94
+ application/x-tcl tcl tk;
95
+ application/x-x509-ca-cert der pem crt;
96
+ application/x-xpinstall xpi;
97
+
98
+ application/octet-stream bin exe dll;
99
+ application/octet-stream deb;
100
+ application/octet-stream dmg;
101
+ application/octet-stream eot;
102
+ application/octet-stream iso img;
103
+ application/octet-stream msi msp msm;
104
+ }
@@ -0,0 +1,178 @@
1
+ user <%= args[:project] %> <%= args[:project] %>;
2
+ worker_processes 2;
3
+
4
+ error_log /home/<%= args[:project] %>/log/nginx_error.log;
5
+ pid /home/<%= args[:project] %>/tmp/pids/nginx.pid;
6
+
7
+ events {
8
+ worker_connections 1024;
9
+ use epoll;
10
+ # use kqueue;
11
+ }
12
+
13
+ http {
14
+ # passenger_root /home/<%= args[:project] %>/.gem/ruby/1.8/gems/passenger-2.2.2;
15
+ # passenger_max_pool_size 4;
16
+ # passenger_max_instances_per_app 2;
17
+ # passenger_default_user <%= args[:project] %>;
18
+ # passenger_user_switching on;
19
+ # passenger_log_level 0; # max 3;
20
+
21
+ include /home/<%= args[:project] %>/config/mime.types;
22
+ default_type application/octet-stream;
23
+
24
+ limit_zone two $binary_remote_addr 10m;
25
+
26
+ log_format main '$remote_addr - $remote_user [$time_local] $request '
27
+ '"$status" $body_bytes_sent "$http_referer" '
28
+ '"$http_user_agent" "$http_x_forwarded_for"';
29
+
30
+ access_log /home/<%= args[:project] %>/log/nginx_access.log main;
31
+
32
+ fastcgi_temp_path /home/<%= args[:project] %>/tmp/fcgi_temp;
33
+ client_body_temp_path /home/<%= args[:project] %>/tmp/client_body 1 2;
34
+ proxy_temp_path /home/<%= args[:project] %>/tmp/proxy_temp;
35
+
36
+ client_header_timeout 10m;
37
+ client_body_timeout 10m;
38
+ send_timeout 10m;
39
+
40
+ connection_pool_size 256;
41
+ client_header_buffer_size 1k;
42
+ large_client_header_buffers 4 2k;
43
+ request_pool_size 4k;
44
+
45
+ output_buffers 1 32k;
46
+ postpone_output 1460;
47
+
48
+ sendfile on;
49
+ tcp_nopush on;
50
+ tcp_nodelay on;
51
+
52
+ keepalive_timeout 75 20;
53
+ ignore_invalid_headers on;
54
+
55
+ gzip on;
56
+ gzip_min_length 1100;
57
+ gzip_buffers 4 8k;
58
+ gzip_types text/plain text/html text/css application/xhtml+xml application/javascript;
59
+
60
+ upstream <%= args[:project] %> {
61
+ server 127.0.0.1:3000;
62
+ # server unix:/tmp/thin.0.sock;
63
+ }
64
+
65
+ # used for X-Reproxy-URL, e.g., return these headers from upstream:
66
+ # X-Accel-Redirect: /x-reproxy-url
67
+ # X-Reproxy-URL: http://10.0.0.123/dev2/0/000/000/0000000024.fid
68
+ #
69
+ # upstream 10.0.0.123 {
70
+ # server 10.0.0.123;
71
+ # }
72
+
73
+ server {
74
+ listen 80;
75
+ server_name _;
76
+ index index.xhtml index.html;
77
+
78
+ location ~ ^/(images|javascripts|stylesheets)/ {
79
+ root /home/<%= args[:project] %>/public;
80
+ expires 30d;
81
+ error_page 404 /404.html;
82
+ }
83
+
84
+ # rewrite ^/(login.*|account.*) https://$server_name/$1 redirect;
85
+
86
+ # location ^/download/ {
87
+ # limit_conn two 2;
88
+ # autoindex on;
89
+ # }
90
+
91
+ # location ~ ^/passenger {
92
+ # root /home/<%= args[:project] %>/public;
93
+ # passenger_enabled on;
94
+ # rack_env development;
95
+ # }
96
+
97
+ location / {
98
+ proxy_set_header X-Real-IP $remote_addr;
99
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
100
+ proxy_set_header Host $http_host;
101
+
102
+ proxy_redirect off;
103
+ proxy_pass http://<%= args[:project] %>;
104
+
105
+ proxy_intercept_errors on;
106
+ recursive_error_pages on;
107
+
108
+ error_page 500 502 503 504 /500.html;
109
+ }
110
+
111
+ # used for X-Reproxy-URL
112
+ # location /x-reproxy-url {
113
+ # internal;
114
+ # proxy_pass $upstream_http_x_reproxy_url;
115
+ #
116
+ # # used for mogilefs
117
+ # # proxy_hide_header Content-Type;
118
+ # }
119
+
120
+ # proxy the PHP scripts to Apache listening on 127.0.0.1:80
121
+ # location ~ \.php$ {
122
+ # proxy_pass http://127.0.0.1;
123
+ # }
124
+
125
+ # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
126
+ # location ~ \.php$ {
127
+ # fastcgi_pass 127.0.0.1:9000;
128
+ # fastcgi_index index.php;
129
+ # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
130
+ # include conf/fastcgi_params;
131
+ # }
132
+
133
+ # deny access to .htaccess files, if Apache's document root
134
+ # concurs with nginx's one
135
+ #
136
+ # location ~ /\.ht {
137
+ # deny all;
138
+ # }
139
+ }
140
+
141
+ # HTTPS server
142
+ # server {
143
+ # listen 443;
144
+ # server_name _;
145
+ # index index.xhtml index.html;
146
+ #
147
+ # ssl on;
148
+ # ssl_certificate ssl.crt;
149
+ # ssl_certificate_key ssl.key;
150
+ #
151
+ # ssl_session_timeout 5m;
152
+ #
153
+ # ssl_protocols SSLv2 SSLv3 TLSv1;
154
+ # ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
155
+ # ssl_prefer_server_ciphers on;
156
+ #
157
+ # location ~ ^/(images|javascripts|stylesheets)/ {
158
+ # root /home/<%= args[:project] %>/public;
159
+ # expires 30d;
160
+ # error_page 404 /404.html;
161
+ # }
162
+ #
163
+ # location / {
164
+ # proxy_set_header X-Real-IP $remote_addr;
165
+ # proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
166
+ # proxy_set_header Host $http_host;
167
+ #
168
+ # proxy_redirect off;
169
+ # proxy_pass http://<%= args[:project] %>;
170
+ #
171
+ # proxy_intercept_errors on;
172
+ # recursive_error_pages on;
173
+ #
174
+ # error_page 500 502 503 504 /500.html;
175
+ # }
176
+ # }
177
+
178
+ }
@@ -0,0 +1,3 @@
1
+ module SourceTools
2
+ VERSION = '0.6.0'
3
+ end
@@ -0,0 +1,35 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = %q{source-tools}
5
+ s.version = "0.6.0"
6
+
7
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
+ s.authors = ["Lin Jen-Shin (a.k.a. godfat 真常)"]
9
+ s.date = %q{2009-11-22}
10
+ s.default_executable = %q{source-tools}
11
+ s.description = %q{ source code tools collection}
12
+ s.email = %q{godfat (XD) godfat.org}
13
+ s.executables = ["source-tools"]
14
+ s.extra_rdoc_files = [".gitignore", "CHANGES", "README", "TODO", "bin/source-tools", "lib/source-tools/templates/t.bashrc.erb", "lib/source-tools/templates/t.config/fish/config.fish.erb", "lib/source-tools/templates/t.gemrc.erb", "lib/source-tools/templates/t.gitconfig.erb", "lib/source-tools/templates/t.gitignore.erb", "lib/source-tools/templates/t.profile.erb", "lib/source-tools/templates/t.screenrc.erb", "lib/source-tools/templates/t.vimrc.erb", "lib/source-tools/templates/tconfig/mime.types.erb", "lib/source-tools/templates/tconfig/nginx.conf.erb", "source-tools.gemspec", "lib/source-tools/templates/t.git/hooks/post-receive.erb"]
15
+ s.files = [".gitignore", "CHANGES", "README", "Rakefile", "TODO", "bin/source-tools", "lib/source-tools.rb", "lib/source-tools/bin.rb", "lib/source-tools/default.rb", "lib/source-tools/tasks.rb", "lib/source-tools/tasks/chmod.rb", "lib/source-tools/tasks/html_wrap.rb", "lib/source-tools/tasks/ruby_magic_encoding.rb", "lib/source-tools/tasks/strip.rb", "lib/source-tools/tasks/template.rb", "lib/source-tools/templates/t.bashrc.erb", "lib/source-tools/templates/t.config/fish/config.fish.erb", "lib/source-tools/templates/t.gemrc.erb", "lib/source-tools/templates/t.gitconfig.erb", "lib/source-tools/templates/t.gitignore.erb", "lib/source-tools/templates/t.profile.erb", "lib/source-tools/templates/t.screenrc.erb", "lib/source-tools/templates/t.vimrc.erb", "lib/source-tools/templates/tRakefile.erb", "lib/source-tools/templates/tconfig/mime.types.erb", "lib/source-tools/templates/tconfig/nginx.conf.erb", "lib/source-tools/version.rb", "source-tools.gemspec", "lib/source-tools/templates/t.git/hooks/post-receive.erb"]
16
+ s.homepage = %q{http://github.com/godfat/source-tools}
17
+ s.rdoc_options = ["--charset=utf-8", "--inline-source", "--line-numbers", "--promiscuous", "--main", "README"]
18
+ s.require_paths = ["lib"]
19
+ s.rubyforge_project = %q{ludy}
20
+ s.rubygems_version = %q{1.3.5}
21
+ s.summary = %q{source code tools collection}
22
+
23
+ if s.respond_to? :specification_version then
24
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
25
+ s.specification_version = 3
26
+
27
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
28
+ s.add_development_dependency(%q<bones>, [">= 2.5.1"])
29
+ else
30
+ s.add_dependency(%q<bones>, [">= 2.5.1"])
31
+ end
32
+ else
33
+ s.add_dependency(%q<bones>, [">= 2.5.1"])
34
+ end
35
+ end