decko 0.10.0 → 0.11.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (97) hide show
  1. checksums.yaml +4 -4
  2. data/lib/decko.rb +0 -15
  3. data/lib/decko/application.rb +1 -6
  4. data/lib/decko/commands/application.rb +2 -2
  5. data/lib/decko/commands/cucumber_command.rb +4 -7
  6. data/lib/decko/commands/rspec_command.rb +4 -6
  7. data/lib/decko/commands/rspec_command/parser.rb +1 -1
  8. data/lib/decko/config/environments/cypress.rb +0 -2
  9. data/lib/decko/config/environments/development.rb +9 -18
  10. data/lib/decko/config/environments/test.rb +0 -7
  11. data/lib/decko/engine.rb +0 -1
  12. data/lib/decko/generators/{decko → deck}/USAGE +0 -0
  13. data/lib/decko/generators/deck/deck_generator.rb +132 -0
  14. data/lib/decko/generators/deck/deck_generator/deck_helper.rb +110 -0
  15. data/lib/decko/generators/deck/deck_generator/interactive.rb +120 -0
  16. data/lib/decko/generators/deck/deck_generator/rails_overrides.rb +54 -0
  17. data/lib/decko/generators/deck/templates/Gemfile.erb +56 -0
  18. data/lib/decko/generators/{decko/templates/Rakefile → deck/templates/Rakefile.erb} +0 -0
  19. data/lib/decko/generators/{decko/templates/bin/spring → deck/templates/bin/spring.erb} +3 -1
  20. data/lib/decko/generators/{decko/templates/config.ru → deck/templates/config.ru.erb} +0 -0
  21. data/lib/decko/generators/{decko/templates/config/application.rb → deck/templates/config/application.rb.erb} +38 -17
  22. data/lib/decko/generators/{decko/templates/config/boot.rb → deck/templates/config/boot.rb.erb} +1 -5
  23. data/lib/decko/generators/deck/templates/config/cucumber.yml +1 -0
  24. data/lib/decko/generators/{decko → deck}/templates/config/databases/frontbase.yml +0 -0
  25. data/lib/decko/generators/{decko → deck}/templates/config/databases/ibm_db.yml +0 -0
  26. data/lib/decko/generators/{decko → deck}/templates/config/databases/jdbc.yml +0 -0
  27. data/lib/decko/generators/{decko → deck}/templates/config/databases/jdbcmysql.yml +0 -0
  28. data/lib/decko/generators/{decko → deck}/templates/config/databases/jdbcpostgresql.yml +0 -0
  29. data/lib/decko/generators/{decko → deck}/templates/config/databases/jdbcsqlite3.yml +0 -0
  30. data/lib/decko/generators/{decko → deck}/templates/config/databases/mysql.yml +0 -0
  31. data/lib/decko/generators/{decko → deck}/templates/config/databases/oracle.yml +0 -0
  32. data/lib/decko/generators/{decko → deck}/templates/config/databases/postgresql.yml +0 -0
  33. data/lib/decko/generators/{decko → deck}/templates/config/databases/sqlite3.yml +0 -0
  34. data/lib/decko/generators/{decko → deck}/templates/config/deck.yml +0 -0
  35. data/lib/decko/generators/{decko/templates/config/environment.rb → deck/templates/config/environment.rb.erb} +2 -2
  36. data/lib/decko/generators/{decko/templates/config/initializers/cypress_on_rails.rb → deck/templates/config/initializers/cypress.rb} +2 -0
  37. data/lib/decko/generators/{decko → deck}/templates/config/puma.rb +5 -5
  38. data/lib/decko/generators/{decko/templates/config/routes.erb → deck/templates/config/routes.rb.erb} +1 -1
  39. data/lib/decko/generators/{decko → deck}/templates/gitignore +0 -0
  40. data/lib/decko/generators/deck/templates/pryrc +6 -0
  41. data/lib/decko/generators/{decko → deck}/templates/public/files/htaccess +0 -0
  42. data/lib/decko/generators/{decko → deck}/templates/public/robots.txt +2 -1
  43. data/lib/decko/generators/deck/templates/rspec.erb +6 -0
  44. data/lib/decko/generators/{decko → deck}/templates/script/decko +2 -1
  45. data/lib/decko/generators/deck/templates/script/decko_cucumber +8 -0
  46. data/lib/decko/generators/deck/templates/script/decko_rspec +8 -0
  47. data/lib/decko/generators/{decko/templates/bin → deck/templates/script}/delayed_job +1 -1
  48. data/lib/decko/generators/deck/templates/simplecov.rb.erb +34 -0
  49. data/lib/decko/generators/{decko/templates/spec/javascripts/support/deck_jasmine.yml → deck/templates/spec/javascripts/support/deck_jasmine.yml.erb} +1 -1
  50. data/lib/decko/generators/{decko/templates/spec/javascripts/support/decko_jasmine.yml → deck/templates/spec/javascripts/support/decko_jasmine.yml.erb} +3 -3
  51. data/lib/decko/generators/{decko → deck}/templates/spec/spec_helper.rb +0 -0
  52. data/lib/decko/mods_spec_helper.rb +3 -4
  53. data/lib/decko/response.rb +1 -0
  54. data/lib/decko/tasks/decko.rake +1 -30
  55. data/lib/decko/tasks/decko/docs.rake +26 -0
  56. data/lib/decko/tasks/decko/tmpsets.rake +25 -0
  57. metadata +61 -76
  58. data/GPL +0 -331
  59. data/LICENSE +0 -16
  60. data/README.rdoc +0 -151
  61. data/app/assets/images/body-bg.bmp +0 -0
  62. data/app/assets/images/body-bg.png +0 -0
  63. data/app/assets/images/external_link.png +0 -0
  64. data/app/assets/images/smoothness/animated-overlay.gif +0 -0
  65. data/app/assets/images/smoothness/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  66. data/app/assets/images/smoothness/ui-bg_flat_75_ffffff_40x100.png +0 -0
  67. data/app/assets/images/smoothness/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
  68. data/app/assets/images/smoothness/ui-bg_glass_65_ffffff_1x400.png +0 -0
  69. data/app/assets/images/smoothness/ui-bg_glass_75_dadada_1x400.png +0 -0
  70. data/app/assets/images/smoothness/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
  71. data/app/assets/images/smoothness/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  72. data/app/assets/images/smoothness/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
  73. data/app/assets/images/smoothness/ui-icons_222222_256x240.png +0 -0
  74. data/app/assets/images/smoothness/ui-icons_2e83ff_256x240.png +0 -0
  75. data/app/assets/images/smoothness/ui-icons_454545_256x240.png +0 -0
  76. data/app/assets/images/smoothness/ui-icons_888888_256x240.png +0 -0
  77. data/app/assets/images/smoothness/ui-icons_cd0a0a_256x240.png +0 -0
  78. data/lib/decko/generators/decko/decko_generator.rb +0 -263
  79. data/lib/decko/generators/decko/decko_generator/interactive.rb +0 -114
  80. data/lib/decko/generators/decko/templates/Gemfile +0 -126
  81. data/lib/decko/generators/decko/templates/config/cucumber.yml +0 -1
  82. data/lib/decko/generators/decko/templates/config/initializers/cypress_dev.rb +0 -10
  83. data/lib/decko/generators/decko/templates/rspec +0 -5
  84. data/lib/decko/generators/decko/templates/simplecov +0 -5
  85. data/rails/application-routes.rb +0 -3
  86. data/rails/assets/external_link.png +0 -0
  87. data/rails/assets/jasmine/404.html +0 -27
  88. data/rails/assets/jasmine/500.html +0 -28
  89. data/rails/assets/jasmine/card_form.html +0 -13
  90. data/rails/assets/jquery.min.map +0 -1
  91. data/rails/controllers/application_controller.rb +0 -2
  92. data/rails/controllers/card_controller.rb +0 -151
  93. data/rails/engine-routes.rb +0 -53
  94. data/script/autospec +0 -4
  95. data/script/decko +0 -6
  96. data/script/rails +0 -6
  97. data/script/test_filter +0 -25
