dry_crud 1.7.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/MIT-LICENSE +1 -1
- data/README.rdoc +126 -87
- data/VERSION +1 -1
- data/lib/generators/dry_crud/dry_crud_generator.rb +42 -22
- data/lib/generators/dry_crud/templates/INSTALL +5 -5
- data/lib/generators/dry_crud/templates/app/assets/stylesheets/crud.scss +0 -20
- data/lib/generators/dry_crud/templates/app/assets/stylesheets/sample.scss +24 -4
- data/lib/generators/dry_crud/templates/app/controllers/crud/generic_model.rb +89 -0
- data/lib/generators/dry_crud/templates/app/controllers/crud/nestable.rb +70 -0
- data/lib/generators/dry_crud/templates/app/controllers/crud/rememberable.rb +64 -0
- data/lib/generators/dry_crud/templates/app/controllers/crud/render_callbacks.rb +46 -0
- data/lib/generators/dry_crud/templates/app/controllers/crud/responder.rb +31 -0
- data/lib/generators/dry_crud/templates/app/controllers/crud/searchable.rb +55 -0
- data/lib/generators/dry_crud/templates/app/controllers/crud/sortable.rb +63 -0
- data/lib/generators/dry_crud/templates/app/controllers/crud_controller.rb +66 -69
- data/lib/generators/dry_crud/templates/app/controllers/list_controller.rb +23 -326
- data/lib/generators/dry_crud/templates/app/helpers/actions_helper.rb +64 -0
- data/lib/generators/dry_crud/templates/app/helpers/crud/form_builder.rb +331 -0
- data/lib/generators/dry_crud/templates/app/helpers/crud/table_builder.rb +280 -0
- data/lib/generators/dry_crud/templates/app/helpers/form_helper.rb +52 -0
- data/lib/generators/dry_crud/templates/app/helpers/format_helper.rb +164 -0
- data/lib/generators/dry_crud/templates/app/helpers/i18n_helper.rb +85 -0
- data/lib/generators/dry_crud/templates/app/helpers/table_helper.rb +83 -0
- data/lib/generators/dry_crud/templates/app/helpers/utility_helper.rb +84 -0
- data/lib/generators/dry_crud/templates/app/views/crud/_actions_edit.html.erb +3 -3
- data/lib/generators/dry_crud/templates/app/views/crud/_actions_edit.html.haml +3 -3
- data/lib/generators/dry_crud/templates/app/views/crud/_actions_index.html.erb +1 -1
- data/lib/generators/dry_crud/templates/app/views/crud/_actions_index.html.haml +1 -1
- data/lib/generators/dry_crud/templates/app/views/crud/_actions_show.html.erb +3 -3
- data/lib/generators/dry_crud/templates/app/views/crud/_actions_show.html.haml +3 -3
- data/lib/generators/dry_crud/templates/app/views/crud/_attrs.html.erb +1 -1
- data/lib/generators/dry_crud/templates/app/views/crud/_attrs.html.haml +1 -1
- data/lib/generators/dry_crud/templates/app/views/crud/_form.html.erb +1 -1
- data/lib/generators/dry_crud/templates/app/views/crud/_form.html.haml +1 -1
- data/lib/generators/dry_crud/templates/app/views/crud/edit.html.erb +1 -1
- data/lib/generators/dry_crud/templates/app/views/crud/edit.html.haml +1 -1
- data/lib/generators/dry_crud/templates/app/views/crud/new.html.erb +2 -2
- data/lib/generators/dry_crud/templates/app/views/crud/new.html.haml +2 -2
- data/lib/generators/dry_crud/templates/app/views/crud/show.html.erb +1 -1
- data/lib/generators/dry_crud/templates/app/views/crud/show.html.haml +1 -1
- data/lib/generators/dry_crud/templates/app/views/layouts/_flash.html.haml +1 -1
- data/lib/generators/dry_crud/templates/app/views/layouts/_nav.html.erb +1 -1
- data/lib/generators/dry_crud/templates/app/views/layouts/_nav.html.haml +1 -1
- data/lib/generators/dry_crud/templates/app/views/layouts/crud.html.erb +15 -7
- data/lib/generators/dry_crud/templates/app/views/layouts/crud.html.haml +18 -8
- data/lib/generators/dry_crud/templates/app/views/list/_search.html.erb +3 -3
- data/lib/generators/dry_crud/templates/app/views/list/_search.html.haml +3 -3
- data/lib/generators/dry_crud/templates/app/views/list/index.html.erb +1 -1
- data/lib/generators/dry_crud/templates/app/views/list/index.html.haml +1 -1
- data/lib/generators/dry_crud/templates/app/views/shared/_error_messages.html.erb +1 -1
- data/lib/generators/dry_crud/templates/app/views/shared/_error_messages.html.haml +1 -1
- data/lib/generators/dry_crud/templates/app/views/shared/_labeled.html.erb +2 -4
- data/lib/generators/dry_crud/templates/app/views/shared/_labeled.html.haml +2 -3
- data/lib/generators/dry_crud/templates/config/initializers/field_error_proc.rb +5 -1
- data/lib/generators/dry_crud/templates/config/locales/crud.de.yml +64 -0
- data/lib/generators/dry_crud/templates/config/locales/{en_crud.yml → crud.en.yml} +2 -2
- data/lib/generators/dry_crud/templates/spec/controllers/crud_test_models_controller_spec.rb +241 -231
- data/lib/generators/dry_crud/templates/spec/helpers/crud/form_builder_spec.rb +226 -0
- data/lib/generators/dry_crud/templates/spec/helpers/{standard_table_builder_spec.rb → crud/table_builder_spec.rb} +36 -34
- data/lib/generators/dry_crud/templates/spec/helpers/form_helper_spec.rb +238 -0
- data/lib/generators/dry_crud/templates/spec/helpers/format_helper_spec.rb +244 -0
- data/lib/generators/dry_crud/templates/spec/helpers/i18n_helper_spec.rb +132 -0
- data/lib/generators/dry_crud/templates/spec/helpers/table_helper_spec.rb +265 -0
- data/lib/generators/dry_crud/templates/spec/helpers/utility_helper_spec.rb +74 -0
- data/lib/generators/dry_crud/templates/spec/support/crud_controller_examples.rb +185 -100
- data/lib/generators/dry_crud/templates/spec/support/crud_controller_test_helper.rb +58 -49
- data/lib/generators/dry_crud/templates/test/{functional → controllers}/crud_test_models_controller_test.rb +112 -91
- data/lib/generators/dry_crud/templates/test/{unit/helpers/standard_form_builder_test.rb → helpers/crud/form_builder_test.rb} +79 -62
- data/lib/generators/dry_crud/templates/test/{unit/helpers/standard_table_builder_test.rb → helpers/crud/table_builder_test.rb} +31 -28
- data/lib/generators/dry_crud/templates/test/helpers/custom_assertions_test.rb +85 -0
- data/lib/generators/dry_crud/templates/test/helpers/form_helper_test.rb +129 -0
- data/lib/generators/dry_crud/templates/test/helpers/format_helper_test.rb +163 -0
- data/lib/generators/dry_crud/templates/test/helpers/i18n_helper_test.rb +79 -0
- data/lib/generators/dry_crud/templates/test/helpers/table_helper_test.rb +217 -0
- data/lib/generators/dry_crud/templates/test/helpers/utility_helper_test.rb +63 -0
- data/lib/generators/dry_crud/templates/test/{functional → support}/crud_controller_test_helper.rb +70 -59
- data/lib/generators/dry_crud/templates/test/{crud_test_model.rb → support/crud_test_model.rb} +107 -75
- data/lib/generators/dry_crud/templates/test/support/custom_assertions.rb +83 -0
- metadata +83 -146
- data/Rakefile +0 -211
- data/lib/generators/dry_crud/templates/app/helpers/crud_helper.rb +0 -168
- data/lib/generators/dry_crud/templates/app/helpers/list_helper.rb +0 -27
- data/lib/generators/dry_crud/templates/app/helpers/standard_form_builder.rb +0 -261
- data/lib/generators/dry_crud/templates/app/helpers/standard_helper.rb +0 -304
- data/lib/generators/dry_crud/templates/app/helpers/standard_table_builder.rb +0 -178
- data/lib/generators/dry_crud/templates/spec/helpers/crud_helper_spec.rb +0 -146
- data/lib/generators/dry_crud/templates/spec/helpers/list_helper_spec.rb +0 -154
- data/lib/generators/dry_crud/templates/spec/helpers/standard_form_builder_spec.rb +0 -215
- data/lib/generators/dry_crud/templates/spec/helpers/standard_helper_spec.rb +0 -387
- data/lib/generators/dry_crud/templates/test/custom_assertions.rb +0 -78
- data/lib/generators/dry_crud/templates/test/unit/custom_assertions_test.rb +0 -117
- data/lib/generators/dry_crud/templates/test/unit/helpers/crud_helper_test.rb +0 -111
- data/lib/generators/dry_crud/templates/test/unit/helpers/list_helper_test.rb +0 -123
- data/lib/generators/dry_crud/templates/test/unit/helpers/standard_helper_test.rb +0 -281
- data/test/templates/Gemfile +0 -46
- data/test/templates/app/controllers/admin/cities_controller.rb +0 -7
- data/test/templates/app/controllers/admin/countries_controller.rb +0 -13
- data/test/templates/app/controllers/ajax_controller.rb +0 -9
- data/test/templates/app/controllers/people_controller.rb +0 -13
- data/test/templates/app/controllers/vips_controller.rb +0 -19
- data/test/templates/app/helpers/cities_helper.rb +0 -9
- data/test/templates/app/helpers/people_helper.rb +0 -8
- data/test/templates/app/models/city.rb +0 -28
- data/test/templates/app/models/country.rb +0 -16
- data/test/templates/app/models/person.rb +0 -12
- data/test/templates/app/views/admin/cities/_actions_index.html.erb +0 -2
- data/test/templates/app/views/admin/cities/_actions_index.html.haml +0 -2
- data/test/templates/app/views/admin/cities/_attrs.html.erb +0 -1
- data/test/templates/app/views/admin/cities/_attrs.html.haml +0 -1
- data/test/templates/app/views/admin/cities/_form.html.erb +0 -7
- data/test/templates/app/views/admin/cities/_form.html.haml +0 -5
- data/test/templates/app/views/admin/cities/_hello.html.erb +0 -1
- data/test/templates/app/views/admin/cities/_hello.html.haml +0 -1
- data/test/templates/app/views/admin/cities/_list.html.erb +0 -3
- data/test/templates/app/views/admin/cities/_list.html.haml +0 -3
- data/test/templates/app/views/admin/countries/_list.html.erb +0 -4
- data/test/templates/app/views/admin/countries/_list.html.haml +0 -3
- data/test/templates/app/views/ajax/_actions_index.html.erb +0 -8
- data/test/templates/app/views/ajax/_actions_index.html.haml +0 -8
- data/test/templates/app/views/ajax/_actions_show.html.erb +0 -4
- data/test/templates/app/views/ajax/_actions_show.html.haml +0 -4
- data/test/templates/app/views/ajax/_form.html.erb +0 -2
- data/test/templates/app/views/ajax/_form.html.haml +0 -2
- data/test/templates/app/views/ajax/_hello.html.erb +0 -1
- data/test/templates/app/views/ajax/_hello.html.haml +0 -1
- data/test/templates/app/views/ajax/ajax.js.erb +0 -1
- data/test/templates/app/views/ajax/ajax.js.haml +0 -1
- data/test/templates/app/views/ajax/edit.js.erb +0 -1
- data/test/templates/app/views/ajax/edit.js.haml +0 -1
- data/test/templates/app/views/ajax/show.js.erb +0 -1
- data/test/templates/app/views/ajax/show.js.haml +0 -1
- data/test/templates/app/views/ajax/update.js.erb +0 -5
- data/test/templates/app/views/ajax/update.js.haml +0 -5
- data/test/templates/app/views/layouts/_nav.html.erb +0 -6
- data/test/templates/app/views/layouts/_nav.html.haml +0 -5
- data/test/templates/app/views/layouts/bootstrap.html.erb +0 -68
- data/test/templates/app/views/layouts/bootstrap.html.haml +0 -49
- data/test/templates/app/views/people/_attrs.html.erb +0 -5
- data/test/templates/app/views/people/_attrs.html.haml +0 -4
- data/test/templates/app/views/people/_list.html.erb +0 -1
- data/test/templates/app/views/people/_list.html.haml +0 -1
- data/test/templates/config/database.yml +0 -21
- data/test/templates/config/locales/en_cities.yml +0 -56
- data/test/templates/config/routes.rb +0 -32
- data/test/templates/db/migrate/20100511174904_create_people_and_cities.rb +0 -26
- data/test/templates/db/seeds.rb +0 -74
- data/test/templates/spec/controllers/admin/cities_controller_spec.rb +0 -74
- data/test/templates/spec/controllers/admin/countries_controller_spec.rb +0 -56
- data/test/templates/spec/controllers/people_controller_spec.rb +0 -80
- data/test/templates/spec/routing/cities_routing_spec.rb +0 -11
- data/test/templates/spec/routing/countries_routing_spec.rb +0 -11
- data/test/templates/test/fixtures/cities.yml +0 -11
- data/test/templates/test/fixtures/countries.yml +0 -11
- data/test/templates/test/fixtures/people.yml +0 -14
- data/test/templates/test/functional/admin/cities_controller_test.rb +0 -59
- data/test/templates/test/functional/admin/countries_controller_test.rb +0 -42
- data/test/templates/test/functional/people_controller_test.rb +0 -68
@@ -0,0 +1,83 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
3
|
+
# A handful of convenient assertions. The aim of custom assertions is to
|
4
|
+
# provide more specific error messages and to perform complex checks.
|
5
|
+
#
|
6
|
+
# Ideally, include this module into your test_helper.rb file:
|
7
|
+
# # at the beginning of the file:
|
8
|
+
# require 'support/custom_assertions'
|
9
|
+
#
|
10
|
+
# # inside the class definition:
|
11
|
+
# include CustomAssertions
|
12
|
+
module CustomAssertions
|
13
|
+
|
14
|
+
# Asserts that regexp occurs exactly expected times in string.
|
15
|
+
def assert_count(expected, regexp, string, msg = '')
|
16
|
+
actual = string.scan(regexp).size
|
17
|
+
msg = message(msg) do
|
18
|
+
"Expected #{mu_pp(regexp)} to occur #{expected} time(s), " +
|
19
|
+
"but occured #{actual} time(s) in \n#{mu_pp(string)}"
|
20
|
+
end
|
21
|
+
assert expected == actual, msg
|
22
|
+
end
|
23
|
+
|
24
|
+
# Asserts that the given active model record is valid.
|
25
|
+
# This method used to be part of Rails but was deprecated, no idea why.
|
26
|
+
def assert_valid(record, msg = '')
|
27
|
+
record.valid?
|
28
|
+
msg = message(msg) do
|
29
|
+
"Expected #{mu_pp(record)} to be valid, " +
|
30
|
+
"but has the following errors:\n" +
|
31
|
+
mu_pp(record.errors.full_messages.join("\n"))
|
32
|
+
end
|
33
|
+
assert record.valid?, msg
|
34
|
+
end
|
35
|
+
|
36
|
+
# Asserts that the given active model record is not valid.
|
37
|
+
# If you provide a set of invalid attribute symbols, all of and only these
|
38
|
+
# attributes are expected to have errors. If no invalid attributes are
|
39
|
+
# specified, only the invalidity of the record is asserted.
|
40
|
+
def assert_not_valid(record, *invalid_attrs)
|
41
|
+
msg = message do
|
42
|
+
"Expected #{mu_pp(record)} to be invalid, but is valid."
|
43
|
+
end
|
44
|
+
assert !record.valid?, msg
|
45
|
+
|
46
|
+
if invalid_attrs.present?
|
47
|
+
assert_invalid_attrs_have_errors(record, *invalid_attrs)
|
48
|
+
assert_other_attrs_have_no_errors(record, *invalid_attrs)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
# The method used to by Test::Unit to format arguments.
|
53
|
+
# Prints ActiveRecord objects in a simpler format.
|
54
|
+
def mu_pp(obj)
|
55
|
+
if obj.is_a?(ActiveRecord::Base) #:nodoc:
|
56
|
+
obj.to_s
|
57
|
+
else
|
58
|
+
super
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
private
|
63
|
+
|
64
|
+
def assert_invalid_attrs_have_errors(record, *invalid_attrs)
|
65
|
+
invalid_attrs.each do |a|
|
66
|
+
msg = message do
|
67
|
+
"Expected attribute #{mu_pp(a)} to be invalid, but is valid."
|
68
|
+
end
|
69
|
+
assert record.errors[a].present?, msg
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
def assert_other_attrs_have_no_errors(record, *invalid_attrs)
|
74
|
+
record.errors.each do |a, error|
|
75
|
+
msg = message do
|
76
|
+
"Attribute #{mu_pp(a)} not declared as invalid attribute, " +
|
77
|
+
"but has the following error(s):\n#{mu_pp(error)}"
|
78
|
+
end
|
79
|
+
assert invalid_attrs.include?(a), msg
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
end
|
metadata
CHANGED
@@ -1,51 +1,48 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: dry_crud
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
6
|
-
segments:
|
7
|
-
- 1
|
8
|
-
- 7
|
9
|
-
- 0
|
10
|
-
version: 1.7.0
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 2.0.0
|
11
5
|
platform: ruby
|
12
|
-
authors:
|
6
|
+
authors:
|
13
7
|
- Pascal Zumkehr
|
14
8
|
autorequire:
|
15
9
|
bindir: bin
|
16
10
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
- !ruby/object:Gem::Dependency
|
11
|
+
date: 2013-08-13 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
21
14
|
name: rails
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
- !ruby/object:Gem::Version
|
28
|
-
hash: 3
|
29
|
-
segments:
|
30
|
-
- 3
|
31
|
-
- 2
|
32
|
-
version: "3.2"
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ! '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '3.2'
|
33
20
|
type: :runtime
|
34
|
-
|
35
|
-
|
36
|
-
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ! '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '3.2'
|
27
|
+
description: ! 'Generates simple and extendable controller, views and helpers that
|
28
|
+
support you
|
29
|
+
|
30
|
+
to DRY up the CRUD code in your Rails project. Start with these elements and
|
37
31
|
|
32
|
+
build a clean base to efficiently develop your application upon.
|
33
|
+
|
34
|
+
'
|
38
35
|
email: spam@codez.ch
|
39
36
|
executables: []
|
40
|
-
|
41
37
|
extensions: []
|
42
|
-
|
43
|
-
extra_rdoc_files:
|
38
|
+
extra_rdoc_files:
|
44
39
|
- MIT-LICENSE
|
45
40
|
- README.rdoc
|
46
41
|
- VERSION
|
47
|
-
files:
|
42
|
+
files:
|
43
|
+
- lib/generators/dry_crud/USAGE
|
48
44
|
- lib/generators/dry_crud/dry_crud_generator.rb
|
45
|
+
- lib/generators/dry_crud/templates/INSTALL
|
49
46
|
- lib/generators/dry_crud/templates/app/assets/images/actions/add.png
|
50
47
|
- lib/generators/dry_crud/templates/app/assets/images/actions/delete.png
|
51
48
|
- lib/generators/dry_crud/templates/app/assets/images/actions/edit.png
|
@@ -53,13 +50,23 @@ files:
|
|
53
50
|
- lib/generators/dry_crud/templates/app/assets/images/actions/show.png
|
54
51
|
- lib/generators/dry_crud/templates/app/assets/stylesheets/crud.scss
|
55
52
|
- lib/generators/dry_crud/templates/app/assets/stylesheets/sample.scss
|
53
|
+
- lib/generators/dry_crud/templates/app/controllers/crud/generic_model.rb
|
54
|
+
- lib/generators/dry_crud/templates/app/controllers/crud/nestable.rb
|
55
|
+
- lib/generators/dry_crud/templates/app/controllers/crud/rememberable.rb
|
56
|
+
- lib/generators/dry_crud/templates/app/controllers/crud/render_callbacks.rb
|
57
|
+
- lib/generators/dry_crud/templates/app/controllers/crud/responder.rb
|
58
|
+
- lib/generators/dry_crud/templates/app/controllers/crud/searchable.rb
|
59
|
+
- lib/generators/dry_crud/templates/app/controllers/crud/sortable.rb
|
56
60
|
- lib/generators/dry_crud/templates/app/controllers/crud_controller.rb
|
57
61
|
- lib/generators/dry_crud/templates/app/controllers/list_controller.rb
|
58
|
-
- lib/generators/dry_crud/templates/app/helpers/
|
59
|
-
- lib/generators/dry_crud/templates/app/helpers/
|
60
|
-
- lib/generators/dry_crud/templates/app/helpers/
|
61
|
-
- lib/generators/dry_crud/templates/app/helpers/
|
62
|
-
- lib/generators/dry_crud/templates/app/helpers/
|
62
|
+
- lib/generators/dry_crud/templates/app/helpers/actions_helper.rb
|
63
|
+
- lib/generators/dry_crud/templates/app/helpers/crud/form_builder.rb
|
64
|
+
- lib/generators/dry_crud/templates/app/helpers/crud/table_builder.rb
|
65
|
+
- lib/generators/dry_crud/templates/app/helpers/form_helper.rb
|
66
|
+
- lib/generators/dry_crud/templates/app/helpers/format_helper.rb
|
67
|
+
- lib/generators/dry_crud/templates/app/helpers/i18n_helper.rb
|
68
|
+
- lib/generators/dry_crud/templates/app/helpers/table_helper.rb
|
69
|
+
- lib/generators/dry_crud/templates/app/helpers/utility_helper.rb
|
63
70
|
- lib/generators/dry_crud/templates/app/views/crud/_actions_edit.html.erb
|
64
71
|
- lib/generators/dry_crud/templates/app/views/crud/_actions_edit.html.haml
|
65
72
|
- lib/generators/dry_crud/templates/app/views/crud/_actions_index.html.erb
|
@@ -97,130 +104,60 @@ files:
|
|
97
104
|
- lib/generators/dry_crud/templates/app/views/shared/_labeled.html.erb
|
98
105
|
- lib/generators/dry_crud/templates/app/views/shared/_labeled.html.haml
|
99
106
|
- lib/generators/dry_crud/templates/config/initializers/field_error_proc.rb
|
100
|
-
- lib/generators/dry_crud/templates/config/locales/
|
101
|
-
- lib/generators/dry_crud/templates/
|
107
|
+
- lib/generators/dry_crud/templates/config/locales/crud.de.yml
|
108
|
+
- lib/generators/dry_crud/templates/config/locales/crud.en.yml
|
102
109
|
- lib/generators/dry_crud/templates/spec/controllers/crud_test_models_controller_spec.rb
|
103
|
-
- lib/generators/dry_crud/templates/spec/helpers/
|
104
|
-
- lib/generators/dry_crud/templates/spec/helpers/
|
105
|
-
- lib/generators/dry_crud/templates/spec/helpers/
|
106
|
-
- lib/generators/dry_crud/templates/spec/helpers/
|
107
|
-
- lib/generators/dry_crud/templates/spec/helpers/
|
110
|
+
- lib/generators/dry_crud/templates/spec/helpers/crud/form_builder_spec.rb
|
111
|
+
- lib/generators/dry_crud/templates/spec/helpers/crud/table_builder_spec.rb
|
112
|
+
- lib/generators/dry_crud/templates/spec/helpers/form_helper_spec.rb
|
113
|
+
- lib/generators/dry_crud/templates/spec/helpers/format_helper_spec.rb
|
114
|
+
- lib/generators/dry_crud/templates/spec/helpers/i18n_helper_spec.rb
|
115
|
+
- lib/generators/dry_crud/templates/spec/helpers/table_helper_spec.rb
|
116
|
+
- lib/generators/dry_crud/templates/spec/helpers/utility_helper_spec.rb
|
108
117
|
- lib/generators/dry_crud/templates/spec/support/crud_controller_examples.rb
|
109
118
|
- lib/generators/dry_crud/templates/spec/support/crud_controller_test_helper.rb
|
110
|
-
- lib/generators/dry_crud/templates/test/
|
111
|
-
- lib/generators/dry_crud/templates/test/
|
112
|
-
- lib/generators/dry_crud/templates/test/
|
113
|
-
- lib/generators/dry_crud/templates/test/
|
114
|
-
- lib/generators/dry_crud/templates/test/
|
115
|
-
- lib/generators/dry_crud/templates/test/
|
116
|
-
- lib/generators/dry_crud/templates/test/
|
117
|
-
- lib/generators/dry_crud/templates/test/
|
118
|
-
- lib/generators/dry_crud/templates/test/
|
119
|
-
- lib/generators/dry_crud/templates/test/
|
120
|
-
- lib/generators/dry_crud/
|
121
|
-
-
|
122
|
-
- test/templates/app/controllers/admin/countries_controller.rb
|
123
|
-
- test/templates/app/controllers/ajax_controller.rb
|
124
|
-
- test/templates/app/controllers/people_controller.rb
|
125
|
-
- test/templates/app/controllers/vips_controller.rb
|
126
|
-
- test/templates/app/helpers/cities_helper.rb
|
127
|
-
- test/templates/app/helpers/people_helper.rb
|
128
|
-
- test/templates/app/models/city.rb
|
129
|
-
- test/templates/app/models/country.rb
|
130
|
-
- test/templates/app/models/person.rb
|
131
|
-
- test/templates/app/views/admin/cities/_actions_index.html.erb
|
132
|
-
- test/templates/app/views/admin/cities/_actions_index.html.haml
|
133
|
-
- test/templates/app/views/admin/cities/_attrs.html.erb
|
134
|
-
- test/templates/app/views/admin/cities/_attrs.html.haml
|
135
|
-
- test/templates/app/views/admin/cities/_form.html.erb
|
136
|
-
- test/templates/app/views/admin/cities/_form.html.haml
|
137
|
-
- test/templates/app/views/admin/cities/_hello.html.erb
|
138
|
-
- test/templates/app/views/admin/cities/_hello.html.haml
|
139
|
-
- test/templates/app/views/admin/cities/_list.html.erb
|
140
|
-
- test/templates/app/views/admin/cities/_list.html.haml
|
141
|
-
- test/templates/app/views/admin/countries/_list.html.erb
|
142
|
-
- test/templates/app/views/admin/countries/_list.html.haml
|
143
|
-
- test/templates/app/views/ajax/_actions_index.html.erb
|
144
|
-
- test/templates/app/views/ajax/_actions_index.html.haml
|
145
|
-
- test/templates/app/views/ajax/_actions_show.html.erb
|
146
|
-
- test/templates/app/views/ajax/_actions_show.html.haml
|
147
|
-
- test/templates/app/views/ajax/_form.html.erb
|
148
|
-
- test/templates/app/views/ajax/_form.html.haml
|
149
|
-
- test/templates/app/views/ajax/_hello.html.erb
|
150
|
-
- test/templates/app/views/ajax/_hello.html.haml
|
151
|
-
- test/templates/app/views/ajax/ajax.js.erb
|
152
|
-
- test/templates/app/views/ajax/ajax.js.haml
|
153
|
-
- test/templates/app/views/ajax/edit.js.erb
|
154
|
-
- test/templates/app/views/ajax/edit.js.haml
|
155
|
-
- test/templates/app/views/ajax/show.js.erb
|
156
|
-
- test/templates/app/views/ajax/show.js.haml
|
157
|
-
- test/templates/app/views/ajax/update.js.erb
|
158
|
-
- test/templates/app/views/ajax/update.js.haml
|
159
|
-
- test/templates/app/views/layouts/_nav.html.erb
|
160
|
-
- test/templates/app/views/layouts/_nav.html.haml
|
161
|
-
- test/templates/app/views/layouts/bootstrap.html.erb
|
162
|
-
- test/templates/app/views/layouts/bootstrap.html.haml
|
163
|
-
- test/templates/app/views/people/_attrs.html.erb
|
164
|
-
- test/templates/app/views/people/_attrs.html.haml
|
165
|
-
- test/templates/app/views/people/_list.html.erb
|
166
|
-
- test/templates/app/views/people/_list.html.haml
|
167
|
-
- test/templates/config/database.yml
|
168
|
-
- test/templates/config/locales/en_cities.yml
|
169
|
-
- test/templates/config/routes.rb
|
170
|
-
- test/templates/db/migrate/20100511174904_create_people_and_cities.rb
|
171
|
-
- test/templates/db/seeds.rb
|
172
|
-
- test/templates/Gemfile
|
173
|
-
- test/templates/spec/controllers/admin/cities_controller_spec.rb
|
174
|
-
- test/templates/spec/controllers/admin/countries_controller_spec.rb
|
175
|
-
- test/templates/spec/controllers/people_controller_spec.rb
|
176
|
-
- test/templates/spec/routing/cities_routing_spec.rb
|
177
|
-
- test/templates/spec/routing/countries_routing_spec.rb
|
178
|
-
- test/templates/test/fixtures/cities.yml
|
179
|
-
- test/templates/test/fixtures/countries.yml
|
180
|
-
- test/templates/test/fixtures/people.yml
|
181
|
-
- test/templates/test/functional/admin/cities_controller_test.rb
|
182
|
-
- test/templates/test/functional/admin/countries_controller_test.rb
|
183
|
-
- test/templates/test/functional/people_controller_test.rb
|
184
|
-
- Rakefile
|
119
|
+
- lib/generators/dry_crud/templates/test/controllers/crud_test_models_controller_test.rb
|
120
|
+
- lib/generators/dry_crud/templates/test/helpers/crud/form_builder_test.rb
|
121
|
+
- lib/generators/dry_crud/templates/test/helpers/crud/table_builder_test.rb
|
122
|
+
- lib/generators/dry_crud/templates/test/helpers/custom_assertions_test.rb
|
123
|
+
- lib/generators/dry_crud/templates/test/helpers/form_helper_test.rb
|
124
|
+
- lib/generators/dry_crud/templates/test/helpers/format_helper_test.rb
|
125
|
+
- lib/generators/dry_crud/templates/test/helpers/i18n_helper_test.rb
|
126
|
+
- lib/generators/dry_crud/templates/test/helpers/table_helper_test.rb
|
127
|
+
- lib/generators/dry_crud/templates/test/helpers/utility_helper_test.rb
|
128
|
+
- lib/generators/dry_crud/templates/test/support/crud_controller_test_helper.rb
|
129
|
+
- lib/generators/dry_crud/templates/test/support/crud_test_model.rb
|
130
|
+
- lib/generators/dry_crud/templates/test/support/custom_assertions.rb
|
185
131
|
- MIT-LICENSE
|
186
132
|
- README.rdoc
|
187
133
|
- VERSION
|
188
134
|
homepage: http://codez.ch/dry_crud
|
189
135
|
licenses: []
|
190
|
-
|
136
|
+
metadata: {}
|
191
137
|
post_install_message:
|
192
|
-
rdoc_options:
|
138
|
+
rdoc_options:
|
193
139
|
- --title
|
194
|
-
- "
|
140
|
+
- ! '"Dry Crud"'
|
195
141
|
- --main
|
196
142
|
- README.rdoc
|
197
143
|
- --line-numbers
|
198
|
-
require_paths:
|
144
|
+
require_paths:
|
199
145
|
- lib
|
200
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
none: false
|
211
|
-
requirements:
|
212
|
-
- - ">="
|
213
|
-
- !ruby/object:Gem::Version
|
214
|
-
hash: 3
|
215
|
-
segments:
|
216
|
-
- 0
|
217
|
-
version: "0"
|
146
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
147
|
+
requirements:
|
148
|
+
- - ! '>='
|
149
|
+
- !ruby/object:Gem::Version
|
150
|
+
version: '0'
|
151
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
152
|
+
requirements:
|
153
|
+
- - ! '>='
|
154
|
+
- !ruby/object:Gem::Version
|
155
|
+
version: '0'
|
218
156
|
requirements: []
|
219
|
-
|
220
157
|
rubyforge_project:
|
221
|
-
rubygems_version:
|
158
|
+
rubygems_version: 2.0.6
|
222
159
|
signing_key:
|
223
|
-
specification_version:
|
224
|
-
summary: Generates DRY and specifically extendable CRUD controller, views and helpers
|
160
|
+
specification_version: 4
|
161
|
+
summary: Generates DRY and specifically extendable CRUD controller, views and helpers
|
162
|
+
for Rails applications.
|
225
163
|
test_files: []
|
226
|
-
|
data/Rakefile
DELETED
@@ -1,211 +0,0 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
require 'rake/testtask'
|
3
|
-
require 'rspec/core/rake_task'
|
4
|
-
require 'rubygems/package_task'
|
5
|
-
require 'rdoc/task'
|
6
|
-
|
7
|
-
load 'dry_crud.gemspec'
|
8
|
-
|
9
|
-
TEST_APP_ROOT = File.join(File.dirname(__FILE__), 'test', 'test_app')
|
10
|
-
GENERATOR_ROOT = File.join(File.dirname(__FILE__), 'lib', 'generators', 'dry_crud')
|
11
|
-
|
12
|
-
task :default => :test
|
13
|
-
|
14
|
-
desc "Run all tests"
|
15
|
-
task :test => ['test:unit', 'test:spec']
|
16
|
-
|
17
|
-
|
18
|
-
namespace :test do
|
19
|
-
|
20
|
-
desc "Run Test::Unit tests"
|
21
|
-
Rake::TestTask.new(:unit => 'test:app:init') do |test|
|
22
|
-
test.libs << "test/test_app/test"
|
23
|
-
test.test_files = Dir[ "test/test_app/test/**/*_test.rb" ]
|
24
|
-
test.verbose = true
|
25
|
-
end
|
26
|
-
|
27
|
-
desc "Run RSpec tests"
|
28
|
-
RSpec::Core::RakeTask.new(:spec => 'test:app:init') do |t|
|
29
|
-
t.ruby_opts = "-I test/test_app/spec"
|
30
|
-
t.pattern = "test/test_app/spec/**/*_spec.rb"
|
31
|
-
end
|
32
|
-
|
33
|
-
|
34
|
-
namespace :app do
|
35
|
-
task :environment do
|
36
|
-
ENV['RAILS_ROOT'] = TEST_APP_ROOT
|
37
|
-
ENV['RAILS_ENV'] = 'test'
|
38
|
-
|
39
|
-
require(File.join(TEST_APP_ROOT, 'config', 'environment'))
|
40
|
-
end
|
41
|
-
|
42
|
-
desc "Create a rails test application"
|
43
|
-
task :create do
|
44
|
-
unless File.exist?(TEST_APP_ROOT)
|
45
|
-
sh "rails new #{TEST_APP_ROOT} --skip-bundle"
|
46
|
-
FileUtils.cp(File.join(File.dirname(__FILE__), 'test', 'templates', 'Gemfile'), TEST_APP_ROOT)
|
47
|
-
sh "cd #{TEST_APP_ROOT}; bundle install --local" # update Gemfile.lock
|
48
|
-
sh "cd #{TEST_APP_ROOT}; rails g rspec:install"
|
49
|
-
FileUtils.rm_f(File.join(TEST_APP_ROOT, 'test', 'performance', 'browsing_test.rb'))
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
desc "Run the dry_crud generator for the test application"
|
54
|
-
task :generate_crud => [:create, :environment] do
|
55
|
-
require File.join(GENERATOR_ROOT, 'dry_crud_generator')
|
56
|
-
|
57
|
-
DryCrudGenerator.new([], {:force => true,
|
58
|
-
:templates => ENV['HAML'] ? 'haml' : 'erb',
|
59
|
-
:tests => 'all'},
|
60
|
-
:destination_root => TEST_APP_ROOT).invoke_all
|
61
|
-
end
|
62
|
-
|
63
|
-
desc "Populates the test application with some models and controllers"
|
64
|
-
task :populate => :generate_crud do
|
65
|
-
# copy test app templates
|
66
|
-
FileUtils.cp_r(File.join(File.dirname(__FILE__), 'test', 'templates', '.'), TEST_APP_ROOT)
|
67
|
-
|
68
|
-
# copy shared fixtures
|
69
|
-
FileUtils.cp_r(File.join(File.dirname(__FILE__), 'test', 'templates', 'test', 'fixtures'),
|
70
|
-
File.join(TEST_APP_ROOT, 'spec'))
|
71
|
-
|
72
|
-
# replace some unused files
|
73
|
-
FileUtils.rm_f(File.join(TEST_APP_ROOT, 'public', 'index.html'))
|
74
|
-
layouts = File.join(TEST_APP_ROOT, 'app', 'views', 'layouts')
|
75
|
-
FileUtils.mv(File.join(layouts, 'crud.html.erb'),
|
76
|
-
File.join(layouts, 'application.html.erb'),
|
77
|
-
:force => true) if File.exists?(File.join(layouts, 'crud.html.erb'))
|
78
|
-
FileUtils.mv(File.join(layouts, 'crud.html.haml'),
|
79
|
-
File.join(layouts, 'application.html.haml'),
|
80
|
-
:force => true) if File.exists?(File.join(layouts, 'crud.html.haml'))
|
81
|
-
|
82
|
-
# remove unused template type, erb or haml
|
83
|
-
exclude = ENV['HAML'] ? 'erb' : 'haml'
|
84
|
-
Dir.glob(File.join(TEST_APP_ROOT, 'app', 'views', '**', "*.#{exclude}")).each do |f|
|
85
|
-
FileUtils.rm(f)
|
86
|
-
end
|
87
|
-
end
|
88
|
-
|
89
|
-
desc "Insert seed data into the test database"
|
90
|
-
task :seed => :populate do
|
91
|
-
# migrate the database
|
92
|
-
FileUtils.cd(TEST_APP_ROOT) do
|
93
|
-
sh "rake db:migrate db:seed RAILS_ENV=development --trace"
|
94
|
-
sh "rake db:migrate RAILS_ENV=test --trace" # db:test:prepare does not work for jdbcsqlite3
|
95
|
-
end
|
96
|
-
end
|
97
|
-
|
98
|
-
desc "Initializes the test application with a couple of classes"
|
99
|
-
task :init => [:seed,
|
100
|
-
:customize]
|
101
|
-
|
102
|
-
desc "Customize some of the functionality provided by dry_crud"
|
103
|
-
task :customize => ['test:app:add_pagination'
|
104
|
-
#'test:app:use_bootstrap'
|
105
|
-
]
|
106
|
-
|
107
|
-
desc "Adds pagination to the test app"
|
108
|
-
task :add_pagination => :generate_crud do
|
109
|
-
list_ctrl = File.join(TEST_APP_ROOT, 'app', 'controllers', 'list_controller.rb')
|
110
|
-
file_replace(list_ctrl, /def list_entries\n\s+model_scope\s*\n/,
|
111
|
-
"def list_entries\n model_scope.page(params[:page]).per(10)\n")
|
112
|
-
file_replace(File.join(TEST_APP_ROOT, 'app', 'views', 'list', 'index.html.erb'),
|
113
|
-
"<%= render 'list' %>", "<%= paginate entries %>\n\n<%= render 'list' %>")
|
114
|
-
file_replace(File.join(TEST_APP_ROOT, 'app', 'views', 'list', 'index.html.haml'),
|
115
|
-
"= render 'list'", "= paginate entries\n\n= render 'list'")
|
116
|
-
end
|
117
|
-
|
118
|
-
desc "Use Boostrap in the test app"
|
119
|
-
task :use_bootstrap => :generate_crud do
|
120
|
-
file_replace(File.join(TEST_APP_ROOT, 'app', 'assets', 'stylesheets', 'application.css'), " *= require_self", "*= require twitter/bootstrap\n *= require_self")
|
121
|
-
file_replace(File.join(TEST_APP_ROOT, 'app', 'assets', 'javascripts', 'application.js'), "//= require_tree .", "//= require twitter/bootstrap\n//= require_tree .")
|
122
|
-
FileUtils.rm(File.join(TEST_APP_ROOT, 'app', 'assets', 'stylesheets', 'sample.scss'))
|
123
|
-
|
124
|
-
layouts = File.join(TEST_APP_ROOT, 'app', 'views', 'layouts')
|
125
|
-
FileUtils.mv(File.join(layouts, 'bootstrap.html.erb'),
|
126
|
-
File.join(layouts, 'application.html.erb'),
|
127
|
-
:force => true) if File.exists?(File.join(layouts, 'bootstrap.html.erb'))
|
128
|
-
FileUtils.mv(File.join(layouts, 'bootstrap.html.haml'),
|
129
|
-
File.join(layouts, 'application.html.haml'),
|
130
|
-
:force => true) if File.exists?(File.join(layouts, 'bootstrap.html.haml'))
|
131
|
-
end
|
132
|
-
|
133
|
-
end
|
134
|
-
end
|
135
|
-
|
136
|
-
desc "Clean up all generated resources"
|
137
|
-
task :clobber do
|
138
|
-
FileUtils.rm_rf(TEST_APP_ROOT)
|
139
|
-
end
|
140
|
-
|
141
|
-
desc "Install dry_crud as a local gem."
|
142
|
-
task :install => [:package] do
|
143
|
-
sudo = RUBY_PLATFORM =~ /win32/ ? '' : 'sudo'
|
144
|
-
gem = RUBY_PLATFORM =~ /java/ ? 'jgem' : 'gem'
|
145
|
-
sh %{#{sudo} #{gem} install --no-ri pkg/dry_crud-#{File.read('VERSION').strip}.gem}
|
146
|
-
end
|
147
|
-
|
148
|
-
desc "Deploy rdoc to website"
|
149
|
-
task :site => :rdoc do
|
150
|
-
if ENV['DEST']
|
151
|
-
sh "rsync -rzv rdoc/ #{ENV['DEST']}"
|
152
|
-
else
|
153
|
-
puts "Please specify a destination with DEST=user@server:/deploy/dir"
|
154
|
-
end
|
155
|
-
end
|
156
|
-
|
157
|
-
if RUBY_VERSION == '1.8.7' && RUBY_PLATFORM != 'java'
|
158
|
-
require 'rcov/rcovtask'
|
159
|
-
Rcov::RcovTask.new do |test|
|
160
|
-
test.libs << "test/test_app/test"
|
161
|
-
test.test_files = Dir[ "test/test_app/test/**/*_test.rb" ]
|
162
|
-
test.rcov_opts = ['--text-report',
|
163
|
-
'-i', '"test\/test_app\/app\/.*"',
|
164
|
-
'-x', '"\/Library\/Ruby\/.*"']
|
165
|
-
test.verbose = true
|
166
|
-
end
|
167
|
-
end
|
168
|
-
|
169
|
-
# :package task
|
170
|
-
Gem::PackageTask.new(DRY_CRUD_GEMSPEC) do |pkg|
|
171
|
-
if Rake.application.top_level_tasks.include?('release')
|
172
|
-
pkg.need_tar_gz = true
|
173
|
-
pkg.need_tar_bz2 = true
|
174
|
-
pkg.need_zip = true
|
175
|
-
end
|
176
|
-
end
|
177
|
-
|
178
|
-
# :rdoc task
|
179
|
-
Rake::RDocTask.new do |rdoc|
|
180
|
-
rdoc.title = 'Dry Crud'
|
181
|
-
rdoc.options << '--line-numbers'
|
182
|
-
rdoc.rdoc_files.include(*FileList.new('*') do |list|
|
183
|
-
list.exclude(/(^|[^.a-z])[a-z]+/)
|
184
|
-
list.exclude('TODO')
|
185
|
-
end.to_a)
|
186
|
-
rdoc.rdoc_files.include('lib/generators/dry_crud/templates/**/*.rb')
|
187
|
-
rdoc.rdoc_files.exclude('lib/generators/dry_crud/templates/**/*_test.rb')
|
188
|
-
rdoc.rdoc_files.exclude('TODO')
|
189
|
-
|
190
|
-
rdoc.rdoc_dir = 'rdoc'
|
191
|
-
rdoc.main = 'README.rdoc'
|
192
|
-
end
|
193
|
-
|
194
|
-
desc "Outputs the commands required for a release. Does not perform any other actions"
|
195
|
-
task :release do
|
196
|
-
version = File.read('VERSION').strip
|
197
|
-
puts "Issue the following commands to perform a release:"
|
198
|
-
puts " $ git tag version-#{version} -m \"Version tag for dry_crud-#{version}.gem\""
|
199
|
-
puts " $ git push --tags"
|
200
|
-
puts " $ rake repackage"
|
201
|
-
puts " $ gem push pkg/dry_crud-#{version}.gem"
|
202
|
-
end
|
203
|
-
|
204
|
-
|
205
|
-
def file_replace(file, expression, replacement)
|
206
|
-
return unless File.exists?(file)
|
207
|
-
text = File.read(file)
|
208
|
-
replaced = text.gsub(expression, replacement)
|
209
|
-
puts "WARN: Nothing replaced in '#{file}' for '#{expression}'" if text == replaced
|
210
|
-
File.open(file, "w") { |f| f.puts replaced }
|
211
|
-
end
|