disco-railties 0.5.2 → 0.5.3

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.
Files changed (34) hide show
  1. checksums.yaml +4 -4
  2. data/MIT-LICENSE +19 -19
  3. data/Rakefile +1 -1
  4. data/bin/disco +7 -7
  5. data/lib/disco/app_disco_loader.rb +65 -62
  6. data/lib/disco/cli.rb +14 -11
  7. data/lib/disco/commands.rb +74 -71
  8. data/lib/disco/commands/application.rb +43 -43
  9. data/lib/disco/commands/destroy.rb +12 -12
  10. data/lib/disco/commands/domainserver.rb +9 -6
  11. data/lib/disco/commands/generate.rb +12 -12
  12. data/lib/disco/commands/projectionserver.rb +13 -9
  13. data/lib/disco/commands/server.rb +23 -22
  14. data/lib/disco/generators.rb +46 -48
  15. data/lib/disco/server/domain_server.rb +26 -26
  16. data/lib/disco/server/projection_servers.rb +25 -25
  17. data/lib/generators/disco/app/app_generator.rb +11 -11
  18. data/lib/generators/disco/app/templates/app/assets/stylesheets/event_source.css +4 -4
  19. data/lib/generators/disco/app/templates/app/controllers/event_source_controller.rb +2 -3
  20. data/lib/generators/disco/app/templates/app/helpers/event_source_helper.rb +11 -11
  21. data/lib/generators/disco/app/templates/config/initializers/event_source_server.rb +2 -2
  22. data/lib/generators/disco/command/command_generator.rb +1 -1
  23. data/lib/generators/disco/event_name.rb +3 -3
  24. data/lib/generators/disco/processor_name.rb +2 -2
  25. data/lib/generators/disco/projection/USAGE +13 -13
  26. data/lib/generators/disco/projection/projection_generator.rb +19 -19
  27. data/lib/generators/disco/scaffold/scaffold_generator.rb +4 -3
  28. data/lib/generators/disco/scaffold_controller/scaffold_controller_generator.rb +1 -1
  29. data/lib/rails-disco/railtie.rb +8 -8
  30. data/lib/rails-disco/tasks.rb +1 -1
  31. data/lib/rails-disco/version.rb +3 -3
  32. data/lib/tasks/db.rake +222 -222
  33. data/lib/tasks/split.rake +93 -93
  34. metadata +8 -8
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cb4edaf8d7730cac1b7aee99e76d4787c9f999e8
4
- data.tar.gz: 9a59fcb5fbd0ba184be96b2a841d49904133af7f
3
+ metadata.gz: 8bcd7f76657f52933f7d043b9d43592a90e015b9
4
+ data.tar.gz: ac260928081d22700b5615f20035423c6a91e592
5
5
  SHA512:
6
- metadata.gz: 08c020e57303faac06b204ea7e32941af49803e9b1ac13d00f95585afcffde9ec7c94bc96b5f5370b4590c09819fabe9f12de18aa86ae7bd0b4d92703b8fe6ad
7
- data.tar.gz: 14061f37b132a63f96450c994ccb6e68dd6c71b08de49482d0f43936c42c20142b9d8c07dd6a5c1baf5bc97d0765a8a4133117ba950efd60d71ad63189eade8a
6
+ metadata.gz: a878018b0b4b9e879b543f4d0a918aac9ad0aa8d7e4b149d500dac4c12644bbecbc54b84b80c651f1ca02a7464140bc0286298d739a3dbde4a3705dffd9c8e60
7
+ data.tar.gz: b6fbdcb31bbcc1aa9c752f1d33cb46aa33f207ead4d8d99276e0697f7823f997805cbf0cf6fbe6c7eca9d41a0ea5b6b45502207fc83ce7b4682f4401887668f4
@@ -1,20 +1,20 @@
1
- Copyright (c) 2013 Robert Kranz
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
1
+ Copyright (c) 2013 Robert Kranz
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
20
  WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile CHANGED