@@ -0,0 +1,120 @@
1
+ module Decko
2
+ module Generators
3
+ module Deck
4
+ class DeckGenerator
5
+ # Guides through the decko deck installation with an interactive menu
6
+ # Offers the possibilitiy to
7
+ # - edit database config
8
+ # - edit application.rb
9
+ # - seed database
10
+ # - run server
11
+ class Interactive
12
+ def initialize destination_root, dev=false
13
+ @dev = dev
14
+ @destination_root = destination_root
15
+ end
16
+
17
+ def run
18
+ require config_path("application") # need this for Rails.env
19
+ @menu = ActiveSupport::OrderedHash.new
20
+ add_config_options
21
+ add_seed_options
22
+ add_exit_option
23
+ while (answer = ask(build_menu)) != "x"
24
+ if @menu.key? answer
25
+ @menu[answer][:code].call
26
+ else
27
+ puts "invalid choice"
28
+ end
29
+ end
30
+ end
31
+
32
+ private
33
+
34
+ def dev_options?
35
+ @dev
36
+ end
37
+
38
+ def config_path file
39
+ File.join destination_root, "config", file
40
+ end
41
+
42
+ def bundle_exec command, opts={}
43
+ rails_env = "RAILS_ENV=#{opts[:rails_env]}" if opts[:rails_env]
44
+ system "cd #{destination_root} && #{rails_env} bundle exec #{command}"
45
+ end
46
+
47
+ def build_menu
48
+ lines = ["What would you like to do next?"]
49
+ lines += @menu.map { |key, v| build_option key, v[:desc], v[:command] }
50
+ lines << "[#{@menu.keys.join}]"
51
+ "\n#{lines.join("\n")}\n"
52
+ end
53
+
54
+ def build_option key, desc, command
55
+ command &&= " " * (65 - desc.size) + "[" + command + "]"
56
+ " #{key} - #{desc}#{command if command}"
57
+ end
58
+
59
+ def add_config_options
60
+ @menu["d"] = {
61
+ desc: "edit database configuration file",
62
+ command: "nano config/database.yml",
63
+ code: proc { system "nano #{config_path 'database.yml'}" }
64
+ }
65
+ @menu["c"] = {
66
+ desc: "configure Decko (e.g. email settings)",
67
+ command: "nano config/application.rb",
68
+ code: proc { system "nano #{config_path 'application.rb'}" }
69
+ }
70
+ end
71
+
72
+ def add_seed_options
73
+ add_common_seed_option
74
+ add_seed_all_option
75
+ end
76
+
77
+ def add_common_seed_option
78
+ @menu["s"] = {
79
+ desc: "seed #{Rails.env}#{' and test' if dev_options?} database",
80
+ command: "decko seed",
81
+ code: proc do
82
+ bundle_exec "rake decko:seed"
83
+ bundle_exec "rake decko:seed", rails_env: "test" if dev_options?
84
+ add_after_seed_options
85
+ end
86
+ }
87
+ end
88
+
89
+ def add_seed_all_option
90
+ @menu["a"] = {
91
+ desc: "seed all databases (production, development, and test)",
92
+ command: "decko seed --all",
93
+ code: proc do
94
+ %w[production development test].each do |env|
95
+ bundle_exec "rake decko:seed", rails_env: env
96
+ end
97
+ add_after_seed_options
98
+ end
99
+ }
100
+ end
101
+
102
+ def add_exit_option
103
+ @menu["x"] = {
104
+ desc: "exit (run 'decko seed' to complete the installation later)"
105
+ }
106
+ end
107
+
108
+ def add_after_seed_options
109
+ @menu["x"][:desc] = "exit"
110
+ @menu["r"] = {
111
+ desc: "run decko server",
112
+ command: "decko server",
113
+ code: proc { bundle_exec "decko server" }
114
+ }
115
+ end
116
+ end
117
+ end
118
+ end
119
+ end
120
+ end
@@ -0,0 +1,54 @@
1
+ module Decko
2
+ module Generators
3
+ module Deck
4
+ class DeckGenerator
5
+ ### the following is straight from rails and is focused on checking
6
+ # the validity of the app name.needs decko-specific tuning
7
+ module RailsOverrides
8
+ protected
9
+
10
+ def app_name
11
+ @app_name ||=
12
+ defined_app_const_base? ? defined_app_name : File.basename(destination_root)
13
+ end
14
+
15
+ def defined_app_name
16
+ defined_app_const_base.underscore
17
+ end
18
+
19
+ def defined_app_const_base
20
+ Rails.respond_to?(:application) && defined?(Rails::Application) &&
21
+ Decko.application.is_a?(Rails::Application) &&
22
+ Decko.application.class.name.sub(/::Application$/, "")
23
+ end
24
+
25
+ alias_method :defined_app_const_base?, :defined_app_const_base
26
+
27
+ def app_const_base
28
+ @app_const_base ||= defined_app_const_base ||
29
+ app_name.gsub(/\W/, "_").squeeze("_").camelize
30
+ end
31
+
32
+ alias_method :camelized, :app_const_base
33
+
34
+ def app_const
35
+ @app_const ||= "#{app_const_base}::Application"
36
+ end
37
+
38
+ def valid_const?
39
+ if app_const.match?(/^\d/)
40
+ invalid_app_name "Please give a name which does not start with numbers."
41
+ elsif Object.const_defined?(app_const_base)
42
+ invalid_app_name "constant #{app_const_base} is already in use. " \
43
+ "Please choose another application name."
44
+ end
45
+ end
46
+
47
+ def invalid_app_name message
48
+ raise Thor::Error, "Invalid application name #{app_name}, #{message}"
49
+ end
50
+ end
51
+ end
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,56 @@
1
+ source "http://rubygems.org"
2
+
3
+ gem "decko"<%= repo_path_constraint %>
4
+
5
+
6
+ # DATABASE
7
+ # Decko currently supports MySQL (best tested), PostgreSQL (well tested), and SQLite
8
+ # (not well tested).
9
+ gem <%= database_gem_and_version %>
10
+
11
+
12
+ # WEBSERVER
13
+ # To run a simple deck at localhost:3000, you can use thin (recommended), unicorn,
14
+ # or (Rails" default) Webrick
15
+ gem "thin"
16
+ # gem "unicorn"
17
+
18
+
19
+ # CARD MODS
20
+ # The easiest way to change card behaviors is with card mods. To install a mod:
21
+ #
22
+ # 1. add `gem "card-mod-MODNAME"` below
23
+ # 2. run `bundle update` to install the code
24
+ # 3. run `decko update` to make any needed changes to your deck
25
+ #
26
+ # The "defaults" includes a lot of functionality that is needed in standard decks.
27
+ gem "card-mod-defaults"
28
+
29
+
30
+ # BACKGROUND
31
+ # A background gem is needed to run tasks like sending notifications in a background
32
+ # process.
33
+ # See https://github.com/decko-commons/decko/tree/master/card-mod-delayed_job
34
+ # for additional configuration details.
35
+ <%= "# " if shark? %>gem "card-mod-delayed_job"
36
+
37
+
38
+ # MONKEYS
39
+ # You can also create your own mods. Mod developers (or "Monkeys") will want some
40
+ # additional gems to support development and testing.
41
+ <%= "# " if shark? %>gem "card-mod-monkey", group: :development
42
+ <%= "# " if shark? %>gem "decko-rspec", group: :test
43
+ <%= "# " if shark? %>gem "decko-cucumber", group: :cucumber
44
+ <%= "# " if shark? %>gem "decko-cypress", group: %i[test development]
45
+ <%= "# " if shark? %>gem "decko-profile", group: :profile
46
+ <%= "# " if shark? || !spring_install? %>gem "decko-spring"
47
+
48
+ <% if platypus? %>
49
+ # PLATYPUSES
50
+ # This mod is strongly recommended for platypuses – coders working on the decko core
51
+ gem "card-mod-platypus"
52
+ <% end %>
53
+
54
+ # The following allows simple (non-gem) mods to specify gems via a Gemfile.
55
+ # You may need to alter this code if you move such mods to an unconventional location.
56
+ Dir.glob("mod/**/Gemfile").each { |gemfile| instance_eval File.read(gemfile) }
@@ -1,5 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
+ GEM_RE = /^GEM$.*?^ (?: )*spring \((.*?)\)$.*?^$/m
4
+
3
5
  # This file loads spring without using Bundler, in order to be fast
