flatiron-rails 1.0.11 → 2.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.
- checksums.yaml +4 -4
- data/bin/flatiron-rails +3 -0
- data/lib/flatiron_rails.rb +3 -4
- data/lib/postgres_checker.rb +28 -0
- data/templates/flatiron.rb +21 -11
- metadata +5 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e7b171a610df19e5fd48c48f703abb24cb487707
|
4
|
+
data.tar.gz: 5d1c0cc825af3dd0077c05737f0e7716f07061b7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 19ba816ba07e229dbe4a42fab3e528d05690ae768d9fde6dc92cfffc3e5a4b36eeb0540c6bd5f6b3684f3f173e25baf8fa0232433f2e3ab32300353b52af8cf9
|
7
|
+
data.tar.gz: dd7cb459e74bc71a838c08dde8b7d74695d42b7550f2082d29cec1efbcfbccb6f8b0eabd4f9a89f3e1ba18700194790ee1115040911361fc7d44f076149a8d4c
|
data/bin/flatiron-rails
CHANGED
data/lib/flatiron_rails.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
class FlatironRails
|
2
|
-
|
3
2
|
FLATIRON_ROOT = File.expand_path('../', File.dirname(__FILE__))
|
3
|
+
|
4
4
|
def self.run
|
5
5
|
if ['-v', '--version'].include?(ARGV[0])
|
6
6
|
puts <<-VERSION.gsub(/^ {6}/, '')
|
7
|
-
Flatiron Rails
|
7
|
+
Flatiron Rails 2.0.0
|
8
8
|
VERSION
|
9
9
|
elsif ARGV[0].nil? || ['-h','--help'].include?(ARGV[0]) || ARGV[0] != "new" || ARGV[2]
|
10
10
|
puts <<-HELP.gsub(/^ {6}/, '')
|
@@ -14,6 +14,5 @@ class FlatironRails
|
|
14
14
|
else
|
15
15
|
system("rails new #{ARGV[1]} -Tm #{FLATIRON_ROOT}/templates/flatiron.rb")
|
16
16
|
end
|
17
|
-
end
|
18
|
-
|
17
|
+
end
|
19
18
|
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
class PostgresChecker
|
2
|
+
def self.check
|
3
|
+
new.check
|
4
|
+
end
|
5
|
+
|
6
|
+
def check
|
7
|
+
if !brew_installed?
|
8
|
+
puts "You must have Homebrew installed."
|
9
|
+
exit
|
10
|
+
else
|
11
|
+
if !postgres_installed?
|
12
|
+
install_postgres
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def brew_installed?
|
18
|
+
!`which brew`.empty?
|
19
|
+
end
|
20
|
+
|
21
|
+
def postgres_installed?
|
22
|
+
!`brew ls --versions postgresql`.empty?
|
23
|
+
end
|
24
|
+
|
25
|
+
def install_postgres
|
26
|
+
system('brew install postgresql')
|
27
|
+
end
|
28
|
+
end
|
data/templates/flatiron.rb
CHANGED
@@ -1,8 +1,6 @@
|
|
1
1
|
# Prevent automatic run of bundle install
|
2
2
|
def run_bundle ; end
|
3
3
|
|
4
|
-
# TODO: Add check for postgres
|
5
|
-
|
6
4
|
# Helper method to write to secrets.yml
|
7
5
|
def add_secret_for(options)
|
8
6
|
key = "#{options.first[0].to_s}"
|
@@ -74,6 +72,11 @@ def add_line_to_file(file, line_to_add, line_to_add_after)
|
|
74
72
|
end
|
75
73
|
end
|
76
74
|
|
75
|
+
# Get formatted app name
|
76
|
+
def formatted_app_name
|
77
|
+
app_name.split(/_|-/).map(&:capitalize).join(' ')
|
78
|
+
end
|
79
|
+
|
77
80
|
# Remove sqlite3 from default gem group and set Ruby version to 2.1.2
|
78
81
|
remove_line_from_file("Gemfile", "sqlite3")
|
79
82
|
file '.ruby-version', <<-RVM.strip_heredoc.chomp
|
@@ -93,6 +96,8 @@ gem_group :test, :development do
|
|
93
96
|
gem 'database_cleaner'
|
94
97
|
gem 'sqlite3'
|
95
98
|
gem 'pry'
|
99
|
+
gem 'guard-rspec', require: false
|
100
|
+
gem 'thin'
|
96
101
|
end
|
97
102
|
|
98
103
|
gem_group :production do
|
@@ -109,7 +114,7 @@ run 'rm README.rdoc'
|
|
109
114
|
|
110
115
|
# Add template data to README.md
|
111
116
|
file 'README.md', <<-README.strip_heredoc.chomp
|
112
|
-
# #{
|
117
|
+
# #{formatted_app_name}
|
113
118
|
|
114
119
|
## Description
|
115
120
|
|
@@ -148,7 +153,7 @@ file 'README.md', <<-README.strip_heredoc.chomp
|
|
148
153
|
|
149
154
|
## License
|
150
155
|
|
151
|
-
|
156
|
+
#{formatted_app_name} is MIT Licensed. See LICENSE for details.
|
152
157
|
README
|
153
158
|
|
154
159
|
# Add LICENSE
|
@@ -176,12 +181,12 @@ file 'LICENSE', <<-MIT.strip_heredoc.chomp
|
|
176
181
|
SOFTWARE.
|
177
182
|
MIT
|
178
183
|
|
179
|
-
# Set Rails version to 4.1.
|
184
|
+
# Set Rails version to 4.1.4
|
180
185
|
File.open("Gemfile", "r+") do |f|
|
181
186
|
out = ""
|
182
187
|
f.each do |line|
|
183
188
|
if line =~ /gem 'rails'/
|
184
|
-
out << "#{line.gsub(/, '(.*)'/, ', \'4.1.
|
189
|
+
out << "#{line.gsub(/, '(.*)'/, ', \'4.1.4\'')}"
|
185
190
|
else
|
186
191
|
out << line
|
187
192
|
end
|
@@ -261,8 +266,13 @@ end
|
|
261
266
|
# Generate RSpec files
|
262
267
|
generate(:"rspec:install")
|
263
268
|
|
264
|
-
#
|
265
|
-
|
269
|
+
# Fix .rspec file to remove excessive warnings/properly setup
|
270
|
+
remove_line_from_file('.rspec', '--warnings')
|
271
|
+
remove_line_from_file('.rspec', '--require spec_helper')
|
272
|
+
add_line_to_file('.rspec', "\n--format documentation", '--color')
|
273
|
+
|
274
|
+
# Edit spec/rails_helper.rb
|
275
|
+
File.open("spec/rails_helper.rb", "r+") do |f|
|
266
276
|
out = ""
|
267
277
|
f.each do |line|
|
268
278
|
if line =~ /require 'rspec\/autorun'/
|
@@ -316,7 +326,7 @@ run('touch spec/features/.keep')
|
|
316
326
|
|
317
327
|
# Create feature_helper.rb
|
318
328
|
file 'spec/feature_helper.rb', <<-CODE.strip_heredoc.chomp
|
319
|
-
require '
|
329
|
+
require 'rails_helper'
|
320
330
|
require 'capybara/rails'
|
321
331
|
CODE
|
322
332
|
|
@@ -331,7 +341,7 @@ file 'Guardfile', %q(
|
|
331
341
|
guard :rspec do
|
332
342
|
watch(%r{^spec/.+_spec\.rb$})
|
333
343
|
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
|
334
|
-
watch('spec/
|
344
|
+
watch('spec/rails_helper.rb') { "spec" }
|
335
345
|
|
336
346
|
# Rails example
|
337
347
|
watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
|
@@ -449,7 +459,7 @@ file 'STACK.md', <<-STACK.strip_heredoc.chomp
|
|
449
459
|
* Google Analytics
|
450
460
|
|
451
461
|
TODO:
|
452
|
-
1. Add the line `ruby '2.1.
|
462
|
+
1. Add the line `ruby '2.1.2'` to the top of your Gemfile
|
453
463
|
2. An MIT License file has been created for you
|
454
464
|
* Add your name and the year
|
455
465
|
3. A README.md file has been started for you
|
metadata
CHANGED
@@ -1,16 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: flatiron-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
- Arel English
|
8
7
|
- Logan Hasson
|
9
|
-
- Katie Hoffman
|
10
8
|
autorequire:
|
11
9
|
bindir: bin
|
12
10
|
cert_chain: []
|
13
|
-
date: 2014-
|
11
|
+
date: 2014-07-28 00:00:00.000000000 Z
|
14
12
|
dependencies:
|
15
13
|
- !ruby/object:Gem::Dependency
|
16
14
|
name: rails
|
@@ -21,7 +19,7 @@ dependencies:
|
|
21
19
|
version: '4.1'
|
22
20
|
- - ">="
|
23
21
|
- !ruby/object:Gem::Version
|
24
|
-
version: 4.1.
|
22
|
+
version: 4.1.4
|
25
23
|
type: :runtime
|
26
24
|
prerelease: false
|
27
25
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -31,7 +29,7 @@ dependencies:
|
|
31
29
|
version: '4.1'
|
32
30
|
- - ">="
|
33
31
|
- !ruby/object:Gem::Version
|
34
|
-
version: 4.1.
|
32
|
+
version: 4.1.4
|
35
33
|
description: Sets up a rails application using the default Flatiron School stack.
|
36
34
|
email: logan@flatironschool.com
|
37
35
|
executables:
|
@@ -41,6 +39,7 @@ extra_rdoc_files: []
|
|
41
39
|
files:
|
42
40
|
- bin/flatiron-rails
|
43
41
|
- lib/flatiron_rails.rb
|
42
|
+
- lib/postgres_checker.rb
|
44
43
|
- templates/flatiron.rb
|
45
44
|
homepage: http://rubygems.org/gems/flatiron-rails
|
46
45
|
licenses:
|