happy_seed 0.0.11 → 0.0.12

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 (51) hide show
  1. checksums.yaml +4 -4
  2. data/happy_seed.rb +69 -88
  3. data/lib/generators/happy_seed/admin/admin_generator.rb +3 -2
  4. data/lib/generators/happy_seed/admin/templates/app/admin/campaigns.rb +1 -1
  5. data/lib/generators/happy_seed/admin/templates/app/admin/newsletter.rb +1 -1
  6. data/lib/generators/happy_seed/admin/templates/app/admin/user.rb +1 -0
  7. data/lib/generators/happy_seed/admin/templates/app/controllers/admin/stats_controller.rb +1 -1
  8. data/lib/generators/happy_seed/admin/templates/app/views/admin/_chart.html.haml +2 -3
  9. data/lib/generators/happy_seed/admin/templates/vendor/assets/javascripts/chartkick.js +0 -1
  10. data/lib/generators/happy_seed/base/base_generator.rb +2 -9
  11. data/lib/generators/happy_seed/base/templates/app/views/setup/index.html.haml +3 -0
  12. data/lib/generators/happy_seed/base/templates/lib/tasks/haml2erb.rake +34 -0
  13. data/lib/generators/happy_seed/bootstrap/bootstrap_generator.rb +7 -3
  14. data/lib/generators/happy_seed/bootstrap/templates/app/assets/stylesheets/application.css.scss +12 -0
  15. data/lib/generators/happy_seed/bootstrap/templates/app/helpers/application_helper.rb +5 -13
  16. data/lib/generators/happy_seed/bootstrap/templates/app/views/application/_flashes.html.haml +1 -5
  17. data/lib/generators/happy_seed/bootstrap/templates/app/views/application/_header.html.haml +9 -15
  18. data/lib/generators/happy_seed/bootstrap/templates/lib/templates/haml/scaffold/_form.html.haml +3 -17
  19. data/lib/generators/happy_seed/devise/devise_generator.rb +11 -12
  20. data/lib/generators/happy_seed/devise/templates/app/views/application/_account_dropdown.html.haml +11 -0
  21. data/lib/generators/happy_seed/devise/templates/app/views/devise/passwords/edit.html.haml +6 -19
  22. data/lib/generators/happy_seed/devise/templates/app/views/devise/passwords/new.html.haml +7 -14
  23. data/lib/generators/happy_seed/devise/templates/app/views/devise/registrations/edit.html.haml +50 -0
  24. data/lib/generators/happy_seed/devise/templates/app/views/devise/registrations/new.html.haml +11 -20
  25. data/lib/generators/happy_seed/devise/templates/app/views/devise/sessions/new.html.haml +8 -25
  26. data/lib/generators/happy_seed/devise/templates/spec/features/forgot_password_spec.rb +1 -1
  27. data/lib/generators/happy_seed/facebook/facebook_generator.rb +2 -2
  28. data/lib/generators/happy_seed/happy_seed_generator.rb +12 -19
  29. data/lib/generators/happy_seed/instagram/instagram_generator.rb +1 -1
  30. data/lib/generators/happy_seed/jazz_hands/jazz_hands_generator.rb +3 -10
  31. data/lib/generators/happy_seed/omniauth/omniauth_generator.rb +14 -11
  32. data/lib/generators/happy_seed/omniauth/templates/app/controllers/omniauth_callbacks_controller.rb +23 -10
  33. data/lib/generators/happy_seed/omniauth/templates/app/controllers/registrations_controller.rb +17 -0
  34. data/lib/generators/happy_seed/omniauth/templates/app/models/form_user.rb +20 -0
  35. data/lib/generators/happy_seed/omniauth/templates/make_email_nullable.rb +7 -0
  36. data/lib/generators/happy_seed/omniauth/templates/spec/factories/oauth.rb +5 -0
  37. data/lib/generators/happy_seed/omniauth/templates/spec/features/registration_spec.rb +81 -0
  38. data/lib/generators/happy_seed/splash/splash_generator.rb +6 -3
  39. data/lib/generators/happy_seed/static/templates/Gemfile.lock +162 -0
  40. data/lib/generators/happy_seed/static_blog/templates/Gemfile.lock +6 -6
  41. data/lib/generators/happy_seed/twitter/twitter_generator.rb +1 -1
  42. data/lib/happy_seed/cli.rb +2 -2
  43. data/lib/happy_seed/version.rb +1 -1
  44. metadata +23 -22
  45. data/lib/generators/happy_seed/omniauth/templates/add_name_to_users.rb +0 -5
  46. data/lib/generators/happy_seed/omniauth/templates/app/controllers/users_controller.rb +0 -31
  47. data/lib/generators/happy_seed/omniauth/templates/app/views/users/finish_signup.html.haml +0 -26
  48. data/lib/generators/happy_seed/omniauth/templates/app/views/users/show.html.haml +0 -5
  49. data/lib/generators/happy_seed/omniauth/templates/user.rb +0 -53
  50. data/test/dummy/db/test.sqlite3 +0 -0
  51. data/test/dummy/log/test.log +0 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 19216ba837e81b765e1197852acacadda4613850