4
6
  # It gets overwritten when you run the `spring binstub` command
5
7
 
@@ -7,7 +9,7 @@ unless defined?(Spring)
7
9
  require "rubygems"
8
10
  require "bundler"
9
11
 
10
- if match = Bundler.default_lockfile.read.match(/^GEM$.*?^ (?: )*spring \((.*?)\)$.*?^$/m)
12
+ if (match = Bundler.default_lockfile.read.match GEM_RE)
11
13
  ENV["GEM_PATH"] = ([Bundler.bundle_path.to_s] + Gem.path).join(File::PATH_SEPARATOR)
12
14
  ENV["GEM_HOME"] = ""
13
15
  Gem.paths = ENV
@@ -6,9 +6,15 @@ module <%= app_const_base %>
6
6
  class Application < Decko::Application
7
7
  config.performance_logger = nil
8
8
 
9
- # Decko inherits Rails configuration options. See http://guides.rubyonrails.org/configuring.html
9
+ # Decko inherits most Ruby-on-Rails configuration options.
10
+ # See http://guides.rubyonrails.org/configuring.html
11
+
12
+ # EMAIL
13
+ # Email is not turned on by default. To turn it on, you need to change the
14
+ # following to `true` and then add configuration specific to your site.
15
+ # Learn more:
16
+ # https://guides.rubyonrails.org/configuring.html#configuring-action-mailer
10
17
 
