rules_engine_templates 0.0.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.
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2009 Chris Douglas
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc ADDED
@@ -0,0 +1,17 @@
1
+ = rules_engine_templates
2
+
3
+ Description goes here.
4
+
5
+ == Note on Patches/Pull Requests
6
+
7
+ * Fork the project.
8
+ * Make your feature addition or bug fix.
9
+ * Add tests for it. This is important so I don't break it in a
10
+ future version unintentionally.
11
+ * Commit, do not mess with rakefile, version, or history.
12
+ (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
13
+ * Send me a pull request. Bonus points for topic branches.
14
+
15
+ == Copyright
16
+
17
+ Copyright (c) 2010 Chris Douglas. See LICENSE for details.
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.0.1
File without changes
@@ -0,0 +1,29 @@
1
+ class RuleTweetFilterManifest
2
+ def self.populate_record(m)
3
+
4
+ %W(
5
+ app/rules
6
+ app/views/re_rule_definitions/rule_tweet_filter
7
+ lib/tasks
8
+ spec/lib/rules
9
+ ).each do |dirname|
10
+ m.directory dirname
11
+ end
12
+
13
+ %W(
14
+ app/rules/rule_tweet_filter.rb
15
+ app/views/re_rule_definitions/rule_tweet_filter/_edit.html.erb
16
+ app/views/re_rule_definitions/rule_tweet_filter/_help.html.erb
17
+ app/views/re_rule_definitions/rule_tweet_filter/_new.html.erb
18
+ app/views/re_rule_definitions/rule_tweet_filter/_script.html.erb
19
+ app/views/re_rule_definitions/rule_tweet_filter/_title.html.erb
20
+ app/views/re_rule_definitions/rule_tweet_filter/_word.html.erb
21
+ app/views/re_rule_definitions/rule_tweet_filter/_words.html.erb
22
+ spec/lib/rules/rule_tweet_filter_spec.rb
23
+ ).each do |filename|
24
+ m.file filename, filename
25
+ end
26
+
27
+
28
+ end
29
+ end
@@ -0,0 +1,12 @@
1
+ directories :
2
+ - app/rules
3
+ - app/views/re_rule_definitions/rule_tweet_filter
4
+ - spec/lib/rules
5
+ - lib/tasks
6
+
7
+ contents :
8
+ - app/views/re_rule_definitions/rule_tweet_filter
9
+
10
+ files :
11
+ - app/rules/rule_tweet_filter.rb
12
+ - spec/lib/rules/rule_tweet_filter_spec.rb
@@ -0,0 +1,41 @@
1
+ Dir["#{File.dirname(__FILE__)}/manifests/*.rb"].each {|f| require f}
2
+
3
+ class RulesEngineTemplatesGenerator < Rails::Generator::Base
4
+
5
+ attr_reader :rule_type
6
+ attr_reader :rule_name, :rule_class
7
+
8
+ def initialize(runtime_args, runtime_options = {})
9
+ super
10
+
11
+ @rule_type = runtime_args[0] unless runtime_args.length < 1
12
+ @rule_name = runtime_args[1].downcase.gsub(/[^a-zA-Z0-9]+/i, '_') unless runtime_args.length < 2
13
+ @rule_class = @rule_name.camelize unless runtime_args.length < 2
14
+ end
15
+
16
+ def after_generate
17
+ puts ''
18
+ puts '******************************************************'
19
+ if @rule_type.nil?
20
+ Dir["#{File.dirname(__FILE__)}/manifests/*.rb"].each do |manifest|
21
+ puts "run >script/generate rules_engine_templates #{File.basename(manifest, '.rb')} [rule name]"
22
+ end
23
+ puts ''
24
+ elsif @rule_name.nil?
25
+ puts "run >script/generate rules_engine_templates #{@rule_type} [rule name]"
26
+ puts ''
27
+ else
28
+ puts 'run >rake spec to test the new rule'
29
+ puts ''
30
+ end
31
+ end
32
+
33
+ def manifest
34
+ record do |m|
35
+ unless @rule_type.nil?
36
+ klass = Kernel.const_get("#{@rule_type.classify}Manifest")
37
+ klass.populate_record(m, @rule_name ,@rule_class)
38
+ end
39
+ end
40
+ end
41
+ end
data/spec/spec.opts ADDED
@@ -0,0 +1 @@
1
+ --color
@@ -0,0 +1,9 @@
1
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
2
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
3
+ require 'rules_engine_templates'
4
+ require 'spec'
5
+ require 'spec/autorun'
6
+
7
+ Spec::Runner.configure do |config|
8
+
9
+ end
metadata ADDED
@@ -0,0 +1,91 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rules_engine_templates
3
+ version: !ruby/object:Gem::Version
4
+ hash: 29
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 1
10
+ version: 0.0.1
11
+ platform: ruby
12
+ authors:
13
+ - Chris Douglas
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2010-07-21 00:00:00 +10:00
19
+ default_executable:
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: rspec
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ hash: 13
30
+ segments:
31
+ - 1
32
+ - 2
33
+ - 9
34
+ version: 1.2.9
35
+ type: :development
36
+ version_requirements: *id001
37
+ description: templates for use in the rules engine
38
+ email: dougo.chris@gmail.com
39
+ executables: []
40
+
41
+ extensions: []
42
+
43
+ extra_rdoc_files:
44
+ - LICENSE
45
+ - README.rdoc
46
+ files:
47
+ - LICENSE
48
+ - README.rdoc
49
+ - VERSION
50
+ - lib/rules_engine_templates.rb
51
+ - rails_generators/manifests/rule_tweet_filter.rb
52
+ - rails_generators/manifests/rule_tweet_filter.yml
53
+ - rails_generators/rules_engine_templates_generator.rb
54
+ - spec/spec.opts
55
+ - spec/spec_helper.rb
56
+ has_rdoc: true
57
+ homepage: http://github.com/dougochris/rules_engine_templates
58
+ licenses: []
59
+
60
+ post_install_message: "\n *** RUN script/generate rules_engine_templates\n "
61
+ rdoc_options:
62
+ - --charset=UTF-8
63
+ require_paths:
64
+ - lib
65
+ required_ruby_version: !ruby/object:Gem::Requirement
66
+ none: false
67
+ requirements:
68
+ - - ">="
69
+ - !ruby/object:Gem::Version
70
+ hash: 3
71
+ segments:
72
+ - 0
73
+ version: "0"
74
+ required_rubygems_version: !ruby/object:Gem::Requirement
75
+ none: false
76
+ requirements:
77
+ - - ">="
78
+ - !ruby/object:Gem::Version
79
+ hash: 3
80
+ segments:
81
+ - 0
82
+ version: "0"
83
+ requirements: []
84
+
85
+ rubyforge_project:
86
+ rubygems_version: 1.3.7
87
+ signing_key:
88
+ specification_version: 3
89
+ summary: templates for use in the rules engine
90
+ test_files:
91
+ - spec/spec_helper.rb