behavior 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.textile +97 -0
- data/Rakefile +43 -0
- data/app/controllers/admin/configs_controller.rb +20 -0
- data/app/helpers/behavior_helper.rb +8 -0
- data/app/models/behavior_config.rb +3 -0
- data/app/views/admin/configs/show.html.erb +20 -0
- data/app/views/layouts/admin.html.erb +11 -0
- data/behavior.gemspec +73 -0
- data/config/behavior.yml +18 -0
- data/config/routes.rb +5 -0
- data/features/admin_configs.feature +15 -0
- data/features/step_definitions/web_steps.rb +248 -0
- data/features/support/behavior_env.rb +3 -0
- data/features/support/env.rb +53 -0
- data/features/support/paths.rb +27 -0
- data/generators/behavior/USAGE +7 -0
- data/generators/behavior/behavior_generator.rb +9 -0
- data/generators/behavior/templates/20091210164854_create_behavior_configs.rb +16 -0
- data/generators/behavior/templates/behavior.yml +33 -0
- data/generators/definition.txt +0 -0
- data/lib/behavior.rb +73 -0
- data/rails/init.rb +1 -0
- data/spec/behavior_generator_spec.rb +43 -0
- data/spec/behavior_spec.rb +41 -0
- data/spec/blueprints.rb +8 -0
- data/spec/database.yml +21 -0
- data/spec/debug.log +1731 -0
- data/spec/helpers/behavior_helper_spec.rb +18 -0
- data/spec/schema.rb +6 -0
- data/spec/spec_helper.rb +42 -0
- metadata +89 -0
@@ -0,0 +1,18 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../spec_helper'
|
2
|
+
|
3
|
+
describe BehaviorHelper do
|
4
|
+
include BehaviorHelper
|
5
|
+
include Behavior
|
6
|
+
|
7
|
+
before do
|
8
|
+
Behavior::Settings.config_file = 'config/behavior.yml'
|
9
|
+
end
|
10
|
+
|
11
|
+
it "should give me a password field for a password" do
|
12
|
+
behavior_tag('password').should match(/type="password"/)
|
13
|
+
end
|
14
|
+
|
15
|
+
it "should give me a text area field for text" do
|
16
|
+
behavior_tag('description').should match(/textarea/)
|
17
|
+
end
|
18
|
+
end
|
data/spec/schema.rb
ADDED
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
begin
|
2
|
+
require File.dirname(__FILE__) + '/../../../../spec/spec_helper'
|
3
|
+
rescue LoadError
|
4
|
+
puts "You need to install rspec in your base app"
|
5
|
+
exit
|
6
|
+
end
|
7
|
+
|
8
|
+
require File.dirname(__FILE__) + '/blueprints'
|
9
|
+
|
10
|
+
plugin_spec_dir = File.dirname(__FILE__)
|
11
|
+
ActiveRecord::Base.logger = Logger.new(plugin_spec_dir + "/debug.log")
|
12
|
+
|
13
|
+
def load_schema
|
14
|
+
config = YAML::load(IO.read(File.dirname(__FILE__) + '/database.yml'))
|
15
|
+
ActiveRecord::Base.logger = Logger.new(File.dirname(__FILE__) + "/debug.log")
|
16
|
+
|
17
|
+
db_adapter = ENV['DB']
|
18
|
+
|
19
|
+
# no db passed, try one of these fine config-free DBs before bombing.
|
20
|
+
db_adapter ||=
|
21
|
+
begin
|
22
|
+
require 'rubygems'
|
23
|
+
require 'sqlite'
|
24
|
+
'sqlite'
|
25
|
+
rescue MissingSourceFile
|
26
|
+
begin
|
27
|
+
require 'sqlite3'
|
28
|
+
'sqlite3'
|
29
|
+
rescue MissingSourceFile
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
if db_adapter.nil?
|
34
|
+
raise "No DB Adapter selected. Pass the DB= option to pick one, or install Sqlite or Sqlite3."
|
35
|
+
end
|
36
|
+
|
37
|
+
ActiveRecord::Base.establish_connection(config[db_adapter])
|
38
|
+
load(File.dirname(__FILE__) + "/schema.rb")
|
39
|
+
require File.dirname(__FILE__) + '/../rails/init.rb'
|
40
|
+
end
|
41
|
+
|
42
|
+
load_schema
|
metadata
ADDED
@@ -0,0 +1,89 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: behavior
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Paul Campbell
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2009-12-11 00:00:00 +00:00
|
13
|
+
default_executable:
|
14
|
+
dependencies: []
|
15
|
+
|
16
|
+
description:
|
17
|
+
email: paul@rslw.com
|
18
|
+
executables: []
|
19
|
+
|
20
|
+
extensions: []
|
21
|
+
|
22
|
+
extra_rdoc_files:
|
23
|
+
- README.textile
|
24
|
+
files:
|
25
|
+
- README.textile
|
26
|
+
- Rakefile
|
27
|
+
- app/controllers/admin/configs_controller.rb
|
28
|
+
- app/helpers/behavior_helper.rb
|
29
|
+
- app/models/behavior_config.rb
|
30
|
+
- app/views/admin/configs/show.html.erb
|
31
|
+
- app/views/layouts/admin.html.erb
|
32
|
+
- behavior.gemspec
|
33
|
+
- config/behavior.yml
|
34
|
+
- config/routes.rb
|
35
|
+
- features/admin_configs.feature
|
36
|
+
- features/step_definitions/web_steps.rb
|
37
|
+
- features/support/behavior_env.rb
|
38
|
+
- features/support/env.rb
|
39
|
+
- features/support/paths.rb
|
40
|
+
- generators/behavior/USAGE
|
41
|
+
- generators/behavior/behavior_generator.rb
|
42
|
+
- generators/behavior/templates/20091210164854_create_behavior_configs.rb
|
43
|
+
- generators/behavior/templates/behavior.yml
|
44
|
+
- generators/definition.txt
|
45
|
+
- lib/behavior.rb
|
46
|
+
- rails/init.rb
|
47
|
+
- spec/behavior_generator_spec.rb
|
48
|
+
- spec/behavior_spec.rb
|
49
|
+
- spec/blueprints.rb
|
50
|
+
- spec/database.yml
|
51
|
+
- spec/debug.log
|
52
|
+
- spec/helpers/behavior_helper_spec.rb
|
53
|
+
- spec/schema.rb
|
54
|
+
- spec/spec_helper.rb
|
55
|
+
has_rdoc: true
|
56
|
+
homepage: http://www.github.com/paulca/behavior
|
57
|
+
licenses: []
|
58
|
+
|
59
|
+
post_install_message:
|
60
|
+
rdoc_options:
|
61
|
+
- --charset=UTF-8
|
62
|
+
require_paths:
|
63
|
+
- lib
|
64
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: "0"
|
69
|
+
version:
|
70
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - ">="
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: "0"
|
75
|
+
version:
|
76
|
+
requirements: []
|
77
|
+
|
78
|
+
rubyforge_project:
|
79
|
+
rubygems_version: 1.3.5
|
80
|
+
signing_key:
|
81
|
+
specification_version: 3
|
82
|
+
summary: A Rails plugin for storing application configuration in the database.
|
83
|
+
test_files:
|
84
|
+
- spec/behavior_generator_spec.rb
|
85
|
+
- spec/behavior_spec.rb
|
86
|
+
- spec/blueprints.rb
|
87
|
+
- spec/helpers/behavior_helper_spec.rb
|
88
|
+
- spec/schema.rb
|
89
|
+
- spec/spec_helper.rb
|