Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

initial commit, extracted spine-rails PR 5

  • Loading branch information...
commit 5d888ec8240dd1ef5f6f64735524c4b92d7019e6 0 parents
@dnagir authored
7 .gitignore
@@ -0,0 +1,7 @@
+.DS_Store
+pkg/*
+*.gem
+*.rbc
+*.swp
+.bundle
+Gemfile.lock
3  Gemfile
@@ -0,0 +1,3 @@
+source 'http://rubygems.org'
+
+gemspec
37 README.md
@@ -0,0 +1,37 @@
+# Spine-Extensions
+
+Provides opinionated but a handy set of extensions to the awesome [Spine](http://spinejs.com) framework.
+
+## What does it do?
+
+It provides you with a number of useful helpers and utilities to make you happier programmer and save you some typing.
+It is supposed to grow with time.
+
+Currently it includes:
+
+### Spine.Controller and JST templating bridge
+
+- obtain the view from JST (assuming the Posts controller): `@view 'show'` (instead of `JST['app/views/posts/show']`)
+- render the view from JST (assuming the Posts controller): `@generate 'show', post` (instead of `JST['app/views/posts/show'](post)`)
+
+## Setup
+
+This gem requires the use of [spine-rails](https://github.com/maccman/spine-rails) as part of assets pipeline.
+
+If you want to use it standalone, you will have to compile the files inside `app/assets/javascripts` for now.
+
+### Installation
+
+In your Gemfile, add this line:
+
+ gem "spine-extensions"
+
+Then run the following commands:
+
+ bundle install
+
+ rails generate spine-extensions:install
+
+## License
+
+MIT
10 Rakefile
@@ -0,0 +1,10 @@
+require 'bundler'
+Bundler::GemHelper.install_tasks
+
+# require "spec/rake/spectask"
+# desc "Run all examples"
+# Spec::Rake::SpecTask.new(:spec) do |t|
+# t.ruby_opts = ['-r test/unit']
+# t.spec_opts = %w[--color]
+# end
+task :default => :spec
12 app/assets/javascripts/spine-extensions.coffee
@@ -0,0 +1,12 @@
+ #= require spine
+
+# Controller view rendering helpers
+Spine.Controller.include
+ view: (name) ->
+ protoString = @constructor.toString().match(/^function ([^\(]+)/)[1] # Blogs
+ areaName = protoString.toLowerCase() # blogs
+ JST["app/views/#{areaName}/#{name}"]
+
+ generate: (name, data) -> @view(name)(data)
+
+
17 lib/generators/spine-extensions/install/install_generator.rb
@@ -0,0 +1,17 @@
+require 'rails'
+
+module SpineExtensions
+ module Generators
+
+ class InstallGenerator < ::Rails::Generators::Base
+ desc "This generator installs Spine Extensions into application.js manigest"
+
+ def inject_require_into_manifest
+ inject_into_file "app/assets/javascripts/application.js", :before => "//= require_tree" do
+ "//= require spine-extensions\n"
+ end
+ end
+ end
+
+ end
+end
2  lib/spine-extensions.rb
@@ -0,0 +1,2 @@
+require 'spine-extensions/version'
+require 'spine-extensions/engine'
6 lib/spine-extensions/engine.rb
@@ -0,0 +1,6 @@
+module SpineExtensions
+ module Rails
+ class Engine < ::Rails::Engine
+ end
+ end
+end
3  lib/spine-extensions/version.rb
@@ -0,0 +1,3 @@
+module SpineExtensions
+ VERSION = "0.0.1"
+end
25 spine-extensions.gemspec
@@ -0,0 +1,25 @@
+# -*- encoding: utf-8 -*-
+require File.expand_path('../lib/spine-extensions/version', __FILE__)
+
+Gem::Specification.new do |s|
+ s.name = "spine-extensions"
+ s.version = SpineExtensions::VERSION
+ s.platform = Gem::Platform::RUBY
+ s.authors = ["Dmytrii Nagirniak"]
+ s.email = ["dnagir@gmail.com"]
+ s.homepage = "http://github.com/dnagir/spine-extensions"
+ s.summary = "Bridge the gap between Spine.js and Rails and make it easier to use it"
+ s.description = "This gem provides a set of handy extensions to Spine and Rails to make you a happier programmer"
+
+ s.required_rubygems_version = ">= 1.3.6"
+ s.rubyforge_project = "spine-extensions"
+
+ s.add_dependency 'rails', '>= 3.1.0'
+ s.add_dependency 'spine-rails'
+ s.add_development_dependency "bundler"
+
+ s.files = `git ls-files`.split("\n")
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
+ s.require_paths = ["lib"]
+end
Please sign in to comment.
Something went wrong with that request. Please try again.