mascut 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/.document ADDED
@@ -0,0 +1,5 @@
1
+ README.rdoc
2
+ lib/**/*.rb
3
+ bin/*
4
+ features/**/*.feature
5
+ LICENSE
data/.gitignore ADDED
@@ -0,0 +1,22 @@
1
+ ## MAC OS
2
+ .DS_Store
3
+
4
+ ## TEXTMATE
5
+ *.tmproj
6
+ tmtags
7
+
8
+ ## EMACS
9
+ *~
10
+ \#*
11
+ .\#*
12
+
13
+ ## VIM
14
+ *.swp
15
+
16
+ ## PROJECT::GENERAL
17
+ coverage
18
+ rdoc
19
+ pkg
20
+ *.gemspec
21
+
22
+ ## PROJECT::SPECIFIC
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2009 okitan
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc ADDED
@@ -0,0 +1,7 @@
1
+ = mascut
2
+
3
+ instant commet-like server in order to debug web pages
4
+
5
+ == Copyright
6
+
7
+ Copyright (c) 2009 okitan. See LICENSE for details.
data/Rakefile ADDED
@@ -0,0 +1,48 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+
4
+ begin
5
+ require 'jeweler'
6
+ Jeweler::Tasks.new do |gem|
7
+ gem.name = 'mascut'
8
+ gem.summary = 'instant commet-like server in order to debug web pages'
9
+ gem.description = 'instant commet-like server in order to debug web pages'
10
+ gem.email = 'okitakunio@gmail.com'
11
+ gem.homepage = 'http://github.com/okitan/mascut'
12
+ gem.authors = %w[ okitan ]
13
+
14
+ gem.add_dependency 'sinatra', '>=0.9.4'
15
+
16
+ gem.add_development_dependency 'rspec', '>= 1.2.9'
17
+ # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
18
+ end
19
+ Jeweler::GemcutterTasks.new
20
+ rescue LoadError
21
+ puts 'Jeweler (or a dependency) not available. Install it with: gem install jeweler'
22
+ end
23
+
24
+ require 'spec/rake/spectask'
25
+ Spec::Rake::SpecTask.new(:spec) do |spec|
26
+ spec.libs << 'lib' << 'spec'
27
+ spec.spec_files = FileList['spec/**/*_spec.rb']
28
+ end
29
+
30
+ Spec::Rake::SpecTask.new(:rcov) do |spec|
31
+ spec.libs << 'lib' << 'spec'
32
+ spec.pattern = 'spec/**/*_spec.rb'
33
+ spec.rcov = true
34
+ end
35
+
36
+ task :spec => :check_dependencies
37
+
38
+ task :default => :spec
39
+
40
+ require 'rake/rdoctask'
41
+ Rake::RDocTask.new do |rdoc|
42
+ version = File.exist?('VERSION') ? File.read('VERSION') : ''
43
+
44
+ rdoc.rdoc_dir = 'rdoc'
45
+ rdoc.title = "mascut #{version}"
46
+ rdoc.rdoc_files.include('README*')
47
+ rdoc.rdoc_files.include('lib/**/*.rb')
48
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.0.1
data/bin/mascut ADDED
@@ -0,0 +1,25 @@
1
+ #!/bin/env ruby
2
+ begin
3
+ require 'rack'
4
+ rescue LoadError
5
+ require 'rubygems'
6
+ require 'rack'
7
+ end
8
+ begin
9
+ require 'mascut'
10
+ rescue LoadError
11
+ require File.join(File.dirname(__FILE__), %w[ .. lib mascut ]) # for development
12
+ end
13
+
14
+
15
+ app = Rack::Builder.new do
16
+ use Rack::CommonLogger, $stdout
17
+ use Rack::ShowExceptions
18
+ use Rack::ShowStatus
19
+
20
+ run Rack::Cascade.new([ Mascut.new, Rack::File.new('.') ])
21
+ end.to_app
22
+
23
+ Rack::Handler::Mongrel.run app, :Host => '0.0.0.0', :Port => 9203 do
24
+ puts '*** Mascut has started on http://localhost:9203/ ***'
25
+ end
data/lib/mascut.rb ADDED
@@ -0,0 +1,49 @@
1
+ require 'sinatra/base'
2
+
3
+ class Mascut < Sinatra::Base
4
+ def monitor
5
+ now = Time.now
6
+ files = Dir['**/*']
7
+
8
+ loop do
9
+ files.each {|file| return 'reload' if File.exist?(file) and now < File.mtime(file) }
10
+ sleep 1
11
+ end
12
+ end
13
+
14
+ get '/mascut' do
15
+ monitor
16
+ end
17
+
18
+ get %r{^/(.+\.html)$} do |name|
19
+ halt(404) unless File.exist?(name)
20
+
21
+ # I don't use nokogiri because it corercts wrong html.
22
+ File.read(name).sub('</head>', <<-JS)
23
+ <script src='http://www.google.com/jsapi'></script>
24
+ <script>
25
+ var comet = function() {
26
+ $.ajax({
27
+ type: 'GET',
28
+ url: '/mascut',
29
+ success: function(msg) {
30
+ msg == 'reload' ? location.reload() : comet();
31
+ }
32
+ });
33
+ }
34
+
35
+ google.load('jquery', '1');
36
+ google.setOnLoadCallback(function() {
37
+ comet();
38
+ });
39
+ </script>
40
+ </head>
41
+ JS
42
+ end
43
+
44
+ get %r{^/(.+\.css)$} do |name|
45
+ content_type :css
46
+ File.exist?(name) ? File.read(name) : halt(404)
47
+ end
48
+ end
49
+
@@ -0,0 +1,7 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
+
3
+ describe "Mascut" do
4
+ it "fails" do
5
+ fail "hey buddy, you should probably rename this file and start specing for real"
6
+ end
7
+ end
data/spec/spec.opts ADDED
@@ -0,0 +1 @@
1
+ --color
@@ -0,0 +1,9 @@
1
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
2
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
3
+ require 'mascut'
4
+ require 'spec'
5
+ require 'spec/autorun'
6
+
7
+ Spec::Runner.configure do |config|
8
+
9
+ end
metadata ADDED
@@ -0,0 +1,86 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: mascut
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - okitan
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-12-03 00:00:00 +09:00
13
+ default_executable: mascut
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: sinatra
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 0.9.4
24
+ version:
25
+ - !ruby/object:Gem::Dependency
26
+ name: rspec
27
+ type: :development
28
+ version_requirement:
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 1.2.9
34
+ version:
35
+ description: instant commet-like server in order to debug web pages
36
+ email: okitakunio@gmail.com
37
+ executables:
38
+ - mascut
39
+ extensions: []
40
+
41
+ extra_rdoc_files:
42
+ - LICENSE
43
+ - README.rdoc
44
+ files:
45
+ - .document
46
+ - .gitignore
47
+ - LICENSE
48
+ - README.rdoc
49
+ - Rakefile
50
+ - VERSION
51
+ - bin/mascut
52
+ - lib/mascut.rb
53
+ - spec/mascut_spec.rb
54
+ - spec/spec.opts
55
+ - spec/spec_helper.rb
56
+ has_rdoc: true
57
+ homepage: http://github.com/okitan/mascut
58
+ licenses: []
59
+
60
+ post_install_message:
61
+ rdoc_options:
62
+ - --charset=UTF-8
63
+ require_paths:
64
+ - lib
65
+ required_ruby_version: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - ">="
68
+ - !ruby/object:Gem::Version
69
+ version: "0"
70
+ version:
71
+ required_rubygems_version: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: "0"
76
+ version:
77
+ requirements: []
78
+
79
+ rubyforge_project:
80
+ rubygems_version: 1.3.5
81
+ signing_key:
82
+ specification_version: 3
83
+ summary: instant commet-like server in order to debug web pages
84
+ test_files:
85
+ - spec/spec_helper.rb
86
+ - spec/mascut_spec.rb