ramaze 2011.01.30 → 2011.07.25
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +2 -1
- data/.mailmap +2 -0
- data/.rvmrc +1 -0
- data/README.md +119 -197
- data/Rakefile +14 -97
- data/bin/ramaze +6 -14
- data/doc/AUTHORS +8 -4
- data/doc/CHANGELOG +3784 -3339
- data/examples/app/chat/start.rb +2 -2
- data/lib/proto/app.rb +2 -3
- data/lib/proto/config.ru +4 -5
- data/lib/proto/controller/init.rb +11 -4
- data/lib/proto/controller/main.rb +12 -7
- data/lib/proto/layout/default.xhtml +56 -23
- data/lib/proto/model/init.rb +3 -1
- data/lib/proto/public/css/grid.css +107 -0
- data/lib/proto/public/css/layout.css +81 -0
- data/lib/proto/public/css/reset.css +123 -0
- data/lib/proto/public/css/text.css +109 -0
- data/lib/proto/public/images/bg.png +0 -0
- data/lib/proto/spec/main.rb +2 -2
- data/lib/proto/start.rb +11 -1
- data/lib/proto/view/index.xhtml +27 -23
- data/lib/ramaze.rb +0 -1
- data/lib/ramaze/app.rb +85 -12
- data/lib/ramaze/app_graph.rb +107 -0
- data/lib/ramaze/bin/console.rb +87 -0
- data/lib/ramaze/bin/create.rb +94 -0
- data/lib/ramaze/bin/helper.rb +107 -0
- data/lib/ramaze/bin/restart.rb +95 -0
- data/lib/ramaze/bin/runner.rb +141 -0
- data/lib/ramaze/bin/start.rb +206 -0
- data/lib/ramaze/bin/status.rb +152 -0
- data/lib/ramaze/bin/stop.rb +112 -0
- data/lib/ramaze/cache.rb +9 -4
- data/lib/ramaze/cache/localmemcache.rb +10 -13
- data/lib/ramaze/cache/lru.rb +49 -7
- data/lib/ramaze/cache/memcache.rb +170 -92
- data/lib/ramaze/cache/sequel.rb +301 -118
- data/lib/ramaze/controller.rb +108 -9
- data/lib/ramaze/controller/default.rb +15 -2
- data/lib/ramaze/current.rb +14 -2
- data/lib/ramaze/dependencies.rb +46 -0
- data/lib/ramaze/files.rb +38 -3
- data/lib/ramaze/gestalt.rb +12 -12
- data/lib/ramaze/helper.rb +0 -2
- data/lib/ramaze/helper/auth.rb +30 -23
- data/lib/ramaze/helper/blue_form.rb +175 -126
- data/lib/ramaze/helper/csrf.rb +76 -91
- data/lib/ramaze/helper/email.rb +105 -0
- data/lib/ramaze/helper/erector.rb +16 -15
- data/lib/ramaze/helper/gestalt.rb +2 -2
- data/lib/ramaze/helper/layout.rb +89 -73
- data/lib/ramaze/helper/link.rb +7 -6
- data/lib/ramaze/helper/localize.rb +6 -5
- data/lib/ramaze/helper/markaby.rb +25 -23
- data/lib/ramaze/helper/maruku.rb +3 -3
- data/lib/ramaze/helper/paginate.rb +19 -27
- data/lib/ramaze/helper/remarkably.rb +3 -3
- data/lib/ramaze/helper/request_accessor.rb +3 -3
- data/lib/ramaze/helper/send_file.rb +12 -8
- data/lib/ramaze/helper/simple_captcha.rb +5 -6
- data/lib/ramaze/helper/stack.rb +7 -4
- data/lib/ramaze/helper/tagz.rb +10 -11
- data/lib/ramaze/helper/thread.rb +19 -16
- data/lib/ramaze/helper/ultraviolet.rb +7 -4
- data/lib/ramaze/helper/user.rb +40 -21
- data/lib/ramaze/helper/xhtml.rb +29 -20
- data/lib/ramaze/log.rb +3 -11
- data/lib/ramaze/log/analogger.rb +5 -4
- data/lib/ramaze/log/growl.rb +9 -7
- data/lib/ramaze/log/hub.rb +3 -5
- data/lib/ramaze/log/informer.rb +15 -12
- data/lib/ramaze/log/knotify.rb +3 -5
- data/lib/ramaze/log/logger.rb +3 -5
- data/lib/ramaze/log/logging.rb +6 -8
- data/lib/ramaze/log/rotatinginformer.rb +27 -17
- data/lib/ramaze/log/syslog.rb +7 -7
- data/lib/ramaze/log/xosd.rb +3 -5
- data/lib/ramaze/middleware_compiler.rb +27 -4
- data/lib/ramaze/reloader.rb +50 -12
- data/lib/ramaze/reloader/watch_inotify.rb +4 -5
- data/lib/ramaze/reloader/watch_stat.rb +3 -3
- data/lib/ramaze/request.rb +18 -8
- data/lib/ramaze/response.rb +38 -7
- data/lib/ramaze/rest.rb +36 -0
- data/lib/ramaze/setup.rb +101 -31
- data/lib/ramaze/spec.rb +1 -1
- data/lib/ramaze/spec/bacon.rb +6 -3
- data/lib/ramaze/spec/helper/bacon.rb +0 -1
- data/lib/ramaze/version.rb +1 -1
- data/lib/ramaze/view.rb +2 -11
- data/lib/ramaze/view/erector.rb +46 -31
- data/lib/ramaze/view/erubis.rb +7 -3
- data/lib/ramaze/view/ezamar.rb +7 -3
- data/lib/ramaze/view/gestalt.rb +9 -3
- data/lib/ramaze/view/haml.rb +7 -3
- data/lib/ramaze/view/liquid.rb +3 -3
- data/lib/ramaze/view/lokar.rb +7 -3
- data/lib/ramaze/view/mustache.rb +11 -5
- data/lib/ramaze/view/nagoro.rb +3 -3
- data/lib/ramaze/view/sass.rb +1 -1
- data/lib/ramaze/view/slippers.rb +40 -13
- data/lib/ramaze/view/tagz.rb +9 -5
- data/ramaze.gemspec +23 -128
- data/spec/helper.rb +5 -0
- data/spec/ramaze/bin/app/config.ru +11 -0
- data/spec/ramaze/bin/create.rb +28 -0
- data/spec/ramaze/bin/runner.rb +30 -0
- data/spec/ramaze/bin/start.rb +38 -0
- data/spec/ramaze/cache/memcache.rb +10 -3
- data/spec/ramaze/cache/sequel.rb +7 -0
- data/spec/ramaze/controller/provide_inheritance.rb +0 -10
- data/spec/ramaze/dispatcher/file.rb +19 -15
- data/spec/ramaze/helper/auth.rb +10 -9
- data/spec/ramaze/helper/blue_form.rb +121 -68
- data/spec/ramaze/helper/email.rb +69 -0
- data/spec/ramaze/helper/layout.rb +12 -15
- data/spec/ramaze/helper/layout/alternative.xhtml +5 -0
- data/spec/ramaze/helper/user.rb +2 -0
- data/spec/ramaze/log/growl.rb +14 -1
- data/spec/{contrib → ramaze}/rest.rb +1 -1
- data/spec/ramaze/session/memcache.rb +2 -2
- data/spec/ramaze/view/sass.rb +1 -1
- data/tasks/bacon.rake +3 -3
- data/tasks/gem.rake +17 -18
- data/tasks/rcov.rake +2 -3
- data/tasks/release.rake +8 -65
- data/tasks/setup.rake +10 -8
- data/tasks/todo.rake +9 -5
- data/tasks/yard.rake +3 -2
- metadata +105 -397
- data/MANIFEST +0 -532
- data/TODO.md +0 -19
- data/benchmark/bench_templates/bench.rb +0 -67
- data/benchmark/bench_templates/view/large.erb +0 -79
- data/benchmark/bench_templates/view/large.haml +0 -41
- data/benchmark/bench_templates/view/large.lok +0 -79
- data/benchmark/bench_templates/view/large.xhtml +0 -79
- data/benchmark/bench_templates/view/small.erb +0 -21
- data/benchmark/bench_templates/view/small.haml +0 -12
- data/benchmark/bench_templates/view/small.lok +0 -21
- data/benchmark/bench_templates/view/small.xhtml +0 -21
- data/benchmark/results.txt +0 -131
- data/benchmark/run.rb +0 -355
- data/benchmark/suite/minimal.rb +0 -11
- data/benchmark/suite/no_informer.rb +0 -7
- data/benchmark/suite/no_sessions.rb +0 -9
- data/benchmark/suite/no_template.rb +0 -7
- data/benchmark/suite/simple.rb +0 -5
- data/benchmark/suite/template_erubis.rb +0 -8
- data/benchmark/suite/template_etanni.rb +0 -8
- data/benchmark/suite/template_ezamar.rb +0 -8
- data/benchmark/suite/template_haml.rb +0 -13
- data/benchmark/suite/template_liquid.rb +0 -11
- data/benchmark/suite/template_markaby.rb +0 -9
- data/benchmark/suite/template_nagoro.rb +0 -8
- data/benchmark/suite/template_redcloth.rb +0 -13
- data/benchmark/suite/template_tenjin.rb +0 -8
- data/benchmark/test.rb +0 -35
- data/doc/FAQ +0 -92
- data/doc/INSTALL +0 -92
- data/doc/TODO +0 -29
- data/doc/meta/announcement.txt +0 -119
- data/doc/meta/configuration.txt +0 -163
- data/doc/meta/internals.txt +0 -278
- data/doc/meta/users.kml +0 -64
- data/doc/tutorial/todolist.html +0 -1512
- data/doc/tutorial/todolist.txt +0 -920
- data/examples/app/sourceview/public/coderay.css +0 -104
- data/examples/app/sourceview/public/images/file.gif +0 -0
- data/examples/app/sourceview/public/images/folder.gif +0 -0
- data/examples/app/sourceview/public/images/tv-collapsable-last.gif +0 -0
- data/examples/app/sourceview/public/images/tv-collapsable.gif +0 -0
- data/examples/app/sourceview/public/images/tv-expandable-last.gif +0 -0
- data/examples/app/sourceview/public/images/tv-expandable.gif +0 -0
- data/examples/app/sourceview/public/images/tv-item-last.gif +0 -0
- data/examples/app/sourceview/public/images/tv-item.gif +0 -0
- data/examples/app/sourceview/public/jquery.js +0 -11
- data/examples/app/sourceview/public/jquery.treeview.css +0 -48
- data/examples/app/sourceview/public/jquery.treeview.js +0 -223
- data/examples/app/sourceview/public/sourceview.js +0 -52
- data/examples/app/sourceview/start.rb +0 -79
- data/examples/app/sourceview/view/index.haml +0 -59
- data/examples/helpers/httpdigest.rb +0 -107
- data/lib/proto/public/css/screen.css +0 -30
- data/lib/proto/public/js/jquery.js +0 -7179
- data/lib/ramaze/contrib/addressable_route.rb +0 -56
- data/lib/ramaze/contrib/app_graph.rb +0 -64
- data/lib/ramaze/contrib/email.rb +0 -88
- data/lib/ramaze/contrib/facebook.rb +0 -23
- data/lib/ramaze/contrib/facebook/facebook.rb +0 -171
- data/lib/ramaze/contrib/gettext.rb +0 -113
- data/lib/ramaze/contrib/gettext/mo.rb +0 -155
- data/lib/ramaze/contrib/gettext/parser.rb +0 -46
- data/lib/ramaze/contrib/gettext/po.rb +0 -109
- data/lib/ramaze/contrib/gzip_filter.rb +0 -1
- data/lib/ramaze/contrib/maruku_uv.rb +0 -59
- data/lib/ramaze/contrib/profiling.rb +0 -36
- data/lib/ramaze/contrib/rest.rb +0 -23
- data/lib/ramaze/contrib/sequel/create_join.rb +0 -26
- data/lib/ramaze/contrib/sequel/form_field.rb +0 -129
- data/lib/ramaze/contrib/sequel/image.rb +0 -196
- data/lib/ramaze/contrib/sequel/relation.rb +0 -98
- data/lib/ramaze/helper/httpdigest.rb +0 -96
- data/lib/ramaze/tool/bin.rb +0 -340
- data/lib/ramaze/tool/create.rb +0 -48
- data/lib/ramaze/tool/project_creator.rb +0 -120
- data/lib/ramaze/view/less.rb +0 -12
- data/lib/ramaze/view/maruku.rb +0 -15
- data/lib/ramaze/view/redcloth.rb +0 -21
- data/spec/contrib/addressable_route.rb +0 -30
- data/spec/examples/helpers/httpdigest.rb +0 -64
- data/spec/examples/templates/template_redcloth.rb +0 -13
- data/spec/ramaze/bin/ramaze.rb +0 -96
- data/spec/ramaze/helper/httpdigest.rb +0 -176
- data/spec/ramaze/view/less.rb +0 -60
- data/spec/ramaze/view/less/file.css.less +0 -8
- data/spec/ramaze/view/redcloth.rb +0 -66
- data/spec/ramaze/view/redcloth/external.redcloth +0 -8
- data/tasks/copyright.rake +0 -21
- data/tasks/gem_setup.rake +0 -112
- data/tasks/git.rake +0 -46
- data/tasks/grancher.rake +0 -12
- data/tasks/jquery.rake +0 -15
- data/tasks/manifest.rake +0 -4
- data/tasks/metric_changes.rake +0 -24
- data/tasks/reversion.rake +0 -8
- data/tasks/traits.rake +0 -21
@@ -1,66 +0,0 @@
|
|
1
|
-
# Copyright (c) 2009 Michael Fellinger m.fellinger@gmail.com
|
2
|
-
# All files in this distribution are subject to the terms of the Ruby license.
|
3
|
-
|
4
|
-
require File.expand_path('../../../../spec/helper', __FILE__)
|
5
|
-
spec_requires 'erubis', 'redcloth'
|
6
|
-
|
7
|
-
Ramaze::App.options.views = 'redcloth'
|
8
|
-
|
9
|
-
class SpecRedCloth < Ramaze::Controller
|
10
|
-
map '/'
|
11
|
-
engine :RedCloth
|
12
|
-
|
13
|
-
def index
|
14
|
-
'h1. RedCloth Index'
|
15
|
-
end
|
16
|
-
|
17
|
-
def links
|
18
|
-
'<ul>
|
19
|
-
<li><%= a("Index page", :index) %></li>
|
20
|
-
<li><%= a("Internal template", :internal) %></li>
|
21
|
-
<li><%= a("External template", :external) %></li>
|
22
|
-
</ul>'.ui
|
23
|
-
end
|
24
|
-
|
25
|
-
def internal
|
26
|
-
"h2. <%= 1 + 1 %>"
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
describe "Ramaze::View::RedCloth" do
|
31
|
-
behaves_like :rack_test
|
32
|
-
|
33
|
-
should 'render' do
|
34
|
-
got = get('/')
|
35
|
-
got.status.should == 200
|
36
|
-
got['Content-Type'].should == 'text/html'
|
37
|
-
got.body.should == '<h1>RedCloth Index</h1>'
|
38
|
-
end
|
39
|
-
|
40
|
-
it "uses helper methods" do
|
41
|
-
got = get('/links')
|
42
|
-
got.status.should == 200
|
43
|
-
got['Content-Type'].should == 'text/html'
|
44
|
-
got.body.strip.should ==
|
45
|
-
'<ul>
|
46
|
-
<li><a href="/index">Index page</a></li>
|
47
|
-
<li><a href="/internal">Internal template</a></li>
|
48
|
-
<li><a href="/external">External template</a></li>
|
49
|
-
</ul>'
|
50
|
-
end
|
51
|
-
|
52
|
-
it 'renders external templates' do
|
53
|
-
got = get('/external')
|
54
|
-
got.status.should == 200
|
55
|
-
got['Content-Type'].should == 'text/html'
|
56
|
-
got.body.strip.should ==
|
57
|
-
"<html>
|
58
|
-
<head>
|
59
|
-
<title>Erubis Test</title>
|
60
|
-
</head>
|
61
|
-
<body>
|
62
|
-
<h1>RedCloth Template</h1>
|
63
|
-
</body>
|
64
|
-
</html>"
|
65
|
-
end
|
66
|
-
end
|
data/tasks/copyright.rake
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
desc "add copyright to all .rb files in the distribution"
|
2
|
-
task :copyright do
|
3
|
-
ignore = File.readlines('doc/LEGAL').
|
4
|
-
select{|line| line.strip!; File.exist?(line)}.
|
5
|
-
map{|file| File.expand_path(file)}
|
6
|
-
|
7
|
-
puts "adding copyright to files that don't have it currently"
|
8
|
-
puts PROJECT_COPYRIGHT
|
9
|
-
puts
|
10
|
-
|
11
|
-
Dir['{lib,test}/**/*{.rb}'].each do |file|
|
12
|
-
file = File.expand_path(file)
|
13
|
-
next if ignore.include? file
|
14
|
-
lines = File.readlines(file).map{|l| l.chomp}
|
15
|
-
unless lines.first(PROJECT_COPYRIGHT.size) == PROJECT_COPYRIGHT
|
16
|
-
puts "#{file} seems to need attention, first 4 lines:"
|
17
|
-
puts lines[0..3]
|
18
|
-
puts
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
data/tasks/gem_setup.rake
DELETED
@@ -1,112 +0,0 @@
|
|
1
|
-
task :gem_setup do
|
2
|
-
class GemSetup
|
3
|
-
def initialize(options = {}, &block)
|
4
|
-
@gems = []
|
5
|
-
@options = options.dup
|
6
|
-
@verbose = @options.delete(:verbose)
|
7
|
-
|
8
|
-
run(&block)
|
9
|
-
end
|
10
|
-
|
11
|
-
def run(&block)
|
12
|
-
return unless block_given?
|
13
|
-
instance_eval(&block)
|
14
|
-
setup
|
15
|
-
end
|
16
|
-
|
17
|
-
def gem(name, version = nil, options = {})
|
18
|
-
if version.respond_to?(:merge!)
|
19
|
-
options = version
|
20
|
-
else
|
21
|
-
options[:version] = version
|
22
|
-
end
|
23
|
-
|
24
|
-
@gems << [name, options]
|
25
|
-
end
|
26
|
-
|
27
|
-
# all gems defined, let's try to load/install them
|
28
|
-
def setup
|
29
|
-
require 'rubygems'
|
30
|
-
require 'rubygems/dependency_installer'
|
31
|
-
|
32
|
-
@gems.each do |name, options|
|
33
|
-
setup_gem(name, options)
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
def setup_gemspec(gemspec)
|
38
|
-
gemspec.dependencies.each do |dependency|
|
39
|
-
dependency.version_requirements.as_list.each do |version|
|
40
|
-
gem(dependency.name, version)
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
setup
|
45
|
-
end
|
46
|
-
|
47
|
-
# First try to activate.
|
48
|
-
# If activation fails, try to install and activate again.
|
49
|
-
# If the second activation also fails, try to require as it may just as
|
50
|
-
# well be in $LOAD_PATH.
|
51
|
-
def setup_gem(name, options)
|
52
|
-
version = [options[:version]].compact
|
53
|
-
lib_name = options[:lib] || name
|
54
|
-
|
55
|
-
log "activating #{name}"
|
56
|
-
|
57
|
-
Gem.activate(name, *version)
|
58
|
-
rescue Gem::LoadError
|
59
|
-
log "activating #{name} failed, try to install"
|
60
|
-
|
61
|
-
install_gem(name, version, options)
|
62
|
-
end
|
63
|
-
|
64
|
-
# tell rubygems to install a gem
|
65
|
-
def install_gem(name, version, options)
|
66
|
-
installer = Gem::DependencyInstaller.new(options)
|
67
|
-
|
68
|
-
temp_argv(options[:extconf]) do
|
69
|
-
log "installing #{name}"
|
70
|
-
installer.install(name, *version)
|
71
|
-
end
|
72
|
-
|
73
|
-
Gem.activate(name, *version)
|
74
|
-
|
75
|
-
log "install and final activation successful"
|
76
|
-
rescue Gem::GemNotFoundException => ex
|
77
|
-
log "installation failed: #{ex}, use normal require"
|
78
|
-
|
79
|
-
require(options[:lib] || name)
|
80
|
-
|
81
|
-
log "require successful, cannot verify version though"
|
82
|
-
end
|
83
|
-
|
84
|
-
# prepare ARGV for rubygems installer
|
85
|
-
def temp_argv(extconf)
|
86
|
-
if extconf ||= @options[:extconf]
|
87
|
-
old_argv = ARGV.clone
|
88
|
-
ARGV.replace(extconf.split(' '))
|
89
|
-
end
|
90
|
-
|
91
|
-
yield
|
92
|
-
|
93
|
-
ensure
|
94
|
-
ARGV.replace(old_argv) if extconf
|
95
|
-
end
|
96
|
-
|
97
|
-
private
|
98
|
-
|
99
|
-
def log(msg)
|
100
|
-
return unless @verbose
|
101
|
-
|
102
|
-
if defined?(Log)
|
103
|
-
Log.info(msg)
|
104
|
-
else
|
105
|
-
puts(msg)
|
106
|
-
end
|
107
|
-
end
|
108
|
-
|
109
|
-
def rubyforge; 'http://gems.rubyforge.org/' end
|
110
|
-
def github; 'http://gems.github.com/' end
|
111
|
-
end
|
112
|
-
end
|
data/tasks/git.rake
DELETED
@@ -1,46 +0,0 @@
|
|
1
|
-
namespace :git do
|
2
|
-
task :anon do
|
3
|
-
sh 'git config remote.origin.url git://github.com/Ramaze/ramaze'
|
4
|
-
puts "You're now accessing ramaze anonymous"
|
5
|
-
end
|
6
|
-
|
7
|
-
task :committer do
|
8
|
-
sh 'git config remote.origin.url git@github.com:Ramaze/ramaze'
|
9
|
-
puts "You're now accessing ramaze as committer"
|
10
|
-
end
|
11
|
-
|
12
|
-
desc 'Update from repository'
|
13
|
-
task :update do
|
14
|
-
puts "Putting your changes on stash"
|
15
|
-
sh 'git stash'
|
16
|
-
|
17
|
-
branch = `git branch`[/^\*\s+(.*)/, 1]
|
18
|
-
puts "Current branch is #{branch}"
|
19
|
-
|
20
|
-
if switch = branch != 'master'
|
21
|
-
puts "Switching to master branch"
|
22
|
-
sh 'git checkout master'
|
23
|
-
end
|
24
|
-
|
25
|
-
if switch
|
26
|
-
puts "Switching to #{branch} branch"
|
27
|
-
sh "git checkout '#{branch}'"
|
28
|
-
end
|
29
|
-
|
30
|
-
sh 'git stash apply'
|
31
|
-
end
|
32
|
-
|
33
|
-
desc 'Create patch files to send'
|
34
|
-
task :send do
|
35
|
-
sh 'git format-patch ^HEAD'
|
36
|
-
end
|
37
|
-
|
38
|
-
desc "show some stats about patches"
|
39
|
-
task :patchflow do
|
40
|
-
patches = `git rev-list HEAD | wc -l`.to_i
|
41
|
-
puts "currently we have #{patches} patches"
|
42
|
-
init = Time.parse("Sat Oct 14 04:22:49 JST 2006")
|
43
|
-
days = (Time.now - init) / (3600 * 24)
|
44
|
-
puts "%d days since init, avg %4.2f patches per day" % [days, patches/days]
|
45
|
-
end
|
46
|
-
end
|
data/tasks/grancher.rake
DELETED
data/tasks/jquery.rake
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
desc 'download latest jquery and put in /lib/proto/public/js/jquery.js'
|
2
|
-
task :jquery do
|
3
|
-
require 'open-uri'
|
4
|
-
$stdout.sync = true
|
5
|
-
|
6
|
-
File.open(PROJECT_JQUERY_FILE, 'w+') do |jquery|
|
7
|
-
remote = open('http://code.jquery.com/jquery-latest.js')
|
8
|
-
print "openend remote side, copying..."
|
9
|
-
while chunk = remote.read(4096)
|
10
|
-
print '.'
|
11
|
-
jquery.write(chunk)
|
12
|
-
end
|
13
|
-
puts " done."
|
14
|
-
end
|
15
|
-
end
|
data/tasks/manifest.rake
DELETED
data/tasks/metric_changes.rake
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
namespace :metric do
|
2
|
-
desc 'committed changes per file according to git'
|
3
|
-
task 'changes' do
|
4
|
-
$stdout.sync = true
|
5
|
-
out = lambda{|changes, rb| puts("%4d %s" % [changes, rb]) }
|
6
|
-
changes = {}
|
7
|
-
|
8
|
-
print 'counting changes '
|
9
|
-
|
10
|
-
Dir['lib/**/*.rb'].each do |rb|
|
11
|
-
changes = `git-log --pretty=oneline '#{rb}'`.count("\n")
|
12
|
-
print '.'
|
13
|
-
# out[changes, rb]
|
14
|
-
changes[rb] = changes
|
15
|
-
end
|
16
|
-
puts ' done.'
|
17
|
-
|
18
|
-
sorted = changes.sort_by{|r,c| c }.reverse
|
19
|
-
puts "Top 20:"
|
20
|
-
sorted.first(20).each{|(r,c)| out[c,r] }
|
21
|
-
puts "Bottom 20:"
|
22
|
-
sorted.last(20).each{|(r,c)| out[c,r] }
|
23
|
-
end
|
24
|
-
end
|
data/tasks/reversion.rake
DELETED
data/tasks/traits.rake
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
desc 'listing of available traits per class/module'
|
2
|
-
task 'traits' do
|
3
|
-
nodes = Hash.new{|h,k| h[k] = []}
|
4
|
-
Dir['lib/**/*.rb'].each do |file|
|
5
|
-
content = File.read(file)
|
6
|
-
traits = content.grep(/^\s*trait\s*:/)
|
7
|
-
traits.each do |trait|
|
8
|
-
space = content[0..content.index(trait)].scan(/^\s*(?:class|module)\s+(.*)$/)
|
9
|
-
space = space.flatten.join('::')
|
10
|
-
nodes[space] << trait.strip
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
nodes.each do |space, traits|
|
15
|
-
puts space
|
16
|
-
traits.each do |trait|
|
17
|
-
print ' ', trait, "\n"
|
18
|
-
end
|
19
|
-
puts
|
20
|
-
end
|
21
|
-
end
|