11
- # Email configuration
12
18
  config.action_mailer.perform_deliveries = false
13
19
  # config.action_mailer.delivery_method = ...
14
20
  # config.action_mailer.smtp_settings = ...
@@ -19,25 +25,25 @@ module <%= app_const_base %>
19
25
  # config.action_mailer.smtp_settings = { address: "localhost", port: 1025 }
20
26
 
21
27
 
22
- # Background jobs
23
- # Moves time-consuming minor tasks that are part of a card transaction (like sending notifications
24
- # to followers) to a background process. To activate it add the 'daemons' gem to the Gemfile, uncomment
25
- # the line below and run 'bin/delayed_job start' to start the background process.
26
- # See https://github.com/collectiveidea/delayed_job#running-jobs for more information
27
- #
28
- # Delayed::Worker.delay_jobs = true
28
+ # BACKGROUND
29
+ # Decko lets you run some card events (like follower notifications) in the
30
+ # background. This is off by default but can be turned on by changing the
31
+ # `delaying` setting to `true`
32
+ config.active_job.queue_adapter = :delayed_job
33
+ config.delaying = false
29
34
 
30
- # config.read_only = true
31
- # defaults to false
32
- # disallows creating, updating, and deleting cards.
33
35
 
36
+ # CACHING
34
37
  # config.cache_store = :file_store, 'tmp/cache'
