formie 0.5.2 → 0.6.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.
Files changed (43) hide show
  1. data/Gemfile +2 -1
  2. data/README.md +29 -22
  3. data/formie.gemspec +13 -10
  4. data/lib/formie/version.rb +1 -1
  5. data/lib/formie.rb +2 -1
  6. metadata +33 -88
  7. data/.rspec +0 -2
  8. data/.watchr +0 -56
  9. data/Gemfile.lock +0 -134
  10. data/Rakefile +0 -30
  11. data/spec/controllers/orders_spec.rb +0 -11
  12. data/spec/dummy/Rakefile +0 -7
  13. data/spec/dummy/app/assets/javascripts/application.js +0 -9
  14. data/spec/dummy/app/controllers/application_controller.rb +0 -8
  15. data/spec/dummy/app/controllers/orders_controller.rb +0 -16
  16. data/spec/dummy/app/formies/application/copyright.html.erb +0 -3
  17. data/spec/dummy/app/formies/forms/builtins.html.erb +0 -7
  18. data/spec/dummy/app/formies/forms/l_field.html.erb +0 -4
  19. data/spec/dummy/app/models/order.rb +0 -10
  20. data/spec/dummy/app/views/layouts/application.html.erb +0 -12
  21. data/spec/dummy/app/views/orders/_form.html.erb +0 -7
  22. data/spec/dummy/app/views/orders/_new.html.erb +0 -1
  23. data/spec/dummy/app/views/orders/index.html.erb +0 -1
  24. data/spec/dummy/app/views/orders/new.html.erb +0 -3
  25. data/spec/dummy/app/views/orders/show.html.erb +0 -3
  26. data/spec/dummy/config/application.rb +0 -49
  27. data/spec/dummy/config/boot.rb +0 -9
  28. data/spec/dummy/config/database.yml +0 -22
  29. data/spec/dummy/config/environment.rb +0 -5
  30. data/spec/dummy/config/environments/development.rb +0 -30
  31. data/spec/dummy/config/environments/production.rb +0 -60
  32. data/spec/dummy/config/environments/test.rb +0 -40
  33. data/spec/dummy/config/initializers/secret_token.rb +0 -1
  34. data/spec/dummy/config/initializers/session_store.rb +0 -8
  35. data/spec/dummy/config/routes.rb +0 -4
  36. data/spec/dummy/config.ru +0 -4
  37. data/spec/dummy/db/migrate/001_create_orders.rb +0 -10
  38. data/spec/dummy/db/schema.rb +0 -23
  39. data/spec/dummy/db/seeds.rb +0 -7
  40. data/spec/dummy/public/favicon.ico +0 -0
  41. data/spec/dummy/script/rails +0 -6
  42. data/spec/integration/order_spec.rb +0 -32
  43. data/spec/spec_helper.rb +0 -63
data/Gemfile CHANGED
@@ -1,7 +1,8 @@
1
1
  source "http://rubygems.org"
2
2
 
3
- gem "rails", '3.1.0'
3
+ gem "rails", '3.1.3'
4
4
  gem 'jquery-rails'
5
+ gem 'formie'
5
6
 
6
7
  group :test do
7
8
  gem "capybara"
data/README.md CHANGED
@@ -4,12 +4,27 @@ Formie
4
4
  Tired of programming each HTML tag? Are you in search of DRYness for Rails
5
5
  views? May be Formie can help you.
6
6
 
7
- Formie is a low level template-based rendering engine. It injects
8
- the formies into the ActionView module. The form-bounded as well as
9
- the unbounded templates are supported. Still, the ActionView
10
- functionality (e.g. text_field) is kept untouched.
7
+ Formie implements low level template-based helpers.
8
+ It injects the formies into the ActionView module.
9
+ The form-bounded as well as the unbounded templates are supported.
10
+ Still, the ActionView functionality (e.g. text_field) is kept untouched.
11
11
  In short, Formie is like a helper using the notation of a partial.
12
12
 
13
+ ## Installation
14
+
15
+ As usual:
16
+
17
+ $ [sudo] gem install formie
18
+
19
+ or:
20
+
21
+ # Gemfile
22
+ gem 'formie'
23
+
24
+ $ bundle
25
+
26
+ ## Description
27
+
13
28
  Templates for Formie are hosted in:
14
29
 
15
30
  - app/formies/forms (bounded to form)
@@ -26,7 +41,7 @@ controller) are available:
26
41
  - form.object
27
42
  - params
28
43
 
29
- Locals are passed by a hash.
44
+ Locals are passed in a hash.
30
45
  The controller attributes are available as usual.
31
46
 
32
47
  To avoid a server restart during development of formies you may add to:
@@ -38,16 +53,15 @@ To avoid a server restart during development of formies you may add to:
38
53
  end
39
54
 
40
55
 
41
- Examples
42
- ========
56
+ ## Examples
43
57
 
44
58
  <%= copyright %>
45
59
  <%= back %>
46
60
  <%= show :obj => @order %>
47
61
 
