Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
initial
  • Loading branch information
virtualstaticvoid committed May 6, 2011
0 parents commit 87c826c
Show file tree
Hide file tree
Showing 9 changed files with 137 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .gitignore
@@ -0,0 +1,4 @@
*.gem
.bundle
Gemfile.lock
pkg/*
4 changes: 4 additions & 0 deletions Gemfile
@@ -0,0 +1,4 @@
source "http://rubygems.org"

# Specify your gem's dependencies in rcqrs_generators.gemspec
gemspec
20 changes: 20 additions & 0 deletions LICENSE
@@ -0,0 +1,20 @@
Copyright (c) 2011 Chris Stefano

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
8 changes: 8 additions & 0 deletions README.md
@@ -0,0 +1,8 @@
# RCQRS Generators

Additional Rails 3 generators for the RCQRS plugin

# Copyright

Copyright (c) 2011 Chris Stefano. See [LICENSE](https://github.com/virtualstaticvoid/rcqrs_generators/blob/master/LICENSE) for details.

2 changes: 2 additions & 0 deletions Rakefile
@@ -0,0 +1,2 @@
require 'bundler'
Bundler::GemHelper.install_tasks
65 changes: 65 additions & 0 deletions lib/generators/rcqrs/install/install_generator.rb
@@ -0,0 +1,65 @@
require 'rails/generators/base'

module Rcqrs
module Generators
class InstallGenerator < Rails::Generators::Base

def add_gem_dependencies
gem "uuidtools"
gem "yajl-ruby", :require => 'yajl'
gem "eventful"
gem "rcqrs", :git => "git://github.com/virtualstaticvoid/rcqrs.git", :branch => "master"
gem "rcqrs-rails", :git => "git://github.com/virtualstaticvoid/rcqrs-rails.git", :branch => "master"
end

def create_event_storage_db_config_file
# just copy the existing one :-P
copy_file File.join(destination_root, "config/database.yml"), "config/event_storage.yml"
end

def create_rcqrs_publish_initializer
@snippet = <<CODE
# define "global" publish method
def publish(command)
Rcqrs::Gateway.publish(command)
end
CODE

initializer 'rcqrs_publish.rb', @snippet
end

def create_rcqrs_directories
empty_directory_with_gitkeep "app/commands"
empty_directory_with_gitkeep "app/commands/handlers"
empty_directory_with_gitkeep "app/domain"
empty_directory_with_gitkeep "app/events"
empty_directory_with_gitkeep "app/events/handlers"
end

def create_rcqrs_autoload_paths_initializer
@snippet = <<CODE
# include command, events, handlers and domain classes in the application auto load paths
config = Application.config
config.autoload_paths += %W(
#\{config.root\}/app/commands
#\{config.root\}/app/commands/handlers
#\{config.root\}/app/domain
#\{config.root\}/app/events
#\{config.root\}/app/events/handlers
)
CODE

initializer 'rcqrs_autoload_paths.rb', @snippet
end

private

def empty_directory_with_gitkeep(destination, config = {})
empty_directory(destination, config)
create_file("#{destination}/.gitkeep") unless options[:skip_git]
end

end
end
end

3 changes: 3 additions & 0 deletions lib/rcqrs_generators.rb
@@ -0,0 +1,3 @@
module RcqrsGenerators
end

3 changes: 3 additions & 0 deletions lib/rcqrs_generators/version.rb
@@ -0,0 +1,3 @@
module RcqrsGenerators
VERSION = "0.0.1"
end
28 changes: 28 additions & 0 deletions rcqrs_generators.gemspec
@@ -0,0 +1,28 @@
# -*- encoding: utf-8 -*-
$:.push File.expand_path("../lib", __FILE__)
require "rcqrs_generators/version"

Gem::Specification.new do |s|
s.name = "rcqrs_generators"
s.version = RcqrsGenerators::VERSION
s.platform = Gem::Platform::RUBY
s.authors = ["Chris Stefano"]
s.email = ["virtualstaticvoid@gmail.com"]
s.homepage = ""
s.summary = %q{Rails 3 generators supporting the RCQRS Rails 3 plugin}

s.rubyforge_project = "rcqrs_generators"

s.files = `git ls-files`.split("\n")
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }

s.require_paths = ["lib"]

s.extra_rdoc_files = [
'LICENSE',
'README.md'
]

end

0 comments on commit 87c826c

Please sign in to comment.