bently 0.1.0 → 1.0.0

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 (58) hide show
  1. data/.travis.yml +6 -0
  2. data/Gemfile +2 -0
  3. data/Gemfile.lock +3 -1
  4. data/LICENSE +7 -0
  5. data/README.md +38 -99
  6. data/bently.gemspec +3 -4
  7. data/bin/bently +1 -1
  8. data/lib/bently/base.rb +108 -0
  9. data/lib/bently/core_ext/string.rb +22 -24
  10. data/lib/bently/recipe/action-mailer.rb +8 -26
  11. data/lib/bently/recipe/cucumber-rails.rb +20 -0
  12. data/lib/bently/recipe/devise.rb +11 -13
  13. data/lib/bently/recipe/factory-girl-rails.rb +27 -24
  14. data/lib/bently/recipe/foreman-thin.rb +19 -0
  15. data/lib/bently/recipe/foreman.rb +17 -0
  16. data/lib/bently/recipe/gitignore-emacs.rb +30 -0
  17. data/lib/bently/recipe/gitignore-linux.rb +21 -0
  18. data/lib/bently/recipe/gitignore-osx.rb +30 -0
  19. data/lib/bently/recipe/gitignore-rails.rb +22 -38
  20. data/lib/bently/recipe/gitignore-ruby.rb +36 -0
  21. data/lib/bently/recipe/gitignore-rubymine.rb +19 -0
  22. data/lib/bently/recipe/gitignore-sass.rb +21 -0
  23. data/lib/bently/recipe/gitignore-sublime-text.rb +21 -0
  24. data/lib/bently/recipe/gitignore-textmate.rb +21 -0
  25. data/lib/bently/recipe/gitignore-vim.rb +23 -0
  26. data/lib/bently/recipe/gitignore-windows.rb +27 -0
  27. data/lib/bently/recipe/guard-livereload.rb +10 -4
  28. data/lib/bently/recipe/guard.rb +10 -6
  29. data/lib/bently/recipe/haml-rails.rb +10 -5
  30. data/lib/bently/recipe/heroku-cleardb.rb +25 -0
  31. data/lib/bently/recipe/heroku-rails.rb +23 -0
  32. data/lib/bently/recipe/heroku-sendgrid.rb +6 -12
  33. data/lib/bently/recipe/omniauth-facebook.rb +23 -0
  34. data/lib/bently/recipe/omniauth.rb +44 -0
  35. data/lib/bently/recipe/resque-rails.rb +20 -0
  36. data/lib/bently/recipe/rspec-rails.rb +11 -15
  37. data/lib/bently/recipe/rvmrc.rb +2 -9
  38. data/lib/bently/recipe/twitter-bootstrap-rails.rb +13 -5
  39. data/lib/bently/recipe.rb +90 -43
  40. data/lib/bently/recipe_class/rails.rb +10 -0
  41. data/lib/bently/recipe_class/ruby.rb +62 -0
  42. data/lib/bently/recipebook.rb +21 -0
  43. data/lib/bently/version.rb +1 -1
  44. data/lib/bently.rb +10 -6
  45. data/spec/bently/base_spec.rb +151 -0
  46. metadata +31 -18
  47. data/lib/bently/clo.rb +0 -33
  48. data/lib/bently/himself.rb +0 -105
  49. data/lib/bently/recipe/gitignore.rb +0 -23
  50. data/lib/bently/recipe/heroku-create.rb +0 -27
  51. data/lib/bently/recipe/heroku-procfile.rb +0 -14
  52. data/lib/bently/recipe/heroku-resque.rb +0 -79
  53. data/lib/bently/recipe/resque.rb +0 -10
  54. data/lib/bently/recipe/welcome-index.rb +0 -10
  55. data/lib/bently/recipe_book.rb +0 -15
  56. data/lib/bently/recipe_template/rails.rb +0 -13
  57. data/lib/bently/step.rb +0 -93
  58. data/spec/bently/himself_spec.rb +0 -175
