From 137f7cfffa9c5e9cd9dac9d9a3525d7738060612 Mon Sep 17 00:00:00 2001 From: Gion Kunz Date: Thu, 21 Nov 2013 00:30:33 +0100 Subject: [PATCH] Added better support for usage outside of rails (i.e. Middleman) --- .gitignore | 1 + lib/angularjs-rails.rb | 5 ++++- lib/angularjs-rails/engine.rb | 6 ++++++ lib/angularjs-rails/sprockets.rb | 3 +++ 4 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 lib/angularjs-rails/engine.rb create mode 100644 lib/angularjs-rails/sprockets.rb diff --git a/.gitignore b/.gitignore index c1ecbde..68e1ed4 100644 --- a/.gitignore +++ b/.gitignore @@ -16,3 +16,4 @@ spec/reports test/tmp test/version_tmp tmp +/.idea diff --git a/lib/angularjs-rails.rb b/lib/angularjs-rails.rb index 079e683..823e1b6 100644 --- a/lib/angularjs-rails.rb +++ b/lib/angularjs-rails.rb @@ -2,7 +2,10 @@ module AngularJS module Rails - class Engine < ::Rails::Engine + if defined? Rails::Engine + require "angularjs-rails/engine" + elsif defined? Sprockets + require "angularjs-rails/sprockets" end end end \ No newline at end of file diff --git a/lib/angularjs-rails/engine.rb b/lib/angularjs-rails/engine.rb new file mode 100644 index 0000000..2591ee0 --- /dev/null +++ b/lib/angularjs-rails/engine.rb @@ -0,0 +1,6 @@ +module AngularJS + module Rails + class Engine < ::Rails::Engine + end + end +end \ No newline at end of file diff --git a/lib/angularjs-rails/sprockets.rb b/lib/angularjs-rails/sprockets.rb new file mode 100644 index 0000000..def18b7 --- /dev/null +++ b/lib/angularjs-rails/sprockets.rb @@ -0,0 +1,3 @@ +require 'sprockets' + +Sprockets.append_path File.expand_path("../../../vendor/assets/javascript", __FILE__)