zsh_dots 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +25 -0
- data/.gitmodules +3 -0
- data/.rvmrc +47 -0
- data/Gemfile +7 -0
- data/Gemfile.lock +38 -0
- data/README.md +115 -0
- data/Rakefile +9 -0
- data/bin/dots +7 -0
- data/bin/elocal_nightly.sh +12 -0
- data/bin/gbrt +42 -0
- data/bin/git_cwd_info +40 -0
- data/bin/lein +229 -0
- data/bin/reattach-to-user-namespace +0 -0
- data/bin/ssh-copy-id +54 -0
- data/bin/stock +83 -0
- data/config/.dot_file +1 -0
- data/config/aws +0 -0
- data/config/example.aws.zsh +13 -0
- data/config/gemrc +9 -0
- data/config/gitconfig +46 -0
- data/config/railsrc +2 -0
- data/config/rspec +2 -0
- data/config/rvmrc +1 -0
- data/config/screenrc +1 -0
- data/config/tmux.conf +6 -0
- data/config/zlogin +1 -0
- data/config/zshenv +59 -0
- data/config/zshrc +8 -0
- data/etc/mandlebrot.c +59 -0
- data/etc/rails/composer.yml +30 -0
- data/etc/rails/ember_template.rb +60 -0
- data/etc/rails/recipes/haml_views.rb +20 -0
- data/etc/rails/recipes/html5.rb +84 -0
- data/etc/rails/recipes/readme_markdown.rb +87 -0
- data/etc/rails/template.rb +1419 -0
- data/lib/dots/aliases.zsh +40 -0
- data/lib/dots/directories.zsh +28 -0
- data/lib/dots/functions.zsh +41 -0
- data/lib/dots/plugins.zsh +18 -0
- data/lib/dots.sh +11 -0
- data/lib/plugins/aws/aws.plugin.zsh +20 -0
- data/lib/plugins/bundler/_bundler +82 -0
- data/lib/plugins/bundler/bundler.plugin.zsh +7 -0
- data/lib/plugins/git/git.plugin.zsh +126 -0
- data/lib/plugins/git-flow/git-flow.plugin.zsh +340 -0
- data/lib/plugins/knife/_knife +183 -0
- data/lib/plugins/knife/knife.plugin.zsh +1 -0
- data/lib/plugins/macvim/macvim.plugin.zsh +13 -0
- data/lib/plugins/osx/_man-preview +5 -0
- data/lib/plugins/osx/osx.plugin.zsh +101 -0
- data/lib/plugins/rails3/rails3.plugin.zsh +75 -0
- data/lib/plugins/rake/rake.plugin.zsh +6 -0
- data/lib/plugins/ruby/ruby.plugin.zsh +58 -0
- data/lib/ruby/dots/command.rb +58 -0
- data/lib/ruby/dots/dot_file.rb +73 -0
- data/lib/ruby/dots/version.rb +3 -0
- data/lib/ruby/dots.rb +9 -0
- data/lib/tasks/db.rake +55 -0
- data/lib/tasks/dots.rake +32 -0
- data/spec/integration/command_spec.rb +34 -0
- data/spec/models/dot_file_spec.rb +45 -0
- data/spec/spec_helper.rb +6 -0
- data/vendor/antigen.zsh +251 -0
- data/vendor/oh-my-zsh/check_for_upgrade.sh +45 -0
- data/vendor/oh-my-zsh/install.sh +43 -0
- data/vendor/oh-my-zsh/require_tool.sh +161 -0
- data/vendor/oh-my-zsh/uninstall.sh +20 -0
- data/vendor/oh-my-zsh/upgrade.sh +6 -0
- data/zsh_dots.gemspec +28 -0
- metadata +163 -0
data/bin/stock
ADDED
@@ -0,0 +1,83 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
#
|
3
|
+
# = Stock
|
4
|
+
#
|
5
|
+
# Given a key/value pair of a stock symbol and how many shares you own, this
|
6
|
+
# program will spit out the yearly dividend amounts you will yield from holding
|
7
|
+
# it. Based on data from Yahoo! Finance.
|
8
|
+
#
|
9
|
+
# == Installation
|
10
|
+
# Install to ~/bin and run
|
11
|
+
# => <tt>chmod 777 stock</tt>
|
12
|
+
#
|
13
|
+
# Then edit your Shell config so that executables can be loaded from `~/bin`...
|
14
|
+
# => <tt>export PATH = $HOME/bin:$PATH</tt>
|
15
|
+
#
|
16
|
+
# Reload your shell with `source ~/.profile` and type
|
17
|
+
# => <tt>stock T=100</tt>
|
18
|
+
# to see how much you'll be making yearly through dividends.
|
19
|
+
#
|
20
|
+
# Author:: Tom Scott
|
21
|
+
# Homepage:: http://tinyurl.com/div-yield
|
22
|
+
|
23
|
+
require 'net/http'
|
24
|
+
require 'bigdecimal'
|
25
|
+
|
26
|
+
symbols_arr = Array.new
|
27
|
+
shares_of = {}
|
28
|
+
|
29
|
+
# A small function that shows the user how to use `stock`, then exits with error code=1
|
30
|
+
def usage(msg)
|
31
|
+
if msg
|
32
|
+
puts msg
|
33
|
+
puts "-----------------------------------------------------------------"
|
34
|
+
end
|
35
|
+
puts "Usage: stock {symbol}={shares} - prints out the current price and"
|
36
|
+
puts "yearly dividend yield in USD, based on how many shares you own."
|
37
|
+
exit 1
|
38
|
+
end
|
39
|
+
|
40
|
+
unless ARGV.empty?
|
41
|
+
ARGV.each do |arg|
|
42
|
+
unless arg == ''
|
43
|
+
arg_arr = arg.split '='
|
44
|
+
symbol = arg_arr[0]
|
45
|
+
shares_of[symbol] = arg_arr[1].to_i
|
46
|
+
symbols_arr.push(symbol)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
symbols = symbols_arr.join '+'
|
51
|
+
opts = 'syl9'
|
52
|
+
url = "http://download.finance.yahoo.com/d/quotes.csv?s=#{symbols}&f=#{opts}"
|
53
|
+
values = Net::HTTP.get URI(url)
|
54
|
+
stocks = values.split "\n"
|
55
|
+
|
56
|
+
unless stocks.empty?
|
57
|
+
stocks.each do |stock_str|
|
58
|
+
# raw data
|
59
|
+
stock = stock_str.split ','
|
60
|
+
symbol = stock[0].split('"').join('')
|
61
|
+
shares_of_stock = BigDecimal.new(shares_of[symbol].to_s)
|
62
|
+
dividend = stock[1].to_f
|
63
|
+
price = stock[2].to_f
|
64
|
+
|
65
|
+
if shares_of_stock > 0
|
66
|
+
# calculations
|
67
|
+
div_per_share = (price*dividend/100).round(2)
|
68
|
+
div_yield = (div_per_share*shares_of_stock).round(2)
|
69
|
+
|
70
|
+
# presentation
|
71
|
+
puts "#{symbol}:\t$#{div_yield}/year\t\t(@ #{div_per_share}/share)"
|
72
|
+
else
|
73
|
+
usage("You must specify more than 0 shares of #{symbol}.")
|
74
|
+
end
|
75
|
+
end
|
76
|
+
exit 0
|
77
|
+
else
|
78
|
+
symbols_str = symbols_arr.join ' '
|
79
|
+
usage("Search query failed for stocks #{symbols_str}.")
|
80
|
+
end
|
81
|
+
else
|
82
|
+
usage("No arguments specified.")
|
83
|
+
end
|
data/config/.dot_file
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
This is my config
|
data/config/aws
ADDED
File without changes
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# Put your AWS credentials here so they can be picked up by EC2 API/AMI
|
2
|
+
# tools.
|
3
|
+
|
4
|
+
# For AWS command-line tools
|
5
|
+
export AWS_ACCESS_KEY=""
|
6
|
+
export AWS_SECRET_KEY=""
|
7
|
+
|
8
|
+
# For AWS SDK
|
9
|
+
export AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY
|
10
|
+
export AWS_SECRET_ACCESS_KEY=$AWS_SECRET_KEY
|
11
|
+
export KNIFE_USER_NAME=''
|
12
|
+
export AWS_SSH_KEY_ID=''
|
13
|
+
|
data/config/gemrc
ADDED
data/config/gitconfig
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
[user]
|
2
|
+
name = Tom Scott
|
3
|
+
email = tubbo@psychedeli.ca
|
4
|
+
[repo]
|
5
|
+
user = tubbo
|
6
|
+
[github]
|
7
|
+
user = tubbo
|
8
|
+
[alias]
|
9
|
+
ci = commit
|
10
|
+
st = status
|
11
|
+
on = branch
|
12
|
+
br = branch
|
13
|
+
co = checkout
|
14
|
+
# Log display from screencast, with train tracks.
|
15
|
+
l = log --graph --pretty=format':%C(yellow)%h%Cblue%d%Creset %s %C(white) %an, %ar%Creset'
|
16
|
+
# Alternate log display from Scott Chacon
|
17
|
+
lol = log --pretty=oneline --abbrev-commit --graph --decorate
|
18
|
+
# Other useful aliases:
|
19
|
+
unstage = reset HEAD
|
20
|
+
staged = diff --cached
|
21
|
+
unstaged = diff
|
22
|
+
current-branch = !git symbolic-ref -q HEAD | sed -e 's|^refs/heads/||'
|
23
|
+
# Usage: git track origin/feature-123-login-form
|
24
|
+
track = checkout -t
|
25
|
+
[apply]
|
26
|
+
whitespace = warn
|
27
|
+
[color]
|
28
|
+
diff = auto
|
29
|
+
status = auto
|
30
|
+
branch = auto
|
31
|
+
ui = true
|
32
|
+
[help]
|
33
|
+
autocorrect = 1
|
34
|
+
[status]
|
35
|
+
submodule = 1
|
36
|
+
[push]
|
37
|
+
# Only push branches that have been set up to track a remote branch.
|
38
|
+
default = current
|
39
|
+
[core]
|
40
|
+
editor = vim
|
41
|
+
[mergetool "mvimdiff"]
|
42
|
+
cmd = mvim -d -g $LOCAL $MERGED $REMOTE
|
43
|
+
trustExitCode = true
|
44
|
+
[merge]
|
45
|
+
tool = mvimdiff
|
46
|
+
|
data/config/railsrc
ADDED
data/config/rspec
ADDED
data/config/rvmrc
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
rvm_trust_rvmrcs_flag=1
|
data/config/screenrc
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
shell -${SHELL}
|
data/config/tmux.conf
ADDED
data/config/zlogin
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
|
data/config/zshenv
ADDED
@@ -0,0 +1,59 @@
|
|
1
|
+
# ZSH configuration for all shells.
|
2
|
+
#
|
3
|
+
# Environment variable definitions go here, but that's about it. All
|
4
|
+
# other definitions go into zshrc or lib/plugins.
|
5
|
+
|
6
|
+
# Set the path to our shell configuration.
|
7
|
+
ZSH=$HOME/.dots
|
8
|
+
DOTS=$ZSH
|
9
|
+
|
10
|
+
# Set our shell paths to load from all of the bin's on the machine.
|
11
|
+
GOPATH=$HOME/Code/Go
|
12
|
+
PATH=/usr/local/bin:/usr/local/sbin:/usr/local/share/npm/bin:/usr/local/Cellar/python/2.7.1/bin:/usr/local/git/bin:/usr/bin:$HOME/.dots/bin:$HOME/.rvm/bin:$GOPATH:$PATH
|
13
|
+
MANPATH=/opt/local/share/man:$MANPATH
|
14
|
+
|
15
|
+
# Text editing and paging
|
16
|
+
EDITOR='vim'
|
17
|
+
PAGER='less -R'
|
18
|
+
|
19
|
+
# A more basic version of my promptstring for non-interactive shells.
|
20
|
+
PROMPT="♬ "
|
21
|
+
|
22
|
+
# PostgreSQL config
|
23
|
+
ARCHFLAGS='-arch x86_64'
|
24
|
+
PGDATA=/usr/local/var/postgres
|
25
|
+
|
26
|
+
# Configure the MySQL prompt to show more information.
|
27
|
+
MYSQL_PS1="\R:\m:\s \h> "
|
28
|
+
|
29
|
+
# Define the C compiler as GCC 4.2
|
30
|
+
CC=/usr/local/bin/gcc-4.2
|
31
|
+
|
32
|
+
# Disable weekly automatic update.
|
33
|
+
DISABLE_AUTO_UPDATE="true"
|
34
|
+
|
35
|
+
# Don't set iTerm/Terminal's title automatically.
|
36
|
+
DISABLE_AUTO_TITLE="true"
|
37
|
+
|
38
|
+
# Display red dots when ZSH is hanging.
|
39
|
+
COMPLETION_WAITING_DOTS="true"
|
40
|
+
|
41
|
+
# Load the framework.
|
42
|
+
source "$ZSH/lib/dots.sh"
|
43
|
+
|
44
|
+
# Make Ruby even faster
|
45
|
+
RUBY_HEAP_MIN_SLOTS=1000000
|
46
|
+
RUBY_HEAP_SLOTS_INCREMENT=1000000
|
47
|
+
RUBY_HEAP_SLOTS_GROWTH_FACTOR=1
|
48
|
+
RUBY_GC_MALLOC_LIMIT=1000000000
|
49
|
+
RUBY_HEAP_FREE_MIN=500000
|
50
|
+
|
51
|
+
# Always use Bundler with RVM.
|
52
|
+
USE_BUNDLER=force
|
53
|
+
|
54
|
+
# Colorize Grep
|
55
|
+
export GREP_OPTIONS='--color=auto'
|
56
|
+
export GREP_COLOR='1;32'
|
57
|
+
|
58
|
+
# Load interactive shell settings
|
59
|
+
source ~/.zshrc
|
data/config/zshrc
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
# ZSH configuration for interactive shells.
|
2
|
+
#
|
3
|
+
# Basically sets up your PROMPT/RPROMPT strings with colors, so
|
4
|
+
# everything looks pretty.
|
5
|
+
|
6
|
+
local path_prompt="%{$reset_color%}%~"
|
7
|
+
PROMPT="%{$fg[white]%}♬ %{$reset_color%}"
|
8
|
+
RPROMPT="%{$fg[yellow]%}${path_prompt}"
|
data/etc/mandlebrot.c
ADDED
@@ -0,0 +1,59 @@
|
|
1
|
+
#include <stdio.h>
|
2
|
+
#define GRID_SIZE 100
|
3
|
+
#define MAX_ITER 1000
|
4
|
+
|
5
|
+
|
6
|
+
int grid[GRID_SIZE][GRID_SIZE] = {0};
|
7
|
+
|
8
|
+
void printGrid(void) {
|
9
|
+
int i, j;
|
10
|
+
for(i = 0; i<GRID_SIZE; i++) {
|
11
|
+
for(j = 0; j<GRID_SIZE; j++) {
|
12
|
+
int iter = grid[i][j];
|
13
|
+
if(iter == -1) {
|
14
|
+
putchar(' ');
|
15
|
+
}
|
16
|
+
else if(iter < 20) {
|
17
|
+
putchar('/');
|
18
|
+
}
|
19
|
+
else if(iter < 50) {
|
20
|
+
putchar('^');
|
21
|
+
}
|
22
|
+
else if(iter < 100) {
|
23
|
+
putchar('/');
|
24
|
+
}
|
25
|
+
else {
|
26
|
+
putchar('(');
|
27
|
+
}
|
28
|
+
}
|
29
|
+
putchar('\n');
|
30
|
+
}
|
31
|
+
|
32
|
+
}
|
33
|
+
|
34
|
+
int main (void) {
|
35
|
+
int i, j, iter;
|
36
|
+
|
37
|
+
for(i = 0; i<GRID_SIZE; i++) {
|
38
|
+
for(j = 0; j<GRID_SIZE; j++) {
|
39
|
+
double x_0 = i/(GRID_SIZE/3.5)-2.5;
|
40
|
+
double y_0 = j/(GRID_SIZE/2.0)-1.0;
|
41
|
+
double x = 0, y = 0;
|
42
|
+
|
43
|
+
for (iter = 0; x*x + y*y < 4 && iter < MAX_ITER; iter++) {
|
44
|
+
double xtemp = x*x - y*y + x_0;
|
45
|
+
y = 2*x*y + y_0;
|
46
|
+
x = xtemp;
|
47
|
+
}
|
48
|
+
|
49
|
+
if(x*x + y*y < 4)
|
50
|
+
grid[i][j] = -1;
|
51
|
+
else {
|
52
|
+
grid[i][j] = iter;
|
53
|
+
}
|
54
|
+
}
|
55
|
+
}
|
56
|
+
|
57
|
+
printGrid();
|
58
|
+
return 0;
|
59
|
+
}
|
@@ -0,0 +1,30 @@
|
|
1
|
+
recipes:
|
2
|
+
- setup
|
3
|
+
- git
|
4
|
+
- readme_markdown
|
5
|
+
- gems
|
6
|
+
- testing
|
7
|
+
- auth
|
8
|
+
- models
|
9
|
+
- controllers
|
10
|
+
- views
|
11
|
+
- haml_views
|
12
|
+
- routes
|
13
|
+
- frontend
|
14
|
+
- html5
|
15
|
+
|
16
|
+
prefs:
|
17
|
+
:dev_webserver: thin
|
18
|
+
:prod_webserver: unicorn
|
19
|
+
:database: postgresql
|
20
|
+
:templates: haml
|
21
|
+
:unit_test: minitest
|
22
|
+
:integration: capybara
|
23
|
+
:fixtures: factory_girl
|
24
|
+
:frontend: bootstrap
|
25
|
+
:bootstrap: sass
|
26
|
+
:form_builder: simpleform
|
27
|
+
:email: gmail
|
28
|
+
:authentication: devise
|
29
|
+
:devise_modules: default
|
30
|
+
:authorization: none
|
@@ -0,0 +1,60 @@
|
|
1
|
+
# This script is designed to be used with Ruby on Rails' new project generator:
|
2
|
+
#
|
3
|
+
# rails new my_app -m http://emberjs.com/template.rb
|
4
|
+
#
|
5
|
+
# For more information about the template API, please see the following Rails
|
6
|
+
# guide:
|
7
|
+
#
|
8
|
+
# http://edgeguides.rubyonrails.org/rails_application_templates.html
|
9
|
+
|
10
|
+
run "rm public/index.html"
|
11
|
+
|
12
|
+
# Install required gems
|
13
|
+
gem "active_model_serializers"
|
14
|
+
gem_group :assets do
|
15
|
+
gem "ember-rails", github: "emberjs/ember-rails"
|
16
|
+
end
|
17
|
+
|
18
|
+
run "bundle install"
|
19
|
+
|
20
|
+
# This needs to be done outside the bootstrap generator
|
21
|
+
# to avoid an initial "unknown variant" error.
|
22
|
+
environment <<-RUBY.strip_heredoc, :env => :development
|
23
|
+
config.ember.variant = :development
|
24
|
+
RUBY
|
25
|
+
|
26
|
+
environment <<-RUBY.strip_heredoc, :env => :test
|
27
|
+
config.ember.variant = :development
|
28
|
+
RUBY
|
29
|
+
|
30
|
+
environment <<-RUBY.strip_heredoc, :env => :production
|
31
|
+
config.ember.variant = :production
|
32
|
+
RUBY
|
33
|
+
|
34
|
+
# Configure the app to serve Ember.js and app assets from an AssetsController
|
35
|
+
generate "ember:bootstrap"
|
36
|
+
generate "ember:install", "--head"
|
37
|
+
generate :controller, "Assets", "index"
|
38
|
+
run "rm app/views/assets/index.html.erb"
|
39
|
+
file 'app/views/assets/index.html.erb', <<-CODE
|
40
|
+
<!DOCTYPE html>
|
41
|
+
<html>
|
42
|
+
<head>
|
43
|
+
<title>Photoblog</title>
|
44
|
+
<%= stylesheet_link_tag "application", :media => "all" %>
|
45
|
+
<%= csrf_meta_tags %>
|
46
|
+
</head>
|
47
|
+
<body>
|
48
|
+
<%= javascript_include_tag "application" %>
|
49
|
+
</body>
|
50
|
+
</html>
|
51
|
+
CODE
|
52
|
+
run "rm -rf app/views/layouts"
|
53
|
+
route "root :to => 'assets#index'"
|
54
|
+
|
55
|
+
# Generate a default serializer that is compatible with ember-data
|
56
|
+
generate :serializer, "application", "--parent", "ActiveModel::Serializer"
|
57
|
+
inject_into_class "app/serializers/application_serializer.rb", 'ApplicationSerializer' do
|
58
|
+
" embed :ids, :include => true\n"
|
59
|
+
end
|
60
|
+
|
@@ -0,0 +1,20 @@
|
|
1
|
+
after_bundler do
|
2
|
+
say_wizard "recipe running after 'bundle install'"
|
3
|
+
|
4
|
+
# Convert all views to Haml
|
5
|
+
run "for i in `find app/views -name '*.erb'` ; do html2haml -e $i ${i%erb}haml ; rm $i ; done"
|
6
|
+
|
7
|
+
### GIT ###
|
8
|
+
git :add => '.' if prefer :git, true
|
9
|
+
git :commit => "-aqm 'rails_apps_composer: Haml starter views.'" if prefer :git, true
|
10
|
+
end # after_bundler
|
11
|
+
|
12
|
+
__END__
|
13
|
+
|
14
|
+
name: haml_views
|
15
|
+
description: "Convert views to Haml"
|
16
|
+
author: tubbo
|
17
|
+
|
18
|
+
requires: [setup, gems, auth, models, controllers, views]
|
19
|
+
run_after: [setup, gems, auth, models, controllers, views]
|
20
|
+
category: mvc
|
@@ -0,0 +1,84 @@
|
|
1
|
+
# Application template recipe for the rails_apps_composer. Check for a newer version here:
|
2
|
+
# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/html5.rb
|
3
|
+
|
4
|
+
after_bundler do
|
5
|
+
say_wizard "HTML5 recipe running 'after bundler'"
|
6
|
+
# add a humans.txt file
|
7
|
+
get 'https://raw.github.com/RailsApps/rails3-application-templates/master/files/humans.txt', 'public/humans.txt'
|
8
|
+
# install a front-end framework for HTML5 and CSS3
|
9
|
+
remove_file 'app/assets/stylesheets/application.css'
|
10
|
+
remove_file 'app/views/layouts/application.html.erb'
|
11
|
+
remove_file 'app/views/layouts/application.html.haml'
|
12
|
+
unless recipes.include? 'bootstrap'
|
13
|
+
if recipes.include? 'haml'
|
14
|
+
# Haml version of a simple application layout
|
15
|
+
get 'https://raw.github.com/RailsApps/rails3-application-templates/master/files/simple/views/layouts/application.html.haml', 'app/views/layouts/application.html.haml'
|
16
|
+
get 'https://raw.github.com/RailsApps/rails3-application-templates/master/files/simple/views/layouts/_messages.html.haml', 'app/views/layouts/_messages.html.haml'
|
17
|
+
else
|
18
|
+
# ERB version of a simple application layout
|
19
|
+
get 'https://raw.github.com/RailsApps/rails3-application-templates/master/files/simple/views/layouts/application.html.erb', 'app/views/layouts/application.html.erb'
|
20
|
+
get 'https://raw.github.com/RailsApps/rails3-application-templates/master/files/simple/views/layouts/_messages.html.erb', 'app/views/layouts/_messages.html.erb'
|
21
|
+
end
|
22
|
+
# simple css styles
|
23
|
+
get 'https://raw.github.com/RailsApps/rails3-application-templates/master/files/simple/assets/stylesheets/application.css.scss', 'app/assets/stylesheets/application.css.scss'
|
24
|
+
else # for Twitter Bootstrap
|
25
|
+
if recipes.include? 'haml'
|
26
|
+
# Haml version of a complex application layout using Twitter Bootstrap
|
27
|
+
get 'https://raw.github.com/RailsApps/rails3-application-templates/master/files/twitter-bootstrap/views/layouts/application.html.haml', 'app/views/layouts/application.html.haml'
|
28
|
+
get 'https://raw.github.com/RailsApps/rails3-application-templates/master/files/twitter-bootstrap/views/layouts/_messages.html.haml', 'app/views/layouts/_messages.html.haml'
|
29
|
+
else
|
30
|
+
# ERB version of a complex application layout using Twitter Bootstrap
|
31
|
+
get 'https://raw.github.com/RailsApps/rails3-application-templates/master/files/twitter-bootstrap/views/layouts/application.html.erb', 'app/views/layouts/application.html.erb'
|
32
|
+
get 'https://raw.github.com/RailsApps/rails3-application-templates/master/files/twitter-bootstrap/views/layouts/_messages.html.erb', 'app/views/layouts/_messages.html.erb'
|
33
|
+
end
|
34
|
+
# complex css styles using Twitter Bootstrap
|
35
|
+
get 'https://raw.github.com/RailsApps/rails3-application-templates/master/files/twitter-bootstrap/assets/stylesheets/application.css.scss', 'app/assets/stylesheets/application.css.scss'
|
36
|
+
end
|
37
|
+
# get an appropriate navigation partial
|
38
|
+
if recipes.include? 'haml'
|
39
|
+
if recipes.include? 'devise'
|
40
|
+
if recipes.include? 'authorization'
|
41
|
+
get 'https://raw.github.com/RailsApps/rails3-application-templates/master/files/navigation/devise/authorization/_navigation.html.haml', 'app/views/layouts/_navigation.html.haml'
|
42
|
+
else
|
43
|
+
get 'https://raw.github.com/RailsApps/rails3-application-templates/master/files/navigation/devise/_navigation.html.haml', 'app/views/layouts/_navigation.html.haml'
|
44
|
+
end
|
45
|
+
elsif recipes.include? 'omniauth'
|
46
|
+
get 'https://raw.github.com/RailsApps/rails3-application-templates/master/files/navigation/omniauth/_navigation.html.haml', 'app/views/layouts/_navigation.html.haml'
|
47
|
+
elsif recipes.include? 'subdomains'
|
48
|
+
get 'https://raw.github.com/RailsApps/rails3-application-templates/master/files/navigation/subdomains/_navigation.html.haml', 'app/views/layouts/_navigation.html.haml'
|
49
|
+
else
|
50
|
+
get 'https://raw.github.com/RailsApps/rails3-application-templates/master/files/navigation/none/_navigation.html.haml', 'app/views/layouts/_navigation.html.haml'
|
51
|
+
end
|
52
|
+
else
|
53
|
+
if recipes.include? 'devise'
|
54
|
+
if recipes.include? 'authorization'
|
55
|
+
get 'https://raw.github.com/RailsApps/rails3-application-templates/master/files/navigation/devise/authorization/_navigation.html.erb', 'app/views/layouts/_navigation.html.erb'
|
56
|
+
else
|
57
|
+
get 'https://raw.github.com/RailsApps/rails3-application-templates/master/files/navigation/devise/_navigation.html.erb', 'app/views/layouts/_navigation.html.erb'
|
58
|
+
end
|
59
|
+
elsif recipes.include? 'omniauth'
|
60
|
+
get 'https://raw.github.com/RailsApps/rails3-application-templates/master/files/navigation/omniauth/_navigation.html.erb', 'app/views/layouts/_navigation.html.erb'
|
61
|
+
elsif recipes.include? 'subdomains'
|
62
|
+
get 'https://raw.github.com/RailsApps/rails3-application-templates/master/files/navigation/subdomains/_navigation.html.erb', 'app/views/layouts/_navigation.html.erb'
|
63
|
+
else
|
64
|
+
get 'https://raw.github.com/RailsApps/rails3-application-templates/master/files/navigation/none/_navigation.html.erb', 'app/views/layouts/_navigation.html.erb'
|
65
|
+
end
|
66
|
+
end
|
67
|
+
if recipes.include? 'haml'
|
68
|
+
gsub_file 'app/views/layouts/application.html.haml', /App_Name/, "#{app_name.humanize.titleize}"
|
69
|
+
gsub_file 'app/views/layouts/_navigation.html.haml', /App_Name/, "#{app_name.humanize.titleize}"
|
70
|
+
else
|
71
|
+
gsub_file 'app/views/layouts/application.html.erb', /App_Name/, "#{app_name.humanize.titleize}"
|
72
|
+
gsub_file 'app/views/layouts/_navigation.html.erb', /App_Name/, "#{app_name.humanize.titleize}"
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
__END__
|
77
|
+
|
78
|
+
name: html5
|
79
|
+
description: "Install HTML5 boilerplate code."
|
80
|
+
author: tubbo
|
81
|
+
|
82
|
+
requires: [setup, gems, frontend]
|
83
|
+
run_after: [setup, gems, frontend]
|
84
|
+
category: frontend
|
@@ -0,0 +1,87 @@
|
|
1
|
+
# Application template recipe for the rails_apps_composer. Change the recipe here:
|
2
|
+
# https://github.com/RailsApps/rails_apps_composer/blob/master/recipes/readme.rb
|
3
|
+
|
4
|
+
after_everything do
|
5
|
+
say_wizard "recipe running after everything"
|
6
|
+
|
7
|
+
# remove default READMEs
|
8
|
+
%w{
|
9
|
+
README
|
10
|
+
README.rdoc
|
11
|
+
doc/README_FOR_APP
|
12
|
+
}.each { |file| remove_file file }
|
13
|
+
|
14
|
+
# add placeholder READMEs and humans.txt file
|
15
|
+
copy_from_repo 'public/humans.txt'
|
16
|
+
copy_from_repo 'README'
|
17
|
+
copy_from_repo 'README.md'
|
18
|
+
gsub_file "README", /App_Name/, "#{app_name.humanize.titleize}"
|
19
|
+
gsub_file "README.md", /App_Name/, "#{app_name.humanize.titleize}"
|
20
|
+
|
21
|
+
# Diagnostics
|
22
|
+
gsub_file "README.md", /recipes that are known/, "recipes that are NOT known" if diagnostics[:recipes] == 'fail'
|
23
|
+
gsub_file "README.md", /preferences that are known/, "preferences that are NOT known" if diagnostics[:prefs] == 'fail'
|
24
|
+
gsub_file "README.md", /RECIPES/, recipes.sort.inspect
|
25
|
+
gsub_file "README.md", /PREFERENCES/, prefs.inspect
|
26
|
+
gsub_file "README", /RECIPES/, recipes.sort.inspect
|
27
|
+
gsub_file "README", /PREFERENCES/, prefs.inspect
|
28
|
+
|
29
|
+
# Ruby on Rails
|
30
|
+
gsub_file "README.md", /\* Ruby/, "* Ruby version #{RUBY_VERSION}"
|
31
|
+
gsub_file "README.md", /\* Rails/, "* Rails version #{Rails::VERSION::STRING}"
|
32
|
+
|
33
|
+
# Database
|
34
|
+
gsub_file "README.md", /SQLite/, "PostgreSQL" if prefer :database, 'postgresql'
|
35
|
+
gsub_file "README.md", /SQLite/, "MySQL" if prefer :database, 'mysql'
|
36
|
+
gsub_file "README.md", /SQLite/, "MongoDB" if prefer :database, 'mongodb'
|
37
|
+
gsub_file "README.md", /ActiveRecord/, "the Mongoid ORM" if prefer :orm, 'mongoid'
|
38
|
+
|
39
|
+
# Template Engine
|
40
|
+
gsub_file "README.md", /ERB/, "Haml" if prefer :templates, 'haml'
|
41
|
+
gsub_file "README.md", /ERB/, "Slim" if prefer :templates, 'slim'
|
42
|
+
|
43
|
+
# Testing Framework
|
44
|
+
gsub_file "README.md", /Test::Unit/, "RSpec" if prefer :unit_test, 'rspec'
|
45
|
+
gsub_file "README.md", /RSpec/, "RSpec and Cucumber" if prefer :integration, 'cucumber'
|
46
|
+
gsub_file "README.md", /RSpec/, "RSpec and Factory Girl" if prefer :fixtures, 'factory_girl'
|
47
|
+
gsub_file "README.md", /RSpec/, "RSpec and Machinist" if prefer :fixtures, 'machinist'
|
48
|
+
|
49
|
+
# Front-end Framework
|
50
|
+
gsub_file "README.md", /Front-end Framework: None/, "Front-end Framework: Twitter Bootstrap (Sass)" if prefer :bootstrap, 'sass'
|
51
|
+
gsub_file "README.md", /Front-end Framework: None/, "Front-end Framework: Twitter Bootstrap (Less)" if prefer :bootstrap, 'less'
|
52
|
+
gsub_file "README.md", /Front-end Framework: None/, "Front-end Framework: Zurb Foundation" if prefer :frontend, 'foundation'
|
53
|
+
gsub_file "README.md", /Front-end Framework: None/, "Front-end Framework: Skeleton" if prefer :frontend, 'skeleton'
|
54
|
+
gsub_file "README.md", /Front-end Framework: None/, "Front-end Framework: Normalized CSS" if prefer :frontend, 'normalize'
|
55
|
+
|
56
|
+
# Form Builder
|
57
|
+
gsub_file "README.md", /Form Builder: None/, "Form Builder: SimpleForm" if prefer :form_builder, 'simple_form'
|
58
|
+
|
59
|
+
# Email
|
60
|
+
unless prefer :email, 'none'
|
61
|
+
gsub_file "README.md", /Gmail/, "SMTP" if prefer :email, 'smtp'
|
62
|
+
gsub_file "README.md", /Gmail/, "SendGrid" if prefer :email, 'sendgrid'
|
63
|
+
gsub_file "README.md", /Gmail/, "Mandrill" if prefer :email, 'mandrill'
|
64
|
+
else
|
65
|
+
gsub_file "README.md", /h2. Email/, ""
|
66
|
+
gsub_file "README.md", /The application is configured to send email using a Gmail account./, ""
|
67
|
+
end
|
68
|
+
|
69
|
+
# Authentication and Authorization
|
70
|
+
gsub_file "README.md", /Authentication: None/, "Authentication: Devise" if prefer :authentication, 'devise'
|
71
|
+
gsub_file "README.md", /Authentication: None/, "Authentication: OmniAuth" if prefer :authentication, 'omniauth'
|
72
|
+
gsub_file "README.md", /Authorization: None/, "Authorization: CanCan" if prefer :authorization, 'cancan'
|
73
|
+
|
74
|
+
git :add => '.' if prefer :git, true
|
75
|
+
git :commit => "-aqm 'rails_apps_composer: add README files'" if prefer :git, true
|
76
|
+
|
77
|
+
end # after_everything
|
78
|
+
|
79
|
+
__END__
|
80
|
+
|
81
|
+
name: readme_markdown
|
82
|
+
description: "Build a Markdown README file for your application."
|
83
|
+
author: tubbo
|
84
|
+
|
85
|
+
requires: [setup]
|
86
|
+
run_after: [setup]
|
87
|
+
category: configuration
|