torquebox-generators 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,5 @@
1
+ lib/**/*.rb
2
+ bin/*
3
+ -
4
+ features/**/*.feature
5
+ LICENSE.txt
data/Gemfile ADDED
@@ -0,0 +1,11 @@
1
+ source "http://rubygems.org"
2
+ # Add dependencies required to use your gem here.
3
+ # Example:
4
+ # gem "activesupport", ">= 2.3.5"
5
+
6
+ # Add dependencies to develop your gem here.
7
+ group :development do
8
+ gem "bundler", "~> 1.0.0"
9
+ gem "jeweler", "~> 1.6.0"
10
+ gem "rcov", ">= 0"
11
+ end
@@ -0,0 +1,18 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ git (1.2.5)
5
+ jeweler (1.6.0)
6
+ bundler (~> 1.0.0)
7
+ git (>= 1.2.5)
8
+ rake
9
+ rake (0.9.0)
10
+ rcov (0.9.9)
11
+
12
+ PLATFORMS
13
+ ruby
14
+
15
+ DEPENDENCIES
16
+ bundler (~> 1.0.0)
17
+ jeweler (~> 1.6.0)
18
+ rcov
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2011 Larry Staton Jr.
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.
@@ -0,0 +1,23 @@
1
+ = torquebox-generators
2
+
3
+ Rails generators for apps using TorqueBox (http://www.torquebox.org).
4
+
5
+ Two generators are provided:
6
+
7
+ 1. rails g torquebox:service MyService
8
+ 2. rails g torquebox:job MyJob
9
+
10
+ == Contributing to torquebox-generators
11
+
12
+ * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
13
+ * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
14
+ * Fork the project
15
+ * Start a feature/bugfix branch
16
+ * Commit and push until you are happy with your contribution
17
+ * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
18
+ * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
19
+
20
+ == Copyright
21
+
22
+ Copyright (c) 2011 Larry Staton Jr. See LICENSE.txt for further details.
23
+
@@ -0,0 +1,53 @@
1
+ # encoding: utf-8
2
+
3
+ require 'rubygems'
4
+ require 'bundler'
5
+ begin
6
+ Bundler.setup(:default, :development)
7
+ rescue Bundler::BundlerError => e
8
+ $stderr.puts e.message
9
+ $stderr.puts "Run `bundle install` to install missing gems"
10
+ exit e.status_code
11
+ end
12
+ require 'rake'
13
+
14
+ require 'jeweler'
15
+ Jeweler::Tasks.new do |gem|
16
+ # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
17
+ gem.name = "torquebox-generators"
18
+ gem.homepage = "http://github.com/statonjr/torquebox-generators"
19
+ gem.license = "MIT"
20
+ gem.summary = %Q{Rails generators for your Torquebox apps}
21
+ gem.description = %Q{Generates services and jobs for Torquebox apps using the familiar Rails 3 generator syntax.}
22
+ gem.email = "statonjr@gmail.com"
23
+ gem.authors = ["Larry Staton Jr."]
24
+ # dependencies defined in Gemfile
25
+ end
26
+ Jeweler::RubygemsDotOrgTasks.new
27
+
28
+ require 'rake/testtask'
29
+ Rake::TestTask.new(:test) do |test|
30
+ test.libs << 'lib' << 'test'
31
+ test.pattern = 'test/**/test_*.rb'
32
+ test.verbose = true
33
+ end
34
+
35
+ require 'rcov/rcovtask'
36
+ Rcov::RcovTask.new do |test|
37
+ test.libs << 'test'
38
+ test.pattern = 'test/**/test_*.rb'
39
+ test.verbose = true
40
+ test.rcov_opts << '--exclude "gems/*"'
41
+ end
42
+
43
+ task :default => :test
44
+
45
+ require 'rake/rdoctask'
46
+ Rake::RDocTask.new do |rdoc|
47
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
48
+
49
+ rdoc.rdoc_dir = 'rdoc'
50
+ rdoc.title = "torquebox-generators #{version}"
51
+ rdoc.rdoc_files.include('README*')
52
+ rdoc.rdoc_files.include('lib/**/*.rb')
53
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.2.0
@@ -0,0 +1,13 @@
1
+ Description:
2
+ Scheduled jobs are simply components that execute on a possibly-recurring schedule instead of in response to user interaction.
3
+ Scheduled jobs fire asynchronously, outside of the normal web-browser thread-of-control.
4
+ Scheduled jobs have full access to the entire Ruby environment.
5
+ This allows them to interact with database models and other application functionality.
6
+
7
+ This generator creates a Ruby class that implements a run() method.
8
+
9
+ Example:
10
+ rails g torquebox:job MyJob
11
+
12
+ This will create:
13
+ app/jobs/my_job.rb
@@ -0,0 +1,15 @@
1
+ module TorqueBox
2
+ class JobGenerator < Rails::Generators::NamedBase
3
+ source_root File.expand_path('../templates', __FILE__)
4
+
5
+ def generate_job
6
+ template "job.rb.erb", "app/jobs/#{file_name}.rb"
7
+ end
8
+
9
+ private
10
+ def file_name
11
+ name.underscore
12
+ end
13
+
14
+ end
15
+ end
@@ -0,0 +1,5 @@
1
+ class <%= name %>
2
+ def run
3
+ # Process data
4
+ end
5
+ end
@@ -0,0 +1,9 @@
1
+ Description:
2
+ Services are persistent background Ruby daemons deployed and managed by TorqueBox.
3
+ This generator creates a Ruby class that implements initialize(Hash), start() and stop() methods.
4
+
5
+ Example:
6
+ rails g torquebox:service MyService
7
+
8
+ This will create:
9
+ app/services/my_service.rb
@@ -0,0 +1,14 @@
1
+ module TorqueBox
2
+ class ServiceGenerator < Rails::Generators::NamedBase
3
+ source_root File.expand_path('../templates', __FILE__)
4
+
5
+ def generate_service
6
+ template "service.rb.erb", "app/services/#{file_name}.rb"
7
+ end
8
+
9
+ private
10
+ def file_name
11
+ name.underscore
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,18 @@
1
+ class <%= name %>
2
+ def intialize(opts={})
3
+ @running = true
4
+ end
5
+
6
+ def start
7
+ @thread = Thread.new { run }
8
+ end
9
+
10
+ def stop
11
+ @running = false
12
+ @thread.join
13
+ end
14
+
15
+ def run
16
+ # Process data
17
+ end
18
+ end
@@ -0,0 +1,59 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{torquebox-generators}
8
+ s.version = "0.2.0"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = [%q{Larry Staton Jr.}]
12
+ s.date = %q{2011-06-01}
13
+ s.description = %q{Generates services and jobs for Torquebox apps using the familiar Rails 3 generator syntax.}
14
+ s.email = %q{statonjr@gmail.com}
15
+ s.extra_rdoc_files = [
16
+ "LICENSE.txt",
17
+ "README.rdoc"
18
+ ]
19
+ s.files = [
20
+ ".document",
21
+ "Gemfile",
22
+ "Gemfile.lock",
23
+ "LICENSE.txt",
24
+ "README.rdoc",
25
+ "Rakefile",
26
+ "VERSION",
27
+ "lib/generators/torquebox/job/USAGE",
28
+ "lib/generators/torquebox/job/job_generator.rb",
29
+ "lib/generators/torquebox/job/templates/job.rb.erb",
30
+ "lib/generators/torquebox/service/USAGE",
31
+ "lib/generators/torquebox/service/service_generator.rb",
32
+ "lib/generators/torquebox/service/templates/service.rb.erb",
33
+ "torquebox-generators.gemspec"
34
+ ]
35
+ s.homepage = %q{http://github.com/statonjr/torquebox-generators}
36
+ s.licenses = [%q{MIT}]
37
+ s.require_paths = [%q{lib}]
38
+ s.rubygems_version = %q{1.8.5}
39
+ s.summary = %q{Rails generators for your Torquebox apps}
40
+
41
+ if s.respond_to? :specification_version then
42
+ s.specification_version = 3
43
+
44
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
45
+ s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
46
+ s.add_development_dependency(%q<jeweler>, ["~> 1.6.0"])
47
+ s.add_development_dependency(%q<rcov>, [">= 0"])
48
+ else
49
+ s.add_dependency(%q<bundler>, ["~> 1.0.0"])
50
+ s.add_dependency(%q<jeweler>, ["~> 1.6.0"])
51
+ s.add_dependency(%q<rcov>, [">= 0"])
52
+ end
53
+ else
54
+ s.add_dependency(%q<bundler>, ["~> 1.0.0"])
55
+ s.add_dependency(%q<jeweler>, ["~> 1.6.0"])
56
+ s.add_dependency(%q<rcov>, [">= 0"])
57
+ end
58
+ end
59
+
metadata ADDED
@@ -0,0 +1,103 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: torquebox-generators
3
+ version: !ruby/object:Gem::Version
4
+ prerelease:
5
+ version: 0.2.0
6
+ platform: ruby
7
+ authors:
8
+ - Larry Staton Jr.
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+
13
+ date: 2011-06-01 00:00:00 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: bundler
17
+ requirement: &id001 !ruby/object:Gem::Requirement
18
+ none: false
19
+ requirements:
20
+ - - ~>
21
+ - !ruby/object:Gem::Version
22
+ version: 1.0.0
23
+ type: :development
24
+ prerelease: false
25
+ version_requirements: *id001
26
+ - !ruby/object:Gem::Dependency
27
+ name: jeweler
28
+ requirement: &id002 !ruby/object:Gem::Requirement
29
+ none: false
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: 1.6.0
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: *id002
37
+ - !ruby/object:Gem::Dependency
38
+ name: rcov
39
+ requirement: &id003 !ruby/object:Gem::Requirement
40
+ none: false
41
+ requirements:
42
+ - - ">="
43
+ - !ruby/object:Gem::Version
44
+ version: "0"
45
+ type: :development
46
+ prerelease: false
47
+ version_requirements: *id003
48
+ description: Generates services and jobs for Torquebox apps using the familiar Rails 3 generator syntax.
49
+ email: statonjr@gmail.com
50
+ executables: []
51
+
52
+ extensions: []
53
+
54
+ extra_rdoc_files:
55
+ - LICENSE.txt
56
+ - README.rdoc
57
+ files:
58
+ - .document
59
+ - Gemfile
60
+ - Gemfile.lock
61
+ - LICENSE.txt
62
+ - README.rdoc
63
+ - Rakefile
64
+ - VERSION
65
+ - lib/generators/torquebox/job/USAGE
66
+ - lib/generators/torquebox/job/job_generator.rb
67
+ - lib/generators/torquebox/job/templates/job.rb.erb
68
+ - lib/generators/torquebox/service/USAGE
69
+ - lib/generators/torquebox/service/service_generator.rb
70
+ - lib/generators/torquebox/service/templates/service.rb.erb
71
+ - torquebox-generators.gemspec
72
+ homepage: http://github.com/statonjr/torquebox-generators
73
+ licenses:
74
+ - MIT
75
+ post_install_message:
76
+ rdoc_options: []
77
+
78
+ require_paths:
79
+ - lib
80
+ required_ruby_version: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ">="
84
+ - !ruby/object:Gem::Version
85
+ hash: -113300150717171270
86
+ segments:
87
+ - 0
88
+ version: "0"
89
+ required_rubygems_version: !ruby/object:Gem::Requirement
90
+ none: false
91
+ requirements:
92
+ - - ">="
93
+ - !ruby/object:Gem::Version
94
+ version: "0"
95
+ requirements: []
96
+
97
+ rubyforge_project:
98
+ rubygems_version: 1.8.5
99
+ signing_key:
100
+ specification_version: 3
101
+ summary: Rails generators for your Torquebox apps
102
+ test_files: []
103
+