bhf 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. data/README.md +0 -0
  2. data/app/controllers/bhf/application_controller.rb +77 -0
  3. data/app/controllers/bhf/entries_controller.rb +123 -0
  4. data/app/controllers/bhf/pages_controller.rb +49 -0
  5. data/app/helpers/bhf/application_helper.rb +22 -0
  6. data/app/helpers/bhf/entries_helper.rb +16 -0
  7. data/app/helpers/bhf/pages_helper.rb +30 -0
  8. data/app/views/bhf/_footer.haml +11 -0
  9. data/app/views/bhf/application/index.haml +3 -0
  10. data/app/views/bhf/entries/_form.haml +14 -0
  11. data/app/views/bhf/entries/_validation_errors.haml +5 -0
  12. data/app/views/bhf/entries/edit.haml +2 -0
  13. data/app/views/bhf/entries/form/belongs_to/_radio.haml +7 -0
  14. data/app/views/bhf/entries/form/belongs_to/_select.haml +6 -0
  15. data/app/views/bhf/entries/form/belongs_to/_static.haml +9 -0
  16. data/app/views/bhf/entries/form/column/_boolean.haml +2 -0
  17. data/app/views/bhf/entries/form/column/_date.haml +2 -0
  18. data/app/views/bhf/entries/form/column/_file.haml +2 -0
  19. data/app/views/bhf/entries/form/column/_markdown.haml +3 -0
  20. data/app/views/bhf/entries/form/column/_number.haml +2 -0
  21. data/app/views/bhf/entries/form/column/_static.haml +8 -0
  22. data/app/views/bhf/entries/form/column/_string.haml +2 -0
  23. data/app/views/bhf/entries/form/column/_text.haml +2 -0
  24. data/app/views/bhf/entries/form/column/_wysiwyg.haml +3 -0
  25. data/app/views/bhf/entries/form/has_and_belongs_to_many/_check_box.haml +4 -0
  26. data/app/views/bhf/entries/form/has_and_belongs_to_many/_static.haml +12 -0
  27. data/app/views/bhf/entries/form/has_many/_static.haml +12 -0
  28. data/app/views/bhf/entries/form/has_one/_static.haml +9 -0
  29. data/app/views/bhf/entries/new.haml +2 -0
  30. data/app/views/bhf/helper/_field_errors.haml +4 -0
  31. data/app/views/bhf/helper/_flash.haml +4 -0
  32. data/app/views/bhf/helper/_info.haml +2 -0
  33. data/app/views/bhf/helper/_node.haml +6 -0
  34. data/app/views/bhf/helper/_reflection_node.haml +7 -0
  35. data/app/views/bhf/pages/_platform.haml +41 -0
  36. data/app/views/bhf/pages/macro/belongs_to/_default.haml +2 -0
  37. data/app/views/bhf/pages/macro/column/_boolean.haml +1 -0
  38. data/app/views/bhf/pages/macro/column/_date.haml +1 -0
  39. data/app/views/bhf/pages/macro/column/_number.haml +1 -0
  40. data/app/views/bhf/pages/macro/column/_primary_key.haml +1 -0
  41. data/app/views/bhf/pages/macro/column/_string.haml +1 -0
  42. data/app/views/bhf/pages/macro/column/_text.haml +1 -0
  43. data/app/views/bhf/pages/macro/has_and_belongs_to_many/_default.haml +2 -0
  44. data/app/views/bhf/pages/macro/has_many/_default.haml +2 -0
  45. data/app/views/bhf/pages/macro/has_one/_default.haml +2 -0
  46. data/app/views/bhf/pages/show.haml +3 -0
  47. data/app/views/layouts/bhf/default.haml +27 -0
  48. data/app/views/layouts/bhf/quick_edit.haml +5 -0
  49. data/config/locales/en.yml +56 -0
  50. data/config/routes.rb +14 -0
  51. data/lib/bhf/active_record.rb +18 -0
  52. data/lib/bhf/data.rb +127 -0
  53. data/lib/bhf/form.rb +35 -0
  54. data/lib/bhf/pagination.rb +111 -0
  55. data/lib/bhf/platform.rb +202 -0
  56. data/lib/bhf/settings.rb +40 -0
  57. data/lib/bhf.rb +13 -0
  58. data/lib/engine.rb +19 -0
  59. data/lib/rails/generators/bhf/templates/initializer.rb +9 -0
  60. data/public/javascripts/bhf.js +0 -0
  61. data/public/stylesheets/bhf.css +1 -0
  62. data/test/test_helper.rb +55 -0
  63. metadata +169 -0
