forked from eicca/chaplin-on-rails
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit eb9a5f1
Showing
63 changed files
with
6,519 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
.bundle/ | ||
log/*.log | ||
pkg/ | ||
test/dummy/db/*.sqlite3 | ||
test/dummy/log/*.log | ||
test/dummy/tmp/ | ||
test/dummy/.sass-cache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
source "http://rubygems.org" | ||
|
||
# Declare your gem's dependencies in chaplin-on-rails.gemspec. | ||
# Bundler will treat runtime dependencies like base dependencies, and | ||
# development dependencies will be added by default to the :development group. | ||
gemspec | ||
|
||
# jquery-rails is used by the dummy application | ||
gem "jquery-rails" | ||
|
||
# Declare any dependencies that are still in development here instead of in | ||
# your gemspec. These might include edge Rails or gems from your path or | ||
# Git. Remember to move these dependencies to your gemspec before releasing | ||
# your gem to rubygems.org. | ||
|
||
# To use debugger | ||
# gem 'debugger' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
PATH | ||
remote: . | ||
specs: | ||
chaplin-on-rails (0.0.1) | ||
coffee-rails | ||
rails (>= 3.1) | ||
requirejs-rails | ||
|
||
GEM | ||
remote: http://rubygems.org/ | ||
specs: | ||
actionmailer (3.2.11) | ||
actionpack (= 3.2.11) | ||
mail (~> 2.4.4) | ||
actionpack (3.2.11) | ||
activemodel (= 3.2.11) | ||
activesupport (= 3.2.11) | ||
builder (~> 3.0.0) | ||
erubis (~> 2.7.0) | ||
journey (~> 1.0.4) | ||
rack (~> 1.4.0) | ||
rack-cache (~> 1.2) | ||
rack-test (~> 0.6.1) | ||
sprockets (~> 2.2.1) | ||
activemodel (3.2.11) | ||
activesupport (= 3.2.11) | ||
builder (~> 3.0.0) | ||
activerecord (3.2.11) | ||
activemodel (= 3.2.11) | ||
activesupport (= 3.2.11) | ||
arel (~> 3.0.2) | ||
tzinfo (~> 0.3.29) | ||
activeresource (3.2.11) | ||
activemodel (= 3.2.11) | ||
activesupport (= 3.2.11) | ||
activesupport (3.2.11) | ||
i18n (~> 0.6) | ||
multi_json (~> 1.0) | ||
ansi (1.4.3) | ||
arel (3.0.2) | ||
builder (3.0.4) | ||
coffee-rails (3.2.2) | ||
coffee-script (>= 2.2.0) | ||
railties (~> 3.2.0) | ||
coffee-script (2.2.0) | ||
coffee-script-source | ||
execjs | ||
coffee-script-source (1.4.0) | ||
erubis (2.7.0) | ||
execjs (1.4.0) | ||
multi_json (~> 1.0) | ||
hike (1.2.1) | ||
i18n (0.6.1) | ||
journey (1.0.4) | ||
jquery-rails (2.1.4) | ||
railties (>= 3.0, < 5.0) | ||
thor (>= 0.14, < 2.0) | ||
json (1.7.6) | ||
mail (2.4.4) | ||
i18n (>= 0.4.0) | ||
mime-types (~> 1.16) | ||
treetop (~> 1.4.8) | ||
mime-types (1.19) | ||
multi_json (1.5.0) | ||
polyglot (0.3.3) | ||
rack (1.4.4) | ||
rack-cache (1.2) | ||
rack (>= 0.4) | ||
rack-ssl (1.3.2) | ||
rack | ||
rack-test (0.6.2) | ||
rack (>= 1.0) | ||
rails (3.2.11) | ||
actionmailer (= 3.2.11) | ||
actionpack (= 3.2.11) | ||
activerecord (= 3.2.11) | ||
activeresource (= 3.2.11) | ||
activesupport (= 3.2.11) | ||
bundler (~> 1.0) | ||
railties (= 3.2.11) | ||
railties (3.2.11) | ||
actionpack (= 3.2.11) | ||
activesupport (= 3.2.11) | ||
rack-ssl (~> 1.3.2) | ||
rake (>= 0.8.7) | ||
rdoc (~> 3.4) | ||
thor (>= 0.14.6, < 2.0) | ||
rake (10.0.3) | ||
rdoc (3.12) | ||
json (~> 1.4) | ||
requirejs-rails (0.9.1) | ||
railties (>= 3.1.1, < 3.3) | ||
sprockets (2.2.2) | ||
hike (~> 1.2) | ||
multi_json (~> 1.0) | ||
rack (~> 1.0) | ||
tilt (~> 1.1, != 1.3.0) | ||
sqlite3 (1.3.7) | ||
thor (0.16.0) | ||
tilt (1.3.3) | ||
treetop (1.4.12) | ||
polyglot | ||
polyglot (>= 0.3.1) | ||
turn (0.9.6) | ||
ansi | ||
tzinfo (0.3.35) | ||
|
||
PLATFORMS | ||
ruby | ||
|
||
DEPENDENCIES | ||
chaplin-on-rails! | ||
jquery-rails | ||
sqlite3 | ||
turn |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
Copyright 2013 aenaku | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining | ||
a copy of this software and associated documentation files (the | ||
"Software"), to deal in the Software without restriction, including | ||
without limitation the rights to use, copy, modify, merge, publish, | ||
distribute, sublicense, and/or sell copies of the Software, and to | ||
permit persons to whom the Software is furnished to do so, subject to | ||
the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be | ||
included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | ||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | ||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | ||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# ChaplinOnRails | ||
|
||
Gem for using [Chaplin.js](https://github.com/chaplinjs/chaplin) with Rails asset pipeline, based on | ||
[chaplin-rails](https://github.com/chaplinjs/chaplin-rails) boilerplate project. | ||
|
||
Since Chaplin requires module system this gem has | ||
[requirejs-rails](https://github.com/jwhitley/requirejs-rails) gem | ||
in dependecy. Those, you're forced to use `requirejs` for your project :) | ||
|
||
Gem already comes with `underscore.js` and `backbone.js`. | ||
|
||
## Installation | ||
|
||
Add this line to your application's Gemfile: | ||
|
||
gem 'chaplin-on-rails', git: 'git://github.com/eicaa/chaplin-on-rails.git' | ||
|
||
And then execute: | ||
|
||
$ bundle | ||
|
||
## Usage | ||
|
||
Run | ||
|
||
rails g chaplin:install | ||
|
||
It should create basic application structure with some basic files. | ||
To learn more about this see | ||
[chaplin-rails](https://github.com/chaplinjs/chaplin-rails). | ||
|
||
This gem generates new `application.js.coffee` for you, so you should | ||
migrate your old `application.js` to `requirejs` config file and remove | ||
`application.js` file. | ||
|
||
Also, there might be a problem with replacing `requirejs_include_tag`. | ||
Just follow for generator's output instructions. | ||
|
||
## TODO | ||
|
||
1. Write tests for install generator. | ||
2. Write generators for scaffold/resource/controller/model. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#!/usr/bin/env rake | ||
begin | ||
require 'bundler/setup' | ||
rescue LoadError | ||
puts 'You must `gem install bundler` and `bundle install` to run rake tasks' | ||
end | ||
begin | ||
require 'rdoc/task' | ||
rescue LoadError | ||
require 'rdoc/rdoc' | ||
require 'rake/rdoctask' | ||
RDoc::Task = Rake::RDocTask | ||
end | ||
|
||
RDoc::Task.new(:rdoc) do |rdoc| | ||
rdoc.rdoc_dir = 'rdoc' | ||
rdoc.title = 'ChaplinOnRails' | ||
rdoc.options << '--line-numbers' | ||
rdoc.rdoc_files.include('README.rdoc') | ||
rdoc.rdoc_files.include('lib/**/*.rb') | ||
end | ||
|
||
|
||
|
||
|
||
Bundler::GemHelper.install_tasks | ||
|
||
require 'rake/testtask' | ||
|
||
Rake::TestTask.new(:test) do |t| | ||
t.libs << 'lib' | ||
t.libs << 'test' | ||
t.pattern = 'test/**/*_test.rb' | ||
t.verbose = false | ||
end | ||
|
||
|
||
task :default => :test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
$:.push File.expand_path("../lib", __FILE__) | ||
|
||
# Maintain your gem's version: | ||
require "chaplin-on-rails/version" | ||
|
||
# Describe your gem and declare its dependencies: | ||
Gem::Specification.new do |s| | ||
s.name = "chaplin-on-rails" | ||
s.version = ChaplinOnRails::VERSION | ||
s.authors = ["TODO: name"] | ||
s.email = ["TODO: email"] | ||
s.homepage = "TODO" | ||
s.summary = "TODO: Summary of ChaplinOnRails." | ||
s.description = "TODO: Description of ChaplinOnRails." | ||
|
||
s.files = Dir["{vendor,lib}/**/*"] + ["MIT-LICENSE", "Rakefile", "README.rdoc"] | ||
s.test_files = Dir["test/**/*"] | ||
|
||
s.add_dependency 'rails', '>= 3.1' | ||
s.add_dependency 'coffee-rails' | ||
s.add_dependency 'requirejs-rails' | ||
|
||
s.add_development_dependency 'sqlite3' | ||
s.add_development_dependency 'turn' | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
require "chaplin-on-rails/engine" | ||
require "chaplin-on-rails/version" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
require 'requirejs-rails' | ||
|
||
module ChaplinOnRails | ||
class Engine < Rails::Engine | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module ChaplinOnRails | ||
VERSION = "0.7.0-pre" | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
module Chaplin | ||
module Generators | ||
module Helpers | ||
|
||
def asset_path | ||
File.join('app', 'assets') | ||
end | ||
|
||
def javascript_path | ||
File.join(asset_path, 'javascripts') | ||
end | ||
|
||
def model_path | ||
File.join(javascript_path, "models") | ||
end | ||
|
||
def view_path | ||
File.join(javascript_path, "views") | ||
end | ||
|
||
def controller_path | ||
File.join(javascript_path, "controllers") | ||
end | ||
|
||
def lib_path | ||
File.join(javascript_path, "lib") | ||
end | ||
|
||
def base_path(path) | ||
File.join(path, 'base') | ||
end | ||
|
||
def template_path | ||
File.join(asset_path, "templates") | ||
end | ||
|
||
def singular_file_name | ||
"#{file_name.singularize}#{@ext}" | ||
end | ||
|
||
def plural_file_name | ||
"#{file_name.pluralize}#{@ext}" | ||
end | ||
|
||
def router_file_name | ||
"#{file_name.pluralize}_router#{@ext}" | ||
end | ||
|
||
def view_file_name | ||
"#{file_name.pluralize}_index#{@ext}" | ||
end | ||
|
||
def model_namespace | ||
[app_name, "Models", file_name.singularize.camelize].join(".") | ||
end | ||
|
||
def collection_namespace | ||
[app_name, "Collections", file_name.pluralize.camelize].join(".") | ||
end | ||
|
||
def router_namespace | ||
[app_name, "Routers", file_name.pluralize.camelize].join(".") | ||
end | ||
|
||
def view_namespace | ||
[app_name, "Views", "#{file_name.pluralize.camelize}Index"].join(".") | ||
end | ||
|
||
def template_namespace | ||
File.join(file_path.pluralize, "index") | ||
end | ||
|
||
def app_name | ||
rails_app_name.camelize | ||
end | ||
|
||
def app_filename | ||
rails_app_name.underscore | ||
end | ||
|
||
def rails_app_name | ||
Rails.application.class.name.split('::').first | ||
end | ||
|
||
def layout_path | ||
Dir['app/views/layouts/application*'].first | ||
end | ||
|
||
def display(output, color = :green) | ||
say(" - #{output}", color) | ||
end | ||
end | ||
end | ||
end |
Oops, something went wrong.