diff options
author | Azul <azul@riseup.net> | 2012-09-27 22:33:04 +0200 |
---|---|---|
committer | Azul <azul@riseup.net> | 2012-09-27 22:33:04 +0200 |
commit | e17a2a676e0ce585ef9eaa9077887bfe1bc1173f (patch) | |
tree | e9984326f2d205d948d0cd3ab8c39aa72cf8af08 /core/lib | |
parent | 7ea11431db5b2ef93cb3caaa8909b742a1b72f8a (diff) |
added in leap web core - merging repos
Diffstat (limited to 'core/lib')
-rw-r--r-- | core/lib/extensions/testing.rb | 24 | ||||
-rw-r--r-- | core/lib/leap_web_core.rb | 6 | ||||
-rw-r--r-- | core/lib/leap_web_core/dependencies.rb | 40 | ||||
-rw-r--r-- | core/lib/leap_web_core/engine.rb | 9 | ||||
-rw-r--r-- | core/lib/leap_web_core/version.rb | 3 | ||||
-rw-r--r-- | core/lib/tasks/leap_web_core_tasks.rake | 4 |
6 files changed, 86 insertions, 0 deletions
diff --git a/core/lib/extensions/testing.rb b/core/lib/extensions/testing.rb new file mode 100644 index 0000000..14a5698 --- /dev/null +++ b/core/lib/extensions/testing.rb @@ -0,0 +1,24 @@ +module LeapWebCore + module AssertResponses + + def assert_attachement_filename(name) + assert_equal %Q(attachment; filename="#{name}"), + @response.headers["Content-Disposition"] + end + + + def assert_json_response(object) + object.stringify_keys! if object.respond_to? :stringify_keys! + assert_equal object, JSON.parse(@response.body) + end + + end +end + +class ::ActionController::TestCase + include LeapWebCore::AssertResponses +end + +class ::ActionDispatch::IntegrationTest + include LeapWebCore::AssertResponses +end diff --git a/core/lib/leap_web_core.rb b/core/lib/leap_web_core.rb new file mode 100644 index 0000000..16004f8 --- /dev/null +++ b/core/lib/leap_web_core.rb @@ -0,0 +1,6 @@ +require "extensions/testing" +require "leap_web_core/dependencies" +require "leap_web_core/engine" + +module LeapWebCore +end diff --git a/core/lib/leap_web_core/dependencies.rb b/core/lib/leap_web_core/dependencies.rb new file mode 100644 index 0000000..7f6ca87 --- /dev/null +++ b/core/lib/leap_web_core/dependencies.rb @@ -0,0 +1,40 @@ +module LeapWebCore + class Dependencies + UI_DEV = { + "haml-rails" => "~> 0.3.4", + "sass-rails" => "~> 3.2.5", + "coffee-rails" => "~> 3.2.2", + "uglifier" => "~> 1.2.7" + } + + UI = { + "haml" => "~> 3.1.7", + "bootstrap-sass" => "~> 2.0.4", + "jquery-rails" => nil, + "simple_form" => nil + } + + def self.require_ui_gems + UI.keys.each {|dep| require dep} + if Rails.env == "development" + # This will be run in the app including plugins that run it. + # However not all development_dependencies might be present. + # So we better only require those that are. + available = Bundler.definition.specs.map(&:name) + gems_to_require = available & UI_DEV.keys + gems_to_require.each {|dep| require dep} + end + end + + def self.add_ui_gems_to_spec(spec) + UI.each do |dep, version| + spec.add_dependency dep, version + end + + UI_DEV.each do |dep, version| + spec.add_development_dependency dep, version + end + end + + end +end diff --git a/core/lib/leap_web_core/engine.rb b/core/lib/leap_web_core/engine.rb new file mode 100644 index 0000000..940b5e2 --- /dev/null +++ b/core/lib/leap_web_core/engine.rb @@ -0,0 +1,9 @@ +# thou shall require all your dependencies in an engine. +require "couchrest" +require "couchrest_model" + +module LeapWebCore + class Engine < ::Rails::Engine + + end +end diff --git a/core/lib/leap_web_core/version.rb b/core/lib/leap_web_core/version.rb new file mode 100644 index 0000000..6a34982 --- /dev/null +++ b/core/lib/leap_web_core/version.rb @@ -0,0 +1,3 @@ +module LeapWebCore + VERSION = "0.0.1" +end diff --git a/core/lib/tasks/leap_web_core_tasks.rake b/core/lib/tasks/leap_web_core_tasks.rake new file mode 100644 index 0000000..ae5b79b --- /dev/null +++ b/core/lib/tasks/leap_web_core_tasks.rake @@ -0,0 +1,4 @@ +# desc "Explaining what the task does" +# task :leap_web_core do +# # Task goes here +# end |