@@ -0,0 +1,55 @@
1
+ ENV["RAILS_ENV"] = "test"
2
+
3
+ require 'test/unit'
4
+ require 'rubygems'
5
+ require 'yaml'
6
+ require 'active_record'
7
+ require 'mysql'
8
+
9
+ require 'app/models/bhf/widget.rb'
10
+
11
+ def bhf_widget( fixture_name )
12
+ id = @@fixtures['bhf_widget'][ fixture_name.to_s ][ 'id' ]
13
+ Bhf::Widget.find( id )
14
+ end
15
+
16
+ def load_schema
17
+ config = YAML::load( IO.read( File.dirname(__FILE__) + '/database.yml') )
18
+
19
+ # Manually initialize the database
20
+ conn = Mysql.real_connect( config['mysql']['host'], config['mysql']['username'], config['mysql']['password'] )
21
+ conn.query( "CREATE DATABASE IF NOT EXISTS #{config['mysql']['database']}" )
22
+
23
+ ActiveRecord::Base.establish_connection( config['mysql'] )
24
+ ActiveRecord::Base.connection()
25
+
26
+ load(File.dirname(__FILE__) + "/../lib/rails/generators/bhf/templates/schema.rb")
27
+
28
+ @@fixtures = {}
29
+
30
+ load_fixture( 'bhf_widget' )
31
+ end
32
+
33
+ def load_fixture( table )
34
+ @@fixtures[ table ] = {}
35
+ fixture = YAML::load( IO.read( File.dirname(__FILE__) + "/fixtures/#{table}.yml") )
36
+ @@fixtures[ table ] = fixture
37
+
38
+ klass = class_eval table.titleize.gsub(/ /, '::')
39
+
40
+ fixture.each do |record_name, record|
41
+ record.each do |column, value|
42
+ if ( match = column.match(/(.*)_id/) )
43
+ fixture_reference = "bhf_" + match[1].pluralize
44
+ if value.is_a? Symbol
45
+ r = class_eval "#{fixture_reference}( '#{value}' )"
46
+ record[ column ] = r.id
47
+ end
48
+ end
49
+ end
50
+
51
+ r = klass.create( record )
52
+ @@fixtures[ table ][ record_name ][ 'id' ] = r.id
53
+ end
54
+
55
+ end
metadata ADDED
@@ -0,0 +1,169 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: bhf
3
+ version: !ruby/object:Gem::Version
4
+ hash: 27
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 1
9
+ - 0
10
+ version: 0.1.0
11
+ platform: ruby
12
+ authors:
13
+ - Anton Pawlik
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2011-02-28 00:00:00 +01:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: rails
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ hash: 3
30
+ segments:
31
+ - 0
32
+ version: "0"
33
+ type: :runtime
34
+ version_requirements: *id001
35
+ - !ruby/object:Gem::Dependency
36
+ name: haml
37
+ prerelease: false
38
+ requirement: &id002 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ hash: 3
44
+ segments:
45
+ - 0
46
+ version: "0"
47
+ type: :runtime
48
+ version_requirements: *id002
49
+ - !ruby/object:Gem::Dependency
50
+ name: will_paginate
51
+ prerelease: false
52
+ requirement: &id003 !ruby/object:Gem::Requirement
53
+ none: false
54
+ requirements:
55
+ - - ">="
56
+ - !ruby/object:Gem::Version
57
+ hash: 3
58
+ segments:
59
+ - 0
60
+ version: "0"
61
+ type: :runtime
62
+ version_requirements: *id003
63
+ description: Gets you there in time
64
+ email: anton.pawlik@gmail.com
65
+ executables: []
66
+
67
+ extensions: []
68
+
69
+ extra_rdoc_files:
70
+ - README.md
71
+ files:
72
+ - app/controllers/bhf/application_controller.rb
73
+ - app/controllers/bhf/entries_controller.rb
74
+ - app/controllers/bhf/pages_controller.rb
75
+ - app/helpers/bhf/application_helper.rb
76
+ - app/helpers/bhf/entries_helper.rb
77
+ - app/helpers/bhf/pages_helper.rb
78
+ - app/views/bhf/_footer.haml
79
+ - app/views/bhf/application/index.haml
80
+ - app/views/bhf/entries/_form.haml
81
+ - app/views/bhf/entries/_validation_errors.haml
82
+ - app/views/bhf/entries/edit.haml
83
+ - app/views/bhf/entries/form/belongs_to/_radio.haml
84
+ - app/views/bhf/entries/form/belongs_to/_select.haml
85
+ - app/views/bhf/entries/form/belongs_to/_static.haml
86
+ - app/views/bhf/entries/form/column/_boolean.haml
87
+ - app/views/bhf/entries/form/column/_date.haml
88
+ - app/views/bhf/entries/form/column/_file.haml
89
+ - app/views/bhf/entries/form/column/_markdown.haml
90
+ - app/views/bhf/entries/form/column/_number.haml
91
+ - app/views/bhf/entries/form/column/_static.haml
92
+ - app/views/bhf/entries/form/column/_string.haml
93
+ - app/views/bhf/entries/form/column/_text.haml
94
+ - app/views/bhf/entries/form/column/_wysiwyg.haml
95
+ - app/views/bhf/entries/form/has_and_belongs_to_many/_check_box.haml
96
+ - app/views/bhf/entries/form/has_and_belongs_to_many/_static.haml
97
+ - app/views/bhf/entries/form/has_many/_static.haml
98
+ - app/views/bhf/entries/form/has_one/_static.haml
99
+ - app/views/bhf/entries/new.haml
100
+ - app/views/bhf/helper/_field_errors.haml
101
+ - app/views/bhf/helper/_flash.haml
102
+ - app/views/bhf/helper/_info.haml
103
+ - app/views/bhf/helper/_node.haml
104
+ - app/views/bhf/helper/_reflection_node.haml
105
+ - app/views/bhf/pages/_platform.haml
106
+ - app/views/bhf/pages/macro/belongs_to/_default.haml
107
+ - app/views/bhf/pages/macro/column/_boolean.haml
108
+ - app/views/bhf/pages/macro/column/_date.haml
109
+ - app/views/bhf/pages/macro/column/_number.haml
110
+ - app/views/bhf/pages/macro/column/_primary_key.haml
111
+ - app/views/bhf/pages/macro/column/_string.haml
112
+ - app/views/bhf/pages/macro/column/_text.haml
113
+ - app/views/bhf/pages/macro/has_and_belongs_to_many/_default.haml
114
+ - app/views/bhf/pages/macro/has_many/_default.haml
115
+ - app/views/bhf/pages/macro/has_one/_default.haml
116
+ - app/views/bhf/pages/show.haml
117
+ - app/views/layouts/bhf/default.haml
118
+ - app/views/layouts/bhf/quick_edit.haml
119
+ - config/locales/en.yml
120
+ - config/routes.rb
121
+ - lib/bhf.rb
122
+ - lib/bhf/active_record.rb
123
+ - lib/bhf/data.rb
124
+ - lib/bhf/form.rb
125
+ - lib/bhf/pagination.rb
126
+ - lib/bhf/platform.rb
127
+ - lib/bhf/settings.rb
128
+ - lib/engine.rb
129
+ - lib/rails/generators/bhf/templates/initializer.rb
130
+ - public/javascripts/bhf.js
131
+ - public/stylesheets/bhf.css
132
+ - README.md
133
+ - test/test_helper.rb
134
+ has_rdoc: true
135
+ homepage: http://github.com/antpaw/bahnhof
136
+ licenses: []
137
+
138
+ post_install_message:
139
+ rdoc_options: []
140
+
141
+ require_paths:
142
+ - lib
143
+ required_ruby_version: !ruby/object:Gem::Requirement
144
+ none: false
145
+ requirements:
146
+ - - ">="
147
+ - !ruby/object:Gem::Version
148
+ hash: 3
149
+ segments:
150
+ - 0
151
+ version: "0"
152
+ required_rubygems_version: !ruby/object:Gem::Requirement
153
+ none: false
154
+ requirements:
155
+ - - ">="
156
+ - !ruby/object:Gem::Version
157
+ hash: 3
158
+ segments:
159
+ - 0
160
+ version: "0"
161
+ requirements: []
162
+
163
+ rubyforge_project: nowarning
164
+ rubygems_version: 1.3.7
165
+ signing_key:
166
+ specification_version: 3
167
+ summary: Agnostic rails backend
168
+ test_files:
169
+ - test/test_helper.rb