remote_factory_girl_home_rails 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/Rakefile +19 -0
- data/app/assets/javascripts/remote_factory_girl_home_rails/application.js +13 -0
- data/app/assets/stylesheets/remote_factory_girl_home_rails/application.css +13 -0
- data/app/controllers/remote_factory_girl_home_rails/home_controller.rb +26 -0
- data/app/helpers/remote_factory_girl_home_rails/application_helper.rb +4 -0
- data/app/views/layouts/remote_factory_girl_home_rails/application.html.erb +14 -0
- data/config/routes.rb +3 -0
- data/lib/remote_factory_girl_home_rails/engine.rb +19 -0
- data/lib/remote_factory_girl_home_rails.rb +37 -0
- data/lib/tasks/remote_factory_girl_home_rails_tasks.rake +4 -0
- metadata +96 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 488e7f7c4d829f08b5a9b3d9cf99de40d945df8d
|
4
|
+
data.tar.gz: 332d1f82ef9fc58fe82343a7f960e755098de275
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: dddc809a5fcb31fb22f3ec1f6cc602f174d0b143f30defaf7c3a95f342bf798e2db6d97b3af60f87f0bbfb76061f7345a6f41a39825334ceaca8bfa7a3a70455
|
7
|
+
data.tar.gz: 3086f0666ac3dae781f27562c9cbf0dde79295fd01a947d7f9ad9fec374511b1c65c3cb58eaf4e4088a077c79cc18e458467de87da1cbd5d6d416511cf8b764b
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2014 YOURNAME
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
begin
|
2
|
+
require 'bundler/setup'
|
3
|
+
rescue LoadError
|
4
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
5
|
+
end
|
6
|
+
|
7
|
+
APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)
|
8
|
+
load 'rails/tasks/engine.rake'
|
9
|
+
|
10
|
+
Bundler::GemHelper.install_tasks
|
11
|
+
Dir[File.join(File.dirname(__FILE__), 'tasks/**/*.rake')].each {|f| load f }
|
12
|
+
|
13
|
+
require 'rspec/core'
|
14
|
+
require 'rspec/core/rake_task'
|
15
|
+
|
16
|
+
desc "Run all specs in spec directory (excluding plugin specs)"
|
17
|
+
RSpec::Core::RakeTask.new(:spec => 'app:db:test:prepare')
|
18
|
+
|
19
|
+
task :default => :spec
|
@@ -0,0 +1,13 @@
|
|
1
|
+
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
2
|
+
// listed below.
|
3
|
+
//
|
4
|
+
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
5
|
+
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
|
6
|
+
//
|
7
|
+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
8
|
+
// compiled file.
|
9
|
+
//
|
10
|
+
// Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
|
11
|
+
// about supported directives.
|
12
|
+
//
|
13
|
+
//= require_tree .
|
@@ -0,0 +1,13 @@
|
|
1
|
+
/*
|
2
|
+
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
3
|
+
* listed below.
|
4
|
+
*
|
5
|
+
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
6
|
+
* or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
|
7
|
+
*
|
8
|
+
* You're free to add application-wide styles to this file and they'll appear at the top of the
|
9
|
+
* compiled file, but it's generally better to create a new file per style scope.
|
10
|
+
*
|
11
|
+
*= require_self
|
12
|
+
*= require_tree .
|
13
|
+
*/
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module RemoteFactoryGirlHomeRails
|
2
|
+
class HomeController < ApplicationController
|
3
|
+
|
4
|
+
skip_before_filter *RemoteFactoryGirlHomeRails.skip_before_filter
|
5
|
+
|
6
|
+
def create
|
7
|
+
if RemoteFactoryGirlHomeRails.enabled?
|
8
|
+
factory = FactoryGirl.create(factory(params), attributes(params))
|
9
|
+
render json: factory
|
10
|
+
else
|
11
|
+
forbidden = 403
|
12
|
+
render json: { status: forbidden }, status: forbidden
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
private
|
17
|
+
|
18
|
+
def factory(params)
|
19
|
+
params['factory'].to_sym
|
20
|
+
end
|
21
|
+
|
22
|
+
def attributes(params)
|
23
|
+
params['attributes'] || {}
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>RemoteFactoryGirlHomeRails</title>
|
5
|
+
<%= stylesheet_link_tag "remote_factory_girl_home_rails/application", media: "all" %>
|
6
|
+
<%= javascript_include_tag "remote_factory_girl_home_rails/application" %>
|
7
|
+
<%= csrf_meta_tags %>
|
8
|
+
</head>
|
9
|
+
<body>
|
10
|
+
|
11
|
+
<%= yield %>
|
12
|
+
|
13
|
+
</body>
|
14
|
+
</html>
|
data/config/routes.rb
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
module RemoteFactoryGirlHomeRails
|
2
|
+
class Engine < ::Rails::Engine
|
3
|
+
isolate_namespace RemoteFactoryGirlHomeRails
|
4
|
+
|
5
|
+
config.generators do |g|
|
6
|
+
g.test_framework :rspec, :fixture => false
|
7
|
+
g.assets false
|
8
|
+
g.helper false
|
9
|
+
end
|
10
|
+
|
11
|
+
config.remote_factory_girl_home_rails = ActiveSupport::OrderedOptions.new
|
12
|
+
|
13
|
+
initializer "remote_factory_girl_home_rails.environment" do |app|
|
14
|
+
options = app.config.remote_factory_girl_home_rails
|
15
|
+
options.skip_before_filter ||= nil
|
16
|
+
options.enable ||= false
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require "remote_factory_girl_home_rails/engine"
|
2
|
+
|
3
|
+
module RemoteFactoryGirlHomeRails
|
4
|
+
|
5
|
+
OFF = false
|
6
|
+
ON = true
|
7
|
+
|
8
|
+
def self.skip_before_filter
|
9
|
+
filters = config.skip_before_filter
|
10
|
+
filters.present? ? [filters].flatten.map(&:to_sym) : nil
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.config(config = RemoteFactoryGirlHomeRails::Engine.config.remote_factory_girl_home_rails)
|
14
|
+
config
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.configure
|
18
|
+
yield config
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.enable!
|
22
|
+
config.enable = ON
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.disable!
|
26
|
+
config.enable = OFF
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.enabled?
|
30
|
+
config.enable == ON
|
31
|
+
end
|
32
|
+
|
33
|
+
def self.reset
|
34
|
+
config.enable = OFF
|
35
|
+
config.skip_before_filter = nil
|
36
|
+
end
|
37
|
+
end
|
metadata
ADDED
@@ -0,0 +1,96 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: remote_factory_girl_home_rails
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Travis Douce
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-04-09 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rails
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 4.0.2
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 4.0.2
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: sqlite3
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec-rails
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
description: ''
|
56
|
+
email:
|
57
|
+
- travisdouce@gmail.com
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- MIT-LICENSE
|
63
|
+
- Rakefile
|
64
|
+
- app/assets/javascripts/remote_factory_girl_home_rails/application.js
|
65
|
+
- app/assets/stylesheets/remote_factory_girl_home_rails/application.css
|
66
|
+
- app/controllers/remote_factory_girl_home_rails/home_controller.rb
|
67
|
+
- app/helpers/remote_factory_girl_home_rails/application_helper.rb
|
68
|
+
- app/views/layouts/remote_factory_girl_home_rails/application.html.erb
|
69
|
+
- config/routes.rb
|
70
|
+
- lib/remote_factory_girl_home_rails.rb
|
71
|
+
- lib/remote_factory_girl_home_rails/engine.rb
|
72
|
+
- lib/tasks/remote_factory_girl_home_rails_tasks.rake
|
73
|
+
homepage: https://github.com/tdouce/remote_factory_girl_home_rails
|
74
|
+
licenses: []
|
75
|
+
metadata: {}
|
76
|
+
post_install_message:
|
77
|
+
rdoc_options: []
|
78
|
+
require_paths:
|
79
|
+
- lib
|
80
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
81
|
+
requirements:
|
82
|
+
- - ">="
|
83
|
+
- !ruby/object:Gem::Version
|
84
|
+
version: '0'
|
85
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
requirements: []
|
91
|
+
rubyforge_project:
|
92
|
+
rubygems_version: 2.2.2
|
93
|
+
signing_key:
|
94
|
+
specification_version: 4
|
95
|
+
summary: ''
|
96
|
+
test_files: []
|