formie 0.7.1 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +1 -1
- data/README.md +9 -3
- data/Rakefile +38 -0
- data/lib/formie/version.rb +1 -1
- data/test/controllers/orders_test.rb +16 -0
- data/test/dummy/Rakefile +6 -0
- data/test/dummy/app/controllers/application_controller.rb +8 -0
- data/test/dummy/app/controllers/orders_controller.rb +16 -0
- data/test/dummy/app/formies/application/copyright.html.erb +3 -0
- data/test/dummy/app/formies/forms/builtins.html.erb +7 -0
- data/test/dummy/app/formies/forms/l_text_field.html.erb +4 -0
- data/test/dummy/app/formies/templates/hello.slim +1 -0
- data/test/dummy/app/formies/templates/l_text_field.html.erb +2 -0
- data/test/dummy/app/formies/templates/labelled.html.erb +4 -0
- data/test/dummy/app/models/order.rb +11 -0
- data/test/dummy/app/views/layouts/application.html.erb +12 -0
- data/test/dummy/app/views/orders/_form.html.erb +7 -0
- data/test/dummy/app/views/orders/_new.html.erb +1 -0
- data/test/dummy/app/views/orders/index.html.erb +2 -0
- data/test/dummy/app/views/orders/new.html.erb +3 -0
- data/test/dummy/app/views/orders/show.html.erb +3 -0
- data/test/dummy/bin/bundle +3 -0
- data/test/dummy/bin/rails +4 -0
- data/test/dummy/bin/rake +4 -0
- data/test/dummy/bin/setup +29 -0
- data/test/dummy/config/application.rb +26 -0
- data/test/dummy/config/boot.rb +5 -0
- data/test/dummy/config/database.yml +25 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +41 -0
- data/test/dummy/config/environments/production.rb +77 -0
- data/test/dummy/config/environments/production.rb.bak +77 -0
- data/test/dummy/config/environments/test.rb +42 -0
- data/test/dummy/config/environments/test.rb.bak +42 -0
- data/test/dummy/config/initializers/assets.rb +11 -0
- data/test/dummy/config/initializers/cookies_serializer.rb +3 -0
- data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/test/dummy/config/initializers/session_store.rb +3 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/locales/en.yml +23 -0
- data/test/dummy/config/routes.rb +4 -0
- data/test/dummy/config/secrets.yml +22 -0
- data/test/dummy/config.ru +4 -0
- data/test/dummy/db/development.sqlite3 +0 -0
- data/test/dummy/db/migrate/20141016161801_create_orders.rb +10 -0
- data/test/dummy/db/schema.rb +23 -0
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/integration/order_test.rb +37 -0
- data/test/test_helper.rb +23 -0
- metadata +114 -75
- data/Gemfile +0 -16
- data/formie.gemspec +0 -30
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: a3a2d8174e39897137b232898c15b85b4c57ff3a
|
4
|
+
data.tar.gz: 68bac9a4e35ca0f4bf7599f48fa6173bbe3363f6
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 2c08fc6dab733537406aff4303e07939762cf347a15331c994dee16c0058c7441e9fd817569a9c83d24a023d80d91de718344481323ea1007f4cd9c3add84de8
|
7
|
+
data.tar.gz: 06b66fc01c0292104b44ff1e76606a3cd5fde3cdfb63b498bdc8609ed3a054b43aad13f4264b406721efe5fb4cae44dd228caefd290bd4b9264ec3b2832482c6
|
data/MIT-LICENSE
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,9 @@
|
|
1
1
|
Formie
|
2
2
|
======
|
3
3
|
|
4
|
+
[![Gem Version](https://badge.fury.io/rb/formie.png)](http://badge.fury.io/rb/formie)
|
5
|
+
[![Build Status](https://travis-ci.org/matique/formie.png?branch=master)](https://travis-ci.org/matique/formie)
|
6
|
+
|
4
7
|
Tired of programming each HTML tag? Are you in search of DRYness for Rails
|
5
8
|
views? May be Formie can help you.
|
6
9
|
|
@@ -26,6 +29,8 @@ or:
|
|
26
29
|
|
27
30
|
$ bundle
|
28
31
|
|
32
|
+
Use 'gem install formie -v 0.7.1' for Rails 3.2.
|
33
|
+
|
29
34
|
## Description
|
30
35
|
|
31
36
|
Templates for Formie are hosted in:
|
@@ -80,9 +85,10 @@ In directory app/formies :
|
|
80
85
|
<a href="<%= "/#{h(controller_name)}/#{obj.id}" %>"> Show </a>
|
81
86
|
|
82
87
|
# forms/l_text_field.html.erb
|
88
|
+
<% field = args.first %>
|
83
89
|
<p>
|
84
|
-
<%= form.label
|
85
|
-
<%= form.text_field
|
90
|
+
<%= form.label field %><br />
|
91
|
+
<%= form.text_field field %>
|
86
92
|
</p>
|
87
93
|
|
88
|
-
Copyright (c) 2009..
|
94
|
+
Copyright (c) 2009..2015 Dittmar Krall, released under the MIT license.
|
data/Rakefile
ADDED
@@ -0,0 +1,38 @@
|
|
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("../test/dummy/Rakefile", __FILE__)
|
8
|
+
load 'rails/tasks/engine.rake'
|
9
|
+
|
10
|
+
load 'rails/tasks/statistics.rake'
|
11
|
+
|
12
|
+
|
13
|
+
Bundler::GemHelper.install_tasks
|
14
|
+
|
15
|
+
require 'rake/testtask'
|
16
|
+
|
17
|
+
Rake::TestTask.new(:test) do |t|
|
18
|
+
t.libs << 'lib'
|
19
|
+
t.libs << 'test'
|
20
|
+
t.pattern = 'test/**/*_test.rb'
|
21
|
+
t.verbose = false
|
22
|
+
end
|
23
|
+
|
24
|
+
task default: :test
|
25
|
+
|
26
|
+
|
27
|
+
desc "Clean automatically generated files"
|
28
|
+
task :clean do
|
29
|
+
FileUtils.rm_rf "pkg"
|
30
|
+
end
|
31
|
+
|
32
|
+
desc "Check syntax"
|
33
|
+
task :syntax do
|
34
|
+
Dir["**/*.rb"].each do |file|
|
35
|
+
print "#{file}: "
|
36
|
+
system("ruby -c #{file}")
|
37
|
+
end
|
38
|
+
end
|
data/lib/formie/version.rb
CHANGED
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class OrdersControllerTest < ActionController::TestCase
|
4
|
+
|
5
|
+
test 'checking formie copyright' do
|
6
|
+
get :index
|
7
|
+
assert_response :success
|
8
|
+
assert_not_nil assigns(:orders)
|
9
|
+
assert_match /copyright/, response.body
|
10
|
+
assert_match /Copyright/, response.body
|
11
|
+
assert_match /label/ , response.body
|
12
|
+
assert_match /input/ , response.body
|
13
|
+
assert_match /def/ , response.body
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
data/test/dummy/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
span Hello Slim
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= f.builtins(123, 456) {|n| n + 1 } %>
|
data/test/dummy/bin/rake
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'pathname'
|
3
|
+
|
4
|
+
# path to your application root.
|
5
|
+
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
|
6
|
+
|
7
|
+
Dir.chdir APP_ROOT do
|
8
|
+
# This script is a starting point to setup your application.
|
9
|
+
# Add necessary setup steps to this file:
|
10
|
+
|
11
|
+
puts "== Installing dependencies =="
|
12
|
+
system "gem install bundler --conservative"
|
13
|
+
system "bundle check || bundle install"
|
14
|
+
|
15
|
+
# puts "\n== Copying sample files =="
|
16
|
+
# unless File.exist?("config/database.yml")
|
17
|
+
# system "cp config/database.yml.sample config/database.yml"
|
18
|
+
# end
|
19
|
+
|
20
|
+
puts "\n== Preparing database =="
|
21
|
+
system "bin/rake db:setup"
|
22
|
+
|
23
|
+
puts "\n== Removing old logs and tempfiles =="
|
24
|
+
system "rm -f log/*"
|
25
|
+
system "rm -rf tmp/cache"
|
26
|
+
|
27
|
+
puts "\n== Restarting application server =="
|
28
|
+
system "touch tmp/restart.txt"
|
29
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require File.expand_path('../boot', __FILE__)
|
2
|
+
|
3
|
+
require 'rails/all'
|
4
|
+
|
5
|
+
Bundler.require(*Rails.groups)
|
6
|
+
require "formie"
|
7
|
+
|
8
|
+
module Dummy
|
9
|
+
class Application < Rails::Application
|
10
|
+
# Settings in config/environments/* take precedence over those specified here.
|
11
|
+
# Application configuration should go into files in config/initializers
|
12
|
+
# -- all .rb files in that directory are automatically loaded.
|
13
|
+
|
14
|
+
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
15
|
+
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
|
16
|
+
# config.time_zone = 'Central Time (US & Canada)'
|
17
|
+
|
18
|
+
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
|
19
|
+
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
20
|
+
# config.i18n.default_locale = :de
|
21
|
+
|
22
|
+
# Do not swallow errors in after_commit/after_rollback callbacks.
|
23
|
+
config.active_record.raise_in_transactional_callbacks = true
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# SQLite version 3.x
|
2
|
+
# gem install sqlite3
|
3
|
+
#
|
4
|
+
# Ensure the SQLite 3 gem is defined in your Gemfile
|
5
|
+
# gem 'sqlite3'
|
6
|
+
#
|
7
|
+
default: &default
|
8
|
+
adapter: sqlite3
|
9
|
+
pool: 5
|
10
|
+
timeout: 5000
|
11
|
+
|
12
|
+
development:
|
13
|
+
<<: *default
|
14
|
+
database: db/development.sqlite3
|
15
|
+
|
16
|
+
# Warning: The database defined as "test" will be erased and
|
17
|
+
# re-generated from your development database when you run "rake".
|
18
|
+
# Do not set this db to the same as development or production.
|
19
|
+
test:
|
20
|
+
<<: *default
|
21
|
+
database: db/test.sqlite3
|
22
|
+
|
23
|
+
production:
|
24
|
+
<<: *default
|
25
|
+
database: db/production.sqlite3
|
@@ -0,0 +1,41 @@
|
|
1
|
+
Rails.application.configure do
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb.
|
3
|
+
|
4
|
+
# In the development environment your application's code is reloaded on
|
5
|
+
# every request. This slows down response time but is perfect for development
|
6
|
+
# since you don't have to restart the web server when you make code changes.
|
7
|
+
config.cache_classes = false
|
8
|
+
|
9
|
+
# Do not eager load code on boot.
|
10
|
+
config.eager_load = false
|
11
|
+
|
12
|
+
# Show full error reports and disable caching.
|
13
|
+
config.consider_all_requests_local = true
|
14
|
+
config.action_controller.perform_caching = false
|
15
|
+
|
16
|
+
# Don't care if the mailer can't send.
|
17
|
+
config.action_mailer.raise_delivery_errors = false
|
18
|
+
|
19
|
+
# Print deprecation notices to the Rails logger.
|
20
|
+
config.active_support.deprecation = :log
|
21
|
+
|
22
|
+
# Raise an error on page load if there are pending migrations.
|
23
|
+
config.active_record.migration_error = :page_load
|
24
|
+
|
25
|
+
# Debug mode disables concatenation and preprocessing of assets.
|
26
|
+
# This option may cause significant delays in view rendering with a large
|
27
|
+
# number of complex assets.
|
28
|
+
config.assets.debug = true
|
29
|
+
|
30
|
+
# Asset digests allow you to set far-future HTTP expiration dates on all assets,
|
31
|
+
# yet still be able to expire them through the digest params.
|
32
|
+
config.assets.digest = true
|
33
|
+
|
34
|
+
# Adds additional error checking when serving assets at runtime.
|
35
|
+
# Checks for improperly declared sprockets dependencies.
|
36
|
+
# Raises helpful error messages.
|
37
|
+
config.assets.raise_runtime_errors = true
|
38
|
+
|
39
|
+
# Raises error for missing translations
|
40
|
+
# config.action_view.raise_on_missing_translations = true
|
41
|
+
end
|
@@ -0,0 +1,77 @@
|
|
1
|
+
Rails.application.configure do
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb.
|
3
|
+
|
4
|
+
# Code is not reloaded between requests.
|
5
|
+
config.cache_classes = true
|
6
|
+
|
7
|
+
# Eager load code on boot. This eager loads most of Rails and
|
8
|
+
# your application in memory, allowing both threaded web servers
|
9
|
+
# and those relying on copy on write to perform better.
|
10
|
+
# Rake tasks automatically ignore this option for performance.
|
11
|
+
config.eager_load = true
|
12
|
+
|
13
|
+
# Full error reports are disabled and caching is turned on.
|
14
|
+
config.consider_all_requests_local = false
|
15
|
+
config.action_controller.perform_caching = true
|
16
|
+
|
17
|
+
# Enable Rack::Cache to put a simple HTTP cache in front of your application
|
18
|
+
# Add `rack-cache` to your Gemfile before enabling this.
|
19
|
+
# For large-scale production use, consider using a caching reverse proxy like
|
20
|
+
# NGINX, varnish or squid.
|
21
|
+
# config.action_dispatch.rack_cache = true
|
22
|
+
|
23
|
+
# Disable Rails's static asset server (Apache or NGINX will already do this).
|
24
|
+
config.serve_static_files = false
|
25
|
+
|
26
|
+
# Compress JavaScripts and CSS.
|
27
|
+
config.assets.js_compressor = :uglifier
|
28
|
+
# config.assets.css_compressor = :sass
|
29
|
+
|
30
|
+
# Do not fallback to assets pipeline if a precompiled asset is missed.
|
31
|
+
config.assets.compile = false
|
32
|
+
|
33
|
+
# Asset digests allow you to set far-future HTTP expiration dates on all assets,
|
34
|
+
# yet still be able to expire them through the digest params.
|
35
|
+
config.assets.digest = true
|
36
|
+
|
37
|
+
# `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
|
38
|
+
|
39
|
+
# Specifies the header that your server uses for sending files.
|
40
|
+
# config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
|
41
|
+
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
|
42
|
+
|
43
|
+
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
|
44
|
+
# config.force_ssl = true
|
45
|
+
|
46
|
+
# Decrease the log volume.
|
47
|
+
# config.log_level = :info
|
48
|
+
|
49
|
+
# Prepend all log lines with the following tags.
|
50
|
+
# config.log_tags = [ :subdomain, :uuid ]
|
51
|
+
|
52
|
+
# Use a different logger for distributed setups.
|
53
|
+
# config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
|
54
|
+
|
55
|
+
# Use a different cache store in production.
|
56
|
+
# config.cache_store = :mem_cache_store
|
57
|
+
|
58
|
+
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
|
59
|
+
# config.action_controller.asset_host = 'http://assets.example.com'
|
60
|
+
|
61
|
+
# Ignore bad email addresses and do not raise email delivery errors.
|
62
|
+
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
|
63
|
+
# config.action_mailer.raise_delivery_errors = false
|
64
|
+
|
65
|
+
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
|
66
|
+
# the I18n.default_locale when a translation cannot be found).
|
67
|
+
config.i18n.fallbacks = true
|
68
|
+
|
69
|
+
# Send deprecation notices to registered listeners.
|
70
|
+
config.active_support.deprecation = :notify
|
71
|
+
|
72
|
+
# Use default logging formatter so that PID and timestamp are not suppressed.
|
73
|
+
config.log_formatter = ::Logger::Formatter.new
|
74
|
+
|
75
|
+
# Do not dump schema after migrations.
|
76
|
+
config.active_record.dump_schema_after_migration = false
|
77
|
+
end
|
@@ -0,0 +1,77 @@
|
|
1
|
+
Rails.application.configure do
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb.
|
3
|
+
|
4
|
+
# Code is not reloaded between requests.
|
5
|
+
config.cache_classes = true
|
6
|
+
|
7
|
+
# Eager load code on boot. This eager loads most of Rails and
|
8
|
+
# your application in memory, allowing both threaded web servers
|
9
|
+
# and those relying on copy on write to perform better.
|
10
|
+
# Rake tasks automatically ignore this option for performance.
|
11
|
+
config.eager_load = true
|
12
|
+
|
13
|
+
# Full error reports are disabled and caching is turned on.
|
14
|
+
config.consider_all_requests_local = false
|
15
|
+
config.action_controller.perform_caching = true
|
16
|
+
|
17
|
+
# Enable Rack::Cache to put a simple HTTP cache in front of your application
|
18
|
+
# Add `rack-cache` to your Gemfile before enabling this.
|
19
|
+
# For large-scale production use, consider using a caching reverse proxy like
|
20
|
+
# NGINX, varnish or squid.
|
21
|
+
# config.action_dispatch.rack_cache = true
|
22
|
+
|
23
|
+
# Disable Rails's static asset server (Apache or NGINX will already do this).
|
24
|
+
config.serve_static_assets = false
|
25
|
+
|
26
|
+
# Compress JavaScripts and CSS.
|
27
|
+
config.assets.js_compressor = :uglifier
|
28
|
+
# config.assets.css_compressor = :sass
|
29
|
+
|
30
|
+
# Do not fallback to assets pipeline if a precompiled asset is missed.
|
31
|
+
config.assets.compile = false
|
32
|
+
|
33
|
+
# Asset digests allow you to set far-future HTTP expiration dates on all assets,
|
34
|
+
# yet still be able to expire them through the digest params.
|
35
|
+
config.assets.digest = true
|
36
|
+
|
37
|
+
# `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
|
38
|
+
|
39
|
+
# Specifies the header that your server uses for sending files.
|
40
|
+
# config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
|
41
|
+
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
|
42
|
+
|
43
|
+
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
|
44
|
+
# config.force_ssl = true
|
45
|
+
|
46
|
+
# Decrease the log volume.
|
47
|
+
# config.log_level = :info
|
48
|
+
|
49
|
+
# Prepend all log lines with the following tags.
|
50
|
+
# config.log_tags = [ :subdomain, :uuid ]
|
51
|
+
|
52
|
+
# Use a different logger for distributed setups.
|
53
|
+
# config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
|
54
|
+
|
55
|
+
# Use a different cache store in production.
|
56
|
+
# config.cache_store = :mem_cache_store
|
57
|
+
|
58
|
+
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
|
59
|
+
# config.action_controller.asset_host = 'http://assets.example.com'
|
60
|
+
|
61
|
+
# Ignore bad email addresses and do not raise email delivery errors.
|
62
|
+
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
|
63
|
+
# config.action_mailer.raise_delivery_errors = false
|
64
|
+
|
65
|
+
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
|
66
|
+
# the I18n.default_locale when a translation cannot be found).
|
67
|
+
config.i18n.fallbacks = true
|
68
|
+
|
69
|
+
# Send deprecation notices to registered listeners.
|
70
|
+
config.active_support.deprecation = :notify
|
71
|
+
|
72
|
+
# Use default logging formatter so that PID and timestamp are not suppressed.
|
73
|
+
config.log_formatter = ::Logger::Formatter.new
|
74
|
+
|
75
|
+
# Do not dump schema after migrations.
|
76
|
+
config.active_record.dump_schema_after_migration = false
|
77
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
Rails.application.configure do
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb.
|
3
|
+
|
4
|
+
# The test environment is used exclusively to run your application's
|
5
|
+
# test suite. You never need to work with it otherwise. Remember that
|
6
|
+
# your test database is "scratch space" for the test suite and is wiped
|
7
|
+
# and recreated between test runs. Don't rely on the data there!
|
8
|
+
config.cache_classes = true
|
9
|
+
|
10
|
+
# Do not eager load code on boot. This avoids loading your whole application
|
11
|
+
# just for the purpose of running a single test. If you are using a tool that
|
12
|
+
# preloads Rails for running tests, you may have to set it to true.
|
13
|
+
config.eager_load = false
|
14
|
+
|
15
|
+
# Configure static asset server for tests with Cache-Control for performance.
|
16
|
+
config.serve_static_files = true
|
17
|
+
config.static_cache_control = 'public, max-age=3600'
|
18
|
+
|
19
|
+
# Show full error reports and disable caching.
|
20
|
+
config.consider_all_requests_local = true
|
21
|
+
config.action_controller.perform_caching = false
|
22
|
+
|
23
|
+
# Raise exceptions instead of rendering exception templates.
|
24
|
+
config.action_dispatch.show_exceptions = false
|
25
|
+
|
26
|
+
# Disable request forgery protection in test environment.
|
27
|
+
config.action_controller.allow_forgery_protection = false
|
28
|
+
|
29
|
+
# Tell Action Mailer not to deliver emails to the real world.
|
30
|
+
# The :test delivery method accumulates sent emails in the
|
31
|
+
# ActionMailer::Base.deliveries array.
|
32
|
+
config.action_mailer.delivery_method = :test
|
33
|
+
|
34
|
+
# Randomize the order test cases are executed
|
35
|
+
config.active_support.test_order = :random
|
36
|
+
|
37
|
+
# Print deprecation notices to the stderr.
|
38
|
+
config.active_support.deprecation = :stderr
|
39
|
+
|
40
|
+
# Raises error for missing translations
|
41
|
+
# config.action_view.raise_on_missing_translations = true
|
42
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
Rails.application.configure do
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb.
|
3
|
+
|
4
|
+
# The test environment is used exclusively to run your application's
|
5
|
+
# test suite. You never need to work with it otherwise. Remember that
|
6
|
+
# your test database is "scratch space" for the test suite and is wiped
|
7
|
+
# and recreated between test runs. Don't rely on the data there!
|
8
|
+
config.cache_classes = true
|
9
|
+
|
10
|
+
# Do not eager load code on boot. This avoids loading your whole application
|
11
|
+
# just for the purpose of running a single test. If you are using a tool that
|
12
|
+
# preloads Rails for running tests, you may have to set it to true.
|
13
|
+
config.eager_load = false
|
14
|
+
|
15
|
+
# Configure static asset server for tests with Cache-Control for performance.
|
16
|
+
config.serve_static_assets = true
|
17
|
+
config.static_cache_control = 'public, max-age=3600'
|
18
|
+
|
19
|
+
# Show full error reports and disable caching.
|
20
|
+
config.consider_all_requests_local = true
|
21
|
+
config.action_controller.perform_caching = false
|
22
|
+
|
23
|
+
# Raise exceptions instead of rendering exception templates.
|
24
|
+
config.action_dispatch.show_exceptions = false
|
25
|
+
|
26
|
+
# Disable request forgery protection in test environment.
|
27
|
+
config.action_controller.allow_forgery_protection = false
|
28
|
+
|
29
|
+
# Tell Action Mailer not to deliver emails to the real world.
|
30
|
+
# The :test delivery method accumulates sent emails in the
|
31
|
+
# ActionMailer::Base.deliveries array.
|
32
|
+
config.action_mailer.delivery_method = :test
|
33
|
+
|
34
|
+
# Randomize the order test cases are executed
|
35
|
+
config.active_support.test_order = :random
|
36
|
+
|
37
|
+
# Print deprecation notices to the stderr.
|
38
|
+
config.active_support.deprecation = :stderr
|
39
|
+
|
40
|
+
# Raises error for missing translations
|
41
|
+
# config.action_view.raise_on_missing_translations = true
|
42
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# Version of your assets, change this if you want to expire all your assets.
|
4
|
+
Rails.application.config.assets.version = '1.0'
|
5
|
+
|
6
|
+
# Add additional assets to the asset load path
|
7
|
+
# Rails.application.config.assets.paths << Emoji.images_path
|
8
|
+
|
9
|
+
# Precompile additional assets.
|
10
|
+
# application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
|
11
|
+
# Rails.application.config.assets.precompile += %w( search.js )
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# This file contains settings for ActionController::ParamsWrapper which
|
4
|
+
# is enabled by default.
|
5
|
+
|
6
|
+
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
|
7
|
+
ActiveSupport.on_load(:action_controller) do
|
8
|
+
wrap_parameters format: [:json] if respond_to?(:wrap_parameters)
|
9
|
+
end
|
10
|
+
|
11
|
+
# To enable root element in JSON for ActiveRecord objects.
|
12
|
+
# ActiveSupport.on_load(:active_record) do
|
13
|
+
# self.include_root_in_json = true
|
14
|
+
# end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# Files in the config/locales directory are used for internationalization
|
2
|
+
# and are automatically loaded by Rails. If you want to use locales other
|
3
|
+
# than English, add the necessary files in this directory.
|
4
|
+
#
|
5
|
+
# To use the locales, use `I18n.t`:
|
6
|
+
#
|
7
|
+
# I18n.t 'hello'
|
8
|
+
#
|
9
|
+
# In views, this is aliased to just `t`:
|
10
|
+
#
|
11
|
+
# <%= t('hello') %>
|
12
|
+
#
|
13
|
+
# To use a different locale, set it with `I18n.locale`:
|
14
|
+
#
|
15
|
+
# I18n.locale = :es
|
16
|
+
#
|
17
|
+
# This would use the information in config/locales/es.yml.
|
18
|
+
#
|
19
|
+
# To learn more, please read the Rails Internationalization guide
|
20
|
+
# available at http://guides.rubyonrails.org/i18n.html.
|
21
|
+
|
22
|
+
en:
|
23
|
+
hello: "Hello world"
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# Your secret key is used for verifying the integrity of signed cookies.
|
4
|
+
# If you change this key, all old signed cookies will become invalid!
|
5
|
+
|
6
|
+
# Make sure the secret is at least 30 characters and all random,
|
7
|
+
# no regular words or you'll be exposed to dictionary attacks.
|
8
|
+
# You can use `rake secret` to generate a secure secret key.
|
9
|
+
|
10
|
+
# Make sure the secrets in this file are kept private
|
11
|
+
# if you're sharing your code publicly.
|
12
|
+
|
13
|
+
development:
|
14
|
+
secret_key_base: 275485c45d2769b27b553713774ddcaa648217bbfe7171c68e0dcc9ad62b095e28a5cd5c7f9a9379e6245d99297031f9d50dc97f98fafb40685afc6cb6fe98d3
|
15
|
+
|
16
|
+
test:
|
17
|
+
secret_key_base: bc357f031a4bb2b17bd13fce6aee4cfc37463c7613838acf287bc0771dd35158cf51812b0b6845d2e6574c3e7460964b49d45a61184be7456a3781602ac30606
|
18
|
+
|
19
|
+
# Do not keep production secrets in the repository,
|
20
|
+
# instead read values from the environment.
|
21
|
+
production:
|
22
|
+
secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
|
Binary file
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
# This file is auto-generated from the current state of the database. Instead
|
3
|
+
# of editing this file, please use the migrations feature of Active Record to
|
4
|
+
# incrementally modify your database, and then regenerate this schema definition.
|
5
|
+
#
|
6
|
+
# Note that this schema.rb definition is the authoritative source for your
|
7
|
+
# database schema. If you need to create the application database on another
|
8
|
+
# system, you should be using db:schema:load, not running all the migrations
|
9
|
+
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
|
10
|
+
# you'll amass, the slower it'll run and the greater likelihood for issues).
|
11
|
+
#
|
12
|
+
# It's strongly recommended that you check this file into your version control system.
|
13
|
+
|
14
|
+
ActiveRecord::Schema.define(version: 20141016161801) do
|
15
|
+
|
16
|
+
create_table "orders", force: true do |t|
|
17
|
+
t.string "name"
|
18
|
+
t.string "qty"
|
19
|
+
t.datetime "created_at", null: false
|
20
|
+
t.datetime "updated_at", null: false
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
Binary file
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# http://blog.crowdint.com/2013/06/14/testing-rails-with-minitest.html
|
2
|
+
|
3
|
+
require 'test_helper'
|
4
|
+
|
5
|
+
describe "Formie" do
|
6
|
+
include Capybara::DSL
|
7
|
+
|
8
|
+
before do
|
9
|
+
Order.delete_all
|
10
|
+
Order.create :name => 'Rumpelstilzchen'
|
11
|
+
end
|
12
|
+
|
13
|
+
it 'should display copyright' do
|
14
|
+
visit "/orders"
|
15
|
+
assert page.has_content?('Copyright')
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'should list one order' do
|
19
|
+
order = Order.all.first
|
20
|
+
|
21
|
+
visit "/orders/#{order.id}"
|
22
|
+
assert_equal order.name, page.find('form p input#order_name').value
|
23
|
+
assert_equal 'Hello Slim', page.find('form span').text
|
24
|
+
end
|
25
|
+
|
26
|
+
it 'builtins' do
|
27
|
+
visit "/orders/new"
|
28
|
+
assert page.has_content?("action_name new")
|
29
|
+
assert page.has_content?("args [123, 456]")
|
30
|
+
assert page.has_content?("block 4")
|
31
|
+
assert page.has_content?("controller_name orders")
|
32
|
+
assert page.has_content?("form ActionView::Helpers::FormBuilder")
|
33
|
+
assert page.has_content?("form.object Order")
|
34
|
+
assert page.has_content?("params new")
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
data/test/test_helper.rb
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'simplecov'
|
2
|
+
SimpleCov.start "rails" do
|
3
|
+
add_filter '/application_controller.rb/'
|
4
|
+
end
|
5
|
+
|
6
|
+
# Configure Rails Environment
|
7
|
+
ENV["RAILS_ENV"] = "test"
|
8
|
+
|
9
|
+
require File.expand_path("../../test/dummy/config/environment.rb", __FILE__)
|
10
|
+
ActiveRecord::Migrator.migrations_paths = [File.expand_path("../../test/dummy/db/migrate", __FILE__)]
|
11
|
+
require "rails/test_help"
|
12
|
+
require 'minitest/autorun'
|
13
|
+
require 'capybara/rails'
|
14
|
+
|
15
|
+
Rails.backtrace_cleaner.remove_silencers!
|
16
|
+
|
17
|
+
# Load support files
|
18
|
+
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
|
19
|
+
|
20
|
+
# Load fixtures from the engine
|
21
|
+
if ActiveSupport::TestCase.respond_to?(:fixture_path=)
|
22
|
+
ActiveSupport::TestCase.fixture_path = File.expand_path("../fixtures", __FILE__)
|
23
|
+
end
|
metadata
CHANGED
@@ -1,120 +1,159 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: formie
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.8.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Dittmar Krall
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2015-10-17 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: rails
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - "~>"
|
20
18
|
- !ruby/object:Gem::Version
|
21
|
-
version: '
|
19
|
+
version: '4.2'
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- -
|
24
|
+
- - "~>"
|
28
25
|
- !ruby/object:Gem::Version
|
29
|
-
version: '
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
- - ! '>='
|
36
|
-
- !ruby/object:Gem::Version
|
37
|
-
version: '0'
|
38
|
-
type: :development
|
39
|
-
prerelease: false
|
40
|
-
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
|
-
requirements:
|
43
|
-
- - ! '>='
|
44
|
-
- !ruby/object:Gem::Version
|
45
|
-
version: '0'
|
46
|
-
- !ruby/object:Gem::Dependency
|
47
|
-
name: rspec-rails
|
48
|
-
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
|
-
requirements:
|
51
|
-
- - ! '>='
|
52
|
-
- !ruby/object:Gem::Version
|
53
|
-
version: '0'
|
54
|
-
type: :development
|
55
|
-
prerelease: false
|
56
|
-
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
|
-
requirements:
|
59
|
-
- - ! '>='
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
62
|
-
- !ruby/object:Gem::Dependency
|
63
|
-
name: capybara
|
64
|
-
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
|
-
requirements:
|
67
|
-
- - ! '>='
|
68
|
-
- !ruby/object:Gem::Version
|
69
|
-
version: '0'
|
70
|
-
type: :development
|
71
|
-
prerelease: false
|
72
|
-
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
|
-
requirements:
|
75
|
-
- - ! '>='
|
76
|
-
- !ruby/object:Gem::Version
|
77
|
-
version: '0'
|
78
|
-
description: ! " Formie implements low level template-based helpers. It injects\n
|
79
|
-
\ the formies into the ActionView module. The form-bounded as well as\n the
|
80
|
-
unbounded templates are supported. Still, the ActionView\n functionality (e.g.
|
81
|
-
text_field) is kept untouched.\n"
|
26
|
+
version: '4.2'
|
27
|
+
description: |2
|
28
|
+
Formie implements low level template-based helpers. It injects
|
29
|
+
the formies into the ActionView module. The form-bounded as well as
|
30
|
+
the unbounded templates are supported. Still, the ActionView
|
31
|
+
functionality (e.g. text_field) is kept untouched.
|
82
32
|
email:
|
83
33
|
- dittmar.krall@matique.de
|
84
34
|
executables: []
|
85
35
|
extensions: []
|
86
36
|
extra_rdoc_files: []
|
87
37
|
files:
|
88
|
-
- lib/formie/version.rb
|
89
|
-
- lib/formie/engine.rb
|
90
|
-
- lib/formie.rb
|
91
|
-
- config/initializers/formie.rb
|
92
|
-
- Gemfile
|
93
38
|
- MIT-LICENSE
|
94
39
|
- README.md
|
95
|
-
-
|
40
|
+
- Rakefile
|
41
|
+
- config/initializers/formie.rb
|
42
|
+
- lib/formie.rb
|
43
|
+
- lib/formie/engine.rb
|
44
|
+
- lib/formie/version.rb
|
45
|
+
- test/controllers/orders_test.rb
|
46
|
+
- test/dummy/Rakefile
|
47
|
+
- test/dummy/app/controllers/application_controller.rb
|
48
|
+
- test/dummy/app/controllers/orders_controller.rb
|
49
|
+
- test/dummy/app/formies/application/copyright.html.erb
|
50
|
+
- test/dummy/app/formies/forms/builtins.html.erb
|
51
|
+
- test/dummy/app/formies/forms/l_text_field.html.erb
|
52
|
+
- test/dummy/app/formies/templates/hello.slim
|
53
|
+
- test/dummy/app/formies/templates/l_text_field.html.erb
|
54
|
+
- test/dummy/app/formies/templates/labelled.html.erb
|
55
|
+
- test/dummy/app/models/order.rb
|
56
|
+
- test/dummy/app/views/layouts/application.html.erb
|
57
|
+
- test/dummy/app/views/orders/_form.html.erb
|
58
|
+
- test/dummy/app/views/orders/_new.html.erb
|
59
|
+
- test/dummy/app/views/orders/index.html.erb
|
60
|
+
- test/dummy/app/views/orders/new.html.erb
|
61
|
+
- test/dummy/app/views/orders/show.html.erb
|
62
|
+
- test/dummy/bin/bundle
|
63
|
+
- test/dummy/bin/rails
|
64
|
+
- test/dummy/bin/rake
|
65
|
+
- test/dummy/bin/setup
|
66
|
+
- test/dummy/config.ru
|
67
|
+
- test/dummy/config/application.rb
|
68
|
+
- test/dummy/config/boot.rb
|
69
|
+
- test/dummy/config/database.yml
|
70
|
+
- test/dummy/config/environment.rb
|
71
|
+
- test/dummy/config/environments/development.rb
|
72
|
+
- test/dummy/config/environments/production.rb
|
73
|
+
- test/dummy/config/environments/production.rb.bak
|
74
|
+
- test/dummy/config/environments/test.rb
|
75
|
+
- test/dummy/config/environments/test.rb.bak
|
76
|
+
- test/dummy/config/initializers/assets.rb
|
77
|
+
- test/dummy/config/initializers/cookies_serializer.rb
|
78
|
+
- test/dummy/config/initializers/filter_parameter_logging.rb
|
79
|
+
- test/dummy/config/initializers/session_store.rb
|
80
|
+
- test/dummy/config/initializers/wrap_parameters.rb
|
81
|
+
- test/dummy/config/locales/en.yml
|
82
|
+
- test/dummy/config/routes.rb
|
83
|
+
- test/dummy/config/secrets.yml
|
84
|
+
- test/dummy/db/development.sqlite3
|
85
|
+
- test/dummy/db/migrate/20141016161801_create_orders.rb
|
86
|
+
- test/dummy/db/schema.rb
|
87
|
+
- test/dummy/db/test.sqlite3
|
88
|
+
- test/integration/order_test.rb
|
89
|
+
- test/test_helper.rb
|
96
90
|
homepage: http://matique.de
|
97
|
-
licenses:
|
91
|
+
licenses:
|
92
|
+
- MIT
|
93
|
+
metadata: {}
|
98
94
|
post_install_message:
|
99
95
|
rdoc_options: []
|
100
96
|
require_paths:
|
101
97
|
- lib
|
102
98
|
required_ruby_version: !ruby/object:Gem::Requirement
|
103
|
-
none: false
|
104
99
|
requirements:
|
105
|
-
- -
|
100
|
+
- - ">="
|
106
101
|
- !ruby/object:Gem::Version
|
107
102
|
version: '0'
|
108
103
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
109
|
-
none: false
|
110
104
|
requirements:
|
111
|
-
- -
|
105
|
+
- - ">="
|
112
106
|
- !ruby/object:Gem::Version
|
113
107
|
version: '0'
|
114
108
|
requirements: []
|
115
109
|
rubyforge_project:
|
116
|
-
rubygems_version:
|
110
|
+
rubygems_version: 2.4.8
|
117
111
|
signing_key:
|
118
|
-
specification_version:
|
112
|
+
specification_version: 4
|
119
113
|
summary: Formie is like a helper, but uses the notation of a partial.
|
120
|
-
test_files:
|
114
|
+
test_files:
|
115
|
+
- test/integration/order_test.rb
|
116
|
+
- test/test_helper.rb
|
117
|
+
- test/dummy/Rakefile
|
118
|
+
- test/dummy/config.ru
|
119
|
+
- test/dummy/db/development.sqlite3
|
120
|
+
- test/dummy/db/schema.rb
|
121
|
+
- test/dummy/db/migrate/20141016161801_create_orders.rb
|
122
|
+
- test/dummy/db/test.sqlite3
|
123
|
+
- test/dummy/app/formies/application/copyright.html.erb
|
124
|
+
- test/dummy/app/formies/forms/builtins.html.erb
|
125
|
+
- test/dummy/app/formies/forms/l_text_field.html.erb
|
126
|
+
- test/dummy/app/formies/templates/labelled.html.erb
|
127
|
+
- test/dummy/app/formies/templates/hello.slim
|
128
|
+
- test/dummy/app/formies/templates/l_text_field.html.erb
|
129
|
+
- test/dummy/app/models/order.rb
|
130
|
+
- test/dummy/app/views/layouts/application.html.erb
|
131
|
+
- test/dummy/app/views/orders/show.html.erb
|
132
|
+
- test/dummy/app/views/orders/new.html.erb
|
133
|
+
- test/dummy/app/views/orders/_form.html.erb
|
134
|
+
- test/dummy/app/views/orders/_new.html.erb
|
135
|
+
- test/dummy/app/views/orders/index.html.erb
|
136
|
+
- test/dummy/app/controllers/application_controller.rb
|
137
|
+
- test/dummy/app/controllers/orders_controller.rb
|
138
|
+
- test/dummy/bin/setup
|
139
|
+
- test/dummy/bin/bundle
|
140
|
+
- test/dummy/bin/rake
|
141
|
+
- test/dummy/bin/rails
|
142
|
+
- test/dummy/config/environment.rb
|
143
|
+
- test/dummy/config/initializers/wrap_parameters.rb
|
144
|
+
- test/dummy/config/initializers/cookies_serializer.rb
|
145
|
+
- test/dummy/config/initializers/session_store.rb
|
146
|
+
- test/dummy/config/initializers/assets.rb
|
147
|
+
- test/dummy/config/initializers/filter_parameter_logging.rb
|
148
|
+
- test/dummy/config/secrets.yml
|
149
|
+
- test/dummy/config/locales/en.yml
|
150
|
+
- test/dummy/config/application.rb
|
151
|
+
- test/dummy/config/routes.rb
|
152
|
+
- test/dummy/config/boot.rb
|
153
|
+
- test/dummy/config/environments/development.rb
|
154
|
+
- test/dummy/config/environments/production.rb
|
155
|
+
- test/dummy/config/environments/test.rb.bak
|
156
|
+
- test/dummy/config/environments/production.rb.bak
|
157
|
+
- test/dummy/config/environments/test.rb
|
158
|
+
- test/dummy/config/database.yml
|
159
|
+
- test/controllers/orders_test.rb
|
data/Gemfile
DELETED
data/formie.gemspec
DELETED
@@ -1,30 +0,0 @@
|
|
1
|
-
lib = File.expand_path('../lib/', __FILE__)
|
2
|
-
$:.unshift lib unless $:.include?(lib)
|
3
|
-
|
4
|
-
require 'formie/version'
|
5
|
-
|
6
|
-
Gem::Specification.new do |s|
|
7
|
-
s.name = "formie"
|
8
|
-
s.version = Formie::VERSION
|
9
|
-
s.platform = Gem::Platform::RUBY
|
10
|
-
s.summary = "Formie is like a helper, but uses the notation of a partial."
|
11
|
-
s.description = <<-'END'
|
12
|
-
Formie implements low level template-based helpers. It injects
|
13
|
-
the formies into the ActionView module. The form-bounded as well as
|
14
|
-
the unbounded templates are supported. Still, the ActionView
|
15
|
-
functionality (e.g. text_field) is kept untouched.
|
16
|
-
END
|
17
|
-
s.authors = ['Dittmar Krall']
|
18
|
-
s.email = ['dittmar.krall@matique.de']
|
19
|
-
s.homepage = 'http://matique.de'
|
20
|
-
|
21
|
-
files = Dir["{app,lib,config}/**/*.rb"]
|
22
|
-
files += %w{Gemfile MIT-LICENSE README.md formie.gemspec}
|
23
|
-
s.files = files
|
24
|
-
s.require_paths = ["lib"]
|
25
|
-
|
26
|
-
s.add_dependency "rails"
|
27
|
-
s.add_development_dependency "sqlite3"
|
28
|
-
s.add_development_dependency "rspec-rails"
|
29
|
-
s.add_development_dependency "capybara"
|
30
|
-
end
|