@@ -0,0 +1,30 @@
1
+ module Bently
2
+
3
+ class GitignoreOsx < Recipe
4
+
5
+ homepage 'https://github.com/github/gitignore/blob/master/Global/OSX.gitignore'
6
+
7
+ def initialize
8
+ append '.gitignore', gitignore
9
+ end
10
+
11
+ protected
12
+
13
+ def gitignore
14
+ %{.DS_Store
15
+ .AppleDouble
16
+ .LSOverride
17
+ Icon
18
+
19
+
20
+ # Thumbnails
21
+ ._*
22
+
23
+ # Files that might appear on external disk
24
+ .Spotlight-V100
25
+ .Trashes}
26
+ end
27
+
28
+ end
29
+
30
+ end
@@ -2,49 +2,33 @@ module Bently
2
2
 
3
3
  class GitignoreRails < Recipe
4
4
 
5
- step :touch_gitignore
5
+ homepage 'https://github.com/github/gitignore/blob/master/Rails.gitignore'
6
6
 
7
- protected
8
-
9
- def touch_gitignore
10
- touch :file => '.gitignore', :with => gitignore
7
+ def initialize
8
+ append '.gitignore', gitignore
11
9
  end
12
10
 
13
- def gitignore
14
- %{
15
- # Configuration files
16
- config/initializers/secret_token.rb
17
- config/database.yml
18
-
19
- # Generated files
20
- log/*
21
- coverage/*
11
+ protected
22
12
 
23
- #Documentation
24
- .yardoc/
25
- doc/
26
-
27
- # Uploaded files and local files
28
- public/uploads/*
29
- public/assets/*
30
- tmp/**/*
31
- tmp/*
32
- *.sqlite3
33
- .env
34
-
35
- # Temporary files of every sort
36
- .sass-cache/*
37
- .DS_Store
38
- .idea
13
+ def gitignore
14
+ %{*.rbc
15
+ *.sassc
16
+ .sass-cache
17
+ capybara-*.html
18
+ .rspec
39
19
  .rvmrc
40
- *.swap
41
- *.swo
42
- *.swp
43
- *~
44
- *#
45
- nbproject
46
- dump.rdb
47
- }
20
+ /.bundle
21
+ /vendor/bundle
22
+ /log/*
23
+ /tmp/*
24
+ /db/*.sqlite3
25
+ /public/system/*
26
+ /coverage/
27
+ /spec/tmp/*
28
+ **.orig
29
+ rerun.txt
30
+ pickle-email-*.html
31
+ .project}
48
32
  end
49
33
 
50
34
  end
@@ -0,0 +1,36 @@
1
+ module Bently
2
+
3
+ class GitignoreRuby < Recipe
4
+
5
+ homepage 'https://github.com/github/gitignore/blob/master/Ruby.gitignore'
6
+
7
+ def initialize
8
+ append '.gitignore', gitignore
9
+ end
10
+
11
+ protected
12
+
13
+ def gitignore
14
+ %{*.gem
15
+ *.rbc
16
+ .bundle
17
+ .config
18
+ coverage
19
+ InstalledFiles
20
+ lib/bundler/man
21
+ pkg
22
+ rdoc
23
+ spec/reports
24
+ test/tmp
25
+ test/version_tmp
26
+ tmp
27
+
28
+ # YARD artifacts
29
+ # .yardoc
30
+ # _yardoc
31
+ # doc/}
32
+ end
33
+
34
+ end
35
+
36
+ end
@@ -0,0 +1,19 @@
1
+ module Bently
2
+
3
+ class GitignoreRubymine < Recipe
4
+
5
+ homepage 'https://github.com/github/gitignore/blob/master/Global/RubyMine.gitignore'
6
+
7
+ def initialize
8
+ append '.gitignore', gitignore
9
+ end
10
+
11
+ protected
12
+
13
+ def gitignore
14
+ %{.idea/workspace.xml}
15
+ end
16
+
17
+ end
18
+
19
+ end
@@ -0,0 +1,21 @@
1
+ module Bently
2
+
3
+ class GitignoreSass < Recipe
4
+
5
+ homepage 'https://github.com/github/gitignore/blob/master/Global/SASS.gitignore'
6
+
7
+ def initialize
8
+ append '.gitignore', gitignore
9
+ end
10
+
11
+ protected
12
+
13
+ def gitignore
14
+ %{### SASS Ignores - "Sassy CSS" http://sass-lang.com/
15
+ *.sass-cache
16
+ }
17
+ end
18
+
19
+ end
20
+
21
+ end
@@ -0,0 +1,21 @@
1
+ module Bently
2
+
3
+ class GitignoreSublimeText < Recipe
4
+
5
+ homepage 'https://github.com/github/gitignore/blob/master/Global/SublimeText.gitignore'
6
+
7
+ def initialize
8
+ append '.gitignore', gitignore
9
+ end
10
+
11
+ protected
12
+
13
+ def gitignore
14
+ %{# SublimeText project files
15
+ *.sublime-workspace}
16
+ end
17
+
18
+ end
19
+
20
+ end
21
+
@@ -0,0 +1,21 @@
1
+ module Bently
2
+
3
+ class GitignoreTextmate < Recipe
4
+
5
+ homepage 'https://github.com/github/gitignore/blob/master/Global/TextMate.gitignore'
6
+
7
+ def initialize
8
+ append '.gitignore', gitignore
9
+ end
10
+
11
+ protected
12
+
13
+ def gitignore
14
+ %{*.tmproj
15
+ *.tmproject
16
+ tmtags}
17
+ end
18
+
19
+ end
20
+
21
+ end
@@ -0,0 +1,23 @@
1
+ module Bently
2
+
3
+ class GitignoreVim < Recipe
4
+
5
+ homepage 'https://github.com/github/gitignore/blob/master/Global/vim.gitignore'
6
+
7
+ def initialize
8
+ append '.gitignore', gitignore
9
+ end
10
+
11
+ protected
12
+
13
+ def gitignore
14
+ %{.*.s[a-w][a-z]
15
+ *.un~
16
+ Session.vim
17
+ .netrwhist
18
+ *~}
19
+ end
20
+
21
+ end
22
+
23
+ end
@@ -0,0 +1,27 @@
1
+ module Bently
2
+
3
+ class GitignoreWindows < Recipe
4
+
5
+ homepage 'https://github.com/github/gitignore/blob/master/Global/Windows.gitignore'
6
+
7
+ def initialize
8
+ append '.gitignore', gitignore
9
+ end
10
+
11
+ protected
12
+
13
+ def gitignore
14
+ %{# Windows image file caches
15
+ Thumbs.db
16
+ ehthumbs.db
17
+
18
+ # Folder config file
19
+ Desktop.ini
20
+
21
+ # Recycle Bin used on file shares
22
+ $RECYCLE.BIN/}
23
+ end
24
+
25
+ end
26
+
27
+ end
@@ -1,10 +1,16 @@
1
1
  module Bently
2
2
 
3
3
  class GuardLivereload < RailsRecipe
4
-
5
- step :add_gem, "gem 'guard-livereload', :group => :development"
6
- step :shell, 'bundle install'
7
- step :shell, 'guard init livereload'
4
+
5
+ homepage 'https://github.com/guard/guard-livereload/blob/master/README.md'
6
+
7
+ def initialize
8
+ gem_group :development do
9
+ gem 'guard-livereload'
10
+ end
11
+ bundle
12
+ run 'guard init livereload'
13
+ end
8
14
 
9
15
  end
10
16
 
@@ -1,11 +1,15 @@
1
1
  module Bently
2
-
3
2
  class Guard < RailsRecipe
4
-
5
- step :add_gem, "gem 'guard', :group => :development"
6
- step :shell, 'bundle install'
7
- step :shell, 'guard init'
8
3
 
9
- end
4
+ homepage 'https://github.com/guard/guard/blob/master/README.md'
10
5
 
6
+ def initialize
7
+ gem_group :development do
8
+ gem 'guard'
9
+ end
10
+ bundle
11
+ run 'guard init'
12
+ end
13
+
14
+ end
11
15
  end
@@ -1,11 +1,16 @@
1
1
  module Bently
2
-
3
2
  class HamlRails < RailsRecipe
4
3
 
5
- step :add_gem, "gem 'haml'"
6
- step :add_gem, "gem 'haml-rails'"
7
- step :shell, 'bundle install'
4
+ name 'haml-rails'
5
+ category 'gem'
6
+ description 'downloads and installs haml Ruby gem with haml-rails Ruby gem'
7
+ homepage 'https://github.com/haml/haml/blob/master/README.md'
8
8
 
9
- end
9
+ def initialize
10
+ gem 'haml'
11
+ gem 'haml-rails'
12
+ bundle
13
+ end
10
14
 
15
+ end
11
16
  end
@@ -0,0 +1,25 @@
1
+ module Bently
2
+
3
+ class HerokuCleardb < RailsRecipe
4
+
5
+ homepage 'https://devcenter.heroku.com/articles/cleardb#the-short-tutorial-for-ruby-on-rails-apps'
6
+
7
+ def initialize
8
+ warn 'heroku commands may incur charges to your account'.upcase
9
+ modify 'Gemfile', /gem 'sqlite3'/, ""
10
+ gem 'mysql2'
11
+ bundle
12
+
13
+ run 'heroku addons:add cleardb:ignite'
14
+
15
+ todo 'Retrieve your database URL by issuing the following command:'
16
+ todo 'heroku config | grep CLEARDB_DATABASE_URL'
17
+ todo 'Copy the value of the CLEARDB_DATABASE_URL config variable to DATABASE_URL (using mysql2:// instead of mysql://):'
18
+ todo "heroku config:add DATABASE_URL='mysql2://...'"
19
+ todo 'Add and commit Gemfile, Gemfile.lock'
20
+ todo 'heroku run rake db:migrate'
21
+ end
22
+
23
+ end
24
+
25
+ end
@@ -0,0 +1,23 @@
1
+ module Bently
2
+
3
+ class HerokuRails < RailsRecipe
4
+
5
+ homepage 'https://devcenter.heroku.com/articles/rails3'
6
+
7
+ def initialize
8
+ warn 'heroku commands may incur charges to your account'.upcase
9
+ modify 'Gemfile', /gem 'sqlite3'/, ""
10
+ gem 'pg'
11
+ bundle
12
+
13
+ run 'git add Gemfile Gemfile.lock'
14
+ run 'git commit -m "postgres gem"'
15
+
16
+ run 'heroku create'
17
+ run 'git push heroku master'
18
+ run 'heroku run rake db:migrate'
19
+ end
20
+
21
+ end
22
+
23
+ end
@@ -2,21 +2,15 @@ module Bently
2
2
 
3
3
  class HerokuSendgrid < RailsRecipe
4
4
 
5
- step :heroku, 'addons:add sendgrid:starter'
6
- step :touch_mail_initializer
5
+ homepage 'https://devcenter.heroku.com/articles/sendgrid#ruby-rails'
7
6
 
8
- protected
9
-
10
- def heroku command
11
- shell("heroku #{command}")
7
+ def initialize
8
+ warn 'heroku commands may incur charges to your account'.upcase
9
+ run 'heroku addons:add sendgrid:starter'
10
+ create './config/initializers/mail.rb', mail_initializer
12
11
  end
13
12
 
14
- def touch_mail_initializer
15
- touch(
16
- :file => "./config/initializers/mail.rb",
17
- :with => mail_initializer
18
- )
19
- end
13
+ protected
20
14
 
21
15
  def mail_initializer
22
16
  %{
@@ -0,0 +1,23 @@
1
+ module Bently
2
+
3
+ class OmniauthFacebook < RailsRecipe
4
+
5
+ homepage 'https://github.com/mkdynamic/omniauth-facebook/blob/master/README.md'
6
+
7
+ def initialize
8
+ requirement 'omniauth'
9
+ gem 'omniauth-facebook'
10
+ bundle
11
+ insert './config/initializers/omniauth.rb', omniauth_initializer, :after => "Rails.application.config.middleware.use OmniAuth::Builder do\n"
12
+ end
13
+
14
+ protected
15
+
16
+ def omniauth_initializer
17
+ %{provider :facebook, ENV['FACEBOOK_KEY'], ENV['FACEBOOK_SECRET']
18
+ }
19
+ end
20
+
21
+ end
22
+
23
+ end
@@ -0,0 +1,44 @@
1
+ module Bently
2
+
3
+ class Omniauth < RailsRecipe
4
+
5
+ homepage 'https://github.com/intridea/omniauth/blob/master/README.md'
6
+
7
+ def initialize
8
+ gem 'omniauth'
9
+ bundle
10
+ create './config/initializers/omniauth.rb', omniauth_initializer
11
+ insert 'config/routes.rb', " match '/auth/:provider/callback', to: 'sessions#create'\n", :after => "Application.routes.draw do\n"
12
+ create './app/controllers/sessions_controller.rb', sessions_controller
13
+ todo 'implement User#find_or_create_from_auth_hash'
14
+ end
15
+
16
+ protected
17
+
18
+ def omniauth_initializer
19
+ %{Rails.application.config.middleware.use OmniAuth::Builder do
20
+ provider :developer unless Rails.env.production?
21
+ #provider :facebook, ENV['FACEBOOK_KEY'], ENV['FACEBOOK_SECRET']
22
+ #provider :twitter, ENV['TWITTER_KEY'], ENV['TWITTER_SECRET']
23
+ end}
24
+ end
25
+
26
+ def sessions_controller
27
+ %{class SessionsController < ApplicationController
28
+ def create
29
+ @user = User.find_or_create_from_auth_hash(auth_hash)
30
+ self.current_user = @user
31
+ redirect_to '/'
32
+ end
33
+
34
+ protected
35
+
36
+ def auth_hash
37
+ request.env['omniauth.auth']
38
+ end
39
+ end}
40
+ end
41
+
42
+ end
43
+
44
+ end
@@ -0,0 +1,20 @@
1
+ module Bently
2
+
3
+ class ResqueRails < RailsRecipe
4
+
5
+ homepage 'https://github.com/defunkt/resque/blob/master/README.md'
6
+
7
+ def initialize
8
+ requirement "redis (OS X: \`brew install redis\`, \`redis-server /usr/local/etc/redis.conf\`)"
9
+ gem 'resque'
10
+ bundle
11
+ create 'lib/tasks/resque.rake', "require 'resque/tasks'"
12
+ todo 'redis-server'
13
+ todo "If you want to use the front end, add to config/routes.rb:"
14
+ say "require 'resque/server'", ''
15
+ say ' mount Resque::Server, :at => "/resque"', ''
16
+ end
17
+
18
+ end
19
+
20
+ end
@@ -1,23 +1,19 @@
1
1
  module Bently
2
-
3
2
  class RspecRails < RailsRecipe
4
3
 
5
- step :add_gem
6
- step :shell, 'bundle install'
7
- step :shell, "rails g rspec:install"
8
-
9
- protected
4
+ name 'rspec-rails'
5
+ category 'gem'
6
+ description 'downloads and installs rspec-rails gem'
7
+ homepage 'https://github.com/rspec/rspec-rails/blob/master/README.md'
8
+ version '2.0'
10
9
 
11
- def add_gem
12
- super gem_def
13
- end
14
-
15
- def gem_def
16
- %{group :test, :development do
17
- gem "rspec-rails", "~> 2.0"
18
- end}
10
+ def initialize
11
+ gem_group :test, :development do
12
+ gem "rspec-rails", "~> 2.0"
13
+ end
14
+ bundle
15
+ generate 'rspec:install'
19
16
  end
20
17
 
21
18
  end
22
-
23
19
  end
@@ -1,16 +1,9 @@
1
1
  module Bently
2
2
 
3
3
  class Rvmrc < Recipe
4
-
5
- step :touch_rvmrc
6
4
 
7
- def touch_rvmrc
8
- ruby_version = `rvm current`.chomp
9
- shell(
10
- lambda{|gemset| "echo \"rvm use --create #{ruby_version}@#{gemset}\" > .rvmrc" },
11
- :ask => "Enter a gemset name:",
12
- :description => "Touch .rvmrc:\nrvm use --create #{ruby_version}@<gemset>"
13
- )
5
+ def initialize
6
+ run "echo \"rvm use --create 1.9.3@gemsetname\" > .rvmrc"
14
7
  end
15
8
 
16
9
  end
@@ -1,11 +1,19 @@
1
1
  module Bently
2
-
3
2
  class TwitterBootstrapRails < RailsRecipe
4
3
 
5
- step :add_gem, 'gem "twitter-bootstrap-rails", :group => :assets'
6
- step :shell, 'bundle install'
7
- step :shell, 'rails g bootstrap:install'
4
+ name 'twitter-bootstrap-rails'
5
+ category 'gem'
6
+ description 'downloads and installs twitter-bootstrap-rails gem'
7
+ homepage 'https://github.com/seyhunak/twitter-bootstrap-rails/blob/master/README.md'
8
+ version '2.2.0'
8
9
 
9
- end
10
+ def initialize
11
+ gem 'therubyracer'
12
+ gem 'less-rails'
13
+ gem 'twitter-bootstrap-rails', '~> 2.2.0'
14
+ bundle
15
+ generate 'bootstrap:install less'
16
+ end
10
17
 
18
+ end
11
19
  end