35
- # determines caching mechanism. options include: file_store, memory_store, mem_cache_store, dalli_store...
38
+ # determines caching mechanism. options include: file_store, memory_store,
39
+ # mem_cache_store, dalli_store...
36
40
  #
37
41
  # for production, we highly recommend memcache
38
42
  # here's a sample configuration for use with the dalli gem
39
43
  # config.cache_store = :dalli_store, []
40
44
 
45
+
46
+ # FILES
41
47
  # config.paths['files'] = 'files'
42
48
  # directory in which uploaded files are actually stored. (eg Image and File cards)
43
49
 
@@ -71,16 +77,31 @@ module <%= app_const_base %>
71
77
  # }
72
78
  # }
73
79
 
80
+ # MISCELLANEOUS
81
+ # config.read_only = true
82
+ # defaults to false
83
+ # disallows creating, updating, and deleting cards.
84
+
74
85
  # config.paths['mod'] << 'my-mod-dir'
75
86
  # add a new directory for code customizations, or "mods"
76
87
 
77
88
  # config.allow_inline_styles = false
78
89
  # don't strip style attributes (not recommended)
79
90
 
80
- # config.override_host = nil
81
- # don't autodetect host (example.com) from web requests
91
+ # config.override_host = "example.com"
92
+ # overrides host auto-detected from web requests
82
93
 
