Git Product home page Git Product logo

phase-3-active-record-intro-to-rake's Issues

Last 'Pry' Based Rake Task Is Flawed

Canvas Link

https://learning.flatironschool.com/courses/5286/assignments/172676?module_item_id=376756

Concern

Here's my entire script:

# NOTE: If we then use the command, 'rake hello' in another terminal, we the return the 'puts' output below
# It's basically Ruby's version of the 'Makefile' / Crontab jobs

# NOTE: By adding a 'namespace', we can group our related Rake tasks together:
namespace :greeting do

  # NOTE: If we use 'rake -T', this will list the available 'Rake' tasks and their descriptions:
  desc 'outputs hello to the terminal'
  task :hello do
    puts "hello from Rake!"
  end

  desc 'outputs hola to the terminal'
  task :hola do
    puts "hola desde Rake!"
  end

end

# NOTE: We can use these individual tasks using the 'namespace:rake_task' syntax:
# rake greeting:hello
# rake greeting:hola

# NOTE: If you encounter this error:
# rake aborted!
# Gem::LoadError: You have already activated rake 10.4.2,
# but your Gemfile requires rake 10.4.0.
# Prepending `bundle exec` to your command may solve this.

# Then, use this command as the fix:
# bundle exec rake greeting:hello

# NOTE: We will now use the 'rake db:migrate' command to create a database table and migrate the code using
# a 'rake' task:

namespace :db do
  task :environment do
    require_relative "./config/environment"
  end

  desc "migrate changes to your database"
  # NOTE: This line creates a task dependency to force the rake task to run the ':environment' task
  # BEFORE running the 'migrate' task:
  task migrate: :environment do
    Student.create_table
  end

  desc "seed the database with some dummy data"
  task seed: :environment do
    require_relative "./db/seeds"
  end
end

desc "drop into the Pry console"
task console: :environment do
  Pry.start
end

If I run the 'bundle exec rake console' command after running the 'rake db:migrate' and 'rake db:seed' commands respectively, I get this error:

samuelbanya@Samuels-MBP ~/hub/Development/code/phase-3/phase-3-active-record-intro-to-rake $ bundle exec rake console
rake aborted!
Don't know how to build task 'environment' (See the list of available tasks with `rake --tasks`)
Did you mean?  db:environment
/Users/samuelbanya/.gem/gems/rake-13.0.6/exe/rake:27:in `<top (required)>'
/Users/samuelbanya/.gem/gems/bundler-2.2.23/lib/bundler/cli/exec.rb:63:in `load'
/Users/samuelbanya/.gem/gems/bundler-2.2.23/lib/bundler/cli/exec.rb:63:in `kernel_load'
/Users/samuelbanya/.gem/gems/bundler-2.2.23/lib/bundler/cli/exec.rb:28:in `run'
/Users/samuelbanya/.gem/gems/bundler-2.2.23/lib/bundler/cli.rb:474:in `exec'
/Users/samuelbanya/.gem/gems/bundler-2.2.23/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
/Users/samuelbanya/.gem/gems/bundler-2.2.23/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
/Users/samuelbanya/.gem/gems/bundler-2.2.23/lib/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
/Users/samuelbanya/.gem/gems/bundler-2.2.23/lib/bundler/cli.rb:30:in `dispatch'
/Users/samuelbanya/.gem/gems/bundler-2.2.23/lib/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
/Users/samuelbanya/.gem/gems/bundler-2.2.23/lib/bundler/cli.rb:24:in `start'
/Users/samuelbanya/.gem/gems/bundler-2.2.23/exe/bundle:49:in `block in <top (required)>'
/Users/samuelbanya/.gem/gems/bundler-2.2.23/lib/bundler/friendly_errors.rb:128:in `with_friendly_errors'
/Users/samuelbanya/.gem/gems/bundler-2.2.23/exe/bundle:37:in `<top (required)>'
/Users/samuelbanya/.rvm/gems/ruby-2.7.4/bin/bundle:25:in `load'
/Users/samuelbanya/.rvm/gems/ruby-2.7.4/bin/bundle:25:in `<main>'
/Users/samuelbanya/.rvm/gems/ruby-2.7.4/bin/ruby_executable_hooks:22:in `eval'
/Users/samuelbanya/.rvm/gems/ruby-2.7.4/bin/ruby_executable_hooks:22:in `<main>'
Tasks: TOP => console
(See full trace by running task with --trace)

Additional Context

No response

Suggested Changes

No response

deprecated language

Canvas Link

https://learning.flatironschool.com/courses/4980/assignments/169129?module_item_id=366662

Concern

This has been the case on the last few labs, but this is the first one where it's really a pain because it shows up every time we type something in the CLI. When i run 'bundle install' as well as every time I run a rake script, I get this:

Calling DidYouMean::SPELL_CHECKERS.merge!(error_name => spell_checker)' has been deprecated. Please call DidYouMean.correct_error(error_name, spell_checker)' instead.

Additional Context

No response

Suggested Changes

No response

Pry console task not working

I'm trying to use the console task to drop into a Pry console, but it's not working. I get the following error:

rake aborted!
Don't know how to build task 'environment' (See the list of available tasks with `rake --tasks`)
Did you mean?  db:environment

The correct code should be:

desc 'drop into the Pry console'
task :console do
require_relative './config/environment'
Pry.start
end

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.