tsrails 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +674 -0
- data/README.md +137 -0
- data/Rakefile +83 -0
- data/bin/tsrails +34 -0
- data/lib/constants.rb +29 -0
- data/lib/create.rb +68 -0
- data/lib/errors.rb +12 -0
- data/lib/helpers.rb +93 -0
- data/template/files/Gem.gemfile +56 -0
- data/template/files/Guardfile +36 -0
- data/template/files/Termfile +37 -0
- data/template/files/_flashes.html.haml +3 -0
- data/template/files/_footer.html.haml +8 -0
- data/template/files/_javascript.html.haml +1 -0
- data/template/files/_sidebar.html.haml +3 -0
- data/template/files/_sign_in_out.html.haml +4 -0
- data/template/files/apache_config.conf +18 -0
- data/template/files/app_config.yml +11 -0
- data/template/files/application.html.haml +21 -0
- data/template/files/application_helper.rb +6 -0
- data/template/files/backtrace_silencers.rb +10 -0
- data/template/files/clearance.rb +7 -0
- data/template/files/cucumber.yml +8 -0
- data/template/files/debug_steps.rb +18 -0
- data/template/files/env.rb +58 -0
- data/template/files/factory_girl_steps.rb +1 -0
- data/template/files/haml_options.rb +3 -0
- data/template/files/jquery.rb +12 -0
- data/template/files/mailer_macros.rb +11 -0
- data/template/files/mongrel_cluster.yml +7 -0
- data/template/files/noisy_attr_accessible.rb +5 -0
- data/template/files/prefilled_input.js +59 -0
- data/template/files/rcov.opts +2 -0
- data/template/files/requires.rb +7 -0
- data/template/files/spec.opts +4 -0
- data/template/files/spec_helper.rb +37 -0
- data/template/files/tiny_mce.yml +16 -0
- data/template/tsrails_3_2.rb +233 -0
- data/tsrails.gemspec +72 -0
- metadata +110 -0
data/README.md
ADDED
@@ -0,0 +1,137 @@
|
|
1
|
+
**TSRails** is a base Rails project that you can upgrade. It is used by
|
2
|
+
[Taylored Software][] as a foundation for their Rails development
|
3
|
+
efforts.
|
4
|
+
|
5
|
+
**TSRails** is based upon the excellent [suspenders][] gem from
|
6
|
+
[thoughtbot][], extended and modified to include other setup tasks commonly
|
7
|
+
performed in Taylored Software's Rails environment.
|
8
|
+
|
9
|
+
Using TSRails
|
10
|
+
-------------
|
11
|
+
|
12
|
+
To create a new project first install tsrails:
|
13
|
+
|
14
|
+
gem install tsrails
|
15
|
+
|
16
|
+
Then run:
|
17
|
+
|
18
|
+
tsrails create projectname
|
19
|
+
|
20
|
+
or:
|
21
|
+
|
22
|
+
tsrails new projectname
|
23
|
+
|
24
|
+
This will create a project in `projectname`, and will check it into version
|
25
|
+
control (Git) using the settings specified in the configuration file (see
|
26
|
+
below.)
|
27
|
+
|
28
|
+
Configuration
|
29
|
+
=============
|
30
|
+
|
31
|
+
The **TSRails** gem requires several configuration options which define things
|
32
|
+
like the staging server, Git username, etc. THese are defined in a
|
33
|
+
configuration file, ~/.tsrails.yml, which is automatically generated if it
|
34
|
+
is not present.
|
35
|
+
|
36
|
+
The configuration file should contain the following keys:
|
37
|
+
|
38
|
+
- **staging_server** - The hostname of the Git/staging Web server
|
39
|
+
- **staging_ssh_user** - The ssh user to use for accessing the remote server
|
40
|
+
- **remote_git_dir** - The root of the Git directory tree on the remote server
|
41
|
+
- **remote_apache_dir** - The root of the Apache directory tree on the remote
|
42
|
+
server
|
43
|
+
- **test_app_domain** - The domain of the remote server (used for generating
|
44
|
+
an Apache/mod_passenger configuration for the test site.
|
45
|
+
|
46
|
+
As mentioned above, this configuration file is automatically generated if it's
|
47
|
+
not present when `tsrails` runs. However, the generated configuration file is
|
48
|
+
almost certainly incorrect, so tsrails will abort after generating a new
|
49
|
+
configuration file to allow you to edit it.
|
50
|
+
|
51
|
+
About TSRails
|
52
|
+
-------------
|
53
|
+
|
54
|
+
**TSRails** was created for use at [Taylored Software][] as a baseline application
|
55
|
+
setup, with reasonable default plugins that the majority (if not all) of our
|
56
|
+
applications used, as well as best-practice configuration options.
|
57
|
+
|
58
|
+
Although **TSRails** has been packaged as a general-purpose gem, it does (at
|
59
|
+
present) make several assumptions that are specific to Taylored Software's
|
60
|
+
server configuration and which may not be what you want:
|
61
|
+
|
62
|
+
- The Git repository and Web server live on the same server
|
63
|
+
- The Web site is to be deployed with Apache 2.2/mod_passenger and
|
64
|
+
with Ruby Enterprise Edition installed in /opt/ree
|
65
|
+
|
66
|
+
Included Gems
|
67
|
+
-------------
|
68
|
+
|
69
|
+
TSRails includes the following gems in the generated application along with
|
70
|
+
their associated configuration files:
|
71
|
+
|
72
|
+
- **User Login and Authentication**
|
73
|
+
- Clearance
|
74
|
+
- **Template and Markup Processing**
|
75
|
+
- HAML
|
76
|
+
- RedCloth
|
77
|
+
- **Form Enhancements**
|
78
|
+
- Paperclip
|
79
|
+
- tiny_mce
|
80
|
+
- flutie
|
81
|
+
- formtastic
|
82
|
+
- **View Enhancements**
|
83
|
+
- WillPaginate
|
84
|
+
- **Application Infrastructure**
|
85
|
+
- Hpricot
|
86
|
+
- exception_notification
|
87
|
+
- Nokogiri
|
88
|
+
- Ryan Bates's `nifty-generators`
|
89
|
+
- **Database Adapters**
|
90
|
+
- SQLite3 (development and test environments)
|
91
|
+
- MySQL (production environment)
|
92
|
+
- **Deployment**
|
93
|
+
- Capistrano
|
94
|
+
- Heroku
|
95
|
+
- Mongrel and mongrel_cluster
|
96
|
+
|
97
|
+
TSRails also includes the following BDD/testing tools:
|
98
|
+
|
99
|
+
- factory_girl
|
100
|
+
- RSpec
|
101
|
+
- Shoulda
|
102
|
+
- capybara
|
103
|
+
- Timecop
|
104
|
+
|
105
|
+
Initializers (in config/initializers)
|
106
|
+
-------------------------------------
|
107
|
+
|
108
|
+
- `backtrace_silencers.rb`: Configured to silence backtraces from Shoulda and
|
109
|
+
factory_girl
|
110
|
+
- `app_config.rb`: Loads application settings from config/app_config.yml
|
111
|
+
- `clearance.rb`: Configuration for Clearance
|
112
|
+
- `haml_options.rb`: Configures HAML options
|
113
|
+
- `jquery.rb`: Substitutes jQuery for Prototype.JS
|
114
|
+
- `noisy_attr_accessible.rb`: Logs protected attribute assignments
|
115
|
+
- `requires.rb`: Autoloads libraries in `lib/` and `lib/extensions`
|
116
|
+
|
117
|
+
Version History
|
118
|
+
---------------
|
119
|
+
|
120
|
+
- 2.0.0 - 2012 Jan 30 - Updated for Rails 3.2
|
121
|
+
- 1.2.2 - 2011 Jan 11 - Using jquery-rails gem instead of doing the heavy lifting ourselves
|
122
|
+
- 1.2.1 - 2010 Dec 19 - Replaced RVM Ruby 1.9.2-head with REE 1.8.7-head
|
123
|
+
- 1.2.0 - 2010 Dec 11 - Replaced `defined_app_name` with `@app_name` throughout,
|
124
|
+
added `ask_with_default` helper, various fixes for Ruby 1.9.2 compatibility
|
125
|
+
- 1.1.2 - 2010 Nov 19 - Change .rvmrc template to use Rails 1.9.2-head, and
|
126
|
+
update a few things in the Gemfile
|
127
|
+
- 1.1.1 - 2010 Nov 11 - Prepare test DB after installing Clearance, change `RAILS_ROOT` to
|
128
|
+
`::Rails.root.to_s`
|
129
|
+
- 1.1.0 - 2010 Nov 11 - Fixed various bugs in the code generation
|
130
|
+
- 1.0.6 - 2010 Nov 10 - Fixed a bug with autotest failing
|
131
|
+
- 1.0.5 - 2010 Nov 10 - Fixed a template bug and updated the readme
|
132
|
+
- 1.0.4 - 2010 Nov 10 - Added configuration file
|
133
|
+
- 1.0.3 - 2010 Nov 10 - Initial public version
|
134
|
+
|
135
|
+
[Taylored Software]: http://www.taylored-software.com/
|
136
|
+
[thoughtbot]: http://www.thoughtbot.com/
|
137
|
+
[suspenders]: https://github.com/thoughtbot/suspenders
|
data/Rakefile
ADDED
@@ -0,0 +1,83 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
require 'date'
|
4
|
+
|
5
|
+
TSRAILS_GEM_VERSION = '2.0.0'
|
6
|
+
|
7
|
+
#############################################################################
|
8
|
+
# Helper functions
|
9
|
+
#############################################################################
|
10
|
+
|
11
|
+
def name
|
12
|
+
@name ||= Dir['*.gemspec'].first.split('.').first
|
13
|
+
end
|
14
|
+
|
15
|
+
def version
|
16
|
+
TSRAILS_GEM_VERSION
|
17
|
+
end
|
18
|
+
|
19
|
+
def date
|
20
|
+
Date.today.to_s
|
21
|
+
end
|
22
|
+
|
23
|
+
def gemspec_file
|
24
|
+
"#{name}.gemspec"
|
25
|
+
end
|
26
|
+
|
27
|
+
def gem_file
|
28
|
+
"#{name}-#{version}.gem"
|
29
|
+
end
|
30
|
+
|
31
|
+
def replace_header(head, header_name)
|
32
|
+
head.sub!(/(\.#{header_name}\s*= ').*'/) { "#{$1}#{send(header_name)}'"}
|
33
|
+
end
|
34
|
+
|
35
|
+
#############################################################################
|
36
|
+
# Packaging tasks
|
37
|
+
#############################################################################
|
38
|
+
|
39
|
+
task :release => :build do
|
40
|
+
unless `git branch` =~ /^\* master$/
|
41
|
+
puts "You must be on the master branch to release!"
|
42
|
+
exit!
|
43
|
+
end
|
44
|
+
sh "git commit --allow-empty -a -m 'Release #{version}'"
|
45
|
+
sh "git tag v#{version}"
|
46
|
+
sh "git push origin master"
|
47
|
+
sh "git push --tags"
|
48
|
+
sh "gem push pkg/#{name}-#{version}.gem"
|
49
|
+
end
|
50
|
+
|
51
|
+
task :build => :gemspec do
|
52
|
+
sh "mkdir -p pkg"
|
53
|
+
sh "gem build #{gemspec_file}"
|
54
|
+
sh "mv #{gem_file} pkg"
|
55
|
+
end
|
56
|
+
|
57
|
+
task :gemspec do
|
58
|
+
# read spec file and split out manifest section
|
59
|
+
spec = File.read(gemspec_file)
|
60
|
+
head, manifest, tail = spec.split(" # = MANIFEST =\n")
|
61
|
+
|
62
|
+
# replace name version and date
|
63
|
+
replace_header(head, :name)
|
64
|
+
replace_header(head, :version)
|
65
|
+
replace_header(head, :date)
|
66
|
+
|
67
|
+
# determine file list from git ls-files
|
68
|
+
files = `git ls-files`.
|
69
|
+
split("\n").
|
70
|
+
sort.
|
71
|
+
reject { |file| file =~ /^\./ }.
|
72
|
+
reject { |file| file =~ /^(rdoc|pkg)/ }.
|
73
|
+
map { |file| " #{file}" }.
|
74
|
+
join("\n")
|
75
|
+
|
76
|
+
# piece file back together and write
|
77
|
+
manifest = " s.files = %w[\n#{files}\n ]\n"
|
78
|
+
spec = [head, manifest, tail].join(" # = MANIFEST =\n")
|
79
|
+
File.open(gemspec_file, 'w') { |io| io.write(spec) }
|
80
|
+
puts "Updated #{gemspec_file}"
|
81
|
+
end
|
82
|
+
|
83
|
+
task :default => :build
|
data/bin/tsrails
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require File.expand_path(File.dirname(__FILE__) + "/../lib/create")
|
4
|
+
require File.expand_path(File.dirname(__FILE__) + "/../lib/constants")
|
5
|
+
require File.expand_path(File.dirname(__FILE__) + "/../lib/errors")
|
6
|
+
|
7
|
+
require 'rubygems'
|
8
|
+
require 'rails'
|
9
|
+
require 'colored'
|
10
|
+
require 'net/http'
|
11
|
+
require 'net/ssh'
|
12
|
+
|
13
|
+
include TSRails::Errors
|
14
|
+
|
15
|
+
def usage
|
16
|
+
"Usage: #{File.basename(__FILE__)} create new_project_name"
|
17
|
+
end
|
18
|
+
|
19
|
+
case ARGV[0]
|
20
|
+
when 'create', '--create', 'new', '--new'
|
21
|
+
if ARGV[1].nil?
|
22
|
+
puts usage
|
23
|
+
else
|
24
|
+
begin
|
25
|
+
TSRails::Create.run!(ARGV[1])
|
26
|
+
rescue TSRails::InvalidInput => e
|
27
|
+
error_with_message(e.message)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
when 'help', '--help'
|
31
|
+
puts usage
|
32
|
+
else
|
33
|
+
error_with_message "Unknown subcommand: #{ARGV[0]}\n#{usage}"
|
34
|
+
end
|
data/lib/constants.rb
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'yaml'
|
3
|
+
require 'erb'
|
4
|
+
require 'etc'
|
5
|
+
|
6
|
+
module TSRails
|
7
|
+
class Constants
|
8
|
+
def self.get(var_name)
|
9
|
+
tsrails_config = File.expand_path(File.join("~", ".tsrails.yml"))
|
10
|
+
|
11
|
+
unless File.exist?(tsrails_config)
|
12
|
+
File.open(tsrails_config, 'w') do |f|
|
13
|
+
f.printf "# Configuration for the TSRails gem - EDIT THIS!\n"
|
14
|
+
f.printf "staging_server: staging.server.com\n"
|
15
|
+
f.printf "staging_ssh_user: %s\n", Etc.getlogin
|
16
|
+
f.printf "remote_git_dir: /var/git\n"
|
17
|
+
f.printf "remote_apache_dir: /var/sites\n"
|
18
|
+
f.printf "test_app_domain: example.com\n"
|
19
|
+
end
|
20
|
+
puts "A tsrails configuration file was generated as "
|
21
|
+
puts " #{tsrails_config}"
|
22
|
+
puts "Please edit it as appropriate and rerun the tsrails command."
|
23
|
+
exit 1
|
24
|
+
end
|
25
|
+
tsrails_config = YAML.load_file(tsrails_config)
|
26
|
+
tsrails_config[var_name.to_s]
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
data/lib/create.rb
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
# Methods needed to create a project.
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require File.expand_path(File.dirname(__FILE__) + "/errors")
|
5
|
+
require File.expand_path(File.dirname(__FILE__) + "/constants.rb")
|
6
|
+
require File.expand_path(File.dirname(__FILE__) + "/helpers.rb")
|
7
|
+
|
8
|
+
require 'rubygems'
|
9
|
+
require 'rails'
|
10
|
+
require 'colored'
|
11
|
+
require 'net/http'
|
12
|
+
require 'net/ssh'
|
13
|
+
|
14
|
+
module TSRails
|
15
|
+
class Create
|
16
|
+
attr_accessor :project_path
|
17
|
+
|
18
|
+
def self.run!(project_path)
|
19
|
+
creator = self.new(project_path)
|
20
|
+
creator.create_project!
|
21
|
+
end
|
22
|
+
|
23
|
+
def initialize(project_path)
|
24
|
+
self.project_path = project_path
|
25
|
+
validate_project_path
|
26
|
+
validate_project_name
|
27
|
+
end
|
28
|
+
|
29
|
+
def create_project!
|
30
|
+
exec(<<-COMMAND)
|
31
|
+
rails new #{project_path} \
|
32
|
+
--template=#{template} \
|
33
|
+
--skip-prototype \
|
34
|
+
--skip-test-unit
|
35
|
+
COMMAND
|
36
|
+
end
|
37
|
+
|
38
|
+
private
|
39
|
+
|
40
|
+
def validate_project_name
|
41
|
+
project_name = File.basename(project_path)
|
42
|
+
unless project_name =~ /^[a-z0-9_]+$/
|
43
|
+
raise InvalidInput.new("Project name must only contain [a-z0-9_]")
|
44
|
+
end
|
45
|
+
if git_name_taken?(project_name)
|
46
|
+
raise InvalidInput.new("Project name \"#{project_name}\" already taken in Git")
|
47
|
+
end
|
48
|
+
if apache_name_taken?(project_name)
|
49
|
+
raise InvalidInput.new("Project name \"#{project_name}\" already taken in Apache")
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
def validate_project_path
|
54
|
+
base_directory = Dir.pwd
|
55
|
+
full_path = File.join(base_directory, project_path)
|
56
|
+
|
57
|
+
# This is for the common case for the user's convenience; the race
|
58
|
+
# condition can still occur.
|
59
|
+
if File.exists?(full_path)
|
60
|
+
raise InvalidInput.new("Project directory (#{project_path}) already exists")
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
def template
|
65
|
+
File.expand_path(File.join(File.dirname(__FILE__), "..", "template", "tsrails_3_2.rb"))
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
data/lib/errors.rb
ADDED
data/lib/helpers.rb
ADDED
@@ -0,0 +1,93 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rails'
|
3
|
+
require 'colored'
|
4
|
+
require 'net/http'
|
5
|
+
require 'net/ssh'
|
6
|
+
|
7
|
+
#============================================================================
|
8
|
+
# Helper functions
|
9
|
+
#============================================================================
|
10
|
+
|
11
|
+
def get_file(http_location, file)
|
12
|
+
uri = URI.parse(http_location)
|
13
|
+
contents = Net::HTTP.get(uri)
|
14
|
+
File.open(file, "w") { |f| f.write(contents) }
|
15
|
+
end
|
16
|
+
|
17
|
+
def msg(message)
|
18
|
+
msg :info, message
|
19
|
+
end
|
20
|
+
|
21
|
+
def ask_with_default(prompt, default_value)
|
22
|
+
msg = "#{prompt} [#{default_value}]"
|
23
|
+
result = ask(msg)
|
24
|
+
if result.nil?
|
25
|
+
result = default_value
|
26
|
+
end
|
27
|
+
result
|
28
|
+
end
|
29
|
+
|
30
|
+
def msg(mtype, message)
|
31
|
+
printf "[".white.bold
|
32
|
+
if (mtype.nil?)
|
33
|
+
printf "message".green
|
34
|
+
elsif (mtype.to_s.blank?)
|
35
|
+
printf "message".green
|
36
|
+
elsif (mtype.to_s.downcase == "info")
|
37
|
+
printf "info".cyan
|
38
|
+
elsif (mtype.to_s.downcase == "warning")
|
39
|
+
printf "warning".red
|
40
|
+
else
|
41
|
+
printf "message".green
|
42
|
+
end
|
43
|
+
printf "] ".white.bold
|
44
|
+
printf "#{message}\n"
|
45
|
+
end
|
46
|
+
|
47
|
+
def remote_dir_exists?(hostname, username, dir_path)
|
48
|
+
output = ""
|
49
|
+
Net::SSH.start(hostname, username) do |ssh|
|
50
|
+
output = ssh.exec!("ls -d #{dir_path} 2>/dev/null | wc -l").chomp.strip
|
51
|
+
end
|
52
|
+
output == "1"
|
53
|
+
end
|
54
|
+
|
55
|
+
def git_name_taken?(project_name)
|
56
|
+
remote_dir_exists?(TSRails::Constants.get(:staging_server), TSRails::Constants.get(:staging_ssh_user), "#{TSRails::Constants.get(:remote_git_dir)}/#{project_name}.git")
|
57
|
+
end
|
58
|
+
|
59
|
+
def apache_name_taken?(project_name)
|
60
|
+
remote_dir_exists?(TSRails::Constants.get(:staging_server), TSRails::Constants.get(:staging_ssh_user), "#{TSRails::Constants.get(:remote_apache_dir)}/#{project_name}.taylored-software.com")
|
61
|
+
end
|
62
|
+
|
63
|
+
def concat_file(source, destination)
|
64
|
+
contents = IO.read(find_in_source_paths(source))
|
65
|
+
append_file destination, contents
|
66
|
+
end
|
67
|
+
|
68
|
+
def replace_in_file(relative_path, find, replace)
|
69
|
+
path = File.join(destination_root, relative_path)
|
70
|
+
contents = IO.read(path)
|
71
|
+
unless contents.gsub!(find, replace)
|
72
|
+
raise "#{find.inspect} not found in #{relative_path}"
|
73
|
+
end
|
74
|
+
File.open(path, "w") { |file| file.write(contents) }
|
75
|
+
end
|
76
|
+
|
77
|
+
def action_mailer_host(rails_env, host)
|
78
|
+
inject_into_file(
|
79
|
+
"config/environments/#{rails_env}.rb",
|
80
|
+
"\n\n config.action_mailer.default_url_options = { :host => '#{host}' }",
|
81
|
+
:before => "\nend"
|
82
|
+
)
|
83
|
+
end
|
84
|
+
|
85
|
+
def section(descr)
|
86
|
+
printf "\n"
|
87
|
+
msg :info, descr
|
88
|
+
end
|
89
|
+
|
90
|
+
def replace_file (filename, content)
|
91
|
+
remove_file filename
|
92
|
+
file filename, content
|
93
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
source 'http://rubygems.org'
|
2
|
+
|
3
|
+
gem 'rake', '0.9.2'
|
4
|
+
|
5
|
+
gem 'rails', '3.2.1'
|
6
|
+
gem 'sqlite3'
|
7
|
+
gem 'bcrypt-ruby', '~> 3.0.0'
|
8
|
+
gem 'meta_search', '>= 1.1.0.pre'
|
9
|
+
gem 'clearance'
|
10
|
+
gem 'therubyracer'
|
11
|
+
|
12
|
+
gem 'kaminari'
|
13
|
+
gem 'haml'
|
14
|
+
gem 'haml-rails', :group => :development
|
15
|
+
gem 'simple_form'
|
16
|
+
gem 'jquery-rails'
|
17
|
+
gem 'prawn'
|
18
|
+
gem 'activemerchant'
|
19
|
+
gem 'draper'
|
20
|
+
|
21
|
+
group :development do
|
22
|
+
gem 'growl'
|
23
|
+
gem 'thin'
|
24
|
+
end
|
25
|
+
|
26
|
+
group :development, :test do
|
27
|
+
gem 'rb-fsevent', :require => false if RUBY_PLATFORM =~ /darwin/i
|
28
|
+
gem 'rails3-generators'
|
29
|
+
gem 'annotate'
|
30
|
+
gem 'spork', '>= 0.9.0.rc'
|
31
|
+
gem 'guard'
|
32
|
+
gem 'guard-bundler'
|
33
|
+
gem 'guard-coffeescript'
|
34
|
+
gem 'guard-rspec'
|
35
|
+
gem 'guard-sass'
|
36
|
+
gem 'guard-spork'
|
37
|
+
gem 'guard-rails'
|
38
|
+
gem 'guard-annotate'
|
39
|
+
gem 'simplecov', :require => false
|
40
|
+
end
|
41
|
+
|
42
|
+
group :test do
|
43
|
+
gem 'database_cleaner'
|
44
|
+
gem 'rails3-generators' #mainly for factory_girl & simple_form at this point
|
45
|
+
gem 'rspec-rails'
|
46
|
+
gem 'factory_girl_rails'
|
47
|
+
gem 'capybara'
|
48
|
+
gem 'launchy'
|
49
|
+
gem 'shoulda', '>= 3.0.0.beta'
|
50
|
+
end
|
51
|
+
|
52
|
+
group :assets do
|
53
|
+
gem 'sass-rails', " ~> 3.2.3"
|
54
|
+
gem 'coffee-rails', "~> 3.2.1"
|
55
|
+
gem 'uglifier', '>= 1.0.3'
|
56
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
guard 'bundler' do
|
2
|
+
watch('Gemfile')
|
3
|
+
end
|
4
|
+
|
5
|
+
guard 'spork', cucumber_env: { 'RAILS_ENV' => 'test' }, rspec_env: { 'RAILS_ENV' => 'test' }, wait: 120 do
|
6
|
+
watch('config/application.rb')
|
7
|
+
watch('config/environment.rb')
|
8
|
+
watch(%r{^config/environments/.+\.rb$})
|
9
|
+
watch(%r{^config/initializers/.+\.rb$})
|
10
|
+
|
11
|
+
watch('Gemfile')
|
12
|
+
watch('Gemfile.lock')
|
13
|
+
|
14
|
+
watch('spec/spec_helper.rb') { :rspec }
|
15
|
+
watch(%r{features/support/}) { :cucumber }
|
16
|
+
watch(%r{^spec/support/.+\.rb$})
|
17
|
+
end
|
18
|
+
|
19
|
+
guard 'rspec', version: 2, cli: '--drb', all_on_start: false, all_after_pass: false do
|
20
|
+
watch(%r{^spec/.+_spec\.rb$})
|
21
|
+
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
|
22
|
+
watch('spec/spec_helper.rb') { "spec" }
|
23
|
+
|
24
|
+
# Rails example
|
25
|
+
watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
|
26
|
+
watch(%r{^app/(.*)(\.erb|\.haml)$}) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
|
27
|
+
watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] }
|
28
|
+
watch(%r{^spec/requests/.+_spec\.rb$}) { "spec/requests"}
|
29
|
+
watch(%r{^spec/support/(.+)\.rb$}) { "spec" }
|
30
|
+
watch('config/routes.rb') { "spec/routing" }
|
31
|
+
watch('app/controllers/application_controller.rb') { "spec/controllers" }
|
32
|
+
watch(%r{^app/views/(.+)/}) { |m| "spec/requests/#{m[1]}_spec.rb" }
|
33
|
+
|
34
|
+
# Capybara request specs
|
35
|
+
watch(%r{^app/views/(.+)/.*\.(erb|haml)$}) { |m| "spec/requests/#{m[1]}_spec.rb" }
|
36
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
FILE_BASE = "/Users/tlcravit/code/<%= @app_name %>"
|
2
|
+
|
3
|
+
window do
|
4
|
+
before { run "cd #{FILE_BASE}" }
|
5
|
+
|
6
|
+
run "mate ."
|
7
|
+
run "tab_title 'shell (bash)'"
|
8
|
+
|
9
|
+
tab "server" do
|
10
|
+
run "tab_title 'server (thin)'"
|
11
|
+
run "bundle exec thin start"
|
12
|
+
end
|
13
|
+
|
14
|
+
if File.exist?("#{FILE_BASE}/Guardfile")
|
15
|
+
tab "guard" do
|
16
|
+
run "tab_title 'guard'"
|
17
|
+
run "guard"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
if File.exist?("#{FILE_BASE}/logs/development.log")
|
22
|
+
tab "log" do
|
23
|
+
run "tab_title 'development log'"
|
24
|
+
run "tail -f \"#{FILE_BASE}/logs/development.log\""
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
tab "console" do
|
29
|
+
run "tab_title 'console (pry)'"
|
30
|
+
run "pry -r ./config/environment"
|
31
|
+
end
|
32
|
+
|
33
|
+
tab "shell" do
|
34
|
+
run "tab_title 'shell (bash)'"
|
35
|
+
run "/usr/local/bin/bash --login"
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
= yield :javascript
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<VirtualHost *:80>
|
2
|
+
ServerName <%= @app_name %>.<%= TSRails::Constants.get(:test_app_domain) %>
|
3
|
+
DocumentRoot <%= TSRails::Constants.get(:remote_apache_dir) %>/<%= @app_name %>.<%= TSRails::Constants.get(:test_app_domain) %>/current/public
|
4
|
+
|
5
|
+
ErrorLog <%= TSRails::Constants.get(:remote_apache_dir) %>/<%= @app_name %>.<%= TSRails::Constants.get(:test_app_domain) %>/current/log/apache_error_log
|
6
|
+
|
7
|
+
RailsSpawnMethod smart
|
8
|
+
PassengerMaxRequests 5000
|
9
|
+
PassengerStatThrottleRate 5
|
10
|
+
RailsAppSpawnerIdleTime 0
|
11
|
+
RailsFrameworkSpawnerIdleTime 0
|
12
|
+
PassengerPoolIdleTime 1000
|
13
|
+
|
14
|
+
<Directory "<%= TSRails::Constants.get(:remote_apache_dir) %>/<%= @app_name %>.<%= TSRails::Constants.get(:test_app_domain) %>/current/public">
|
15
|
+
Allow from all
|
16
|
+
Options -MultiViews
|
17
|
+
</Directory>
|
18
|
+
</VirtualHost>
|
@@ -0,0 +1,21 @@
|
|
1
|
+
!!!
|
2
|
+
%html
|
3
|
+
%head
|
4
|
+
%meta{"http-equiv" => "Content-type", :content => "text/html; charset=utf-8"}
|
5
|
+
%title= @page_title || "Page Title"
|
6
|
+
= stylesheet_link_tag "application"
|
7
|
+
= javascript_include_tag "application"
|
8
|
+
= csrf_meta_tags
|
9
|
+
= yield :head
|
10
|
+
%body.bp.two-col
|
11
|
+
#container
|
12
|
+
#header
|
13
|
+
Web Site
|
14
|
+
#sidebar
|
15
|
+
= render :partial => 'shared/sidebar'
|
16
|
+
#content
|
17
|
+
= render :partial => 'shared/flashes'
|
18
|
+
= yield
|
19
|
+
= render :partial => 'shared/javascript'
|
20
|
+
#footer
|
21
|
+
= render :partial => 'shared/footer'
|