bently 0.1.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +6 -0
- data/Gemfile +2 -0
- data/Gemfile.lock +3 -1
- data/LICENSE +7 -0
- data/README.md +38 -99
- data/bently.gemspec +3 -4
- data/bin/bently +1 -1
- data/lib/bently/base.rb +108 -0
- data/lib/bently/core_ext/string.rb +22 -24
- data/lib/bently/recipe/action-mailer.rb +8 -26
- data/lib/bently/recipe/cucumber-rails.rb +20 -0
- data/lib/bently/recipe/devise.rb +11 -13
- data/lib/bently/recipe/factory-girl-rails.rb +27 -24
- data/lib/bently/recipe/foreman-thin.rb +19 -0
- data/lib/bently/recipe/foreman.rb +17 -0
- data/lib/bently/recipe/gitignore-emacs.rb +30 -0
- data/lib/bently/recipe/gitignore-linux.rb +21 -0
- data/lib/bently/recipe/gitignore-osx.rb +30 -0
- data/lib/bently/recipe/gitignore-rails.rb +22 -38
- data/lib/bently/recipe/gitignore-ruby.rb +36 -0
- data/lib/bently/recipe/gitignore-rubymine.rb +19 -0
- data/lib/bently/recipe/gitignore-sass.rb +21 -0
- data/lib/bently/recipe/gitignore-sublime-text.rb +21 -0
- data/lib/bently/recipe/gitignore-textmate.rb +21 -0
- data/lib/bently/recipe/gitignore-vim.rb +23 -0
- data/lib/bently/recipe/gitignore-windows.rb +27 -0
- data/lib/bently/recipe/guard-livereload.rb +10 -4
- data/lib/bently/recipe/guard.rb +10 -6
- data/lib/bently/recipe/haml-rails.rb +10 -5
- data/lib/bently/recipe/heroku-cleardb.rb +25 -0
- data/lib/bently/recipe/heroku-rails.rb +23 -0
- data/lib/bently/recipe/heroku-sendgrid.rb +6 -12
- data/lib/bently/recipe/omniauth-facebook.rb +23 -0
- data/lib/bently/recipe/omniauth.rb +44 -0
- data/lib/bently/recipe/resque-rails.rb +20 -0
- data/lib/bently/recipe/rspec-rails.rb +11 -15
- data/lib/bently/recipe/rvmrc.rb +2 -9
- data/lib/bently/recipe/twitter-bootstrap-rails.rb +13 -5
- data/lib/bently/recipe.rb +90 -43
- data/lib/bently/recipe_class/rails.rb +10 -0
- data/lib/bently/recipe_class/ruby.rb +62 -0
- data/lib/bently/recipebook.rb +21 -0
- data/lib/bently/version.rb +1 -1
- data/lib/bently.rb +10 -6
- data/spec/bently/base_spec.rb +151 -0
- metadata +31 -18
- data/lib/bently/clo.rb +0 -33
- data/lib/bently/himself.rb +0 -105
- data/lib/bently/recipe/gitignore.rb +0 -23
- data/lib/bently/recipe/heroku-create.rb +0 -27
- data/lib/bently/recipe/heroku-procfile.rb +0 -14
- data/lib/bently/recipe/heroku-resque.rb +0 -79
- data/lib/bently/recipe/resque.rb +0 -10
- data/lib/bently/recipe/welcome-index.rb +0 -10
- data/lib/bently/recipe_book.rb +0 -15
- data/lib/bently/recipe_template/rails.rb +0 -13
- data/lib/bently/step.rb +0 -93
- data/spec/bently/himself_spec.rb +0 -175
data/.travis.yml
ADDED
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,13 +1,14 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
bently (0.
|
4
|
+
bently (0.1.0)
|
5
5
|
thor (>= 0.14.6)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: http://rubygems.org/
|
9
9
|
specs:
|
10
10
|
diff-lcs (1.1.3)
|
11
|
+
rake (0.9.2.2)
|
11
12
|
rspec (2.11.0)
|
12
13
|
rspec-core (~> 2.11.0)
|
13
14
|
rspec-expectations (~> 2.11.0)
|
@@ -23,4 +24,5 @@ PLATFORMS
|
|
23
24
|
|
24
25
|
DEPENDENCIES
|
25
26
|
bently!
|
27
|
+
rake
|
26
28
|
rspec (~> 2.6)
|
data/LICENSE
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
Copyright (c) 2013 Benjamin Sullivan
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
4
|
+
|
5
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
6
|
+
|
7
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
CHANGED
@@ -1,123 +1,62 @@
|
|
1
|
-
|
1
|
+
[<img src="https://secure.travis-ci.org/bonsaiben/bently.png">](http://travis-ci.org/bonsaiben/bently)
|
2
2
|
|
3
|
-
|
3
|
+
Bently is a community maintained library of executable recipes for rapid application development. The bulk of recipes are for automating installation and configuration of commonly-used dependencies. Another potential use case is feature scaffolding, or laying down basic implementation for common functionality like social authentication.
|
4
4
|
|
5
|
-
|
5
|
+
The goal of Bently is to reduce duplication in the development process across projects, with rapid prototyping in mind.
|
6
6
|
|
7
|
-
|
8
|
-
============
|
9
|
-
|
10
|
-
You'll probably want to add your own custom recipes so I recommend cloning into an easy-to-find directory and build and install the gem from there.
|
11
|
-
|
12
|
-
You can install the Gem if you'd prefer.
|
13
|
-
|
14
|
-
gem install bently
|
7
|
+
Bently is Homebrew meets Rails generators.
|
15
8
|
|
9
|
+
Bently is built on top of Thor.
|
16
10
|
|
17
|
-
Example
|
18
|
-
=======
|
19
11
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
add "gem 'devise'" to Gemfile
|
24
|
-
bundle install
|
25
|
-
rails g devise:install
|
26
|
-
rails g devise user
|
12
|
+
Installation
|
13
|
+
============
|
27
14
|
|
28
|
-
|
15
|
+
gem install bently
|
29
16
|
|
30
|
-
module Bently
|
31
|
-
class Devise < Recipe
|
32
|
-
step :append, :file => 'Gemfile', :with => "gem 'devise'"
|
33
|
-
step :shell, 'bundle install'
|
34
|
-
step :shell, 'rails g devise:install'
|
35
|
-
step :shell, 'rails g devise user'
|
36
|
-
end
|
37
|
-
end
|
38
17
|
|
39
|
-
|
18
|
+
Usage
|
19
|
+
=====
|
40
20
|
|
41
|
-
bently
|
42
|
-
|
43
|
-
|
21
|
+
bently list # list all recipes
|
22
|
+
bently list [STRING] # search recipes matching a string
|
23
|
+
bently read [RECIPE] # display a recipe without executing it
|
24
|
+
bently bake [RECIPE] # execute all steps in recipe
|
25
|
+
bently bake [RECIPE] --step # execute a recipe step by step, prompting before each step
|
26
|
+
bently source [RECIPE] # output the URL for the document on which the recipe is based
|
44
27
|
|
45
|
-
bently read devise
|
46
28
|
|
47
|
-
|
29
|
+
Example
|
48
30
|
=======
|
49
31
|
|
50
|
-
|
51
|
-
|
52
|
-
Shell
|
53
|
-
|
54
|
-
execute a command
|
55
|
-
|
56
|
-
step :shell, 'echo hello'
|
57
|
-
|
58
|
-
Touch
|
59
|
-
|
60
|
-
create a file with some content
|
32
|
+
Installing and configuring devise in a Rails application.
|
61
33
|
|
62
|
-
|
34
|
+
$ bently bake devise
|
35
|
+
gemfile devise
|
36
|
+
1
|
37
|
+
2 gem "devise"
|
38
|
+
run bundle install from "."
|
39
|
+
run rails generate devise:install from "."
|
40
|
+
TODO rails generate devise MODEL
|
63
41
|
|
64
|
-
|
42
|
+
The recipe for devise looks like:
|
65
43
|
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
add content to the end of a file
|
73
|
-
|
74
|
-
step :append, :file => 'file.rb', :with => 'put this at the bottom'
|
75
|
-
|
76
|
-
Prepend
|
77
|
-
|
78
|
-
add content to beginning of a file
|
79
|
-
|
80
|
-
step :prepend, :file => 'file.rb', :with => 'put this at the top'
|
81
|
-
|
82
|
-
Insert
|
83
|
-
|
84
|
-
add content before or after some part of a file
|
85
|
-
|
86
|
-
step :insert, :file => 'file.rb', :with => 'insert this', :after => 'after this'
|
87
|
-
|
88
|
-
Remove
|
89
|
-
|
90
|
-
remove a file
|
91
|
-
|
92
|
-
step :remove, :file => 'delete_me.txt'
|
93
|
-
|
94
|
-
|
95
|
-
You can also define custom steps that reduce to one of the above.
|
96
|
-
|
97
|
-
step :add_gem, "gem 'rails'"
|
98
|
-
|
99
|
-
def add_gem gem
|
100
|
-
append :file => 'Gemfile', :with => gem
|
44
|
+
class Devise < RailsRecipe
|
45
|
+
gem 'devise'
|
46
|
+
bundle
|
47
|
+
generate 'devise:install'
|
48
|
+
todo 'rails generate devise MODEL'
|
101
49
|
end
|
102
50
|
|
103
|
-
Recipe Templates
|
104
|
-
================
|
105
51
|
|
106
|
-
|
52
|
+
Available Recipes
|
53
|
+
=================
|
107
54
|
|
108
|
-
|
109
|
-
class RailsRecipe < Recipe
|
110
|
-
GEMFILE = 'Gemfile'
|
111
|
-
|
112
|
-
def add_gem gem
|
113
|
-
append :file => GEMFILE, :with => gem
|
114
|
-
end
|
115
|
-
|
116
|
-
end
|
117
|
-
end
|
55
|
+
You can browse the recipe library on GitHub: https://github.com/bonsaiben/bently/tree/master/lib/bently/recipe
|
118
56
|
|
119
|
-
To use a template, inherit from the template class instead of Recipe.
|
120
57
|
|
121
|
-
|
58
|
+
License
|
59
|
+
-------
|
60
|
+
Released under the MIT License. See the [LICENSE][] file for further details.
|
122
61
|
|
123
|
-
|
62
|
+
[license]: LICENSE
|
data/bently.gemspec
CHANGED
@@ -4,11 +4,10 @@ require "bently/version"
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = 'bently'
|
6
6
|
s.version = Bently::VERSION
|
7
|
-
s.
|
8
|
-
s.
|
9
|
-
s.description = "Bently executes (bakes) predefined formulas (recipes) for trivial stuff you do a lot"
|
7
|
+
s.summary = "Application-level dependency installation/configuration recipe manager"
|
8
|
+
s.description = "Bently is a community maintained library of recipes for the installation and configuration of application-level dependencies"
|
10
9
|
s.authors = ["Benjamin Sullivan"]
|
11
|
-
s.email = '
|
10
|
+
s.email = 'ruby-bently@googlegroups.com'
|
12
11
|
s.homepage = 'http://github.com/bonsaiben/bently'
|
13
12
|
|
14
13
|
s.add_dependency "thor", ">= 0.14.6"
|
data/bin/bently
CHANGED
data/lib/bently/base.rb
ADDED
@@ -0,0 +1,108 @@
|
|
1
|
+
module Bently
|
2
|
+
|
3
|
+
class Base < Thor
|
4
|
+
include Thor::Actions
|
5
|
+
|
6
|
+
desc 'list [STRING]', 'list recipes'
|
7
|
+
def list str=nil
|
8
|
+
recipes = Recipebook.all
|
9
|
+
recipes = recipes.select{|r| r =~ /#{str}/ } if str
|
10
|
+
recipes.each {|f| puts f }
|
11
|
+
end
|
12
|
+
|
13
|
+
desc 'read [RECIPE]', 'display a recipe'
|
14
|
+
method_options :pretend => true
|
15
|
+
def read recipe
|
16
|
+
recipe = Recipebook.find(recipe)
|
17
|
+
exec recipe
|
18
|
+
end
|
19
|
+
|
20
|
+
desc 'bake [RECIPE]', 'execute a recipe'
|
21
|
+
method_option :step, :default => false, :type => :boolean, :desc => "step through the recipe and prompt before executing each operation"
|
22
|
+
def bake recipe
|
23
|
+
recipe = Recipebook.find(recipe)
|
24
|
+
if options['step']
|
25
|
+
step recipe
|
26
|
+
else
|
27
|
+
exec recipe
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
desc 'source [RECIPE]', 'print the URL for the source of the instructions contained in the recipe'
|
32
|
+
def source recipe
|
33
|
+
recipe = Recipebook.find(recipe)
|
34
|
+
puts recipe.homepage
|
35
|
+
end
|
36
|
+
|
37
|
+
|
38
|
+
protected
|
39
|
+
|
40
|
+
def step recipe
|
41
|
+
recipe.breakdown.each do |op|
|
42
|
+
pretendly { run_operation op }
|
43
|
+
a = ask("Perform this operation [y,n,q]?").downcase
|
44
|
+
exit if a == 'q'
|
45
|
+
if a == 'y'
|
46
|
+
quietly { run_operation op }
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
def pretendly
|
52
|
+
set_option :pretend, true
|
53
|
+
yield
|
54
|
+
set_option :pretend, false
|
55
|
+
end
|
56
|
+
|
57
|
+
def quietly
|
58
|
+
set_option :quiet, true
|
59
|
+
yield
|
60
|
+
set_option :quiet, false
|
61
|
+
end
|
62
|
+
|
63
|
+
def set_option option, val
|
64
|
+
self.options = self.options.merge(option => val)
|
65
|
+
end
|
66
|
+
|
67
|
+
def exec recipe
|
68
|
+
recipe.breakdown.each do |op|
|
69
|
+
run_operation op
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
def run_operation op
|
74
|
+
case op
|
75
|
+
when Recipe::Say
|
76
|
+
op.status ? say_status(*op.args) : say(*op.args)
|
77
|
+
when Recipe::Run
|
78
|
+
run op.command
|
79
|
+
when Recipe::Create
|
80
|
+
create_file *op.args
|
81
|
+
when Recipe::Modify
|
82
|
+
gsub_file *op.args
|
83
|
+
when Recipe::Append
|
84
|
+
create_file op.file unless File.exists? op.file
|
85
|
+
say_status *op.say if op.say
|
86
|
+
append_to_file *op.args
|
87
|
+
when Recipe::Prepend
|
88
|
+
create_file op.file unless File.exists? op.file
|
89
|
+
prepend_to_file *op.args
|
90
|
+
when Recipe::Insert
|
91
|
+
insert_into_file *op.args
|
92
|
+
when Recipe::Remove
|
93
|
+
remove_file *op.args
|
94
|
+
end
|
95
|
+
op.after.each{|s,t| say_status s, t, :magenta } if op.after
|
96
|
+
end
|
97
|
+
|
98
|
+
#def confirmed_step? step
|
99
|
+
# yes? tab(magenta("#{step.action}?"))
|
100
|
+
#end
|
101
|
+
|
102
|
+
#def cancel_step
|
103
|
+
# puts red(tab('skipped'))
|
104
|
+
#end
|
105
|
+
|
106
|
+
end
|
107
|
+
|
108
|
+
end
|
@@ -4,37 +4,35 @@
|
|
4
4
|
|
5
5
|
class String
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
7
|
+
def camelize
|
8
|
+
string = self
|
9
|
+
string = string.sub(/^[a-z\d]*/) { $&.capitalize }
|
10
|
+
string = string.gsub(/\-/,'_')
|
11
|
+
string.gsub(/(?:_|(\/))([a-z\d]*)/i) { "#{$1}#{$2.capitalize}" }.gsub('/', '::')
|
12
|
+
end
|
13
13
|
|
14
|
+
if Module.method(:const_get).arity == 1
|
14
15
|
def constantize
|
15
16
|
names = self.split('::')
|
16
17
|
names.shift if names.empty? || names.first.empty?
|
17
18
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
constant = constant.ancestors.inject do |const, ancestor|
|
29
|
-
break const if ancestor == Object
|
30
|
-
break ancestor if ancestor.const_defined?(name, false)
|
31
|
-
const
|
32
|
-
end
|
19
|
+
constant = Object
|
20
|
+
names.each do |name|
|
21
|
+
constant = constant.const_defined?(name) ? constant.const_get(name) : constant.const_missing(name)
|
22
|
+
end
|
23
|
+
constant
|
24
|
+
end
|
25
|
+
else
|
26
|
+
def constantize
|
27
|
+
names = self.split('::')
|
28
|
+
names.shift if names.empty? || names.first.empty?
|
33
29
|
|
34
|
-
|
35
|
-
|
36
|
-
|
30
|
+
constant = Object
|
31
|
+
names.each do |name|
|
32
|
+
constant = constant.const_defined?(name, false) ? constant.const_get(name) : constant.const_missing(name)
|
37
33
|
end
|
34
|
+
constant
|
38
35
|
end
|
36
|
+
end
|
39
37
|
|
40
38
|
end
|
@@ -2,34 +2,16 @@ module Bently
|
|
2
2
|
|
3
3
|
class ActionMailer < RailsRecipe
|
4
4
|
|
5
|
-
|
6
|
-
step :add_welcome_email_method
|
7
|
-
step :touch_welcome_email_html
|
8
|
-
step :touch_welcome_email_text
|
5
|
+
homepage 'http://guides.rubyonrails.org/action_mailer_basics.html'
|
9
6
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
:with => welcome_email_method,
|
16
|
-
:after => /^.*default.*$/
|
17
|
-
)
|
7
|
+
def initialize
|
8
|
+
generate 'mailer UserMailer'
|
9
|
+
insert 'app/mailers/user_mailer.rb', welcome_email_method, :after => /^.*default.*$/
|
10
|
+
create './app/views/user_mailer/welcome_email.html.erb', welcome_email_html
|
11
|
+
create './app/views/user_mailer/welcome_email.text.erb', welcome_email_text
|
18
12
|
end
|
19
13
|
|
20
|
-
|
21
|
-
touch(
|
22
|
-
:file => './app/views/user_mailer/welcome_email.html.erb',
|
23
|
-
:with => welcome_email_html
|
24
|
-
)
|
25
|
-
end
|
26
|
-
|
27
|
-
def touch_welcome_email_text
|
28
|
-
touch(
|
29
|
-
:file => './app/views/user_mailer/welcome_email.text.erb',
|
30
|
-
:with => welcome_email_text
|
31
|
-
)
|
32
|
-
end
|
14
|
+
protected
|
33
15
|
|
34
16
|
def welcome_email_method
|
35
17
|
%{
|
@@ -76,7 +58,7 @@ To login to the site, just follow this link: <%= @url %>.
|
|
76
58
|
Thanks for joining and have a great day!
|
77
59
|
}
|
78
60
|
end
|
79
|
-
|
61
|
+
|
80
62
|
end
|
81
63
|
|
82
64
|
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module Bently
|
2
|
+
class CucumberRails < RailsRecipe
|
3
|
+
|
4
|
+
name 'cucumber-rails'
|
5
|
+
category 'gem'
|
6
|
+
description 'downloads and installs cucumber-rails gem'
|
7
|
+
homepage 'https://github.com/cucumber/cucumber-rails'
|
8
|
+
version '1.3.0'
|
9
|
+
|
10
|
+
def initialize
|
11
|
+
gem_group :test, :development do
|
12
|
+
gem "cucumber-rails", :require => false
|
13
|
+
gem "database_cleaner"
|
14
|
+
end
|
15
|
+
bundle
|
16
|
+
generate 'cucumber:install'
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
end
|
data/lib/bently/recipe/devise.rb
CHANGED
@@ -1,20 +1,18 @@
|
|
1
1
|
module Bently
|
2
|
-
|
3
2
|
class Devise < RailsRecipe
|
4
|
-
|
5
|
-
step :add_gem, "gem 'devise'"
|
6
|
-
step :shell, 'bundle install'
|
7
|
-
step :shell, 'rails g devise:install'
|
8
|
-
step :generate_model
|
9
3
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
4
|
+
name 'devise'
|
5
|
+
category 'gem'
|
6
|
+
description 'downloads and installs devise gem'
|
7
|
+
homepage 'https://github.com/plataformatec/devise/blob/master/README.md'
|
8
|
+
version '2.0'
|
9
|
+
|
10
|
+
def initialize
|
11
|
+
gem 'devise'
|
12
|
+
bundle
|
13
|
+
generate 'devise:install'
|
14
|
+
todo 'rails generate devise MODEL'
|
16
15
|
end
|
17
16
|
|
18
17
|
end
|
19
|
-
|
20
18
|
end
|
@@ -1,35 +1,38 @@
|
|
1
1
|
module Bently
|
2
|
-
|
3
2
|
class FactoryGirlRails < RailsRecipe
|
4
3
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
protected
|
4
|
+
name 'factory_girl_rails'
|
5
|
+
category 'gem'
|
6
|
+
description 'downloads and installs factory_girl_rails gem'
|
7
|
+
homepage 'https://github.com/thoughtbot/factory_girl_rails/blob/master/README.md'
|
10
8
|
|
11
|
-
def
|
12
|
-
|
9
|
+
def initialize
|
10
|
+
gem_group :test do
|
11
|
+
gem "factory_girl_rails", "~> 4.0"
|
12
|
+
end
|
13
|
+
bundle
|
14
|
+
create './spec/factories.rb', factory_file
|
13
15
|
end
|
14
16
|
|
17
|
+
protected
|
18
|
+
|
15
19
|
def factory_file
|
16
|
-
%{# # This will guess the User class
|
17
|
-
# FactoryGirl.define do
|
18
|
-
# factory :user do
|
19
|
-
# first_name "John"
|
20
|
-
# last_name "Doe"
|
21
|
-
# admin false
|
22
|
-
# end
|
23
|
-
#
|
24
|
-
# # This will use the User class (Admin would have been guessed)
|
25
|
-
# factory :admin, class: User do
|
26
|
-
# first_name "Admin"
|
27
|
-
# last_name "User"
|
28
|
-
# admin true
|
29
|
-
# end
|
30
|
-
# end}
|
20
|
+
%{# # This will guess the User class
|
21
|
+
# FactoryGirl.define do
|
22
|
+
# factory :user do
|
23
|
+
# first_name "John"
|
24
|
+
# last_name "Doe"
|
25
|
+
# admin false
|
26
|
+
# end
|
27
|
+
#
|
28
|
+
# # This will use the User class (Admin would have been guessed)
|
29
|
+
# factory :admin, class: User do
|
30
|
+
# first_name "Admin"
|
31
|
+
# last_name "User"
|
32
|
+
# admin true
|
33
|
+
# end
|
34
|
+
# end}
|
31
35
|
end
|
32
36
|
|
33
37
|
end
|
34
|
-
|
35
38
|
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Bently
|
2
|
+
class ForemanThin < RailsRecipe
|
3
|
+
|
4
|
+
name 'foreman-thin'
|
5
|
+
category 'gem'
|
6
|
+
description 'downloads and installs foreman and thin Ruby gems'
|
7
|
+
homepage 'https://devcenter.heroku.com/articles/rails3#webserver'
|
8
|
+
|
9
|
+
def initialize
|
10
|
+
gem 'thin'
|
11
|
+
bundle
|
12
|
+
append 'Procfile', 'web: bundle exec thin start -p $PORT -e $RACK_ENV'
|
13
|
+
run 'gem install foreman'
|
14
|
+
run 'echo "RACK_ENV=development" >>.env'
|
15
|
+
todo 'foreman start'
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Bently
|
2
|
+
class Foreman < RubyRecipe
|
3
|
+
|
4
|
+
name 'foreman'
|
5
|
+
category 'gem'
|
6
|
+
description 'downloads and installs foreman gem'
|
7
|
+
homepage 'https://github.com/ddollar/foreman/blob/master/README.md'
|
8
|
+
|
9
|
+
def initialize
|
10
|
+
append 'Procfile', 'web: bundle exec rails server -p $PORT -e $RACK_ENV'
|
11
|
+
run 'gem install foreman'
|
12
|
+
run 'echo "RACK_ENV=development" >>.env'
|
13
|
+
todo 'foreman start'
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module Bently
|
2
|
+
|
3
|
+
class GitignoreEmacs < Recipe
|
4
|
+
|
5
|
+
homepage 'https://github.com/github/gitignore/blob/master/Global/Emacs.gitignore'
|
6
|
+
|
7
|
+
def initialize
|
8
|
+
append '.gitignore', gitignore
|
9
|
+
end
|
10
|
+
|
11
|
+
protected
|
12
|
+
|
13
|
+
def gitignore
|
14
|
+
%{*~
|
15
|
+
\#*\#
|
16
|
+
/.emacs.desktop
|
17
|
+
/.emacs.desktop.lock
|
18
|
+
.elc
|
19
|
+
auto-save-list
|
20
|
+
tramp
|
21
|
+
.\#*
|
22
|
+
|
23
|
+
# Org-mode
|
24
|
+
.org-id-locations
|
25
|
+
*_archive}
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Bently
|
2
|
+
|
3
|
+
class GitignoreLinux < Recipe
|
4
|
+
|
5
|
+
homepage 'https://github.com/github/gitignore/blob/master/Global/Linux.gitignore'
|
6
|
+
|
7
|
+
def initialize
|
8
|
+
append '.gitignore', gitignore
|
9
|
+
end
|
10
|
+
|
11
|
+
protected
|
12
|
+
|
13
|
+
def gitignore
|
14
|
+
%{.*
|
15
|
+
!.gitignore
|
16
|
+
*~}
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|