learn-generate 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.
- checksums.yaml +7 -0
- data/.gitignore +22 -0
- data/.rspec +2 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +54 -0
- data/Rakefile +1 -0
- data/bin/learn-generate +43 -0
- data/learn-generate.gemspec +23 -0
- data/lib/learn_generate/file_finder.rb +19 -0
- data/lib/learn_generate/helpers/dot-learn-helper.rb +12 -0
- data/lib/learn_generate/helpers/gemfile-helper.rb +48 -0
- data/lib/learn_generate/helpers/template-helper.rb +52 -0
- data/lib/learn_generate/template_loader.rb +96 -0
- data/lib/learn_generate/template_maker.rb +115 -0
- data/lib/learn_generate/version.rb +3 -0
- data/lib/learn_generate.rb +10 -0
- data/lib/templates/activerecord/.gitignore +0 -0
- data/lib/templates/activerecord/.rspec +3 -0
- data/lib/templates/activerecord/README.md +5 -0
- data/lib/templates/activerecord/Rakefile +22 -0
- data/lib/templates/activerecord/app/models/sample-class.rb +2 -0
- data/lib/templates/activerecord/config/environment.rb +26 -0
- data/lib/templates/activerecord/db/migrations/.keep +0 -0
- data/lib/templates/activerecord/lib/support/connection_adapter.rb +15 -0
- data/lib/templates/activerecord/lib/support/db_registry.rb +4 -0
- data/lib/templates/activerecord/spec/spec_helper.rb +21 -0
- data/lib/templates/command-line/.gitignore +0 -0
- data/lib/templates/command-line/.rspec +3 -0
- data/lib/templates/command-line/README.md +5 -0
- data/lib/templates/command-line/bin/runner.rb +4 -0
- data/lib/templates/command-line/lib/environment.rb +5 -0
- data/lib/templates/command-line/lib/lab-name/cli.rb +4 -0
- data/lib/templates/command-line/spec/spec_helper.rb +80 -0
- data/lib/templates/front-end/.gitignore +0 -0
- data/lib/templates/front-end/README.md +5 -0
- data/lib/templates/front-end/css/style.css +0 -0
- data/lib/templates/front-end/images/.keep +0 -0
- data/lib/templates/front-end/index.html +11 -0
- data/lib/templates/fundamental-ruby/.gitignore +0 -0
- data/lib/templates/fundamental-ruby/.rspec +3 -0
- data/lib/templates/fundamental-ruby/README.md +5 -0
- data/lib/templates/fundamental-ruby/lib/file.rb +0 -0
- data/lib/templates/fundamental-ruby/spec/spec_helper.rb +80 -0
- data/lib/templates/js/README.md +5 -0
- data/lib/templates/js/css/.keep +0 -0
- data/lib/templates/js/images/.keep +0 -0
- data/lib/templates/js/index.html +8 -0
- data/lib/templates/js/js/file.js +0 -0
- data/lib/templates/js/js/jquery-1.8.3.min.js +2 -0
- data/lib/templates/js/requires.yml +6 -0
- data/lib/templates/js/spec/.keep +0 -0
- data/lib/templates/kids/.DS_Store +0 -0
- data/lib/templates/kids/.rspec +3 -0
- data/lib/templates/kids/README.md +14 -0
- data/lib/templates/kids/lib/file.rb +0 -0
- data/lib/templates/kids/spec/spec_helper.rb +80 -0
- data/lib/templates/rack/.gitignore +0 -0
- data/lib/templates/rack/.rspec +3 -0
- data/lib/templates/rack/README.md +5 -0
- data/lib/templates/rack/app/application.rb +7 -0
- data/lib/templates/rack/app/controllers/erb_maker.rb +2 -0
- data/lib/templates/rack/config/environment.rb +8 -0
- data/lib/templates/rack/config.ru +4 -0
- data/lib/templates/rack/lib/templates/my_cool_response.html.erb +5 -0
- data/lib/templates/rack/spec/controllers/01_server_port_spec.rb +11 -0
- data/lib/templates/rack/spec/spec_helper.rb +12 -0
- data/lib/templates/rack/spec/support/an_ok_request.rb +5 -0
- data/lib/templates/rake/.gitignore +0 -0
- data/lib/templates/rake/.rspec +3 -0
- data/lib/templates/rake/README.md +5 -0
- data/lib/templates/rake/Rakefile +6 -0
- data/lib/templates/rake/bin/console +20 -0
- data/lib/templates/rake/config/environment.rb +1 -0
- data/lib/templates/rake/lib/file.rb +0 -0
- data/lib/templates/rake/spec/rakefile_spec.rb +5 -0
- data/lib/templates/rake/spec/spec_helper.rb +9 -0
- data/lib/templates/sinatra-classic/.gitignore +0 -0
- data/lib/templates/sinatra-classic/.rspec +3 -0
- data/lib/templates/sinatra-classic/README.md +5 -0
- data/lib/templates/sinatra-classic/Rakefile +9 -0
- data/lib/templates/sinatra-classic/app.rb +4 -0
- data/lib/templates/sinatra-classic/config/environment.rb +7 -0
- data/lib/templates/sinatra-classic/config.ru +3 -0
- data/lib/templates/sinatra-classic/models/.keep +0 -0
- data/lib/templates/sinatra-classic/public/images/.keep +0 -0
- data/lib/templates/sinatra-classic/public/javascripts/.keep +0 -0
- data/lib/templates/sinatra-classic/public/stylesheets/.keep +0 -0
- data/lib/templates/sinatra-classic/spec/spec_helper.rb +5 -0
- data/lib/templates/sinatra-classic/views/.keep +0 -0
- data/lib/templates/sinatra-mvc/.gitignore +0 -0
- data/lib/templates/sinatra-mvc/.rspec +3 -0
- data/lib/templates/sinatra-mvc/Gemfile +15 -0
- data/lib/templates/sinatra-mvc/README.md +5 -0
- data/lib/templates/sinatra-mvc/Rakefile +10 -0
- data/lib/templates/sinatra-mvc/app/controllers/application_controller.rb +5 -0
- data/lib/templates/sinatra-mvc/app/models/.keep +0 -0
- data/lib/templates/sinatra-mvc/app/views/layout.erb +10 -0
- data/lib/templates/sinatra-mvc/config/environment.rb +11 -0
- data/lib/templates/sinatra-mvc/config.ru +14 -0
- data/lib/templates/sinatra-mvc/db/migrate/.keep +0 -0
- data/lib/templates/sinatra-mvc/db/seeds.rb +1 -0
- data/lib/templates/sinatra-mvc/public/stylesheets/.keep +0 -0
- data/lib/templates/sinatra-mvc/spec/controllers/.keep +0 -0
- data/lib/templates/sinatra-mvc/spec/features/.keep +0 -0
- data/lib/templates/sinatra-mvc/spec/models/.keep +0 -0
- data/lib/templates/sinatra-mvc/spec/spec_helper.rb +33 -0
- data/lib/templates/sql/.gitignore +0 -0
- data/lib/templates/sql/.rspec +3 -0
- data/lib/templates/sql/README.md +5 -0
- data/lib/templates/sql/bin/environment.rb +5 -0
- data/lib/templates/sql/bin/run.rb +6 -0
- data/lib/templates/sql/bin/sql_runner.rb +23 -0
- data/lib/templates/sql/lib/sample.sql +0 -0
- data/lib/templates/sql/spec/spec_helper.rb +84 -0
- data/spec/flatiron-lab-generator_spec.rb +81 -0
- data/spec/spec_helper.rb +12 -0
- metadata +192 -0
|
File without changes
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
require 'pry'
|
|
4
|
+
require 'rake'
|
|
5
|
+
|
|
6
|
+
begin
|
|
7
|
+
require_relative '../config/environment'
|
|
8
|
+
puts "Environment in config/environment loaded...welcome to your code."
|
|
9
|
+
rescue
|
|
10
|
+
puts "Unable to load environment from config/environment"
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
begin
|
|
14
|
+
load 'Rakefile'
|
|
15
|
+
puts "Rakefile loaded. See all your tasks with Rake::Task.tasks"
|
|
16
|
+
rescue
|
|
17
|
+
puts "Unable to load Rakefile"
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
Pry.start
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require_relative "../lib/%{file_name}"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
source 'http://rubygems.org'
|
|
2
|
+
|
|
3
|
+
gem 'activerecord', :require => 'active_record'
|
|
4
|
+
gem 'sinatra-activerecord', :require => 'sinatra/activerecord'
|
|
5
|
+
|
|
6
|
+
gem 'sinatra'
|
|
7
|
+
gem 'sqlite3'
|
|
8
|
+
gem 'tux'
|
|
9
|
+
gem 'pry'
|
|
10
|
+
gem 'pry-nav'
|
|
11
|
+
gem 'rake'
|
|
12
|
+
gem 'rspec'
|
|
13
|
+
gem 'rack-test'
|
|
14
|
+
gem 'database_cleaner', git: 'https://github.com/bmabey/database_cleaner.git'
|
|
15
|
+
gem 'require_all'
|
|
File without changes
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
ENV['SINATRA_ENV'] ||= "development"
|
|
2
|
+
|
|
3
|
+
require 'bundler/setup'
|
|
4
|
+
Bundler.require(:default, ENV['SINATRA_ENV'])
|
|
5
|
+
|
|
6
|
+
ActiveRecord::Base.establish_connection(
|
|
7
|
+
:adapter => "sqlite3",
|
|
8
|
+
:database => "db/#{ENV['SINATRA_ENV']}.sqlite"
|
|
9
|
+
)
|
|
10
|
+
|
|
11
|
+
require_all 'app'
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
require_relative './config/environment'
|
|
2
|
+
|
|
3
|
+
if ActiveRecord::Migrator.needs_migration?
|
|
4
|
+
raise 'Migrations are pending. Run `rake db:migrate` to resolve the issue.'
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
# auto-add controllers
|
|
8
|
+
Dir[File.join(File.dirname(__FILE__), "app/controllers", "*.rb")].collect {|file| File.basename(file).split(".")[0] }.reject {|file| file == "application_controller" }.each do |file|
|
|
9
|
+
string_class_name = file.split('_').collect { |w| w.capitalize }.join
|
|
10
|
+
class_name = Object.const_get(string_class_name)
|
|
11
|
+
use class_name
|
|
12
|
+
end
|
|
13
|
+
use Rack::MethodOverride
|
|
14
|
+
run ApplicationController
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# Add seed data here. Seed your database with `rake db:seed`
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
ENV["SINATRA_ENV"] = "test"
|
|
2
|
+
|
|
3
|
+
require_relative '../config/environment'
|
|
4
|
+
require 'rack/test'
|
|
5
|
+
require 'capybara/rspec'
|
|
6
|
+
require 'capybara/dsl'
|
|
7
|
+
|
|
8
|
+
if ActiveRecord::Migrator.needs_migration?
|
|
9
|
+
raise 'Migrations are pending. Run `rake db:migrate SINATRA_ENV=test` to resolve the issue.'
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
RSpec.configure do |config|
|
|
13
|
+
|
|
14
|
+
config.include Rack::Test::Methods
|
|
15
|
+
config.include Capybara::DSL
|
|
16
|
+
DatabaseCleaner.strategy = :truncation
|
|
17
|
+
|
|
18
|
+
config.before do
|
|
19
|
+
DatabaseCleaner.clean
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
config.after do
|
|
23
|
+
DatabaseCleaner.clean
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
config.order = 'default'
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def app
|
|
30
|
+
Rack::Builder.parse_file('config.ru').first
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
Capybara.app = app
|
|
File without changes
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
require_relative 'environment'
|
|
2
|
+
|
|
3
|
+
class SQLRunner
|
|
4
|
+
|
|
5
|
+
COMMANDS = ["create", "insert", "update", "delete"]
|
|
6
|
+
|
|
7
|
+
def initialize(db)
|
|
8
|
+
@db = db
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def self.make_methods
|
|
12
|
+
COMMANDS.each do |command|
|
|
13
|
+
define_method("execute_sql_#{command}") do
|
|
14
|
+
sql = File.read("lib/#{command}.sql")
|
|
15
|
+
execute_sql(sql)
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def execute_sql(sql)
|
|
21
|
+
sql.scan(/[^;]*;/m).each { |line| @db.execute(line) } unless sql.empty?
|
|
22
|
+
end
|
|
23
|
+
end
|
|
File without changes
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
require_relative '../bin/environment'
|
|
2
|
+
# This file was generated by the `rspec --init` command. Conventionally, all
|
|
3
|
+
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
|
4
|
+
# The generated `.rspec` file contains `--require spec_helper` which will cause this
|
|
5
|
+
# file to always be loaded, without a need to explicitly require it in any files.
|
|
6
|
+
#
|
|
7
|
+
# Given that it is always loaded, you are encouraged to keep this file as
|
|
8
|
+
# light-weight as possible. Requiring heavyweight dependencies from this file
|
|
9
|
+
# (such as loading up an entire rails app) will add to the boot time of your
|
|
10
|
+
# test suite on EVERY test run, even for an individual file that may not need
|
|
11
|
+
# all of that loaded.
|
|
12
|
+
#
|
|
13
|
+
# The `.rspec` file also contains a few flags that are not defaults but that
|
|
14
|
+
# users commonly want.
|
|
15
|
+
#
|
|
16
|
+
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
|
17
|
+
RSpec.configure do |config|
|
|
18
|
+
# The settings below are suggested to provide a good initial experience
|
|
19
|
+
# with RSpec, but feel free to customize to your heart's content.
|
|
20
|
+
# config.treat_symbols_as_metadata_keys_with_true_values = true
|
|
21
|
+
=begin
|
|
22
|
+
# These two settings work together to allow you to limit a spec run
|
|
23
|
+
# to individual examples or groups you care about by tagging them with
|
|
24
|
+
# `:focus` metadata. When nothing is tagged with `:focus`, all examples
|
|
25
|
+
# get run.
|
|
26
|
+
config.filter_run :focus
|
|
27
|
+
config.run_all_when_everything_filtered = true
|
|
28
|
+
|
|
29
|
+
# Many RSpec users commonly either run the entire suite or an individual
|
|
30
|
+
# file, and it's useful to allow more verbose output when running an
|
|
31
|
+
# individual spec file.
|
|
32
|
+
if config.files_to_run.one?
|
|
33
|
+
# RSpec filters the backtrace by default so as not to be so noisy.
|
|
34
|
+
# This causes the full backtrace to be printed when running a single
|
|
35
|
+
# spec file (e.g. to troubleshoot a particular spec failure).
|
|
36
|
+
config.full_backtrace = true
|
|
37
|
+
|
|
38
|
+
# Use the documentation formatter for detailed output,
|
|
39
|
+
# unless a formatter has already been configured
|
|
40
|
+
# (e.g. via a command-line flag).
|
|
41
|
+
config.formatter = 'doc' if config.formatters.none?
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
# Print the 10 slowest examples and example groups at the
|
|
45
|
+
# end of the spec run, to help surface which specs are running
|
|
46
|
+
# particularly slow.
|
|
47
|
+
config.profile_examples = 10
|
|
48
|
+
|
|
49
|
+
# Run specs in random order to surface order dependencies. If you find an
|
|
50
|
+
# order dependency and want to debug it, you can fix the order by providing
|
|
51
|
+
# the seed, which is printed after each run.
|
|
52
|
+
# --seed 1234
|
|
53
|
+
config.order = :random
|
|
54
|
+
|
|
55
|
+
# Seed global randomization in this process using the `--seed` CLI option.
|
|
56
|
+
# Setting this allows you to use `--seed` to deterministically reproduce
|
|
57
|
+
# test failures related to randomization by passing the same `--seed` value
|
|
58
|
+
# as the one that triggered the failure.
|
|
59
|
+
Kernel.srand config.seed
|
|
60
|
+
|
|
61
|
+
# rspec-expectations config goes here. You can use an alternate
|
|
62
|
+
# assertion/expectation library such as wrong or the stdlib/minitest
|
|
63
|
+
# assertions if you prefer.
|
|
64
|
+
config.expect_with :rspec do |expectations|
|
|
65
|
+
# Enable only the newer, non-monkey-patching expect syntax.
|
|
66
|
+
# For more details, see:
|
|
67
|
+
# - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
|
|
68
|
+
expectations.syntax = :expect
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
# rspec-mocks config goes here. You can use an alternate test double
|
|
72
|
+
# library (such as bogus or mocha) by changing the `mock_with` option here.
|
|
73
|
+
config.mock_with :rspec do |mocks|
|
|
74
|
+
# Enable only the newer, non-monkey-patching expect syntax.
|
|
75
|
+
# For more details, see:
|
|
76
|
+
# - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
|
|
77
|
+
mocks.syntax = :expect
|
|
78
|
+
|
|
79
|
+
# Prevents you from mocking or stubbing a method that does not exist on
|
|
80
|
+
# a real object. This is generally recommended.
|
|
81
|
+
mocks.verify_partial_doubles = true
|
|
82
|
+
end
|
|
83
|
+
=end
|
|
84
|
+
end
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
require "spec_helper"
|
|
2
|
+
|
|
3
|
+
describe FlatironLabGenerator::TemplateMaker do
|
|
4
|
+
let(:lab_generator_object) {FlatironLabGenerator::TemplateMaker.new("fundamental-ruby","test_lab template","git_repo")}
|
|
5
|
+
describe "#git_init" do
|
|
6
|
+
it "initializes a new local git repo" do
|
|
7
|
+
lab_generator_object.git_init
|
|
8
|
+
expect(system('git rev-parse')).to eq(true)
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
describe "::run" do
|
|
13
|
+
let(:lab_name) {"test_lab"}
|
|
14
|
+
it "creates a lab template with expected name and returns nil" do
|
|
15
|
+
expect(FlatironLabGenerator::TemplateMaker.run("fundamental-ruby",lab_name, "git repo")).to be_nil
|
|
16
|
+
expect(File.directory?(lab_name)).to eq(true)
|
|
17
|
+
expect(`tree #{lab_name}`).to eq("test_lab\n├── Gemfile\n├── README.md\n├── lib\n│ └── test_lab.rb\n└── spec\n ├── spec_helper.rb\n └── test_lab_spec.rb\n\n2 directories, 5 files\n")
|
|
18
|
+
FileUtils.rm_rf(lab_name)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
it "creates a command-line lab template" do
|
|
22
|
+
expect(FlatironLabGenerator::TemplateMaker.run("command-line",lab_name, "git repo")).to be_nil
|
|
23
|
+
expect(`tree #{lab_name}`).to eq("test_lab\n├── Gemfile\n├── README.md\n├── bin\n│ └── runner.rb\n├── lib\n│ ├── environment.rb\n│ └── test_lab\n│ └── cli.rb\n└── spec\n ├── spec_helper.rb\n └── test_lab_spec.rb\n\n4 directories, 7 files\n")
|
|
24
|
+
FileUtils.rm_rf(lab_name)
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
it "creates a SQL lab template" do
|
|
28
|
+
expect(FlatironLabGenerator::TemplateMaker.run("sql",lab_name, "git repo")).to be_nil
|
|
29
|
+
expect(`tree #{lab_name}`).to eq("test_lab\n├── Gemfile\n├── README.md\n├── bin\n│ ├── environment.rb\n│ ├── run.rb\n│ └── sql_runner.rb\n├── lib\n│ └── sample.sql\n└── spec\n ├── spec_helper.rb\n └── test_lab_spec.rb\n\n3 directories, 8 files\n")
|
|
30
|
+
FileUtils.rm_rf(lab_name)
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
it "creates an activerecord lab template" do
|
|
34
|
+
expect(FlatironLabGenerator::TemplateMaker.run("activerecord",lab_name, "git repo")).to be_nil
|
|
35
|
+
expect(`tree #{lab_name}`).to eq("test_lab\n├── Gemfile\n├── README.md\n├── Rakefile\n├── app\n│ └── models\n│ └── sample-class.rb\n├── config\n│ └── environment.rb\n├── db\n│ └── migrations\n├── lib\n│ └── support\n│ ├── connection_adapter.rb\n│ └── db_registry.rb\n└── spec\n ├── spec_helper.rb\n └── test_lab_spec.rb\n\n8 directories, 9 files\n")
|
|
36
|
+
FileUtils.rm_rf(lab_name)
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
it "creates a rake lab template" do
|
|
40
|
+
expect(FlatironLabGenerator::TemplateMaker.run("rake",lab_name, "git repo")).to be_nil
|
|
41
|
+
expect(`tree #{lab_name}`).to eq("test_lab\n├── Gemfile\n├── README.md\n├── Rakefile\n├── bin\n│ └── console\n├── config\n│ └── environment.rb\n├── lib\n│ └── test_lab.rb\n└── spec\n ├── rakefile_spec.rb\n ├── spec_helper.rb\n └── test_lab_spec.rb\n\n4 directories, 9 files\n")
|
|
42
|
+
FileUtils.rm_rf(lab_name)
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
it "creates a rack lab template" do
|
|
46
|
+
expect(FlatironLabGenerator::TemplateMaker.run("rack",lab_name, "git repo")).to be_nil
|
|
47
|
+
expect(`tree #{lab_name}`).to eq("test_lab\n├── Gemfile\n├── README.md\n├── app\n│ ├── application.rb\n│ └── controllers\n│ └── erb_maker.rb\n├── config\n│ └── environment.rb\n├── config.ru\n├── lib\n│ └── templates\n│ └── my_cool_response.html.erb\n└── spec\n ├── controllers\n │ └── 01_server_port_spec.rb\n ├── spec_helper.rb\n ├── support\n │ └── an_ok_request.rb\n └── test_lab_spec.rb\n\n8 directories, 11 files\n")
|
|
48
|
+
FileUtils.rm_rf(lab_name)
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
it "creates a sinatra-classic lab template" do
|
|
52
|
+
expect(FlatironLabGenerator::TemplateMaker.run("sinatra-classic",lab_name, "git repo")).to be_nil
|
|
53
|
+
expect(`tree #{lab_name}`).to eq("test_lab\n├── Gemfile\n├── README.md\n├── Rakefile\n├── app.rb\n├── config\n│ └── environment.rb\n├── config.ru\n├── models\n├── public\n│ ├── images\n│ ├── javascripts\n│ └── stylesheets\n├── spec\n│ ├── spec_helper.rb\n│ └── test_lab_spec.rb\n└── views\n\n8 directories, 8 files\n")
|
|
54
|
+
FileUtils.rm_rf(lab_name)
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
it "creates a sinatra-mvc lab template" do
|
|
58
|
+
expect(FlatironLabGenerator::TemplateMaker.run("sinatra-mvc",lab_name, "git repo")).to be_nil
|
|
59
|
+
expect(`tree #{lab_name}`).to eq("test_lab\n├── Gemfile\n├── README.md\n├── Rakefile\n├── app\n│ ├── controllers\n│ │ └── application_controller.rb\n│ ├── models\n│ └── views\n│ └── layout.erb\n├── config\n│ └── environment.rb\n├── config.ru\n├── db\n│ ├── migrate\n│ └── seeds.rb\n├── public\n│ └── stylesheets\n└── spec\n ├── controllers\n ├── features\n ├── models\n └── spec_helper.rb\n\n13 directories, 9 files\n")
|
|
60
|
+
FileUtils.rm_rf(lab_name)
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
it "creates a js lab template" do
|
|
64
|
+
expect(FlatironLabGenerator::TemplateMaker.run("js",lab_name, "git repo")).to be_nil
|
|
65
|
+
expect(`tree #{lab_name}`).to eq("test_lab\n├── README.md\n├── css\n├── images\n├── index.html\n├── js\n│ ├── jquery-1.8.3.min.js\n│ └── test_lab.js\n├── requires.yml\n└── spec\n\n4 directories, 5 files\n" )
|
|
66
|
+
FileUtils.rm_rf(lab_name)
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
it "creates a front-end template" do
|
|
70
|
+
expect(FlatironLabGenerator::TemplateMaker.run("front-end",lab_name, "git repo")).to be_nil
|
|
71
|
+
expect(`tree #{lab_name}`).to eq("test_lab\n├── README.md\n├── css\n│ └── style.css\n├── images\n└── index.html\n\n2 directories, 3 files\n")
|
|
72
|
+
FileUtils.rm_rf(lab_name)
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
it "creates a kids template" do
|
|
76
|
+
expect(FlatironLabGenerator::TemplateMaker.run("kids",lab_name, "git repo")).to be_nil
|
|
77
|
+
expect(`tree #{lab_name}`).to eq("test_lab\n├── Gemfile\n├── README.md\n├── lib\n│ └── test_lab.rb\n└── spec\n ├── spec_helper.rb\n └── test_lab_spec.rb\n\n2 directories, 5 files\n")
|
|
78
|
+
FileUtils.rm_rf(lab_name)
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
end
|
data/spec/spec_helper.rb
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
require_relative '../config/environment'
|
|
2
|
+
|
|
3
|
+
RSpec.configure do |config|
|
|
4
|
+
config.run_all_when_everything_filtered = true
|
|
5
|
+
config.filter_run :focus
|
|
6
|
+
|
|
7
|
+
# Run specs in random order to surface order dependencies. If you find an
|
|
8
|
+
# order dependency and want to debug it, you can fix the order by providing
|
|
9
|
+
# the seed, which is printed after each run.
|
|
10
|
+
# --seed 1234
|
|
11
|
+
config.order = 'random'
|
|
12
|
+
end
|