@@ -1 +1 @@
1
- Dir.glob('lib/tasks/*.rake').each {|r| import r}
1
+ Dir.glob('lib/tasks/*.rake').each { |r| import r }
data/bin/disco CHANGED
@@ -1,7 +1,7 @@
1
- #!/usr/bin/env ruby
2
-
3
- unless Gem::Specification.find_by_name('disco-railties').gem_dir == File.expand_path('../..', __FILE__)
4
- $:.push File.expand_path('../../lib', __FILE__)
5
- $:.delete "#{Gem::Specification.find_by_name('disco-railties').gem_dir}/lib"
6
- end
7
- require 'disco/cli'
1
+ #!/usr/bin/env ruby
2
+
3
+ unless Gem::Specification.find_by_name('disco-railties').gem_dir == File.expand_path('../..', __FILE__)
4
+ $LOAD_PATH.push File.expand_path('../../lib', __FILE__)
5
+ $LOAD_PATH.delete "#{Gem::Specification.find_by_name('disco-railties').gem_dir}/lib"
6
+ end
7
+ require 'disco/cli'
@@ -1,62 +1,65 @@
1
- require 'pathname'
2
-
3
- module Disco
4
- module AppDiscoLoader
5
- RUBY = File.join(*RbConfig::CONFIG.values_at('bindir', 'ruby_install_name')) + RbConfig::CONFIG['EXEEXT']
6
- EXECUTABLES = ['bin/disco']
7
- BUNDLER_WARNING = <<EOS
8
- Looks like your app's ./bin/disco is a stub that was generated by Bundler.
9
-
10
- In Rails Disco, your app's bin/ directory contains executables that are versioned
11
- like any other source code, rather than stubs that are generated on demand.
12
-
13
- Here's how to upgrade:
14
-
15
- bundle config --delete bin # Turn off Bundler's stub generator
16
- rake disco:update:bin # Use the new Rails Disco executables
17
- git add bin # Add bin/ to source control
18
-
19
- You may need to remove bin/ from your .gitignore as well.
20
-
21
- When you install a gem whose executable you want to use in your app,
22
- generate it and add it to source control:
23
-
24
- bundle binstubs some-gem-name
25
- git add bin/new-executable
26
-
27
- EOS
28
-
29
- def self.exec_app_disco
30
- original_cwd = Dir.pwd
31
-
32
- loop do
33
- exe = find_executable
34
- if exe
35
- contents = File.read(exe)
36
-
37
- if contents =~ /(APP|ENGINE)_PATH/
38
- exec RUBY, exe, *ARGV
39
- break # non reachable, hack to be able to stub exec in the test suite
40
- elsif exe.end_with?('bin/disco') && contents.include?('This file was generated by Bundler')
41
- $stderr.puts(BUNDLER_WARNING)
42
- Object.const_set(:APP_PATH, File.expand_path('config/application', Dir.pwd))
43
- require File.expand_path('../boot', APP_PATH)
44
- require 'disco/commands'
45
- break
46
- end
47
- end
48
-
49
- # If we exhaust the search there is no executable, this could be a
50
- # call to generate a new application, so restore the original cwd.
51
- Dir.chdir(original_cwd) and return if Pathname.new(Dir.pwd).root?
52
-
53
- # Otherwise keep moving upwards in search of a executable.
54
- Dir.chdir('..')
55
- end
56
- end
57
-
58
- def self.find_executable
59
- EXECUTABLES.find { |exe| File.exists?(exe) }
60
- end
61
- end
62
- end
1
+ require 'pathname'
2
+
3
+ module Disco
4
+ module AppDiscoLoader
5
+ RUBY = File.join(*RbConfig::CONFIG.values_at('bindir', 'ruby_install_name')) + RbConfig::CONFIG['EXEEXT']
6
+ EXECUTABLES = ['bin/disco']
7
+ BUNDLER_WARNING = <<EOS
8
+ Looks like your app's ./bin/disco is a stub that was generated by Bundler.
9
+
10
+ In Rails Disco, your app's bin/ directory contains executables that are versioned
11
+ like any other source code, rather than stubs that are generated on demand.
12
+
13
+ Here's how to upgrade:
14
+
15
+ bundle config --delete bin # Turn off Bundler's stub generator
16
+ rake disco:update:bin # Use the new Rails Disco executables
17
+ git add bin # Add bin/ to source control
18
+
19
+ You may need to remove bin/ from your .gitignore as well.
20
+
21
+ When you install a gem whose executable you want to use in your app,
22
+ generate it and add it to source control:
23
+
24
+ bundle binstubs some-gem-name
25
+ git add bin/new-executable
26
+
27
+ EOS
28
+
29
+ def self.exec_app_disco
30
+ original_cwd = Dir.pwd
31
+
32
+ loop do
33
+ exe = find_executable
34
+ if exe
35
+ contents = File.read(exe)
36
+
37
+ if contents =~ /(APP|ENGINE)_PATH/
38
+ exec RUBY, exe, *ARGV
39
+ break # non reachable, hack to be able to stub exec in the test suite
40
+ elsif exe.end_with?('bin/disco') && contents.include?('This file was generated by Bundler')
41
+ $stderr.puts(BUNDLER_WARNING)
42
+ Object.const_set(:APP_PATH, File.expand_path('config/application', Dir.pwd))
43
+ require File.expand_path('../boot', APP_PATH)
44
+ require 'disco/commands'
45
+ break
46
+ end
47
+ end
48
+
49
+ # If we exhaust the search there is no executable, this could be a
50
+ # call to generate a new application, so restore the original cwd.
51
+ if Pathname.new(Dir.pwd).root?
52
+ Dir.chdir(original_cwd)
53
+ break
54
+ end
55
+
56
+ # Otherwise keep moving upwards in search of a executable.
57
+ Dir.chdir('..')
58
+ end
59
+ end
60
+
61
+ def self.find_executable
62
+ EXECUTABLES.find { |exe| File.exist?(exe) }
63
+ end
64
+ end
65
+ end
@@ -1,11 +1,14 @@
1
- require 'rbconfig'
2
- require 'disco/app_disco_loader'
3
-
4
- # If we are inside a Rails application this method performs an exec and thus
5
- # the rest of this script is not run.
6
- Disco::AppDiscoLoader.exec_app_disco
7
-
8
- require 'rails/ruby_version_check'
9
- Signal.trap('INT') { puts; exit(1) }
10
-
11
- require 'disco/commands/application'
1
+ require 'rbconfig'
2
+ require 'disco/app_disco_loader'
3
+
4
+ # If we are inside a Rails application this method performs an exec and thus
5
+ # the rest of this script is not run.
6
+ Disco::AppDiscoLoader.exec_app_disco
7
+
8
+ require 'rails/ruby_version_check'
9
+ Signal.trap('INT') do
10
+ puts
11
+ exit(1)
12
+ end
13
+
14
+ require 'disco/commands/application'
@@ -1,71 +1,74 @@
1
- ARGV << '--help' if ARGV.empty?
2
-
3
- aliases = {
4
- 'ds' => 'domainserver',
5
- 's' => 'server',
6
- 'ps' => 'projectionserver',
7
- 'g' => 'generate',
8
- 'd' => 'destroy',
9
- '-h' => '--help',
10
- '-v' => '--version',
11
- }
12
-
13
- help_message = <<-EOT
14
- Usage: disco COMMAND [ARGS]
15
-
16
- The most common disco commands are:
17
- generate(g) Generate new Rails Disco code
18
- domainserver(ds) Start the domain server
19
- projectionserver(ps) Start the projection server
20
- server(s) Start domain and projection server
21
- new Creates a new Rails Disco application
22
- "disco new my_app" creates a
23
- new application called MyApp in "./my_app"
24
-
25
- In addition to those, there are:
26
- application Generate the Rails Disco application code
27
- destroy(d) Undo code generated with "generate"
28
-
29
- All commands can be run with -h (or --help) for more information.
30
- EOT
31
-
32
-
33
- command = ARGV.shift
34
- command = aliases[command] || command
35
-
36
- case command
37
- when 'generate', 'destroy'
38
- require 'disco/generators'
39
-
40
- require APP_PATH
41
- Rails.application.require_environment!
42
- Rails.application.load_generators
43
-
44
- require "disco/commands/#{command}"
45
-
46
- when 'server', 'domainserver', 'projectionserver'
47
- Dir.chdir(File.expand_path('../../', APP_PATH)) unless File.exists?(File.expand_path('config.ru'))
48
-
49
- require "disco/commands/#{command}"
50
-
51
- when 'new'
52
- if %w(-h --help).include?(ARGV.first)
53
- require 'disco/commands/application'
54
- else
55
- puts "Can't initialize a new Rails Disco application within the directory of another, please change to a non-Rails Disco directory first.\n"
56
- puts "Type 'disco' for help."
57
- exit(1)
58
- end
59
-
60
- when '--version'
61
- require 'rails-disco/version'
62
- puts "Rails Disco #{RailsDisco::VERSION::STRING}"
63
-
64
- when '--help'
65
- puts help_message
66
-
67
- else
68
- puts "Error: Command '#{command}' not recognized"
69
- puts help_message
70
- exit(1)
71
- end
1
+ ARGV << '--help' if ARGV.empty?
2
+
3
+ aliases = {
4
+ 'ds' => 'domainserver',
5
+ 's' => 'server',
6
+ 'ps' => 'projectionserver',
7
+ 'g' => 'generate',
8
+ 'd' => 'destroy',
9
+ '-h' => '--help',
10
+ '-v' => '--version',
11
+ }
12
+
13
+ help_message = <<-EOT
14
+ Usage: disco COMMAND [ARGS]
15
+
16
+ The most common disco commands are:
17
+ generate(g) Generate new Rails Disco code
18
+ domainserver(ds) Start the domain server
19
+ projectionserver(ps) Start the projection server
20
+ server(s) Start domain and projection server
21
+ new Creates a new Rails Disco application
22
+ "disco new my_app" creates a
23
+ new application called MyApp in "./my_app"
24
+
25
+ In addition to those, there are:
26
+ application Generate the Rails Disco application code
27
+ destroy(d) Undo code generated with "generate"
28
+
29
+ All commands can be run with -h (or --help) for more information.
30
+ EOT
31
+
32
+ command = ARGV.shift
33
+ command = aliases[command] || command
34
+
35
+ case command
36
+ when 'generate', 'destroy'
37
+ require 'disco/generators'
38
+
39
+ require APP_PATH
40
+ Rails.application.require_environment!
41
+ Rails.application.load_generators
42
+
43
+ require "disco/commands/#{command}"
44
+
45
+ when 'server', 'domainserver', 'projectionserver'
46
+ Dir.chdir(File.expand_path('../../', APP_PATH)) unless File.exist?(File.expand_path('config.ru'))
47
+
48
+ require "disco/commands/#{command}"
49
+
50
+ when 'new'
51
+ if %w(-h --help).include?(ARGV.first)
52
+ require 'disco/commands/application'
53
+ else
54
+ puts <<-EOT
55
+ Can't initialize a new Rails Disco application within the directory of another.
56
+ Please change to a non-Rails Disco directory first.
57
+
58
+ Type 'disco' for help.
59
+ EOT
60
+ exit(1)
61
+ end
62
+
63
+ when '--version'
64
+ require 'rails-disco/version'
65
+ puts "Rails Disco #{RailsDisco::VERSION::STRING}"
66
+
67
+ when '--help'
68
+ puts help_message
69
+
70
+ else
71
+ puts "Error: Command '#{command}' not recognized"
72
+ puts help_message
73
+ exit(1)
74
+ end
@@ -1,43 +1,43 @@
1
- require 'rails-disco/version'
2
-
3
- if ['--version', '-v'].include?(ARGV.first)
4
- puts "Rails Disco #{RailsDisco::VERSION::STRING}"
5
- exit(0)
6
- end
7
-
8
- if ARGV.first != "new"
9
- ARGV[0] = "--help"
10
- else
11
- ARGV.shift
12
- unless ARGV.delete("--no-rc")
13
- customrc = ARGV.index{ |x| x.include?("--rc=") }
14
- railsrc = if customrc
15
- File.expand_path(ARGV.delete_at(customrc).gsub(/--rc=/, ""))
16
- else
17
- File.join(File.expand_path("~"), '.railsrc')
18
- end
19
- if File.exist?(railsrc)
20
- extra_args_string = File.read(railsrc)
21
- extra_args = extra_args_string.split(/\n+/).map {|l| l.split}.flatten
22
- puts "Using #{extra_args.join(" ")} from #{railsrc}"
23
- ARGV.insert(1, *extra_args)
24
- end
25
- end
26
- end
27
-
28
- require 'rails/generators'
29
- require 'generators/disco/app/app_generator'
30
-
31
- module Disco
32
- module Generators
33
- class AppGenerator # :nodoc:
34
- # We want to exit on failure to be kind to other libraries
35
- # This is only when accessing via CLI
36
- def self.exit_on_failure?
37
- true
38
- end
39
- end
40
- end
41
- end
42
-
43
- Disco::Generators::AppGenerator.start
1
+ require 'rails-disco/version'
2
+
3
+ if %w(--version -v).include?(ARGV.first)
4
+ puts "Rails Disco #{RailsDisco::VERSION::STRING}"
5
+ exit(0)
6
+ end
7
+
8
+ if ARGV.first != 'new'
9
+ ARGV[0] = '--help'
10
+ else
11
+ ARGV.shift
12
+ unless ARGV.delete('--no-rc')
13
+ customrc = ARGV.index { |x| x.include?('--rc=') }
14
+ railsrc = if customrc
15
+ File.expand_path(ARGV.delete_at(customrc).gsub(/--rc=/, ''))
16
+ else
17
+ File.join(File.expand_path('~'), '.railsrc')
18
+ end
19
+ if File.exist?(railsrc)
20
+ extra_args_string = File.read(railsrc)
21
+ extra_args = extra_args_string.split(/\n+/).map { |l| l.split }.flatten
22
+ puts "Using #{extra_args.join(' ')} from #{railsrc}"
23
+ ARGV.insert(1, *extra_args)
24
+ end
25
+ end
26
+ end
27
+
28
+ require 'rails/generators'
29
+ require 'generators/disco/app/app_generator'
30
+
31
+ module Disco
32
+ module Generators
33
+ class AppGenerator # :nodoc:
34
+ # We want to exit on failure to be kind to other libraries
35
+ # This is only when accessing via CLI
36
+ def self.exit_on_failure?
37
+ true
38
+ end
39
+ end
40
+ end
41
+ end
42
+
43
+ Disco::Generators::AppGenerator.start