83
- # config.override_protocol = nil
84
- # don't autodetect protocol (http/https) from web requests
94
+ # config.override_protocol = "https"
95
+ # overrides protocol auto-detected from web requests
96
+ <% if platypus? %>
97
+ config.file_buckets = {
98
+ test_bucket: {
99
+ provider: "AWS",
100
+ aws_access_key_id: ENV["TEST_BUCKET_AWS_ACCESS_KEY_ID"],
101
+ aws_secret_access_key: ENV["TEST_BUCKET_AWS_SECRET_ACCESS_KEY"],
102
+ region: "us-east-1"
103
+ }
104
+ }
105
+ <% end %>
85
106
  end
86
107
  end
@@ -3,11 +3,7 @@
3
3
  require 'rubygems'
4
4
 
5
5
  # defaults to development mode without the following
6
- <% if options['mod-dev'] || options['core-dev'] -%>
7
- # ENV['RAILS_ENV'] ||= 'production'
8
- <% else -%>
9
- ENV['RAILS_ENV'] ||= 'production'
10
- <% end -%>
6
+ <%= "# " unless shark? %>ENV['RAILS_ENV'] ||= 'production'
11
7
 
12
8
  # Set up gems listed in the Gemfile.
13
9
  ENV['BUNDLE_GEMFILE'] ||= File.expand_path("Gemfile")
@@ -0,0 +1 @@
1
+ default: '<%= features_path %>'
@@ -1,5 +1,5 @@
1
- # Load the rails application
1
+ # Load the decko application
2
2
  require File.expand_path('../application', __FILE__)
3
3
 
4
- # Initialize the rails application
4
+ # Initialize the decko application
5
5
  <%= app_const %>.initialize!
@@ -1,4 +1,6 @@
1
1
  if defined?(CypressOnRails)
2
+ require "simplecov"
3
+
2
4
  CypressOnRails.configure do |c|
3
5
  c.cypress_folder = File.join Decko.gem_root, "spec", "cypress"
4
6
  # WARNING!! CypressOnRails can execute arbitrary ruby code
@@ -1,13 +1,13 @@
1
- workers Integer(ENV['WEB_CONCURRENCY'] || 1)
2
- min_threads_count = Integer(ENV['RAILS_MIN_THREADS'] || 1)
3
- max_threads_count = Integer(ENV['RAILS_MAX_THREADS'] || 1)
1
+ workers Integer(ENV["WEB_CONCURRENCY"] || 1)
2
+ min_threads_count = Integer(ENV["RAILS_MIN_THREADS"] || 1)
3
+ max_threads_count = Integer(ENV["RAILS_MAX_THREADS"] || 1)
4
4
  threads min_threads_count, max_threads_count
5
5
 
6
6
  preload_app!
7
7
 
8
8
  rackup DefaultRackup
9
- port ENV['PORT'] || 3000
10
- environment ENV['RACK_ENV'] || 'development'
9
+ port ENV["PORT"] || 3000
10
+ environment ENV["RACK_ENV"] || "development"
11
11
 
12
12
  on_worker_boot do
13
13
  # Worker specific setup for Rails 4.1+
@@ -1,7 +1,7 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
 
3
3
  Decko.application.routes.draw do
4
- <% if @include_jasmine_engine %>
4
+ <% if !shark? %>
5
5
  if !Rails.env.production? && Object.const_defined?( :JasmineRails )
6
6
  engine = Object.const_get(:JasmineRails).const_get :Engine
7
7
  mount engine => "#{rel_root}/specs"
@@ -0,0 +1,6 @@
1
+ begin
2
+ puts "Loading pry configuration: (#{File.expand_path __FILE__})"
3
+ include Cardio::Pry
4
+ rescue NameError
5
+ puts 'Card config unavailable. Add `gem "card-mod-monkey" to Gemfile to enable.'
6
+ end
@@ -1,4 +1,5 @@
1
- # See http://www.robotstxt.org/wc/norobots.html for documentation on how to use the robots.txt file
1
+ # See http://www.robotstxt.org/wc/norobots.html
2
+ # for documentation on how to use the robots.txt file
2
3
  #
3
4
  # To ban all spiders from the entire site uncomment the next two lines:
4
5
  # User-Agent: *