happy_seed 0.0.19 → 0.0.21
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.
- checksums.yaml +4 -4
- data/Rakefile +4 -69
- data/bin/rails +12 -0
- data/bin/rspec +16 -0
- data/happy_seed.rb +5 -1
- data/happy_seed.txt +25 -18
- data/lib/generators/happy_seed/admin/admin_generator.rb +40 -5
- data/lib/generators/happy_seed/admin/templates/app/admin/campaigns.rb +10 -14
- data/lib/generators/happy_seed/admin/templates/app/admin/newsletter.rb +2 -2
- data/lib/generators/happy_seed/admin/templates/app/admin/user.rb +4 -1
- data/lib/generators/happy_seed/admin/templates/app/controllers/admin/stats_controller.rb +1 -1
- data/lib/generators/happy_seed/admin/templates/docs/README.07.admin.rdoc +33 -4
- data/lib/generators/happy_seed/angular_view/templates/docs/README.11.angular_view.rdoc +2 -4
- data/lib/generators/happy_seed/api/api_generator.rb +38 -39
- data/lib/generators/happy_seed/api/templates/app/controllers/api/v1/base_controller.rb +4 -5
- data/lib/generators/happy_seed/api/templates/app/controllers/api/v1/model_hash.rb +3 -20
- data/lib/generators/happy_seed/api/templates/app/controllers/api/v1/user_tokens_controller.rb +13 -36
- data/lib/generators/happy_seed/api/templates/app/controllers/api/v1/users_controller.rb +14 -40
- data/lib/generators/happy_seed/api/templates/config/initializers/apitome.rb +1 -1
- data/lib/generators/happy_seed/api/templates/docs/README.01.api.rdoc +4 -1
- data/lib/generators/happy_seed/api/templates/docs/api.md +2 -2
- data/lib/generators/happy_seed/api/templates/spec/acceptance/api/v1/user_tokens_spec.rb +10 -53
- data/lib/generators/happy_seed/api/templates/spec/acceptance/api/v1/users_spec.rb +17 -61
- data/lib/generators/happy_seed/base/base_generator.rb +47 -19
- data/lib/generators/happy_seed/base/templates/app/controllers/setup_controller.rb +1 -1
- data/lib/generators/happy_seed/base/templates/app/views/setup/index.html.haml +6 -3
- data/lib/generators/happy_seed/base/templates/application_controller.rb +1 -1
- data/lib/generators/happy_seed/base/templates/docs/README.00.base.rdoc +3 -3
- data/lib/generators/happy_seed/bootstrap/bootstrap_generator.rb +5 -2
- data/lib/generators/happy_seed/bootstrap/templates/app/assets/stylesheets/application.scss +5 -1
- data/lib/generators/happy_seed/bootstrap/templates/app/assets/stylesheets/components/_profile_panels.scss +62 -0
- data/lib/generators/happy_seed/bootstrap/templates/app/assets/stylesheets/components/_slideup_header.scss +51 -0
- data/lib/generators/happy_seed/bootstrap/templates/app/assets/stylesheets/shared/_grid.scss +0 -12
- data/lib/generators/happy_seed/bootstrap/templates/app/views/application/_javascripts.html.haml +7 -4
- data/lib/generators/happy_seed/bootstrap/templates/docs/README.01.bootstrap.rdoc +3 -0
- data/lib/generators/happy_seed/ckeditor/ckeditor_generator.rb +31 -0
- data/lib/generators/happy_seed/ckeditor/templates/docs/README.01.ckeditor.rdoc +35 -0
- data/lib/generators/happy_seed/devise/devise_generator.rb +12 -19
- data/lib/generators/happy_seed/devise/templates/app/views/devise/confirmations/new.html.haml +17 -0
- data/lib/generators/happy_seed/devise/templates/app/views/devise/mailer/confirmation_instructions.html.erb +14 -0
- data/lib/generators/happy_seed/devise/templates/app/views/devise/mailer/confirmation_instructions.text.rhtml +7 -0
- data/lib/generators/happy_seed/devise/templates/app/views/devise/mailer/password_change.html.erb +3 -0
- data/lib/generators/happy_seed/devise/templates/app/views/devise/mailer/reset_password_instructions.html.erb +15 -0
- data/lib/generators/happy_seed/devise/templates/app/views/devise/mailer/reset_password_instructions.text.erb +11 -0
- data/lib/generators/happy_seed/devise/templates/app/views/devise/mailer/unlock_instructions.html.erb +7 -0
- data/lib/generators/happy_seed/devise/templates/app/views/devise/passwords/edit.html.haml +14 -13
- data/lib/generators/happy_seed/devise/templates/app/views/devise/passwords/new.html.haml +12 -16
- data/lib/generators/happy_seed/devise/templates/app/views/devise/registrations/edit.html.haml +28 -40
- data/lib/generators/happy_seed/devise/templates/app/views/devise/registrations/new.html.haml +16 -24
- data/lib/generators/happy_seed/devise/templates/app/views/devise/sessions/new.html.haml +13 -18
- data/lib/generators/happy_seed/devise/templates/app/views/devise/shared/_links.html.erb +25 -0
- data/lib/generators/happy_seed/devise/templates/app/views/devise/unlocks/new.html.erb +16 -0
- data/lib/generators/happy_seed/devise/templates/docs/README.03.devise.rdoc +2 -2
- data/lib/generators/happy_seed/devise/templates/spec/factories/users.rb +5 -4
- data/lib/generators/happy_seed/devise/templates/spec/features/registration_spec.rb +149 -0
- data/lib/generators/happy_seed/devise/templates/spec/mailers/previews/devise_preview.rb +28 -0
- data/lib/generators/happy_seed/devise_confirmable/devise_confirmable_generator.rb +45 -0
- data/lib/generators/happy_seed/devise_confirmable/templates/add_confirmable_to_devise.rb +24 -0
- data/lib/generators/happy_seed/devise_confirmable/templates/app/controllers/confirmations_controller.rb +10 -0
- data/lib/generators/happy_seed/devise_confirmable/templates/app/views/devise/invitations/edit.html.haml +22 -0
- data/lib/generators/happy_seed/devise_confirmable/templates/app/views/devise/invitations/new.html.haml +20 -0
- data/lib/generators/happy_seed/devise_confirmable/templates/app/views/devise/mailer/invitation_instructions.html.erb +20 -0
- data/lib/generators/happy_seed/devise_confirmable/templates/docs/README.03.devise_confirmable.rdoc +23 -0
- data/lib/generators/happy_seed/devise_invitable/devise_invitable_generator.rb +3 -1
- data/lib/generators/happy_seed/devise_invitable/templates/app/views/devise/invitations/edit.html.haml +3 -2
- data/lib/generators/happy_seed/devise_invitable/templates/app/views/devise/invitations/new.html.haml +3 -2
- data/lib/generators/happy_seed/devise_invitable/templates/app/views/devise/mailer/invitation_instructions.html.erb +20 -0
- data/lib/generators/happy_seed/devise_invitable/templates/spec/features/invitations_spec.rb +61 -0
- data/lib/generators/happy_seed/facebook/facebook_generator.rb +2 -0
- data/lib/generators/happy_seed/facebook/templates/spec/features/facebook_registration_spec.rb +72 -0
- data/lib/generators/happy_seed/googleoauth/googleoauth_generator.rb +1 -1
- data/lib/generators/happy_seed/happy_seed_generator.rb +1 -3
- data/lib/generators/happy_seed/html_email/html_email_generator.rb +32 -0
- data/lib/generators/happy_seed/html_email/templates/app/views/layouts/mailer.html.erb +244 -0
- data/lib/generators/happy_seed/html_email/templates/docs/README.01.html_email.rdoc +25 -0
- data/lib/generators/happy_seed/omniauth/omniauth_generator.rb +4 -2
- data/lib/generators/happy_seed/omniauth/templates/app/controllers/omniauth_callbacks_controller.rb +3 -13
- data/lib/generators/happy_seed/omniauth/templates/app/models/identity.rb +13 -9
- data/lib/generators/happy_seed/omniauth/templates/docs/README.04.omniauth.rdoc +5 -5
- data/lib/generators/happy_seed/omniauth/templates/spec/factories/oauth.rb +6 -1
- data/lib/generators/happy_seed/omniauth/templates/spec/features/oauth_registration_spec.rb +80 -0
- data/lib/generators/happy_seed/omniauth/templates/spec/models/identity_spec.rb +39 -12
- data/lib/generators/happy_seed/omniauth/templates/{app/models/form_user.rb → user.rb} +4 -5
- data/lib/generators/happy_seed/plugin/plugin_generator.rb +13 -11
- data/lib/generators/happy_seed/react/react_generator.rb +36 -0
- data/lib/generators/happy_seed/react/templates/docs/README.10.react.rdoc +20 -0
- data/lib/generators/happy_seed/roles/roles_generator.rb +38 -0
- data/lib/generators/happy_seed/roles/templates/ability.rb +9 -0
- data/lib/generators/happy_seed/roles/templates/docs/README.03.roles.rdoc +23 -0
- data/lib/generators/happy_seed/simple_cms/simple_cms_generator.rb +41 -0
- data/lib/generators/happy_seed/simple_cms/templates/app/admin/simple_content.rb +42 -0
- data/lib/generators/happy_seed/simple_cms/templates/app/controllers/simple_content_controller.rb +7 -0
- data/lib/generators/happy_seed/simple_cms/templates/app/models/simple_content.rb +5 -0
- data/lib/generators/happy_seed/simple_cms/templates/app/views/splash/faq.html.haml +13 -0
- data/lib/generators/happy_seed/simple_cms/templates/app/views/splash/index.html.haml +79 -0
- data/lib/generators/happy_seed/simple_cms/templates/application_helper.rb +18 -0
- data/lib/generators/happy_seed/simple_cms/templates/create_simple_contents.rb +14 -0
- data/lib/generators/happy_seed/simple_cms/templates/docs/README.04.simple_cms.rdoc +32 -0
- data/lib/generators/happy_seed/simple_cms/templates/spec/factories/oauth.rb +10 -0
- data/lib/generators/happy_seed/simple_cms/templates/spec/features/oauth_registration_spec.rb +80 -0
- data/lib/generators/happy_seed/simple_cms/templates/spec/models/identity_spec.rb +49 -0
- data/lib/generators/happy_seed/splash/templates/app/assets/stylesheets/splash.css.scss +119 -84
- data/lib/generators/happy_seed/splash/templates/app/controllers/splash_controller.rb +1 -1
- data/lib/generators/happy_seed/splash/templates/app/views/layouts/splash.html.haml +15 -18
- data/lib/generators/happy_seed/splash/templates/app/views/splash/index.html.haml +54 -92
- data/lib/generators/happy_seed/splash/templates/docs/README.02.splash.rdoc +2 -2
- data/lib/generators/happy_seed/splash/templates/spec/controllers/splash_controller_spec.rb +11 -3
- data/lib/generators/happy_seed/static/templates/source/stylesheets/application.css.scss +1 -1
- data/lib/generators/happy_seed/static_blog/templates/Gemfile.lock +45 -49
- data/lib/generators/happy_seed/twitter/templates/spec/features/twitter_oauth_registration_spec.rb +57 -0
- data/lib/generators/happy_seed/twitter/twitter_generator.rb +2 -1
- data/lib/happy_seed/cli.rb +1 -1
- data/lib/happy_seed/engine.rb +12 -0
- data/lib/happy_seed/version.rb +1 -1
- data/lib/tasks/seed.rake +56 -0
- data/{test → spec}/dummy/Rakefile +0 -0
- data/spec/dummy/app/assets/config/manifest.js +5 -0
- data/{test → spec}/dummy/app/assets/javascripts/application.js +3 -3
- data/spec/dummy/app/assets/javascripts/cable.coffee +11 -0
- data/{test → spec}/dummy/app/assets/stylesheets/application.css +4 -4
- data/spec/dummy/app/channels/application_cable/channel.rb +5 -0
- data/spec/dummy/app/channels/application_cable/connection.rb +5 -0
- data/{test → spec}/dummy/app/controllers/application_controller.rb +0 -0
- data/{test → spec}/dummy/app/helpers/application_helper.rb +0 -0
- data/spec/dummy/app/jobs/application_job.rb +2 -0
- data/spec/dummy/app/mailers/application_mailer.rb +4 -0
- data/spec/dummy/app/models/application_record.rb +3 -0
- data/spec/dummy/app/views/layouts/application.html.erb +15 -0
- data/spec/dummy/app/views/layouts/mailer.html.erb +13 -0
- data/spec/dummy/app/views/layouts/mailer.text.erb +1 -0
- data/{test → spec}/dummy/bin/bundle +0 -0
- data/{test → spec}/dummy/bin/rails +1 -1
- data/{test → spec}/dummy/bin/rake +0 -0
- data/spec/dummy/bin/setup +34 -0
- data/spec/dummy/bin/update +29 -0
- data/spec/dummy/config.ru +8 -0
- data/spec/dummy/config/application.rb +21 -0
- data/{test → spec}/dummy/config/boot.rb +0 -0
- data/spec/dummy/config/cable.yml +10 -0
- data/{test → spec}/dummy/config/database.yml +0 -0
- data/{test → spec}/dummy/config/environment.rb +0 -0
- data/{test → spec}/dummy/config/environments/development.rb +28 -3
- data/{test → spec}/dummy/config/environments/production.rb +29 -24
- data/{test → spec}/dummy/config/environments/test.rb +6 -3
- data/spec/dummy/config/initializers/active_record_belongs_to_required_by_default.rb +6 -0
- data/spec/dummy/config/initializers/application_controller_renderer.rb +6 -0
- data/{test → spec}/dummy/config/initializers/assets.rb +3 -0
- data/{test → spec}/dummy/config/initializers/backtrace_silencers.rb +0 -0
- data/spec/dummy/config/initializers/callback_terminator.rb +6 -0
- data/{test → spec}/dummy/config/initializers/cookies_serializer.rb +3 -1
- data/{test → spec}/dummy/config/initializers/filter_parameter_logging.rb +0 -0
- data/{test → spec}/dummy/config/initializers/inflections.rb +0 -0
- data/{test → spec}/dummy/config/initializers/mime_types.rb +0 -0
- data/spec/dummy/config/initializers/per_form_csrf_tokens.rb +4 -0
- data/spec/dummy/config/initializers/request_forgery_protection.rb +4 -0
- data/{test → spec}/dummy/config/initializers/session_store.rb +0 -0
- data/{test → spec}/dummy/config/initializers/wrap_parameters.rb +2 -2
- data/{test → spec}/dummy/config/locales/en.yml +0 -0
- data/spec/dummy/config/puma.rb +47 -0
- data/spec/dummy/config/routes.rb +3 -0
- data/{test → spec}/dummy/config/secrets.yml +3 -3
- data/spec/dummy/db/schema.rb +16 -0
- data/{test → spec}/dummy/public/404.html +0 -0
- data/{test → spec}/dummy/public/422.html +0 -0
- data/{test → spec}/dummy/public/500.html +0 -0
- data/{test/dummy/public/favicon.ico → spec/dummy/public/apple-touch-icon-precomposed.png} +0 -0
- data/spec/dummy/public/apple-touch-icon.png +0 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/rails_helper.rb +58 -0
- data/spec/spec_helper.rb +91 -0
- metadata +195 -89
- data/lib/generators/happy_seed/api/templates/app/controllers/api/v1/configurations_controller.rb +0 -11
- data/lib/generators/happy_seed/api/templates/spec/acceptance/api/v1/configurations_spec.rb +0 -21
- data/lib/generators/happy_seed/base/templates/config/puma.rb +0 -15
- data/lib/generators/happy_seed/base/templates/spec/support/controller_helpers.rb +0 -12
- data/lib/generators/happy_seed/bootstrap/templates/app/assets/stylesheets/sections/_profile_page.scss +0 -9
- data/lib/generators/happy_seed/bootstrap/templates/lib/templates/haml/scaffold/_form.html.haml +0 -5
- data/lib/generators/happy_seed/devise/templates/spec/features/forgot_password_spec.rb +0 -54
- data/lib/generators/happy_seed/devise/templates/test/mailers/previews/devise_preview.rb +0 -13
- data/lib/generators/happy_seed/omniauth/templates/spec/features/registration_spec.rb +0 -81
- data/lib/generators/happy_seed/static/templates/Gemfile.lock +0 -158
- data/lib/tasks/seed_tasks.rake +0 -4
- data/test/dummy/README.rdoc +0 -28
- data/test/dummy/app/views/layouts/application.html.erb +0 -14
- data/test/dummy/config.ru +0 -4
- data/test/dummy/config/application.rb +0 -23
- data/test/dummy/config/initializers/jazz_hands.rb +0 -5
- data/test/dummy/config/routes.rb +0 -56
- data/test/seed_test.rb +0 -7
- data/test/test_helper.rb +0 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4c6cbf58652f4c3fafea1da8176e6f173a4fd223
|
4
|
+
data.tar.gz: 429f1707391c98c3fad657fe5bf97c40d29c2952
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 53cdb84f1b3cc863df1a36fe5d23d8555d9d7d416c97deb8c34a55bbac8c9456831319295bfb445f1def39bbbf40beeeb69e505757d67b3eb1bbb195a6c30efa
|
7
|
+
data.tar.gz: 161929fc06b7c1d0a1afee1538f9983f44ffe03396a0d6ecb817989534bc5e253c726233098a43afe73a2e9103e27d0f1ad8b3b69769c7d23c5535d11f0aa803
|
data/Rakefile
CHANGED
@@ -14,75 +14,10 @@ RDoc::Task.new(:rdoc) do |rdoc|
|
|
14
14
|
rdoc.rdoc_files.include('lib/**/*.rb')
|
15
15
|
end
|
16
16
|
|
17
|
+
# APP_RAKEFILE = File.expand_path('../spec/dummy/Rakefile', __FILE__)
|
18
|
+
# load 'rails/tasks/engine.rake'
|
17
19
|
|
18
|
-
|
20
|
+
load 'rails/tasks/statistics.rake'
|
21
|
+
load 'tasks/seed.rake'
|
19
22
|
|
20
23
|
Bundler::GemHelper.install_tasks
|
21
|
-
|
22
|
-
require 'rake/testtask'
|
23
|
-
|
24
|
-
Rake::TestTask.new(:test) do |t|
|
25
|
-
t.libs << 'lib'
|
26
|
-
t.libs << 'test'
|
27
|
-
t.pattern = 'test/**/*_test.rb'
|
28
|
-
t.verbose = false
|
29
|
-
end
|
30
|
-
|
31
|
-
|
32
|
-
task default: :test
|
33
|
-
|
34
|
-
desc "Copy readme files into the doc directory"
|
35
|
-
task :sync_docs do
|
36
|
-
system( "mkdir -p website/source/docs" )
|
37
|
-
`find lib -name README\\* -print`.each_line do |file|
|
38
|
-
file.gsub!( /\n/, "" )
|
39
|
-
out = file.gsub( /.*\//, "" ).gsub( /.rdoc/, ".html.markdown" )
|
40
|
-
# puts file, out
|
41
|
-
system( "cp #{file} website/source/docs/#{out}" )
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
desc "Generate dependancy graph"
|
46
|
-
task :generator_dependancies do
|
47
|
-
require 'active_support/inflector'
|
48
|
-
|
49
|
-
Dir.glob( 'lib/generators/**/*_generator.rb' ).each do |f|
|
50
|
-
data = File.read f
|
51
|
-
# name = data.lines.select { |x| x =~ /class/ }.first.gsub( /.*class (.*?)Generator.*/m, '\1' ).underscore
|
52
|
-
name = data.grep( /class/ ).first.gsub( /.*class (.*?)Generator.*/m, '\1' ).underscore
|
53
|
-
|
54
|
-
if name != 'happy_seed'
|
55
|
-
print = false
|
56
|
-
|
57
|
-
if data.grep( /require_omniauth/ ).size > 0
|
58
|
-
puts "[#{name}] -> [omniauth]"
|
59
|
-
print = true
|
60
|
-
end
|
61
|
-
|
62
|
-
data.grep( /generate .happy_seed/ ).each do |line|
|
63
|
-
dep = line.gsub( /.*happy_seed:([^"' ]*).*/m, '\1' )
|
64
|
-
puts "[#{name}] -> [#{dep}]"
|
65
|
-
print = true
|
66
|
-
end
|
67
|
-
|
68
|
-
if name == 'base'
|
69
|
-
puts "[base]"
|
70
|
-
print = true
|
71
|
-
end
|
72
|
-
|
73
|
-
if ['plugin', 'static', 'static_blog'].index( name )
|
74
|
-
# puts "Skipping #{name}"
|
75
|
-
print = true
|
76
|
-
end
|
77
|
-
|
78
|
-
puts "[#{name}] -> [base]" unless print
|
79
|
-
|
80
|
-
end
|
81
|
-
end
|
82
|
-
end
|
83
|
-
|
84
|
-
class String
|
85
|
-
def grep( regex )
|
86
|
-
lines.select { |x| x =~ regex }
|
87
|
-
end
|
88
|
-
end
|
data/bin/rails
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# This command will automatically be run when you run "rails" with Rails 4 gems installed from the root of your application.
|
3
|
+
|
4
|
+
ENGINE_ROOT = File.expand_path('../..', __FILE__)
|
5
|
+
ENGINE_PATH = File.expand_path('../../lib/happy_seed/engine', __FILE__)
|
6
|
+
|
7
|
+
# Set up gems listed in the Gemfile.
|
8
|
+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
|
9
|
+
require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
|
10
|
+
|
11
|
+
require 'rails/all'
|
12
|
+
require 'rails/engine/commands'
|
data/bin/rspec
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# This file was generated by Bundler.
|
4
|
+
#
|
5
|
+
# The application 'rspec' is installed as part of a gem, and
|
6
|
+
# this file is here to facilitate running it.
|
7
|
+
#
|
8
|
+
|
9
|
+
require "pathname"
|
10
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
11
|
+
Pathname.new(__FILE__).realpath)
|
12
|
+
|
13
|
+
require "rubygems"
|
14
|
+
require "bundler/setup"
|
15
|
+
|
16
|
+
load Gem.bin_path("rspec-core", "rspec")
|
data/happy_seed.rb
CHANGED
@@ -36,8 +36,11 @@ Bundler.with_clean_env do
|
|
36
36
|
|
37
37
|
GRAPH = [
|
38
38
|
{name: 'splash', desc: 'Basic splash page' },
|
39
|
+
{name: 'simple_cms', desc: 'Simple CMS' },
|
39
40
|
{name: 'devise', desc: 'User profiles', subtree: [
|
41
|
+
{name: 'roles', desc: 'User roles'},
|
40
42
|
{name: 'devise_invitable', desc: 'Invitable users'},
|
43
|
+
{name: 'devise_confirmable', desc: 'Confirmable users'},
|
41
44
|
{name: 'facebook', desc: 'OAuth: Connect with facebook' },
|
42
45
|
{name: 'github', desc: 'OAuth: Connect with github' },
|
43
46
|
{name: 'googleoauth', desc: 'OAuth: Connect wuth google' },
|
@@ -46,7 +49,8 @@ Bundler.with_clean_env do
|
|
46
49
|
]},
|
47
50
|
{name: 'admin', desc: 'Active Admin for back office adminstration' },
|
48
51
|
{name: 'api', desc: 'Provide API for mobile device (Beta)' },
|
49
|
-
{name: '
|
52
|
+
{name: 'react', desc: 'Setup react-on-rails' },
|
53
|
+
{name: 'angular_install', desc: 'Setup an angular application' },
|
50
54
|
{name: 'jazz_hands', desc: 'Better Rails Console tools' }
|
51
55
|
]
|
52
56
|
|
data/happy_seed.txt
CHANGED
@@ -24,24 +24,31 @@
|
|
24
24
|
`.-:::::::::::::-.``
|
25
25
|
```````
|
26
26
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
│
|
32
|
-
│
|
33
|
-
|
34
|
-
│
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
│
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
27
|
+
|
28
|
+
┌────────────────────┐
|
29
|
+
┌──│ devise_confirmable │
|
30
|
+
┌───────────┐ │ └────────────────────┘
|
31
|
+
┌───│ ckeditor │ ┌───────┐ │ ┌──────────────────┐
|
32
|
+
│ └───────────┘ │ api │ ├──│ devise_invitable │
|
33
|
+
│ ┌────────────┐ └───────┘ │ └──────────────────┘
|
34
|
+
├───│ jazz_hands │ │ │ ┌───────┐ ┌────────────┐
|
35
|
+
│ └────────────┘ ▼ ├──│ roles │◀─────│ admin │
|
36
|
+
│ ┌───────────┐ ┌────────┐ │ └───────┘ └────────────┘
|
37
|
+
├───│ htmlemail │ ┌──│ devise │◀─┤ ┌────────┐
|
38
|
+
│ └───────────┘ │ └────────┘ │ ┌────────┐ ┌──│facebook│
|
39
|
+
┌──────┐ │ ┌────────────┐ │ └──│omniauth│◀─┤ └────────┘
|
40
|
+
│ base │◀─┼───│ bootstrap │◀─┤ └────────┘ │ ┌───────┐
|
41
|
+
└──────┘ │ └────────────┘ │ ┌────────┐ ├──│github │
|
42
|
+
│ ┌────────────┐ └──│ splash │◀─┐ │ └───────┘
|
43
|
+
├───│ react │ └────────┘ │ │ ┌──────────┐
|
44
|
+
│ └────────────┘ │ ├──│googleauth│
|
45
|
+
│ ┌────────────┐ ┌───────────┐ │ └──────────┘
|
46
|
+
└───│angular_view│◀──┐ │simple_cms │ │ ┌─────────┐
|
47
|
+
└────────────┘ │ └───────────┘ ├──│instagram│
|
48
|
+
│ │ └─────────┘
|
49
|
+
┌───────────────┐ │ ┌───────┐
|
50
|
+
│angular_install│ └──│twitter│
|
51
|
+
└───────────────┘ └───────┘
|
45
52
|
|
46
53
|
Welcome to Seed. Above is the list of generators and how they interact
|
47
54
|
with each other.
|
@@ -1,4 +1,7 @@
|
|
1
1
|
require 'generators/happy_seed/happy_seed_generator'
|
2
|
+
require 'generators/happy_seed/roles/roles_generator'
|
3
|
+
require 'generators/happy_seed/ckeditor/ckeditor_generator'
|
4
|
+
|
2
5
|
|
3
6
|
module HappySeed
|
4
7
|
module Generators
|
@@ -12,16 +15,35 @@ module HappySeed
|
|
12
15
|
def install_active_admin
|
13
16
|
return if already_installed
|
14
17
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
+
seperate_admin_user = yes? "Install seperate AdminUser (otherwise add role to User)?"
|
19
|
+
|
20
|
+
if !seperate_admin_user
|
21
|
+
require_generator RolesGenerator
|
22
|
+
end
|
23
|
+
|
24
|
+
require_generator CkeditorGenerator
|
25
|
+
|
26
|
+
gem 'activeadmin', github: 'activeadmin'
|
27
|
+
gem 'inherited_resources', github: 'activeadmin/inherited_resources'
|
28
|
+
gem 'ransack', github: 'activerecord-hackery/ransack'
|
29
|
+
gem 'kaminari', github: 'amatsuda/kaminari', branch: '0-17-stable'
|
30
|
+
gem 'formtastic', github: 'justinfrench/formtastic'
|
31
|
+
gem 'draper', github: 'audionerd/draper', branch: 'rails5', ref: 'e816e0e587'
|
32
|
+
|
33
|
+
# To fix a Draper deprecation error
|
34
|
+
gem 'activemodel-serializers-xml', github: 'rails/activemodel-serializers-xml'
|
35
|
+
|
18
36
|
gem 'dateslices'
|
19
37
|
|
20
38
|
Bundler.with_clean_env do
|
21
39
|
run "bundle install --without production"
|
22
40
|
end
|
23
41
|
|
24
|
-
|
42
|
+
if seperate_admin_user
|
43
|
+
generate 'active_admin:install'
|
44
|
+
else
|
45
|
+
generate 'active_admin:install --skip-users'
|
46
|
+
end
|
25
47
|
|
26
48
|
remove_file "app/admin/dashboard.rb"
|
27
49
|
remove_file "spec/factories/admin_users.rb"
|
@@ -31,7 +53,17 @@ module HappySeed
|
|
31
53
|
directory "spec"
|
32
54
|
directory "vendor"
|
33
55
|
|
34
|
-
insert_into_file "config/initializers/active_admin.rb", " config.register_javascript '//www.google.com/jsapi'\n config.register_javascript 'chartkick.js'\n", :after => "To load a javascript file:\n"
|
56
|
+
insert_into_file "config/initializers/active_admin.rb", " config.register_javascript '//www.google.com/jsapi'\n config.register_javascript 'chartkick.js'\n config.register_javascript 'ckeditor/init.js'", :after => "To load a javascript file:\n"
|
57
|
+
|
58
|
+
if !seperate_admin_user
|
59
|
+
gsub_file "config/initializers/active_admin.rb", /# config.authentication_method.*/, "config.authentication_method = :authenticate_user!"
|
60
|
+
gsub_file "config/initializers/active_admin.rb", /# config.authorization_adapter = ActiveAdmin::CanCanAdapter/, "config.authorization_adapter = ActiveAdmin::CanCanAdapter"
|
61
|
+
gsub_file "config/initializers/active_admin.rb", /# config.on_unauthorized_access = :access_denied/, "config.on_unauthorized_access = :access_denied"
|
62
|
+
gsub_file "config/initializers/active_admin.rb", /# config.current_user_method.*/, "config.current_user_method = :current_user"
|
63
|
+
gsub_file "config/initializers/active_admin.rb", /config.logout_link_path.*/, "config.logout_link_path = :destroy_user_session_path"
|
64
|
+
gsub_file "config/initializers/active_admin.rb", /# config.logout_link_method.*/, "config.logout_link_method = :delete"
|
65
|
+
end
|
66
|
+
|
35
67
|
append_to_file "config/initializers/assets.rb", "\nRails.application.config.assets.precompile += %w( chartkick.js )\n"
|
36
68
|
|
37
69
|
inject_into_file 'config/application.rb', after: "config.generators do |g|\n" do <<-'RUBY'
|
@@ -39,6 +71,9 @@ module HappySeed
|
|
39
71
|
RUBY
|
40
72
|
end
|
41
73
|
|
74
|
+
inject_into_file "config/environments/production.rb", " config.assets.precompile += Ckeditor.assets\n config.assets.precompile += ['ckeditor/*']\n", before: "end\n"
|
75
|
+
append_to_file "app/assets/stylesheets/active_admin.scss", "\n.cke_chrome {\n width: 79.5% !important;\n overflow: hidden;\n}"
|
76
|
+
|
42
77
|
route <<-'ROUTE'
|
43
78
|
namespace :admin do
|
44
79
|
# get "/stats" => "stats#stats"
|
@@ -4,28 +4,24 @@ if !ENV['MAILCHIMP_API_KEY'].blank?
|
|
4
4
|
|
5
5
|
content do
|
6
6
|
@c = {}
|
7
|
+
gb = Gibbon::Request.new(api_key: ENV['MAILCHIMP_API_KEY'])
|
7
8
|
if params[:list_id]
|
8
|
-
@c =
|
9
|
+
@c = gb.campaigns.retrieve( params: {list_id: params[:list_id]} )
|
9
10
|
elsif params[:campaign_id]
|
10
|
-
@c =
|
11
|
+
@c = gb.campaigns.retrieve( params: {campaign_id: params[:campaign_id]} )
|
11
12
|
else
|
12
|
-
@c =
|
13
|
+
@c = gb.campaigns.retrieve
|
13
14
|
end
|
14
15
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
table_for data do #.sort { |a,b| a['send_time'] <=> b['send_time'] } do
|
19
|
-
column( "list_id" ) { |d| d['list_id']}
|
20
|
-
column( "title" ) { |d| d['title'] }
|
16
|
+
table_for @c['campaigns'] do
|
17
|
+
column( "subject" ) { |d| d['settings']['subject_line'] }
|
18
|
+
column( "title" ) { |d| d['settings']['title'] }
|
21
19
|
column( "created" ) { |d| d['create_time'] }
|
22
20
|
column( "sent" ) { |d| d['send_time'] }
|
23
|
-
column( "subject" ) { |d| d['subject'] }
|
24
21
|
column( "emails sent") { |d| d['emails_sent'] }
|
25
|
-
column( "opens" ) { |d| d['
|
26
|
-
column( "clicks" ) { |d| d['
|
27
|
-
column( "
|
28
|
-
column( "last click" ) { |d| d['summary']['last_click'] }
|
22
|
+
column( "opens" ) { |d| d['report_summary'] && d['report_summary']['opens'] }
|
23
|
+
column( "clicks" ) { |d| d['report_summary'] && d['report_summary']['clicks'] }
|
24
|
+
column( "unique_opens" ) { |d| d['report_summary'] && d['report_summary']['unique_opens'] }
|
29
25
|
end
|
30
26
|
end
|
31
27
|
|
@@ -2,10 +2,10 @@ if !ENV['MAILCHIMP_API_KEY'].blank?
|
|
2
2
|
ActiveAdmin.register_page "Newsletter" do
|
3
3
|
content do
|
4
4
|
if !params[:list_id]
|
5
|
-
@lists = Gibbon::
|
5
|
+
@lists = Gibbon::Request.new(api_key: ENV['MAILCHIMP_API_KEY']).lists.retrieve
|
6
6
|
|
7
7
|
panel "MailChimp Lists" do
|
8
|
-
table_for @lists['
|
8
|
+
table_for @lists['lists'] do
|
9
9
|
column( "name" ) { |d| d['name'] }
|
10
10
|
column( "members" ) { |d| d['stats']['member_count'] }
|
11
11
|
column( "unsubscribe_count") { |d| d["stats"]["unsubscribe_count"] }
|
@@ -7,12 +7,15 @@ The happy_seed bootstrap generator
|
|
7
7
|
|
8
8
|
* Installs active admin from git
|
9
9
|
* Runs the active_admin:install generator
|
10
|
-
*
|
10
|
+
* Uses user roles and cancancan to control access
|
11
|
+
* Optionally creates a seperate AdminUser model
|
11
12
|
* Creates basic newsletter/campaign admin panel if `MAILCHIMP_API_KEY` is active
|
12
13
|
|
13
14
|
### Why do you want this?
|
14
15
|
|
15
|
-
ActiveAdmin
|
16
|
+
ActiveAdmin is a great way to create backend admin tools. For very complex workflows it may make sense to go custom, but for quickly adding some crud operations it can't be beat.
|
17
|
+
|
18
|
+
If you choose to create a seperate AdminUser there is a seperate user universe for admins. If you want to use the existing devise users, then the happy_seed:roles generator is run and ActiveAdmin is configured to use CanCanCan for all of the models. This lets you control admin access based upon the `abilities.rb` class.
|
16
19
|
|
17
20
|
### Environment Variables
|
18
21
|
|
@@ -20,6 +23,32 @@ na
|
|
20
23
|
|
21
24
|
### What needs to be done?
|
22
25
|
|
23
|
-
Add models to the dashboard.
|
26
|
+
Add models to the dashboard by editing app/admin/dashboard.rb to lay out the dashboard, and app/controllers/admin/stats_controller.rb to provide the data.
|
27
|
+
|
28
|
+
|
29
|
+
### Example of using rich text editor
|
30
|
+
|
31
|
+
To easily enable editing html content in ActiveAdmin we've included the ckeditor. Here's a quick example of how you'd add this to the admin tool.
|
32
|
+
|
33
|
+
First create a model:
|
34
|
+
|
35
|
+
```
|
36
|
+
rails g scaffold faq title:string body:text position:integer
|
37
|
+
```
|
38
|
+
|
39
|
+
Then create `app/admin/faq.rb`, and define the fields for the form:
|
40
|
+
|
41
|
+
ActiveAdmin.register Faq do
|
42
|
+
permit_params :title, :body, :position
|
43
|
+
|
44
|
+
form do |f|
|
45
|
+
f.semantic_errors # shows errors on :base
|
46
|
+
f.inputs do
|
47
|
+
f.input :title
|
48
|
+
f.input :body, as: :ckeditor, input_html: { ckeditor: { height: 400 } } # builds an input field for every attribute
|
49
|
+
f.input :position
|
50
|
+
end
|
51
|
+
f.actions # adds the 'Submit' and 'Cancel' buttons
|
52
|
+
end
|
53
|
+
end
|
24
54
|
|
25
|
-
(the happy_Seed stats module is in development)
|
@@ -11,9 +11,7 @@ The view generator adds
|
|
11
11
|
|
12
12
|
### Why do you want this?
|
13
13
|
|
14
|
-
|
15
|
-
|
16
|
-
The philosophy here is that all of the angular html templates are stored out of the assets/templates directory.
|
14
|
+
This sets up your angular views for you in a quick and easy way.
|
17
15
|
|
18
16
|
### Environment Variables
|
19
17
|
|
@@ -21,4 +19,4 @@ na
|
|
21
19
|
|
22
20
|
### What needs to be done?
|
23
21
|
|
24
|
-
|
22
|
+
When you have set up your project and you want to add a new angular view, just run `rails g happy_seed:angular_view <NAME_OF VIEW>`.
|
@@ -9,84 +9,84 @@ module HappySeed
|
|
9
9
|
gem_available? 'apitome'
|
10
10
|
end
|
11
11
|
|
12
|
-
def
|
12
|
+
def install_api
|
13
13
|
return if already_installed
|
14
14
|
|
15
|
-
require_generator DeviseGenerator
|
16
|
-
|
17
15
|
gem 'apitome'
|
18
|
-
|
16
|
+
gem_group :development, :test do
|
17
|
+
gem 'rspec-rails'
|
18
|
+
gem 'factory_girl_rails'
|
19
|
+
gem 'faker'
|
20
|
+
gem 'rspec_api_documentation'
|
21
|
+
end
|
22
|
+
|
23
|
+
generate 'rspec:install'
|
24
|
+
|
25
|
+
require_generator DeviseGenerator
|
19
26
|
|
20
27
|
Bundler.with_clean_env do
|
21
|
-
run
|
28
|
+
run 'bundle install --without production'
|
22
29
|
end
|
23
30
|
|
24
|
-
generate
|
25
|
-
generate "migration add_user_tokens_count_to_users user_tokens_count:integer"
|
31
|
+
generate 'model UserToken user:belongs_to access_token:string'
|
26
32
|
|
27
33
|
directory '.'
|
28
34
|
|
29
|
-
route "
|
35
|
+
route "scope module: :api, defaults: {format: :json} do
|
30
36
|
%w(v1).each do |version|
|
31
37
|
namespace version.to_sym do
|
32
|
-
resource :configuration, only: %w(show)
|
33
|
-
resource :user_token, path: :token, only: %w(create destroy update)
|
34
38
|
resources :users, only: %w(create update show) do
|
35
|
-
resources :questions, only: %w(index)
|
36
39
|
collection do
|
37
40
|
post :forgot_password
|
38
41
|
put :reset_password
|
39
42
|
end
|
40
43
|
end
|
44
|
+
resource :user_token, path: :token, only: %w(create destroy)
|
41
45
|
end
|
42
46
|
end
|
43
|
-
end
|
44
|
-
"
|
45
|
-
inject_into_class "app/models/user.rb", "User", " has_many :user_tokens, dependent: :destroy\n"
|
47
|
+
end\n"
|
46
48
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
validates :push_token, allow_blank: true, uniqueness: {case_sensitive: false}
|
51
|
-
validates :form_factor, allow_blank: true, inclusion: {in: %w(smartphone tablet10 tablet7 desktop)}
|
52
|
-
validates :os, allow_blank: true, inclusion: {in: %w(ios android bb wp7)}
|
49
|
+
inject_into_class 'app/models/user.rb', 'User' do
|
50
|
+
' has_many :user_tokens, dependent: :destroy'
|
51
|
+
end
|
53
52
|
|
54
|
-
|
53
|
+
gsub_file 'app/models/user_token.rb', /belongs_to :user\n/, "belongs_to :user, required: true
|
55
54
|
|
56
|
-
|
55
|
+
validates :access_token, presence: true, uniqueness: {case_sensitive: false}
|
57
56
|
|
58
|
-
before_validation :
|
57
|
+
before_validation :set_access_token
|
59
58
|
|
60
59
|
private
|
61
60
|
|
62
|
-
def
|
63
|
-
self.
|
64
|
-
|
65
|
-
break
|
61
|
+
def set_access_token
|
62
|
+
self.access_token ||= loop do
|
63
|
+
random_string = SecureRandom.hex(4).downcase
|
64
|
+
break random_string if self.class.where(access_token: random_string).empty?
|
66
65
|
end
|
67
|
-
end
|
68
|
-
"
|
66
|
+
end\n"
|
69
67
|
|
70
|
-
|
71
|
-
append_to_file 'spec/spec_helper.rb', "\nRspecApiDocumentation.configure do |config|
|
68
|
+
append_to_file 'spec/rails_helper.rb', "\nRspecApiDocumentation.configure do |config|
|
72
69
|
config.format = :json
|
73
|
-
config.docs_dir = Pathname(
|
70
|
+
config.docs_dir = Pathname('docs/api')
|
74
71
|
|
75
72
|
config.request_headers_to_include = %w(Authorization)
|
76
73
|
config.response_headers_to_include = %w()
|
77
74
|
end"
|
78
75
|
|
79
|
-
|
80
|
-
factory :user_with_token, parent: :user do
|
76
|
+
insert_into_file 'spec/factories/users.rb', before: /end\s*\z/ do
|
77
|
+
"\n factory :user_with_token, parent: :user do
|
81
78
|
after :build do |user, evaluator|
|
82
|
-
user.user_tokens.build
|
83
|
-
form_factor: %w(smartphone tablet10 tablet7 desktop).sample, os: %w(ios android bb wp7).sample
|
79
|
+
user.user_tokens.build
|
84
80
|
end
|
85
|
-
end
|
86
|
-
end
|
81
|
+
end\n"
|
82
|
+
end
|
83
|
+
|
84
|
+
rake 'db:migrate:reset', env: 'test'
|
85
|
+
rake 'docs:generate', env: 'test'
|
87
86
|
end
|
88
87
|
|
89
88
|
private
|
89
|
+
|
90
90
|
def gem_available?(name)
|
91
91
|
Gem::Specification.find_by_name(name)
|
92
92
|
rescue Gem::LoadError
|
@@ -94,7 +94,6 @@ end"
|
|
94
94
|
rescue
|
95
95
|
Gem.available?(name)
|
96
96
|
end
|
97
|
-
|
98
97
|
end
|
99
98
|
end
|
100
99
|
end
|