4
- data.tar.gz: bc889a12383af7d06b276054512d919912733e20
3
+ metadata.gz: 89f5659db2682b561404e4561119472d1148e01e
4
+ data.tar.gz: 52f9952e7b4a408c524db4e3c7fc948f23651a8e
5
5
  SHA512:
6
- metadata.gz: 3508c78258a71bd40670d3814280445ad5b8c68db3e83e5166c048db817a2b2c5342ab0eddcdc5c256060b6bcb461abf81155aaee16d8cdea0f73acc888f5778
7
- data.tar.gz: ab985487550cb68a1adfc37a877b105692ee7ac5bf32775d8489e4c7bfd3699498df4e5d7726f4ad5245182a81918a626b0de4a1a85e801aaef6cca7433ce612
6
+ metadata.gz: f506b2e25a29c40238abc695b1b3e1cbe9f3401a02b6dd6b6e2c8feb2649759ea3a2f1821f3795fa0893621e831e008aa9121b729df416ba7f9e1fcf2ae3d345
7
+ data.tar.gz: 5d5f30de0cf66f084ba2e3d33a704fe2c4c1617af8b5d5f3cf90c70a13a1edc4cd088ee1a4f2b4a65ce4e91a8a499ebea234e98dad5dea25739e606cc8bdc1dc
data/happy_seed.rb CHANGED
@@ -1,3 +1,6 @@
1
+ puts "Setting up basic template"
2
+ puts
3
+
1
4
  gsub_file 'Gemfile', /.*sqlite3.*/, ""
2
5
  gem 'haml-rails'
3
6
  gem "httparty"
@@ -6,10 +9,13 @@ gem_group :development, :test do
6
9
  gem "sqlite3"
7
10
  gem "rspec"
8
11
  gem "rspec-rails"
9
- gem "rspec-autotest"
10
12
  gem "factory_girl_rails"
11
- gem "autotest-rails"
12
13
  gem "capybara"
14
+ gem "cucumber-rails", :require => false
15
+ gem "guard-rspec"
16
+ gem "guard-cucumber"
17
+ gem "database_cleaner"
18
+ gem 'spring-commands-rspec'
13
19
  end
14
20
 
15
21
  gem_group :test do
@@ -25,112 +31,87 @@ if ENV['SEED_DEVELOPMENT']
25
31
  else
26
32
  gem 'happy_seed'
27
33
  end
