if_statement 0.1.0 → 0.2.0
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.
- data/README.md +22 -2
- data/lib/if_statement/railtie.rb +22 -0
- data/lib/if_statement/version.rb +1 -1
- data/lib/if_statement.rb +1 -0
- metadata +4 -5
- data/lib/if_statement/import.rb +0 -6
- data/rails/init.rb +0 -2
data/README.md
CHANGED
|
@@ -30,14 +30,34 @@ feature :nuke do
|
|
|
30
30
|
end
|
|
31
31
|
```
|
|
32
32
|
|
|
33
|
+
## Installation
|
|
34
|
+
|
|
35
|
+
In a Rails 3 project, add this to your `Gemfile`:
|
|
36
|
+
|
|
37
|
+
``` ruby
|
|
38
|
+
gem 'if_statement'
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
and then run `bundle install`
|
|
42
|
+
|
|
33
43
|
## Setting what these thing evalute to
|
|
34
44
|
|
|
35
|
-
|
|
45
|
+
Global settings should be in `config/features.rb`:
|
|
46
|
+
|
|
47
|
+
``` ruby
|
|
48
|
+
IfStatement.setup do
|
|
49
|
+
set(:nuts) { current_person.has_no :allergies }
|
|
50
|
+
set :wipe_db, false
|
|
51
|
+
end
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Environment specific settings can be in `config/features/environment.rb`:
|
|
36
55
|
|
|
37
56
|
``` ruby
|
|
57
|
+
# config/features/development.rb
|
|
38
58
|
IfStatement.setup do
|
|
39
59
|
set(:nuts) { current_person.has_no :allergies }
|
|
40
|
-
set :
|
|
60
|
+
set :wipe_db, true
|
|
41
61
|
end
|
|
42
62
|
```
|
|
43
63
|
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
require 'if_statement'
|
|
2
|
+
require 'rails'
|
|
3
|
+
|
|
4
|
+
module IfStatement
|
|
5
|
+
class Railtie < Rails::Railtie
|
|
6
|
+
|
|
7
|
+
# loaded on Rails initialization
|
|
8
|
+
initializer "if_statement.configure_rails_initialization" do
|
|
9
|
+
ActionController::Base.send :include, IfStatement::Features
|
|
10
|
+
ActiveRecord::Base.send :include, IfStatement::Features
|
|
11
|
+
ActionView::Base.send :include, IfStatement::Features
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
config.to_prepare do
|
|
15
|
+
global_config = Rails.root.join 'config', 'features.rb'
|
|
16
|
+
local_config = Rails.root.join 'config', 'features', "#{ Rails.env }.rb"
|
|
17
|
+
|
|
18
|
+
load global_config if File.exists? global_config
|
|
19
|
+
load local_config if File.exists? local_config
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
data/lib/if_statement/version.rb
CHANGED
data/lib/if_statement.rb
CHANGED
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: if_statement
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
hash:
|
|
4
|
+
hash: 23
|
|
5
5
|
prerelease:
|
|
6
6
|
segments:
|
|
7
7
|
- 0
|
|
8
|
-
-
|
|
8
|
+
- 2
|
|
9
9
|
- 0
|
|
10
|
-
version: 0.
|
|
10
|
+
version: 0.2.0
|
|
11
11
|
platform: ruby
|
|
12
12
|
authors:
|
|
13
13
|
- Andrew Lunny
|
|
@@ -52,9 +52,8 @@ files:
|
|
|
52
52
|
- install.rb
|
|
53
53
|
- lib/if_statement.rb
|
|
54
54
|
- lib/if_statement/features.rb
|
|
55
|
-
- lib/if_statement/
|
|
55
|
+
- lib/if_statement/railtie.rb
|
|
56
56
|
- lib/if_statement/version.rb
|
|
57
|
-
- rails/init.rb
|
|
58
57
|
- spec/if_statement_features_spec.rb
|
|
59
58
|
- spec/if_statement_spec.rb
|
|
60
59
|
- spec/spec_helper.rb
|
data/lib/if_statement/import.rb
DELETED
data/rails/init.rb
DELETED