48
- <%= form_for :order do |f| %>
49
- <%= f.who %>
50
- <%= f.amount %>
62
+ <%= form_for @order do |f| %>
63
+ <%= f.l_text_field :who %>
64
+ <%= f.l_text_field :amount %>
51
65
  <% end %>
52
66
 
53
67
  In directory app/formies :
@@ -61,17 +75,10 @@ In directory app/formies :
61
75
  # application/show.html.erb
62
76
  <a href="<%= "/#{h(controller_name)}/#{obj.id}" %>"> Show </a>
63
77
 
64
- # forms/who.html.erb
65
- <%= form.labelled_field :field => :who %>
66
-
67
- # forms/amount.html.erb
68
- <%= form.labelled_field :field => :amount %>
69
-
70
- # forms/labelled_field.html.erb
71
- <label style="width: 8em; display: block; float: left;">
72
- <%= field.to_s.capitalize %>
73
- </label>
74
- <%= form.text_field field %> <br />
75
-
78
+ # forms/l_text_field.html.erb
79
+ <p>
80
+ <%= form.label args.first %><br />
81
+ <%= form.text_field args.first %>
82
+ </p>
76
83
 
77
84
  Copyright (c) 2009..2012 Dittmar Krall, released under the MIT license
data/formie.gemspec CHANGED
@@ -7,21 +7,24 @@ Gem::Specification.new do |s|
7
7
  s.name = "formie"
8
8
  s.version = Formie::VERSION
9
9
  s.platform = Gem::Platform::RUBY
10
- s.summary = "Like a helper, but based on html."
11
- s.description = "app/formies/labelled_field.html.erb"
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
12
17
  s.authors = ['Dittmar Krall']
13
18
  s.email = ['dittmar.krall@matique.de']
14
19
  s.homepage = 'http://matique.de'
15
- s.files = `git ls-files`.split("\n")
16
- s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
17
- s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
18
- s.require_paths = ["lib"]
19
20
 
20
- # specify any dependencies here; for example:
21
- # s.add_development_dependency "rspec"
22
- # s.add_runtime_dependency "rest-client"
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"]
23
25
 
24
- s.add_development_dependency "sqlite3" # for testing
26
+ s.add_dependency "rails", "~> 3.1.0"
27
+ s.add_development_dependency "sqlite3"
25
28
  s.add_development_dependency "rspec-rails"
26
29
  s.add_development_dependency "capybara"
27
30
  end
@@ -1,3 +1,3 @@
1
1
  module Formie
2
- VERSION = '0.5.2'
2
+ VERSION = '0.6.1'
3
3
  end
data/lib/formie.rb CHANGED
@@ -7,6 +7,7 @@ module Formie
7
7
  @last_update ||= Time.new(0)
8
8
  self.load_formies(::ActionView::Helpers::FormBuilder, 'app/formies/forms')
9
9
  self.load_formies(::ActionView::Helpers::TextHelper, 'app/formies/application')
10
+ self.load_formies(::ActionView::Helpers::TextHelper, 'app/formies/templates')
10
11
  @last_update = now
11
12
  end
12
13
 
@@ -32,7 +33,7 @@ module Formie
32
33
  private
33
34
  def self.load_formies(where, dir)
34
35
  dir = "#{::Rails.root.to_s}/#{dir}"
