Skip to content

Commit

Permalink
Merge branch 'master' into jruby-1.7
Browse files Browse the repository at this point in the history
Conflicts:
	README.markdown
  • Loading branch information
tka committed Nov 22, 2013
2 parents 5fcb133 + ab87ffa commit 6c097f5
Show file tree
Hide file tree
Showing 3,369 changed files with 249,552 additions and 60,184 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
2 changes: 1 addition & 1 deletion Info.plist
Expand Up @@ -30,7 +30,7 @@
<key>JVMVersion</key>
<string>1.6*</string>
<key>MainClass</key>
<string>com.handlino.fireapp.Main</string>
<string>com.kkbox.fireapp.Main</string>
<key>ClassPath</key>
<array>
<string>$JAVAROOT/fire-app.jar</string>
Expand Down
8 changes: 4 additions & 4 deletions README.markdown
@@ -1,4 +1,4 @@
![Fire.app](https://github.com/handlino/FireApp/raw/master/lib/images/icon/256.png)
![Fire.app](https://github.com/kkbox/FireApp/raw/master/lib/images/icon/256.png)

# Fire.app

Expand Down Expand Up @@ -32,8 +32,8 @@ If you want to build your own copy, you will need Java 7, [JRuby](http://jruby.o

## License

Copyright (c) 2012 Handlino Inc.
Copyright (c) 2012 KKBOX Inc.
Licensed under GPL v2.

[fireapp]: http://fireapp.handlino.com/
[fireapp-github]: http://github.com/handlino/fireapp
[fireapp]: http://fireapp.kkbox.com/
[fireapp-github]: http://github.com/kkbox/fireapp
2 changes: 1 addition & 1 deletion build_configuration.rb
Expand Up @@ -22,7 +22,7 @@
# The fully-qualified name of the main Java file used to initiate the application.
# default value: "org.monkeybars.rawr.Main"
#
c.main_java_file = "com.handlino.fireapp.Main"
c.main_java_file = "com.kkbox.fireapp.Main"

# A list of directories where source files reside
# default value: ["src"]
Expand Down
74 changes: 0 additions & 74 deletions editor_extensions/vim-compassapp/plugin/compassapp.vim

This file was deleted.

22 changes: 15 additions & 7 deletions hosting_server/config.ru
Expand Up @@ -10,7 +10,7 @@ require 'redis'
require 'yaml'
require 'json'

DOMAIN = "the-hold.handlino.com"
DOMAIN = "the-hold.kkbox.com"

module Rack
module Session
Expand All @@ -22,7 +22,11 @@ module Rack

patten = Regexp.new("(?<version>\\d{8}-\\d{6})?\\.?(?<project>.+?)\\.(?<login>.+)\\.#{DOMAIN}$")
project_route = request.host.match(patten)
cookie[:domain] = ".#{project_route[:project]}.#{project_route[:login]}.#{DOMAIN}"
if project_route
cookie[:domain] = ".#{project_route[:project]}.#{project_route[:login]}.#{DOMAIN}"
else
cookie[:domain] = request.host
end

Utils.set_cookie_header!(headers, @key, cookie)
end
Expand All @@ -45,8 +49,12 @@ class TheHoldApp

patten = Regexp.new("(?<version>\\d{8}-\\d{6})?\\.?(?<project>.+?)\\.(?<login>.+)\\.#{DOMAIN}$")
project_route = req.host.match(patten)

site_key = "site-#{project_route[:project]}.#{project_route[:login]}.#{DOMAIN}"
if project_route
site_key = "site-#{project_route[:project]}.#{project_route[:login]}.#{DOMAIN}"
else
site_key = "site-#{req.host}"
project_route={version: nil}
end
site = @redis.hgetall(site_key)

return not_found if !( site["login"] && site["project"] )
Expand Down Expand Up @@ -282,8 +290,8 @@ EOL
cname = params["cname"]
begin
dns = Resolv::DNS.new
target_name = dns.getresources(cname, Resolv::DNS::Resource::IN::CNAME).first.try(:name)
if target_name && target_name.to_s == project_hostname
target_record = dns.getresources(cname, Resolv::DNS::Resource::IN::CNAME).first
if target_record && target_record.name.to_s == project_hostname
@redis.hmset("site-#{cname}", :login, params["login"], :project, params["project"] );
end
end
Expand All @@ -302,7 +310,7 @@ EOL
end

def not_found
[404, {'Content-Type' => 'text/plain' }, ["Not Fonud"]]
[404, {'Content-Type' => 'text/plain' }, ["Not Found"]]
end

def forbidden
Expand Down
4 changes: 2 additions & 2 deletions lib/documents/extensions_readme.txt
Expand Up @@ -3,7 +3,7 @@ Install Compass Extension

Fire.app uses Compass extension as project template. If you put Compass extensions inside this folder, Fire.app will try to load it when the application starts.

For more detailed information, please refer: https://github.com/handlino/FireApp/wiki/Use-compass-extensions
For more detailed information, please refer: https://github.com/kkbox/FireApp/wiki/Use-compass-extensions


Create Your Own Project Template
Expand All @@ -25,4 +25,4 @@ If you do not have a manifest.rb, Compass will use "easy mode" and put everythin

For more detailed information, please refer: http://compass-style.org/help/tutorials/extensions/

You can also download our sample project template and give it a try: https://github.com/handlino/compass-handlino
You can also download our sample project template and give it a try: https://github.com/kkbox/compass-handlino
Binary file added lib/images/icon/favorite-16.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added lib/images/icon/history-16.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 17 additions & 0 deletions lib/ruby/common/commonjs-0.2.6/.gitignore
@@ -0,0 +1,17 @@
*.gem
*.rbc
.bundle
.config
.yardoc
Gemfile.lock
InstalledFiles
_yardoc
coverage
doc/
lib/bundler/man
pkg
rdoc
spec/reports
test/tmp
test/version_tmp
tmp
3 changes: 3 additions & 0 deletions lib/ruby/common/commonjs-0.2.6/.gitmodules
@@ -0,0 +1,3 @@
[submodule "spec/ext/commonjs"]
path = spec/ext/commonjs
url = https://github.com/kriskowal/commonjs.git
10 changes: 10 additions & 0 deletions lib/ruby/common/commonjs-0.2.6/.travis.yml
@@ -0,0 +1,10 @@
rvm:
- 1.9.3
- 1.9.2
- 1.8.7
- jruby-18mode
- jruby-19mode
notifications:
recipients:
- cowboyd@thefrontside.net
before_install: git submodule update --init
7 changes: 7 additions & 0 deletions lib/ruby/common/commonjs-0.2.6/Gemfile
@@ -0,0 +1,7 @@
source 'http://rubygems.org'

# Specify your gem's dependencies in commonjs.gemspec
gemspec

gem "therubyracer", :platforms => :ruby
gem "therubyrhino", "~> 1.73.3", :platforms => :jruby
44 changes: 44 additions & 0 deletions lib/ruby/common/commonjs-0.2.6/README.md
@@ -0,0 +1,44 @@

# CommonJS [![Build Status](https://secure.travis-ci.org/cowboyd/commonjs.rb.png)](http://travis-ci.org/cowboyd/commonjs.rb)

Host CommonJS JavaScript environments in Ruby

## Why?

The internet is now awash with non-browser JavaScript code. Much of this code conforms to some
simple conventions that let you use it anywhere you have a JavaScript interpreter available. These
conventions are collectively called "commonjs"

We have several JavaScript interpreters available to us from Ruby. Therefore, why shouldn't we be
able to use commonjs applications and libraries?

## Using common JS from Ruby.

`CommonJS` now passes all of the Modules 1.0 unit tests

env = CommonJS::Environment.new(:path => '/path/to/lib/dir')
env.require('foo.js')



## Future directions

By default, all you get with a bare commonjs environment is the Modules API

The plan however, is to allow you to extend your commonjs environment to have whatever native
interfaces you want in it. So for example, if you want to allow filesystem access, as well as
access to the process information, you would say:

env.modules :filesystem, :process

## Supported runtimes

### Current

* The Ruby Racer (V8) - [https://github.com/cowboyd/therubyracer]
* The Ruby Rhino (JRuby) - [https://github.com/cowboyd/therubyrhino]

### Desired

* Johnson (TraceMonkey) - [https://github.com/jbarnette/johnson]
* Lyndon (MacRuby) - [https://github.com/defunkt/lyndon]
9 changes: 9 additions & 0 deletions lib/ruby/common/commonjs-0.2.6/Rakefile
@@ -0,0 +1,9 @@
#!/usr/bin/env rake
require "bundler/gem_tasks"

require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new('spec') do |spec|
spec.rspec_opts = ['--color', "--format documentation"]
end

task :default => :spec
20 changes: 20 additions & 0 deletions lib/ruby/common/commonjs-0.2.6/commonjs.gemspec
@@ -0,0 +1,20 @@
# -*- encoding: utf-8 -*-
require File.expand_path('../lib/commonjs/version', __FILE__)

Gem::Specification.new do |gem|
gem.authors = ["Charles Lowell"]
gem.email = ["cowboyd@thefrontside.net"]
gem.description = "Host CommonJS JavaScript environments in Ruby"
gem.summary = "Provide access to your Ruby and Operating System runtime via the commonjs API"
gem.homepage = "http://github.com/cowboyd/commonjs.rb"

gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
gem.files = `git ls-files`.split("\n")
gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
gem.name = "commonjs"
gem.require_paths = ["lib"]
gem.version = CommonJS::VERSION

gem.add_development_dependency "rake"
gem.add_development_dependency "rspec"
end
6 changes: 6 additions & 0 deletions lib/ruby/common/commonjs-0.2.6/lib/commonjs.rb
@@ -0,0 +1,6 @@
require "commonjs/version"

module CommonJS
autoload :Environment, 'commonjs/environment'
autoload :Module, 'commonjs/module'
end
39 changes: 39 additions & 0 deletions lib/ruby/common/commonjs-0.2.6/lib/commonjs/environment.rb
@@ -0,0 +1,39 @@
require 'pathname'
module CommonJS
class Environment

attr_reader :runtime

def initialize(runtime, options = {})
@runtime = runtime
@paths = [options[:path]].flatten.map {|path| Pathname(path)}
@modules = {}
end

def require(module_id)
unless mod = @modules[module_id]
filepath = find(module_id) or fail LoadError, "no such module '#{module_id}'"
load = @runtime.eval("(function(module, require, exports) {#{File.read(filepath)}})", filepath.expand_path.to_s)
@modules[module_id] = mod = Module.new(module_id, self)
load.call(mod, mod.require_function, mod.exports)
end
return mod.exports
end

def native(module_id, impl)
@modules[module_id] = Module::Native.new(impl)
end

def new_object
@runtime['Object'].new
end

private

def find(module_id)
if loadpath = @paths.find { |path| path.join("#{module_id}.js").exist? }
loadpath.join("#{module_id}.js")
end
end
end
end
49 changes: 49 additions & 0 deletions lib/ruby/common/commonjs-0.2.6/lib/commonjs/module.rb
@@ -0,0 +1,49 @@
module CommonJS
class Module

attr_reader :id
attr_accessor :exports

def initialize(id, env)
@id = id
@env = env
@exports = env.new_object
@segments = id.split('/')
end

def require_function
@require_function ||= lambda do |*args|
this, module_id = *args
module_id ||= this #backwards compatibility with TRR < 0.10
@env.require(expand(module_id))
end
end

private

def expand(module_id)
return module_id unless module_id =~ /(\.|\..)/
module_id.split('/').inject(@segments[0..-2]) do |path, element|
path.tap do
if element == '.'
#do nothing
elsif element == '..'
path.pop
else
path.push element
end
end
end.join('/')
end


class Native

attr_reader :exports

def initialize(impl)
@exports = impl
end
end
end
end

0 comments on commit 6c097f5

Please sign in to comment.