rake

Keyword Extraction in Python_RAKE

吃可爱长大的小学妹 提交于 2019-12-19 11:53:13
问题 I am a novice user and puzzled over the following otherwise simple "loop" problem. I have a local dir with x number of files (about 500 .txt files). I would like to extract the corresponding keywords from each unique file using RAKE for Python. I've reviewed the documentation for RAKE; however, the suggested code in the tutorial gets keywords for a single document. Can someone please explain to me how to loop over an X number of files stored in my local dir. Here's the code from the tutorial

Invoking bash aliases in rake

我的梦境 提交于 2019-12-19 08:18:11
问题 I have the following command in my .bashrc: alias mfigpdf='for FIG in *.fig; do fig2dev -L pdftex "$FIG" "${FIG%.*}.pdftex"; done; for FIG in *.fig; do fig2dev -L pstex_t -p "${FIG%.*}.pdftex" "$FIG" "${FIG%.*}.pdftex_t"; done' And I want to execute the 'mfigpdf' command in my Rakefile: desc "convert all images to pdftex (or png)" task :pdf do sh "mfigpdf" system "mfigpdf" end But none of theses tasks is working. I could just copy the command in the rakefile of insert it in a shellscript file

Why is my rake task running twice in my test?

ε祈祈猫儿з 提交于 2019-12-19 07:35:20
问题 I have a rake task test that I setup following the only examples I could find online. It looks like this: require 'test_helper' require 'minitest/mock' require 'rake' class TestScrapeWelcome < ActiveSupport::TestCase def setup Rake.application.init Rake.application.load_rakefile @task = Rake::Task['scrape:scrape'] @task.reenable end def teardown Rake::Task.clear end test "scraping text and sending to elasticsearch" do mocked_client = Minitest::Mock.new get_fixtures.each_with_index do |arg,i|

How to make rake db:migrate generate schema.rb when using :sql schema format

十年热恋 提交于 2019-12-19 05:24:11
问题 If using the this option in config/application.rb : config.active_record.schema_format = :sql then when you do: rake db:migrate it only dumps the db/structure.sql . I know it isn't using the db/schema.rb since it is using the :sql option, but how can you make rake db:migrate generate db/schema.rb also? We need that because RubyMine 4.5 and IntelliJ IDea 11 use db/schema.rb for autocompletion of columns. 回答1: To generate/update db/schema.rb even if using the :sql option, you can put this in

Is there a way to know the current rake task?

匆匆过客 提交于 2019-12-18 18:54:08
问题 Is it possible to know the current rake task within ruby: # Rakefile task :install do MyApp.somemethod(options) end # myapp.rb class MyApp def somemetod(opts) ## current_task? end end Edit I'm asking about any enviroment|global variable that can be queried about that, because I wanted to make an app smart about rake, not modify the task itself. I'm thinking of making an app behave differently when it was run by rake. 回答1: I'm thinking of making an app behave different when runned by rake. Is

How do I use Rails clockwork gem to run rake tasks?

元气小坏坏 提交于 2019-12-18 15:01:22
问题 What is the syntax for calling rake tasks from clockwork? I've tried all kinds of syntax, and nothing seems to work. (I'm specifically interested in clockwork because Heroku's supporting it.) Here's my clock.rb, using the same syntax that the whenever gem uses: module Clockwork puts "testing clockwork!" every(30.seconds, 'Send Messages') { rake 'scheduler:send_messages' } end And here's my rake task in scheduler.rake: task :send_messages => :environment do puts "rake task run successfully!"

Could not find rake-10.0.4 in any of the sources (Bundler::GemNotFound)

怎甘沉沦 提交于 2019-12-18 14:46:27
问题 I have been trying to run my ruby application on the server recently and I keep coming across this error: Could not find rake-10.0.4 in any of the sources (Bundler::GemNotFound) I am running Rails 3.2.12 and Ruby 1.9.3p392. Until now I have not had any problems when accessing the server, and this is the first time I have come across this error. I have tried looking around for answers, but as I am relatively new to ruby and rails I couldn't find an answer that was simple to understand. Gemfile

HTTP streaming in rails not working when using Rack::Deflater

旧城冷巷雨未停 提交于 2019-12-18 13:34:55
问题 I've setup unicorn in rails 3.1 and http streaming works until I enable Rack::Deflater. I've tried both with and without use Rack::Chunked. In curl I can see my response while in chrome I get the following errror: ERR_INVALID_CHUNKED_ENCODING The result is same in other browsers (firefox, safari) and between development (osx) and production (heroku). config.ru: require ::File.expand_path('../config/environment', __FILE__) use Rack::Chunked use Rack::Deflater run Site::Application unicorn.rb:

Confused with rake error in Rails 3

杀马特。学长 韩版系。学妹 提交于 2019-12-18 13:13:53
问题 Noob trying to decipher what to do with the following error: rake aborted! You have already activated rake 0.9.1, but your Gemfile requires rake 0.8.7. Consider using bundle exec. Any help is greatly appreciated. 回答1: Try running bundle exec rake instead of just rake . This error will occur when you have a newer version of rake installed on your computer than the one specified in your Gemfile (or Gemfile.lock) 回答2: This worked for me: Add rake 0.8.7 to your Gemfile gem 'rake', '0.8.7' remove

PRIMARY KEY issue with creating tables in Rails using rake db:migrate command with mysql

戏子无情 提交于 2019-12-18 12:52:57
问题 My version of rails is 4.0.0, my version of mysql is Ver 14.14 Distrib 5.7.9, for Win64 (x86_64). I am operating of an older version of rails as I was getting some clashes with the mysql as per my previous question Here. (check Kalelc's approved answer for my recourse) upon running rake db:migrate I get the following error == CreateUsers: migrating ==================================================== -- create_table(:users) rake aborted! StandardError: An error has occurred, all later