35
- raise "Missing Formie directory '#{dir}'" unless File.exists?(dir)
36
+ return unless File.exists?(dir)
36
37
  Dir.chdir(dir) {|current_dir|
37
38
  Dir.glob('**/*.html.erb').each {|path|
38
39
  next if File.new(path).mtime < @last_update
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: formie
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.2
4
+ version: 0.6.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,12 +9,22 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-01-17 00:00:00.000000000 +01:00
13
- default_executable:
12
+ date: 2012-02-21 00:00:00.000000000 Z
14
13
  dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rails
16
+ requirement: &83422300 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: 3.1.0
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: *83422300
15
25
  - !ruby/object:Gem::Dependency
16
26
  name: sqlite3
17
- requirement: &70343920 !ruby/object:Gem::Requirement
27
+ requirement: &83571370 !ruby/object:Gem::Requirement
18
28
  none: false
19
29
  requirements:
20
30
  - - ! '>='
@@ -22,10 +32,10 @@ dependencies:
22
32
  version: '0'
23
33
  type: :development
24
34
  prerelease: false
25
- version_requirements: *70343920
35
+ version_requirements: *83571370
26
36
  - !ruby/object:Gem::Dependency
27
37
  name: rspec-rails
28
- requirement: &70343710 !ruby/object:Gem::Requirement
38
+ requirement: &83570640 !ruby/object:Gem::Requirement
29
39
  none: false
30
40
  requirements:
31
41
  - - ! '>='
@@ -33,10 +43,10 @@ dependencies:
33
43
  version: '0'
34
44
  type: :development
35
45
  prerelease: false
36
- version_requirements: *70343710
46
+ version_requirements: *83570640
37
47
  - !ruby/object:Gem::Dependency
38
48
  name: capybara
39
- requirement: &70343500 !ruby/object:Gem::Requirement
49
+ requirement: &83569970 !ruby/object:Gem::Requirement
40
50
  none: false
41
51
  requirements:
42
52
  - - ! '>='
@@ -44,60 +54,25 @@ dependencies:
44
54
  version: '0'
45
55
  type: :development
46
56
  prerelease: false
47
- version_requirements: *70343500
48
- description: app/formies/labelled_field.html.erb
57
+ version_requirements: *83569970
58
+ description: ! " Formie implements low level template-based helpers. It injects\n
59
+ \ the formies into the ActionView module. The form-bounded as well as\n the
60
+ unbounded templates are supported. Still, the ActionView\n functionality (e.g.
61
+ text_field) is kept untouched.\n"
49
62
  email:
50
63
  - dittmar.krall@matique.de
51
64
  executables: []
52
65
  extensions: []
53
66
  extra_rdoc_files: []
54
67
  files:
55
- - .rspec
56
- - .watchr
68
+ - lib/formie/version.rb
69
+ - lib/formie/engine.rb
70
+ - lib/formie.rb
71
+ - config/initializers/formie.rb
57
72
  - Gemfile
58
- - Gemfile.lock
59
73
  - MIT-LICENSE
60
74
  - README.md
61
- - Rakefile
62
- - config/initializers/formie.rb
63
75
  - formie.gemspec
64
- - lib/formie.rb
65
- - lib/formie/engine.rb
66
- - lib/formie/version.rb
67
- - spec/controllers/orders_spec.rb
68
- - spec/dummy/Rakefile
69
- - spec/dummy/app/assets/javascripts/application.js
70
- - spec/dummy/app/controllers/application_controller.rb
71
- - spec/dummy/app/controllers/orders_controller.rb
72
- - spec/dummy/app/formies/application/copyright.html.erb
73
- - spec/dummy/app/formies/forms/builtins.html.erb
74
- - spec/dummy/app/formies/forms/l_field.html.erb
75
- - spec/dummy/app/models/order.rb
76
- - spec/dummy/app/views/layouts/application.html.erb
77
- - spec/dummy/app/views/orders/_form.html.erb
78
- - spec/dummy/app/views/orders/_new.html.erb
79
- - spec/dummy/app/views/orders/index.html.erb
80
- - spec/dummy/app/views/orders/new.html.erb
81
- - spec/dummy/app/views/orders/show.html.erb
82
- - spec/dummy/config.ru
83
- - spec/dummy/config/application.rb
84
- - spec/dummy/config/boot.rb
85
- - spec/dummy/config/database.yml
86
- - spec/dummy/config/environment.rb
87
- - spec/dummy/config/environments/development.rb
88
- - spec/dummy/config/environments/production.rb
89
- - spec/dummy/config/environments/test.rb
90
- - spec/dummy/config/initializers/secret_token.rb
91
- - spec/dummy/config/initializers/session_store.rb
92
- - spec/dummy/config/routes.rb
93
- - spec/dummy/db/migrate/001_create_orders.rb
94
- - spec/dummy/db/schema.rb
95
- - spec/dummy/db/seeds.rb
96
- - spec/dummy/public/favicon.ico
97
- - spec/dummy/script/rails
98
- - spec/integration/order_spec.rb
99
- - spec/spec_helper.rb
100
- has_rdoc: true
101
76
  homepage: http://matique.de
102
77
  licenses: []
103
78
  post_install_message:
@@ -110,6 +85,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
110
85
  - - ! '>='
111
86
  - !ruby/object:Gem::Version
112
87
  version: '0'
88
+ segments:
89
+ - 0
90
+ hash: 221700925
113
91
  required_rubygems_version: !ruby/object:Gem::Requirement
114
92
  none: false
115
93
  requirements:
@@ -118,41 +96,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
118
96
  version: '0'
119
97
  requirements: []
120
98
  rubyforge_project:
121
- rubygems_version: 1.6.2
99
+ rubygems_version: 1.8.15
122
100
  signing_key:
123
101
  specification_version: 3
124
- summary: Like a helper, but based on html.
125
- test_files:
126
- - spec/controllers/orders_spec.rb
127
- - spec/dummy/Rakefile
128
- - spec/dummy/app/assets/javascripts/application.js
129
- - spec/dummy/app/controllers/application_controller.rb
130
- - spec/dummy/app/controllers/orders_controller.rb
131
- - spec/dummy/app/formies/application/copyright.html.erb
132
- - spec/dummy/app/formies/forms/builtins.html.erb
133
- - spec/dummy/app/formies/forms/l_field.html.erb
134
- - spec/dummy/app/models/order.rb
135
- - spec/dummy/app/views/layouts/application.html.erb
136
- - spec/dummy/app/views/orders/_form.html.erb
137
- - spec/dummy/app/views/orders/_new.html.erb
138
- - spec/dummy/app/views/orders/index.html.erb
139
- - spec/dummy/app/views/orders/new.html.erb
140
- - spec/dummy/app/views/orders/show.html.erb
141
- - spec/dummy/config.ru
142
- - spec/dummy/config/application.rb
143
- - spec/dummy/config/boot.rb
144
- - spec/dummy/config/database.yml
145
- - spec/dummy/config/environment.rb
146
- - spec/dummy/config/environments/development.rb
147
- - spec/dummy/config/environments/production.rb
148
- - spec/dummy/config/environments/test.rb
149
- - spec/dummy/config/initializers/secret_token.rb
150
- - spec/dummy/config/initializers/session_store.rb
151
- - spec/dummy/config/routes.rb
152
- - spec/dummy/db/migrate/001_create_orders.rb
153
- - spec/dummy/db/schema.rb
154
- - spec/dummy/db/seeds.rb
155
- - spec/dummy/public/favicon.ico
156
- - spec/dummy/script/rails
157
- - spec/integration/order_spec.rb
158
- - spec/spec_helper.rb
102
+ summary: Formie is like a helper, but uses the notation of a partial.
103
+ test_files: []
data/.rspec DELETED
@@ -1,2 +0,0 @@
1
- --colour --drb
2
- #--format=documentation
data/.watchr DELETED
@@ -1,56 +0,0 @@
1
- def run(cmd)
2
- puts "***** #{cmd}"
3
- system "/usr/bin/time --format 'Elapsed time %E' #{cmd}"
4
- end
5
-
6
- def run_without(list)
7
- all = Dir.glob("spec/**/*_spec.rb")
8
- res = []
9
- list.each { |str|
10
- files = Dir.glob("spec/**/#{str}/*_spec.rb")
11
- res << files
12
- }
13
- run "rspec #{(all - res.flatten).sort.uniq.join(' ')}"
14
- end
15
-
16
- def run_matching(name)
17
- arr = name.gsub('_', '/').split('/')
18
- bool = false
19
- arr.each { |str|
20
- files = Dir.glob("spec/**/#{str}_spec.rb")
21
- files.each { |file|
22
- bool = true
23
- run "rspec #{file}"
24
- }
25
- }
26
- puts "***** Changed #{name}; not yet done" unless bool
27
- end
28
-
29
-
30
- watch('spec/.*/*_spec\.rb') { |match| run "rspec #{match[0]}" }
31
- watch('spec/.*/.*/*_spec\.rb') { |match| run "rspec #{match[0]}" }
32
-
33
- watch('app/(.*)?\.rb') { |match|
34
- puts "** touched #{match[1]}"
35
- file = "spec/#{match[1]}_spec.rb"
36
- if File.exists?(file)
37
- run "rspec #{file}"
38
- else
39
- run_matching match[1]
40
- end
41
- }
42
-
43
- watch('app/views/(.*)?\.erb') { |match|
44
- puts "** touched #{match[1]}"
45
- run_without ['models']
46
- }
47
-
48
-
49
- # Ctrl-\ or ctrl-4
50
- Signal.trap('QUIT') do
51
- puts "\n--- Running all tests ---\n"
52
- run 'rake spec'
53
- end
54
-
55
- # Ctrl-C
56
- Signal.trap('INT') { abort("Interrupted\n") }
data/Gemfile.lock DELETED
@@ -1,134 +0,0 @@
1
- GEM
2
- remote: http://rubygems.org/
3
- specs:
4
- actionmailer (3.1.0)
5
- actionpack (= 3.1.0)
6
- mail (~> 2.3.0)
7
- actionpack (3.1.0)
8
- activemodel (= 3.1.0)
9
- activesupport (= 3.1.0)
10
- builder (~> 3.0.0)
11
- erubis (~> 2.7.0)
12
- i18n (~> 0.6)
13
- rack (~> 1.3.2)
14
- rack-cache (~> 1.0.3)
15
- rack-mount (~> 0.8.2)
16
- rack-test (~> 0.6.1)
17
- sprockets (~> 2.0.0)
18
- activemodel (3.1.0)
19
- activesupport (= 3.1.0)
20
- bcrypt-ruby (~> 3.0.0)
21
- builder (~> 3.0.0)
22
- i18n (~> 0.6)
23
- activerecord (3.1.0)
24
- activemodel (= 3.1.0)
25
- activesupport (= 3.1.0)
26
- arel (~> 2.2.1)
27
- tzinfo (~> 0.3.29)
28
- activeresource (3.1.0)
29
- activemodel (= 3.1.0)
30
- activesupport (= 3.1.0)
31
- activesupport (3.1.0)
32
- multi_json (~> 1.0)
33
- arel (2.2.1)
34
- bcrypt-ruby (3.0.1)
35
- builder (3.0.0)
36
- capybara (1.1.2)
37
- mime-types (>= 1.16)
38
- nokogiri (>= 1.3.3)
39
- rack (>= 1.0.0)
40
- rack-test (>= 0.5.4)
41
- selenium-webdriver (~> 2.0)
42
- xpath (~> 0.1.4)
43
- childprocess (0.3.0)
44
- ffi (~> 1.0.6)
45
- diff-lcs (1.1.3)
46
- erubis (2.7.0)
47
- ffi (1.0.11)
48
- hike (1.2.1)
49
- i18n (0.6.0)
50
- jquery-rails (1.0.19)
51
- railties (~> 3.0)
52
- thor (~> 0.14)
53
- json (1.6.4)
54
- mail (2.3.0)
55
- i18n (>= 0.4.0)
56
- mime-types (~> 1.16)
57
- treetop (~> 1.4.8)
58
- mime-types (1.17.2)
59
- multi_json (1.0.4)
60
- nokogiri (1.5.0)
61
- polyglot (0.3.3)
62
- rack (1.3.6)
63
- rack-cache (1.0.3)
64
- rack (>= 0.4)
65
- rack-mount (0.8.3)
66
- rack (>= 1.0.0)
67
- rack-ssl (1.3.2)
68
- rack
69
- rack-test (0.6.1)
70
- rack (>= 1.0)
71
- rails (3.1.0)
72
- actionmailer (= 3.1.0)
73
- actionpack (= 3.1.0)
74
- activerecord (= 3.1.0)
75
- activeresource (= 3.1.0)
76
- activesupport (= 3.1.0)
77
- bundler (~> 1.0)
78
- railties (= 3.1.0)
79
- railties (3.1.0)
80
- actionpack (= 3.1.0)
81
- activesupport (= 3.1.0)
82
- rack-ssl (~> 1.3.2)
83
- rake (>= 0.8.7)
84
- rdoc (~> 3.4)
85
- thor (~> 0.14.6)
86
- rake (0.9.2.2)
87
- rdoc (3.12)
88
- json (~> 1.4)
89
- rspec (2.8.0)
90
- rspec-core (~> 2.8.0)
91
- rspec-expectations (~> 2.8.0)
92
- rspec-mocks (~> 2.8.0)
93
- rspec-core (2.8.0)
94
- rspec-expectations (2.8.0)
95
- diff-lcs (~> 1.1.2)
96
- rspec-mocks (2.8.0)
97
- rspec-rails (2.8.1)
98
- actionpack (>= 3.0)
99
- activesupport (>= 3.0)
100
- railties (>= 3.0)
101
- rspec (~> 2.8.0)
102
- rubyzip (0.9.5)
103
- selenium-webdriver (2.16.0)
104
- childprocess (>= 0.2.5)
105
- ffi (~> 1.0.9)
106
- multi_json (~> 1.0.4)
107
- rubyzip
108
- spork (0.8.5)
109
- sprockets (2.0.3)
110
- hike (~> 1.2)
111
- rack (~> 1.0)
112
- tilt (~> 1.1, != 1.3.0)
113
- sqlite3 (1.3.5)
114
- thor (0.14.6)
115
- tilt (1.3.3)
116
- treetop (1.4.10)
117
- polyglot
118
- polyglot (>= 0.3.1)
119
- tzinfo (0.3.31)
120
- watchr (0.7)
121
- xpath (0.1.4)
122
- nokogiri (~> 1.3)
123
-
124
- PLATFORMS
125
- ruby
126
-
127
- DEPENDENCIES
128
- capybara
129
- jquery-rails
130
- rails (= 3.1.0)
131
- rspec-rails
132
- spork
133
- sqlite3
134
- watchr
data/Rakefile DELETED
@@ -1,30 +0,0 @@
1
- # encoding: UTF-8
2
-
3
- begin
4
- require 'bundler'
5
- require 'bundler/setup'
6
- rescue LoadError
7
- puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
8
- end
9
-
10
- require 'rspec/core'
11
- require 'rspec/core/rake_task'
12
-
13
- Bundler::GemHelper.install_tasks
14
- RSpec::Core::RakeTask.new(:spec)
15
-
16
- task :default => :spec
17
-
18
-
19
- desc "Clean automatically generated files"
20
- task :clean do
21
- FileUtils.rm_rf "pkg"
22
- end
23
-
24
- desc "Check syntax"
25
- task :syntax do
26
- Dir["**/*.rb"].each do |file|
27
- print "#{file}: "
28
- system("ruby -c #{file}")
29
- end
30
- end
@@ -1,11 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe OrdersController, ':' do
4
- render_views
5
-
6
- it 'checking formie copyright' do
7
- get :index
8
- response.body.should =~ /copyright/
9
- end
10
-
11
- end
data/spec/dummy/Rakefile DELETED
@@ -1,7 +0,0 @@
1
- #!/usr/bin/env rake
2
- # Add your own tasks in files placed in lib/tasks ending in .rake,
3
- # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
4
-
5
- require File.expand_path('../config/application', __FILE__)
6
-
7
- Dummy::Application.load_tasks
@@ -1,9 +0,0 @@
1
- // This is a manifest file that'll be compiled into including all the files listed below.
2
- // Add new JavaScript/Coffee code in separate files in this directory and they'll automatically
3
- // be included in the compiled file accessible from http://example.com/assets/application.js
4
- // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
5
- // the compiled file.
6
- //
7
- //= require jquery
8
- //= require jquery_ujs
9
- //= require_tree .
@@ -1,8 +0,0 @@
1
- class ApplicationController < ActionController::Base
2
- protect_from_forgery
3
-
4
- before_filter do
5
- Formie.reload if 'development' == Rails.env
6
- end
7
-
8
- end
@@ -1,16 +0,0 @@
1
- class OrdersController < ApplicationController
2
-
3
- def index
4
- @orders = Order.all
5
- end
6
-
7
- def new
8
- @order = Order.new
9
- end
10
-
11
- def show
12
- Order.create :name => 'hugo'
13
- @order = Order.find(params[:id])
14
- end
15
-
16
- end
@@ -1,3 +0,0 @@
1
- <% year ||= args.first || Time.now.year %>
2
-
3
- <div class="copyright"> Copyright (c) <%= year %> </div>
@@ -1,7 +0,0 @@
1
- action_name <%= action_name %> <br/>
2
- args <%= args %> <br/>
3
- block <%= block.call(3) %> <br/>
4
- controller_name <%= controller_name %> <br/>
5
- form <%= form.class.name %> <br/>
6
- form.object <%= form.object.class.name %> <br/>
7
- params <%= params[:action] %> <br/>
@@ -1,4 +0,0 @@
1
- <p class="labelled">
2
- <label> <%= field %> </label>
3
- <%= form.text_field(field) %>
4
- </p>
@@ -1,10 +0,0 @@
1
- class Order < ActiveRecord::Base
2
-
3
- before_save do |row|
4
- return true unless row.name == 'error'
5
-
6
- row.errors.add :base, 'panic'
7
- return false
8
- end
9
-
10
- end
@@ -1,12 +0,0 @@
1
- <!DOCTYPE html>
2
- <html>
3
- <head>
4
- <title>Dummy</title>
5
- <%#= stylesheet_link_tag "application" %>
6
- <%= javascript_include_tag "application" %>
7
- <%= csrf_meta_tags %>
8
- </head>
9
- <body>
10
- <%= yield %>
11
- </body>
12
- </html>
@@ -1,7 +0,0 @@
1
- <%
2
- # This is a typical form
3
- # Requires f
4
- %>
5
-
6
- <%= f.l_field :field => :name %>
7
- <%= f.l_field :field => :qty %>
@@ -1 +0,0 @@
1
- <%= f.builtins(123, 456) {|n| n + 1 } %>
@@ -1 +0,0 @@
1
- <%= copyright(2000) %>
@@ -1,3 +0,0 @@
1
- <%= form_for @order do |f| %>
2
- <%= render 'new', :f => f %>
3
- <% end %>
@@ -1,3 +0,0 @@
1
- <%= form_for @order do |f| %>
2
- <%= render 'form', :f => f %>
3
- <% end %>
@@ -1,49 +0,0 @@
1
- require File.expand_path('../boot', __FILE__)
2
-
3
- require 'rails/all'
4
- require 'formie'
5
-
6
- if defined?(Bundler)
7
- # If you precompile assets before deploying to production, use this line
8
- Bundler.require(*Rails.groups(:assets => %w(development test)))
9
- # If you want your assets lazily compiled in production, use this line
10
- # Bundler.require(:default, :assets, Rails.env)
11
- end
12
-
13
- module Dummy
14
- class Application < Rails::Application
15
- # Settings in config/environments/* take precedence over those specified here.
16
- # Application configuration should go into files in config/initializers
17
- # -- all .rb files in that directory are automatically loaded.
18
-
19
- # Custom directories with classes and modules you want to be autoloadable.
20
- # config.autoload_paths += %W(#{config.root}/extras)
21
-
22
- # Only load the plugins named here, in the order given (default is alphabetical).
23
- # :all can be used as a placeholder for all plugins not explicitly named.
24
- # config.plugins = [ :exception_notification, :ssl_requirement, :all ]
25
-
26
- # Activate observers that should always be running.
27
- # config.active_record.observers = :cacher, :garbage_collector, :forum_observer
28
-
29
- # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
30
- # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
31
- # config.time_zone = 'Central Time (US & Canada)'
32
-
33
- # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
34
- # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
35
- # config.i18n.default_locale = :de
36
-
37
- # Configure the default encoding used in templates for Ruby 1.9.
38
- config.encoding = "utf-8"
39
-
40
- # Configure sensitive parameters which will be filtered from the log file.
41
- config.filter_parameters += [:password]
42
-
43
- # Enable the asset pipeline
44
- config.assets.enabled = true
45
-
46
- # Version of your assets, change this if you want to expire all your assets
47
- config.assets.version = '1.0'
48
- end
49
- end
@@ -1,9 +0,0 @@
1
- require 'rubygems'
2
-
3
- # Set up gems listed in the Gemfile.
4
- #ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
5
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../../../Gemfile', __FILE__)
6
-
7
- require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
8
-
9
- $:.unshift File.expand_path('../../../../lib', __FILE__)
@@ -1,22 +0,0 @@
1
- # SQLite version 3.x
2
- # gem install sqlite3
3
- development:
4
- adapter: sqlite3
5
- database: db/development.sqlite3
6
- pool: 5
7
- timeout: 5000
8
-
9
- # Warning: The database defined as "test" will be erased and
10
- # re-generated from your development database when you run "rake".
11
- # Do not set this db to the same as development or production.
12
- test:
13
- adapter: sqlite3
14
- database: db/test.sqlite3
15
- pool: 5
16
- timeout: 5000
17
-
18
- production:
19
- adapter: sqlite3
20
- database: db/production.sqlite3
21
- pool: 5
22
- timeout: 5000
@@ -1,5 +0,0 @@
1
- # Load the rails application
2
- require File.expand_path('../application', __FILE__)
3
-
4
- # Initialize the rails application
5
- Dummy::Application.initialize!
@@ -1,30 +0,0 @@
1
- Dummy::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
- # Log error messages when you accidentally call methods on nil.
10
- config.whiny_nils = true
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
- # Only use best-standards-support built into browsers
23
- config.action_dispatch.best_standards_support = :builtin
24
-
25
- # Do not compress assets
26
- config.assets.compress = false
27
-
28
- # Expands the lines which load the assets
29
- config.assets.debug = false
30
- end
@@ -1,60 +0,0 @@
1
- Dummy::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
- # Full error reports are disabled and caching is turned on
8
- config.consider_all_requests_local = false
9
- config.action_controller.perform_caching = true
10
-
11
- # Disable Rails's static asset server (Apache or nginx will already do this)
12
- config.serve_static_assets = false
13
-
14
- # Compress JavaScripts and CSS
15
- config.assets.compress = true
16
-
17
- # Don't fallback to assets pipeline if a precompiled asset is missed
18
- config.assets.compile = false
19
-
20
- # Generate digests for assets URLs
21
- config.assets.digest = true
22
-
23
- # Defaults to Rails.root.join("public/assets")
24
- # config.assets.manifest = YOUR_PATH
25
-
26
- # Specifies the header that your server uses for sending files
27
- # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
28
- # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
29
-
30
- # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
31
- # config.force_ssl = true
32
-
33
- # See everything in the log (default is :info)
34
- # config.log_level = :debug
35
-
36
- # Use a different logger for distributed setups
37
- # config.logger = SyslogLogger.new
38
-
39
- # Use a different cache store in production
40
- # config.cache_store = :mem_cache_store
41
-
42
- # Enable serving of images, stylesheets, and JavaScripts from an asset server
43
- # config.action_controller.asset_host = "http://assets.example.com"
44
-
45
- # Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
46
- # config.assets.precompile += %w( search.js )
47
-
48
- # Disable delivery errors, bad email addresses will be ignored
49
- # config.action_mailer.raise_delivery_errors = false
50
-
51
- # Enable threaded mode
52
- # config.threadsafe!
53
-
54
- # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
55
- # the I18n.default_locale when a translation can not be found)
56
- config.i18n.fallbacks = true
57
-
58
- # Send deprecation notices to registered listeners
59
- config.active_support.deprecation = :notify
60
- end
@@ -1,40 +0,0 @@
1
- Dummy::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
- #DK config.cache_classes = true
9
- config.cache_classes = false
10
-
11
- # Configure static asset server for tests with Cache-Control for performance
12
- config.serve_static_assets = true
13
- config.static_cache_control = "public, max-age=3600"
14
-
15
- # Log error messages when you accidentally call methods on nil
16
- config.whiny_nils = true
17
-
18
- # Show full error reports and disable caching
19
- config.consider_all_requests_local = true
20
- config.action_controller.perform_caching = false
21
-
22
- # Raise exceptions instead of rendering exception templates
23
- config.action_dispatch.show_exceptions = false
24
-
25
- # Disable request forgery protection in test environment
26
- config.action_controller.allow_forgery_protection = false
27
-
28
- # Tell Action Mailer not to deliver emails to the real world.
29
- # The :test delivery method accumulates sent emails in the
30
- # ActionMailer::Base.deliveries array.
31
- config.action_mailer.delivery_method = :test
32
-
33
- # Use SQL instead of Active Record's schema dumper when creating the test database.
34
- # This is necessary if your schema can't be completely dumped by the schema dumper,
35
- # like if you have constraints or database-specific column types
36
- # config.active_record.schema_format = :sql
37
-
38
- # Print deprecation notices to the stderr
39
- config.active_support.deprecation = :stderr
40
- end
@@ -1 +0,0 @@
1
- Dummy::Application.config.secret_token = '937a92d6932bff76ce073df95330b64d1df95bb11505bc24ebda6f103ca567a0fedf45811d459ac97b24901f0650da5280cdf82e7de21e86ebfc35586bb06f32'
@@ -1,8 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- Dummy::Application.config.session_store :cookie_store, key: '_hugo_session'
4
-
5
- # Use the database for sessions instead of the cookie-based default,
6
- # which shouldn't be used to store highly confidential information
7
- # (create the session table with "rails generate session_migration")
8
- # Dummy::Application.config.session_store :active_record_store
@@ -1,4 +0,0 @@
1
- Dummy::Application.routes.draw do
2
- resources :orders
3
- root :to => 'orders#index'
4
- end
data/spec/dummy/config.ru DELETED
@@ -1,4 +0,0 @@
1
- # This file is used by Rack-based servers to start the application.
2
-
3
- require ::File.expand_path('../config/environment', __FILE__)
4
- run Dummy::Application
@@ -1,10 +0,0 @@
1
- class CreateOrders < ActiveRecord::Migration
2
- def change
3
- create_table :orders do |t|
4
- t.string :name
5
- t.string :qty
6
-
7
- t.timestamps
8
- end
9
- end
10
- end
@@ -1,23 +0,0 @@
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 to check this file into your version control system.
13
-
14
- ActiveRecord::Schema.define(:version => 1) do
15
-
16
- create_table "orders", :force => true do |t|
17
- t.string "name"
18
- t.string "qty"
19
- t.datetime "created_at"
20
- t.datetime "updated_at"
21
- end
22
-
23
- end
@@ -1,7 +0,0 @@
1
- # This file should contain all the record creation needed to seed the database with its default values.
2
- # The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
3
- #
4
- # Examples:
5
- #
6
- # cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
7
- # Mayor.create(name: 'Emanuel', city: cities.first)
File without changes
@@ -1,6 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
3
-
4
- APP_PATH = File.expand_path('../../config/application', __FILE__)
5
- require File.expand_path('../../config/boot', __FILE__)
6
- require 'rails/commands'
@@ -1,32 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe "Formie" do
4
- before do
5
- Order.delete_all
6
- Order.create :name => 'Rumpelstilzchen'
7
- end
8
-
9
- it 'should display copyright' do
10
- visit "/orders"
11
- page.should have_content("Copyright")
12
- end
13
-
14
- it 'should list one order' do
15
- order = Order.all.first
16
-
17
- visit "/orders/#{order.id}"
18
- page.find('form p input').value.should == order.name
19
- end
20
-
21
- it 'builtins' do
22
- visit "/orders/new"
23
- page.should have_content("action_name new")
24
- page.should have_content("args [123, 456]")
25
- page.should have_content("block 4")
26
- page.should have_content("controller_name orders")
27
- page.should have_content("form ActionView::Helpers::FormBuilder")
28
- page.should have_content("form.object Order")
29
- page.should have_content("params new")
30
- end
31
-
32
- end
data/spec/spec_helper.rb DELETED
@@ -1,63 +0,0 @@
1
- require 'rubygems'
2
- require 'spork'
3
-
4
- Spork.prefork do
5
- # Loading more in this block will cause your tests to run faster. However,
6
- # if you change any configuration or code from libraries loaded here, you'll
7
- # need to restart spork for it take effect.
8
-
9
- ENV["RAILS_ENV"] = "test"
10
-
11
- require File.expand_path("../dummy/config/environment.rb", __FILE__)
12
- require "rails/test_help"
13
- require "rspec/rails"
14
-
15
- # ActionMailer::Base.delivery_method = :test
16
- # ActionMailer::Base.perform_deliveries = true
17
- # ActionMailer::Base.default_url_options[:host] = "test.com"
18
-
19
- Rails.backtrace_cleaner.remove_silencers!
20
-
21
- # Configure capybara for integration testing
22
- require "capybara/rails"
23
- Capybara.default_driver = :rack_test
24
- Capybara.default_selector = :css
25
-
26
- # Run any available migration
27
- ActiveRecord::Migrator.migrate File.expand_path("../dummy/db/migrate/", __FILE__)
28
-
29
- # Load support files
30
- Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
31
-
32
- RSpec.configure do |config|
33
- # Remove this line if you don't want RSpec's should and should_not
34
- # methods or matchers
35
- require 'rspec/expectations'
36
- config.include RSpec::Matchers
37
-
38
- # == Mock Framework
39
- config.mock_with :rspec
40
- end
41
- end
42
-
43
-
44
- Spork.each_run do
45
- # This code will be run each time you run your specs.
46
- Dir["#{File.dirname(__FILE__)}/../lib/controllers/*.rb"].each { |f| load f }
47
-
48
- unless ENV['COVERAGE'].nil?
49
- require 'simplecov'
50
- SimpleCov.start 'rails' do
51
- coverage_dir 'coverage'
52
- end
53
- end
54
- end
55
-
56
-
57
- # --- Instructions ---
58
- # - Sort through your spec_helper file. Place as much environment loading
59
- # code that you don't normally modify during development in the
60
- # Spork.prefork block.
61
- # - Place the rest under Spork.each_run block
62
- # - Any code that is left outside of the blocks will be ran during preforking
63
- # and during each_run!