28
- gsub_file "Gemfile", /^#\s*Turbolinks.*$/,'# No one likes Turbolinks.'
29
- gsub_file "Gemfile", /^gem\s+["']turbolinks["'].*$/,'# gem \'turbolinks\''
30
- #gsub_file "Gemfile", /^gem\s+["']spring["'].*$/,'# gem \'spring\''
31
-
32
- run 'bundle install'
33
-
34
- gsub_file "app/assets/javascripts/application.js", /= require turbolinks/, "require turbolinks"
35
-
36
- # Install rspec
37
- generate "rspec:install"
38
- gsub_file ".rspec", "--warnings\n", ""
39
- append_to_file ".rspec", "--format documentation\n"
40
-
41
- # Run the base generator
42
- generate "happy_seed:base"
43
-
44
- all_in = false
45
- all_in = true if yes? "Would you like to install everything?"
46
-
47
- packages = []
48
34
 
49
- if all_in || yes?( "Would you like to install bootstrap?" )
50
- generate "happy_seed:bootstrap"
51
- packages << "bootstrap"
35
+ Bundler.with_clean_env do
36
+ run "bundle install > /dev/null"
52
37
 
53
- if all_in || yes?( "Would you like to install splash page?" )
54
- generate "happy_seed:splash"
55
- packages << "splash"
38
+ if !File.exists? "/Users/wschenk/src/happy_seed/ta/Gemfile.lock"
39
+ puts "Gemfile.lock should exist"
40
+ exit
56
41
  end
57
- end
58
42
 
59
- if all_in || yes?( "Would you like to install devise?" )
60
- generate "happy_seed:devise"
61
- packages << "devise"
43
+ gsub_file "app/assets/javascripts/application.js", /= require turbolinks/, "require turbolinks"
62
44
 
63
- if all_in || yes?( "Would you like to install twitter?" )
64
- generate "happy_seed:twitter"
65
- packages << "twitter"
66
- end
45
+ # Install rspec
46
+ generate "rspec:install"
47
+ gsub_file ".rspec", "--warnings\n", ""
48
+ append_to_file ".rspec", "--format documentation\n"
67
49
 
68
- if all_in || yes?( "Would you like to install facebook connect?" )
69
- generate "happy_seed:facebook"
70
- packages << "facebook"
71
- end
50
+ # Install cucumber
51
+ generate "cucumber:install"
72
52
 
73
- if all_in || yes?( "Would you like to install instagram?" )
74
- generate "happy_seed:instagram"
75
- packages << "instagram"
76
- end
77
- end
53
+ # Install Guard
54
+ run "guard init"
78
55
 
79
- if all_in || yes?( "Would you like to install active admin?" )
80
- generate "happy_seed:admin"
81
- packages << "admin"
82
- end
56
+ # Use the spring version and also run everything on startup
57
+ gsub_file "Guardfile", 'cmd: "bundle exec rspec"', 'cmd: "bin/rspec", all_on_start: true'
83
58
 
84
- if yes?( "You would like to install angular?" )
85
- generate "happy_seed:angular_install"
86
- packages << "angular"
87
- end
88
-
89
- if yes?( "You would like to install jazz hands?" )
90
- generate "happy_seed:jazz_hands"
91
- packages << "jazz_hands"
92
- end
93
59
 
94
- puts "Adding rake task to convert templates to ERB. If you need to do this, please run:"
95
- puts "rake html2erb"
96
- rakefile "haml2erb.rake",
97
- %q{
98
- desc "Converts everything to erb"
99
- task :haml2erb do
100
- require 'httparty'
60
+ # Run the base generator
61
+ generate "happy_seed:base"
101
62
 
102
- FileUtils.mkdir_p "lib/templates/erb"
63
+ all_in = false
64
+ all_in = true if yes? "Would you like to install everything?"
103
65
 
104
- Dir.glob( "**/*.haml").each do |f|
105
- puts "Converting #{f}"
66
+ packages = []
106
67
 
107
- data = File.read( f )
68
+ if all_in || yes?( "Would you like to install jazz hands?" )
69
+ generate "happy_seed:jazz_hands"
70
+ packages << "jazz_hands"
71
+ end
108
72
 
109
- resp = HTTParty.post( "http://haml2erb.herokuapp.com/api.html", { query: { haml: data } } )
73
+ if all_in || yes?( "Would you like to install bootstrap?" )
74
+ generate "happy_seed:bootstrap"
75
+ packages << "bootstrap"
110
76
 
111
- puts "FROM--------"
112
- puts data
113
- puts "TO--------"
114
- puts resp.body
77
+ if all_in || yes?( "Would you like to install splash page?" )
78
+ generate "happy_seed:splash"
79
+ packages << "splash"
80
+ end
81
+ end
115
82
 
116
- outfile = f.gsub( /\.haml/, ".erb" )
83
+ if all_in || yes?( "Would you like to install devise?" )
84
+ generate "happy_seed:devise"
85
+ packages << "devise"
117
86
 
118
- if outfile =~ /templates\/haml/
119
- outfile.gsub!( /templates\/haml/, "templates/erb" )
120
- puts "outfile = #{outfile}"
87
+ if all_in || yes?( "Would you like to install twitter?" )
88
+ generate "happy_seed:twitter"
89
+ packages << "twitter"
90
+ end
121
91
 
122
- FileUtils.mkdir_p( Pathname.new( outfile ).dirname )
92
+ if all_in || yes?( "Would you like to install facebook connect?" )
93
+ generate "happy_seed:facebook"
94
+ packages << "facebook"
123
95
  end
124
96
 
125
- File.open( outfile, "w" ) do |out|
126
- out.puts resp.body
97
+ if all_in || yes?( "Would you like to install instagram?" )
98
+ generate "happy_seed:instagram"
99
+ packages << "instagram"
127
100
  end
101
+ end
128
102
 
129
- FileUtils.mv( f, "#{f}.bak" )
103
+ if all_in || yes?( "Would you like to install active admin?" )
104
+ generate "happy_seed:admin"
105
+ packages << "admin"
130
106
  end
131
- end
132
- }
133
- puts "Setting up git"
134
- git :init
135
- git add: "."
136
- git commit: "-a -m 'Based off of happy_seed: #{packages.join( ', ')} included'"
107
+
108
+ if yes?( "(BETA) Would you like to install angular?" )
109
+ generate "happy_seed:angular_install"
110
+ packages << "angular"
111
+ end
112
+
113
+ puts "Setting up git"
114
+ git :init
115
+ git add: "."
116
+ git commit: "-a -m 'Based off of happy_seed: #{packages.join( ', ')} included'"
117
+ end
@@ -5,11 +5,12 @@ module HappySeed
5
5
 
6
6
  def install_landing_page
7
7
  gem 'devise'
8
- gem 'activeadmin', github: 'gregbell/active_admin'
8
+ gem 'activeadmin', github: 'activeadmin', branch: 'master'
9
+ gem 'inherited_resources', github: 'josevalim/inherited_resources', branch: 'rails-4-2'
9
10
  gem 'dateslices'
10
11
 
11
12
  Bundler.with_clean_env do
12
- run "bundle install"
13
+ run "bundle install > /dev/null"
13
14
  end
14
15
 
15
16
  generate 'active_admin:install'
@@ -1,4 +1,4 @@
1
- if ENV['MAILCHIMP_API_KEY']
1
+ if !ENV['MAILCHIMP_API_KEY'].blank?
2
2
  ActiveAdmin.register_page "Campaigns" do
3
3
  menu parent: "Newsletter"
4
4
 
@@ -1,4 +1,4 @@
1
- if ENV['MAILCHIMP_API_KEY']
1
+ if !ENV['MAILCHIMP_API_KEY'].blank?
2
2
  ActiveAdmin.register_page "Newsletter" do
3
3
  content do
4
4
  if !params[:list_id]
@@ -0,0 +1 @@
1
+ ActiveAdmin.register User
@@ -8,7 +8,7 @@ class Admin::StatsController < ApplicationController
8
8
  cls = User
9
9
  cls = Identity.where( "provider = ?", "twitter" ) if params[:scope] == 'twitter_users'
10
10
  cls = Identity.where( "provider = ?", "instagram" ) if params[:scope] == 'instagram_users'
11
- ret = cls.group_by_month.collect { |x| [x[:date_slice],x[:count]] }
11
+ ret = cls.group_by_month
12
12
  render json: ret
13
13
  end
14
14
  end
@@ -1,5 +1,4 @@
1
- = scope
2
- %div{ id: scope, style: "height: 300px" }
1
+ %div{ id: "#{scope}_chart", style: "height: 300px" }
3
2
 
4
3
  :javascript
5
- $( function() { new Chartkick.ColumnChart( '#{scope}', "/admin/stats/#{scope}" ) } )
4
+ $( function() { new Chartkick.ColumnChart( '#{scope}_chart', "/admin/stats/#{scope}" ) } )
@@ -1,4 +1,3 @@
1
- @@ -0,0 +1,829 @@
2
1
  /*
3
2
  * Chartkick.js
4
3
  * Create beautiful Javascript charts with minimal code
@@ -4,13 +4,14 @@ module HappySeed
4
4
  source_root File.expand_path('../templates', __FILE__)
5
5
 
6
6
  def install_foreman
7
+ puts "Installing happy_seed:base environment"
7
8
  gem 'dotenv-rails', :groups=>[:development, :test]
8
9
  gem 'rdiscount', :groups => [:development, :test]
9
10
  gem 'unicorn'
10
11
  gem 'rails_12factor'
11
12
 
12
13
  Bundler.with_clean_env do
13
- run "bundle install"
14
+ run "bundle install > /dev/null"
14
15
  end
15
16
 
16
17
  directory '.'
@@ -32,14 +33,6 @@ module HappySeed
32
33
  say_status :spec, "Unable to add factory girl to rails_helper.rb", :red
33
34
  end
34
35
 
35
- begin
36
- prepend_to_file 'spec/spec_helper.rb', "require 'devise'\n"
37
- inject_into_file 'spec/spec_helper.rb', "\n config.include Devise::TestHelpers, type: :controller\n", :before => "\nend\n"
38
- rescue
39
- say_status :spec, "Unable to add devise helpers to spec_helper.rb", :red
40
- end
41
-
42
-
43
36
  route "get '/setup' => 'setup#index'"
44
37
  route "root 'setup#index'"
45
38
  end
@@ -2,6 +2,7 @@
2
2
  %html
3
3
  %head
4
4
  %title HappySeed Generator setup page
5
+ %script{:src=>"https://code.jquery.com/jquery-2.1.3.min.js"}
5
6
  %script{:src=>"//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"}
6
7
  %link{:href=>"//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css", :rel=>"stylesheet"}
7
8
  :css
@@ -13,6 +14,8 @@
13
14
  }
14
15
 
15
16
  %body
17
+ = render partial: "application/flashes"
18
+ = render partial: "application/header"
16
19
  .container
17
20
  .row
18
21
  .col-sm-3
@@ -0,0 +1,34 @@
1
+ desc "Converts everything to erb"
2
+ task :haml2erb do
3
+ require 'httparty'
4
+
5
+ FileUtils.mkdir_p "lib/templates/erb"
6
+
7
+ Dir.glob( "**/*.haml").each do |f|
8
+ puts "Converting #{f}"
9
+
10
+ data = File.read( f )
11
+
12
+ resp = HTTParty.post( "http://haml2erb.herokuapp.com/api.html", { query: { haml: data } } )
13
+
14
+ puts "FROM--------"
15
+ puts data
16
+ puts "TO--------"
17
+ puts resp.body
18
+
19
+ outfile = f.gsub( /\.haml/, ".erb" )
20
+
21
+ if outfile =~ /templates\/haml/
22
+ outfile.gsub!( /templates\/haml/, "templates/erb" )
23
+ puts "outfile = #{outfile}"
24
+
25
+ FileUtils.mkdir_p( Pathname.new( outfile ).dirname )
26
+ end
27
+
28
+ File.open( outfile, "w" ) do |out|
29
+ out.puts resp.body
30
+ end
31
+
32
+ FileUtils.mv( f, "#{f}.bak" )
33
+ end
34
+ end
@@ -1,15 +1,19 @@
1
+ require 'generators/happy_seed/happy_seed_generator'
2
+
1
3
  module HappySeed
2
4
  module Generators
3
- class BootstrapGenerator < Rails::Generators::Base
5
+ class BootstrapGenerator < HappySeedGenerator
4
6
  source_root File.expand_path('../templates', __FILE__)
5
7
 
6
8
  def update_application_haml
7
9
  gem 'bootstrap-sass'
8
10
  gem 'modernizr-rails'
9
11
  gem 'meta-tags', :require => 'meta_tags'
12
+ gem 'responders', '~> 2.0'
13
+ gem 'bh'
10
14
 
11
15
  Bundler.with_clean_env do
12
- run "bundle install"
16
+ run "bundle install > /dev/null"
13
17
  end
14
18
 
15
19
  remove_file 'app/views/layouts/application.html.erb'
@@ -30,7 +34,7 @@ module HappySeed
30
34
  RUBY
31
35
  end
32
36
  if File.exists?( File.join( destination_root, ".env" ) )
33
- append_to_file ".env", "GOOGLE_ANALYTICS_SITE_ID=\n"
37
+ add_env "GOOGLE_ANALYTICS_SITE_ID"
34
38
  end
35
39
  end
36
40
  end
@@ -5,3 +5,15 @@
5
5
 
6
6
  @import 'bootstrap-sprockets';
7
7
  @import 'bootstrap';
8
+
9
+ // This is used by the devise generated views.
10
+ .center_panel {
11
+ @extend .col-lg-6;
12
+ @extend .col-lg-offset-3;
13
+
14
+ @extend .col-md-6;
15
+ @extend .col-md-offset-3;
16
+
17
+ @extend .col-sm-8;
18
+ @extend .col-sm-offset-2;
19
+ }
@@ -1,19 +1,11 @@
1
1
  module ApplicationHelper
2
2
  def flash_class(level)
3
3
  case level.to_sym
4
- when :notice then "alert alert-info"
5
- when :success then "alert alert-success"
6
- when :alert then "alert alert-warning"
7
- when :error then "alert alert-danger"
8
- else "alert-danger alert"
9
- end
10
- end
11
-
12
- def error_for( model_class, attribute, err_class )
13
- if model_class.errors[attribute].size > 0
14
- err_class
15
- else
16
- nil
4
+ when :notice then "alert-info"
5
+ when :success then "alert-success"
6
+ when :alert then "alert-warning"
7
+ when :error then "alert-danger"
8
+ else "alert-danger"
17
9
  end
18
10
  end
19
11
 
@@ -1,8 +1,4 @@
1
1
  - if !flash.empty?
2
2
  .container#flash
3
3
  - flash.each do |key, value|
4
- %div{ :title => key.to_s.humanize, :class => flash_class(key), :role => "alert" }
5
- %button.close{ "type" => "button", "data-dismiss" => "alert"}
6
- %span{ "aria-hidden" => "true" } &times;
7
- %span{ "class" => "sr-only" } Close
8
- %p= value
4
+ = alert_box value, context: flash_class(key), dismissible: true
@@ -1,16 +1,10 @@
1
- %header#top.navbar.navbar-default{:role=>:banner}
2
- .container-fluid
3
- .navbar-header
4
- %button.navbar-toggle{:type=>:button, 'data-toggle'=>:collapse, 'data-target'=>'.navbar-collapse'}
5
- %span.sr-only Toggle navigations
6
- %span.icon-bar
7
- %span.icon-bar
8
- %span.icon-bar
9
- = link_to root_path, :class=>'navbar-brand' do
10
- %span.glyphicon.glyphicon-cloud
11
- App name
12
- %nav.collapse.navbar-collapse{:role=>:navigation}
13
- %ul.nav.navbar-nav
14
- %li= link_to 'Contact', '#'
15
- %li= link_to 'Blog', '#'
1
+ = navbar position: :static do
2
+ = vertical do
3
+ = link_to root_path do
4
+ %span.glyphicon.glyphicon-cloud
5
+ Home
6
+ = horizontal do
7
+ = nav class: 'navbar-right' do
8
+ = link_to 'Contact', ""
9
+ = link_to 'About', ""
16
10
  / USER NAV