I have this leak in Indy 10.5.7 (under Delphi 7).
5 - 12 bytes: TIdThreadSafeInteger x 1
21 - 36 bytes: TIdCriticalSection x 2
I use Indy like this:
function getWeb(a,b:Integer):Integer;
var url: string;
H: TIdHttp;
SS: TStringStream;
begin
url := 'http://blabla';
H := TIdHttp.Create(nil);
try
SS := TStringStream.Create('');
try
H.Get(url, SS);
Result := StrToInt(SS.DataString);
FINALLY
SS.Free;
END;
finally H.Free;
end;
The leak itself doesn't bother me since is on app shutdown. That makes my melon explode is the error message I see every time I shut down the app.
Why this leak appear?
I have checked the Indy web site but it barely makes sense. Anyway, it looks this bug cannot be fixed: the latest version of Indy cannot be compiled with Delphi 7. The only solution might be Indy 9.
Update: it looks like what on the web site calls v10.203 is is actually v10.2.3.
This is a problem that occurs with FastMM memory manager and has been around for a while and there is a lot of information available on fixes. The solution I use in Delphi 2010 is:
Make the changes below to the file IdGlobal.pas
Add the path "C:\Program Files\Embarcadero\RAD Studio\7.0\source\Indy\Indy10\System" (without quotes) to the library.
Changes:
{$IFNDEF DOTNET}
{$IFDEF REGISTER_EXPECTED_MEMORY_LEAK}
function IndyRegisterExpectedMemoryLeak(AAddress: Pointer): Boolean;
{$IFDEF USEINLINE}inline;{$ENDIF}
begin
// ===== My modification begins =====================
Result := FastMM4.RegisterExpectedMemoryLeak(AAddress);
Exit;
// ===== My modification ends =====================
Hope this helps.
There is a IdStack validation file which does not pass through the cleaning function.
Open the file IdStack.pas
At the end of the file, look for this:
{$ IFNDEF DOTNET}
{$ IFDEF} REGISTER_EXPECTED_MEMORY_LEAK
IndyRegisterExpectedMemoryLeak (GStackCriticalSection);
{$ ENDIF}
{$ ENDIF}
finalization
// Dont Free. If shutdown is from another Init section, it can cause GPF When stack
// Tries to access it. App will kill it off anyways, so just let it leak
// # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
// THIS LINE AND INCLUDE A COMMENT LINE DOWN
if GStackCriticalSection <> nil then FreeAndNil (GStackCriticalSection);
// # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
{$ IFDEF} FREE_ON_FINAL
// # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
// FreeAndNil (GStackCriticalSection); // DISABLE THIS LINE
// # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
{$ ENDIF}
end.
I'm using version 10.515 from Indy, you can find this version for download at http://indy.fulgan.com/ZIP/
to remove other message includes this command in the main DPR
Application.terminate;
if GThreadCount <> Nil then GThreadCount.Free;
Add IdThread uses.
Even more!
Related
I have a Rails application with GraphQL API which works fine when running in development. After I deployed the app to Heroku, visiting the GraphiQL interface at /graphiql I get this error below:
Ensure that there is only one instance of "graphql" in the node_modules
directory. If different versions of "graphql" are the dependencies of other
relied on modules, use "resolutions" to ensure only one version is installed.
https://yarnpkg.com/en/docs/selective-version-resolutions
Duplicate "graphql" modules cannot be used at the same time since different
versions may have different capabilities and behavior. The data from one
version used in the function from another could produce confusing and
spurious results.
at n.default (application-d621ca4100ba6f2e72e972ecd2a7ddcd5d2ec26b6f1fcf2932d68e2e12c78794.js:597)
at u (application-d621ca4100ba6f2e72e972ecd2a7ddcd5d2ec26b6f1fcf2932d68e2e12c78794.js:807)
at o (application-d621ca4100ba6f2e72e972ecd2a7ddcd5d2ec26b6f1fcf2932d68e2e12c78794.js:807)
at M (application-d621ca4100ba6f2e72e972ecd2a7ddcd5d2ec26b6f1fcf2932d68e2e12c78794.js:807)
at R (application-d621ca4100ba6f2e72e972ecd2a7ddcd5d2ec26b6f1fcf2932d68e2e12c78794.js:807)
at new P (application-d621ca4100ba6f2e72e972ecd2a7ddcd5d2ec26b6f1fcf2932d68e2e12c78794.js:807)
at P (application-d621ca4100ba6f2e72e972ecd2a7ddcd5d2ec26b6f1fcf2932d68e2e12c78794.js:807)
at Object.129.../jsutils/isInvalid (application-d621ca4100ba6f2e72e972ecd2a7ddcd5d2ec26b6f1fcf2932d68e2e12c78794.js:815)
at i (application-d621ca4100ba6f2e72e972ecd2a7ddcd5d2ec26b6f1fcf2932d68e2e12c78794.js:12)
at application-d621ca4100ba6f2e72e972ecd2a7ddcd5d2ec26b6f1fcf2932d68e2e12c78794.js:12
n.default # application-d621ca4100ba6f2e72e972ecd2a7ddcd5d2ec26b6f1fcf2932d68e2e12c78794.js:597
u # application-d621ca4100ba6f2e72e972ecd2a7ddcd5d2ec26b6f1fcf2932d68e2e12c78794.js:807
o # application-d621ca4100ba6f2e72e972ecd2a7ddcd5d2ec26b6f1fcf2932d68e2e12c78794.js:807
M # application-d621ca4100ba6f2e72e972ecd2a7ddcd5d2ec26b6f1fcf2932d68e2e12c78794.js:807
R # application-d621ca4100ba6f2e72e972ecd2a7ddcd5d2ec26b6f1fcf2932d68e2e12c78794.js:807
P # application-d621ca4100ba6f2e72e972ecd2a7ddcd5d2ec26b6f1fcf2932d68e2e12c78794.js:807
P # application-d621ca4100ba6f2e72e972ecd2a7ddcd5d2ec26b6f1fcf2932d68e2e12c78794.js:807
129.../jsutils/isInvalid # application-d621ca4100ba6f2e72e972ecd2a7ddcd5d2ec26b6f1fcf2932d68e2e12c78794.js:815
i # application-d621ca4100ba6f2e72e972ecd2a7ddcd5d2ec26b6f1fcf2932d68e2e12c78794.js:12
(anonymous) # application-d621ca4100ba6f2e72e972ecd2a7ddcd5d2ec26b6f1fcf2932d68e2e12c78794.js:12
132.../error/GraphQLError # application-d621ca4100ba6f2e72e972ecd2a7ddcd5d2ec26b6f1fcf2932d68e2e12c78794.js:831
i # application-d621ca4100ba6f2e72e972ecd2a7ddcd5d2ec26b6f1fcf2932d68e2e12c78794.js:12
(anonymous) # application-d621ca4100ba6f2e72e972ecd2a7ddcd5d2ec26b6f1fcf2932d68e2e12c78794.js:12
96../execution/execute # application-d621ca4100ba6f2e72e972ecd2a7ddcd5d2ec26b6f1fcf2932d68e2e12c78794.js:588
i # application-d621ca4100ba6f2e72e972ecd2a7ddcd5d2ec26b6f1fcf2932d68e2e12c78794.js:12
(anonymous) # application-d621ca4100ba6f2e72e972ecd2a7ddcd5d2ec26b6f1fcf2932d68e2e12c78794.js:12
97../error # application-d621ca4100ba6f2e72e972ecd2a7ddcd5d2ec26b6f1fcf2932d68e2e12c78794.js:588
i # application-d621ca4100ba6f2e72e972ecd2a7ddcd5d2ec26b6f1fcf2932d68e2e12c78794.js:12
(anonymous) # application-d621ca4100ba6f2e72e972ecd2a7ddcd5d2ec26b6f1fcf2932d68e2e12c78794.js:12
(anonymous) # application-d621ca4100ba6f2e72e972ecd2a7ddcd5d2ec26b6f1fcf2932d68e2e12c78794.js:84
12.../utility/CodeMirrorSizer # application-d621ca4100ba6f2e72e972ecd2a7ddcd5d2ec26b6f1fcf2932d68e2e12c78794.js:84
i # application-d621ca4100ba6f2e72e972ecd2a7ddcd5d2ec26b6f1fcf2932d68e2e12c78794.js:12
(anonymous) # application-d621ca4100ba6f2e72e972ecd2a7ddcd5d2ec26b6f1fcf2932d68e2e12c78794.js:12
22../components/GraphiQL # application-d621ca4100ba6f2e72e972ecd2a7ddcd5d2ec26b6f1fcf2932d68e2e12c78794.js:139
i # application-d621ca4100ba6f2e72e972ecd2a7ddcd5d2ec26b6f1fcf2932d68e2e12c78794.js:12
t # application-d621ca4100ba6f2e72e972ecd2a7ddcd5d2ec26b6f1fcf2932d68e2e12c78794.js:12
(anonymous) # application-d621ca4100ba6f2e72e972ecd2a7ddcd5d2ec26b6f1fcf2932d68e2e12c78794.js:12
(anonymous) # application-d621ca4100ba6f2e72e972ecd2a7ddcd5d2ec26b6f1fcf2932d68e2e12c78794.js:12
(anonymous) # application-d621ca4100ba6f2e72e972ecd2a7ddcd5d2ec26b6f1fcf2932d68e2e12c78794.js:12
Meanwhile, here's my routes file:
Rails.application.routes.draw do
mount GraphiQL::Rails::Engine, at: '/graphiql', graphql_path: '/graphql'
get 'home/index'
post '/graphql', to: 'graphql#execute'
root 'home#index'
end
And I am using these versions of graphql and graphiql-rails respectively:
graphql (1.10.8)
graphiql-rails (1.7.0)
I'm using Rails (5.1.0), Mongoid(6.1.0) and Rspec(3.6.0). I have removed active record from my app. Everything is working perfectly apart from tests. When I'm running rspec i get error:
Failure/Error: raise ConnectionNotEstablished, "No connection pool with '#{spec_name}' found." unless pool
ActiveRecord::ConnectionNotEstablished:
No connection pool with 'primary' found.
# /Users/kukicola/.rvm/gems/ruby-2.4.1/gems/activerecord-5.1.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:930:in `retrieve_connection'
# /Users/kukicola/.rvm/gems/ruby-2.4.1/gems/activerecord-5.1.0/lib/active_record/connection_handling.rb:116:in `retrieve_connection'
# /Users/kukicola/.rvm/gems/ruby-2.4.1/gems/activerecord-5.1.0/lib/active_record/connection_handling.rb:88:in `connection'
# /Users/kukicola/.rvm/gems/ruby-2.4.1/gems/activerecord-5.1.0/lib/active_record/fixtures.rb:516:in `create_fixtures'
# /Users/kukicola/.rvm/gems/ruby-2.4.1/gems/activerecord-5.1.0/lib/active_record/fixtures.rb:1028:in `load_fixtures'
# /Users/kukicola/.rvm/gems/ruby-2.4.1/gems/activerecord-5.1.0/lib/active_record/fixtures.rb:999:in `setup_fixtures'
# /Users/kukicola/.rvm/gems/ruby-2.4.1/gems/activerecord-5.1.0/lib/active_record/fixtures.rb:851:in `before_setup'
# /Users/kukicola/.rvm/gems/ruby-2.4.1/gems/rspec-rails-3.6.0/lib/rspec/rails/adapters.rb:126:in `block (2 levels) in <module:MinitestLifecycleAdapter>'
# /Users/kukicola/.rvm/gems/ruby-2.4.1/gems/rspec-core-3.6.0/lib/rspec/core/example.rb:447:in `instance_exec'
# /Users/kukicola/.rvm/gems/ruby-2.4.1/gems/rspec-core-3.6.0/lib/rspec/core/example.rb:447:in `instance_exec'
# /Users/kukicola/.rvm/gems/ruby-2.4.1/gems/rspec-core-3.6.0/lib/rspec/core/hooks.rb:375:in `execute_with'
# /Users/kukicola/.rvm/gems/ruby-2.4.1/gems/rspec-core-3.6.0/lib/rspec/core/hooks.rb:606:in `block (2 levels) in run_around_example_hooks_for'
# /Users/kukicola/.rvm/gems/ruby-2.4.1/gems/rspec-core-3.6.0/lib/rspec/core/example.rb:342:in `call'
# /Users/kukicola/.rvm/gems/ruby-2.4.1/gems/rspec-core-3.6.0/lib/rspec/core/hooks.rb:607:in `run_around_example_hooks_for'
# /Users/kukicola/.rvm/gems/ruby-2.4.1/gems/rspec-core-3.6.0/lib/rspec/core/hooks.rb:464:in `run'
# /Users/kukicola/.rvm/gems/ruby-2.4.1/gems/rspec-core-3.6.0/lib/rspec/core/example.rb:457:in `with_around_example_hooks'
# /Users/kukicola/.rvm/gems/ruby-2.4.1/gems/rspec-core-3.6.0/lib/rspec/core/example.rb:500:in `with_around_and_singleton_context_hooks'
# /Users/kukicola/.rvm/gems/ruby-2.4.1/gems/rspec-core-3.6.0/lib/rspec/core/example.rb:251:in `run'
# /Users/kukicola/.rvm/gems/ruby-2.4.1/gems/rspec-core-3.6.0/lib/rspec/core/example_group.rb:627:in `block in run_examples'
# /Users/kukicola/.rvm/gems/ruby-2.4.1/gems/rspec-core-3.6.0/lib/rspec/core/example_group.rb:623:in `map'
# /Users/kukicola/.rvm/gems/ruby-2.4.1/gems/rspec-core-3.6.0/lib/rspec/core/example_group.rb:623:in `run_examples'
# /Users/kukicola/.rvm/gems/ruby-2.4.1/gems/rspec-core-3.6.0/lib/rspec/core/example_group.rb:589:in `run'
# /Users/kukicola/.rvm/gems/ruby-2.4.1/gems/rspec-core-3.6.0/lib/rspec/core/example_group.rb:590:in `block in run'
# /Users/kukicola/.rvm/gems/ruby-2.4.1/gems/rspec-core-3.6.0/lib/rspec/core/example_group.rb:590:in `map'
# /Users/kukicola/.rvm/gems/ruby-2.4.1/gems/rspec-core-3.6.0/lib/rspec/core/example_group.rb:590:in `run'
# /Users/kukicola/.rvm/gems/ruby-2.4.1/gems/rspec-core-3.6.0/lib/rspec/core/runner.rb:118:in `block (3 levels) in run_specs'
# /Users/kukicola/.rvm/gems/ruby-2.4.1/gems/rspec-core-3.6.0/lib/rspec/core/runner.rb:118:in `map'
# /Users/kukicola/.rvm/gems/ruby-2.4.1/gems/rspec-core-3.6.0/lib/rspec/core/runner.rb:118:in `block (2 levels) in run_specs'
# /Users/kukicola/.rvm/gems/ruby-2.4.1/gems/rspec-core-3.6.0/lib/rspec/core/configuration.rb:1894:in `with_suite_hooks'
# /Users/kukicola/.rvm/gems/ruby-2.4.1/gems/rspec-core-3.6.0/lib/rspec/core/runner.rb:113:in `block in run_specs'
# /Users/kukicola/.rvm/gems/ruby-2.4.1/gems/rspec-core-3.6.0/lib/rspec/core/reporter.rb:79:in `report'
# /Users/kukicola/.rvm/gems/ruby-2.4.1/gems/rspec-core-3.6.0/lib/rspec/core/runner.rb:112:in `run_specs'
# /Users/kukicola/.rvm/gems/ruby-2.4.1/gems/rspec-core-3.6.0/lib/rspec/core/runner.rb:87:in `run'
# /Users/kukicola/.rvm/gems/ruby-2.4.1/gems/rspec-core-3.6.0/lib/rspec/core/runner.rb:71:in `run'
# /Users/kukicola/.rvm/gems/ruby-2.4.1/gems/rspec-core-3.6.0/lib/rspec/core/runner.rb:45:in `invoke'
# /Users/kukicola/.rvm/gems/ruby-2.4.1/gems/rspec-core-3.6.0/exe/rspec:4:in `<top (required)>'
# /Users/kukicola/.rvm/gems/ruby-2.4.1/bin/rspec:23:in `load'
# /Users/kukicola/.rvm/gems/ruby-2.4.1/bin/rspec:23:in `<main>'
# /Users/kukicola/.rvm/gems/ruby-2.4.1/bin/ruby_executable_hooks:15:in `eval'
# /Users/kukicola/.rvm/gems/ruby-2.4.1/bin/ruby_executable_hooks:15:in `<main>'
#
# Showing full backtrace because every line was filtered out.
# See docs for RSpec::Configuration#backtrace_exclusion_patterns and
# RSpec::Configuration#backtrace_inclusion_patterns for more information.
My rails_helper.rb file:
# This file is copied to spec/ when you run 'rails generate rspec:install'
require 'spec_helper'
ENV['RAILS_ENV'] ||= 'test'
require File.expand_path('../../config/environment', __FILE__)
# Prevent database truncation if the environment is production
abort("The Rails environment is running in production mode!") if Rails.env.production?
require 'rspec/rails'
Mongoid.load!(Rails.root.join("config", "mongoid.yml"))
# Add additional requires below this line. Rails is not loaded until this point!
# Requires supporting ruby files with custom matchers and macros, etc, in
# spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are
# run as spec files by default. This means that files in spec/support that end
# in _spec.rb will both be required and run as specs, causing the specs to be
# run twice. It is recommended that you do not name files matching this glob to
# end with _spec.rb. You can configure this pattern with the --pattern
# option on the command line or in ~/.rspec, .rspec or `.rspec-local`.
#
# The following line is provided for convenience purposes. It has the downside
# of increasing the boot-up time by auto-requiring all files in the support
# directory. Alternatively, in the individual `*_spec.rb` files, manually
# require only the support files necessary.
#
# Dir[Rails.root.join('spec/support/**/*.rb')].each { |f| require f }
# Checks for pending migration and applies them before tests are run.
# If you are not using ActiveRecord, you can remove this line.
#ActiveRecord::Migration.maintain_test_schema!
RSpec.configure do |config|
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
#config.fixture_path = "#{::Rails.root}/spec/fixtures"
# If you're not using ActiveRecord, or you'd prefer not to run each of your
# examples within a transaction, remove the following line or assign false
# instead of true.
#config.use_transactional_fixtures = true
# RSpec Rails can automatically mix in different behaviours to your tests
# based on their file location, for example enabling you to call `get` and
# `post` in specs under `spec/controllers`.
#
# You can disable this behaviour by removing the line below, and instead
# explicitly tag your specs with their type, e.g.:
#
# RSpec.describe UsersController, :type => :controller do
# # ...
# end
#
# The different available types are documented in the features, such as in
# https://relishapp.com/rspec/rspec-rails/docs
config.infer_spec_type_from_file_location!
# Filter lines from Rails gems in backtraces.
config.filter_rails_from_backtrace!
# arbitrary gems may also be filtered via:
# config.filter_gems_from_backtrace("gem name")
# config.before(:suite) do
# DatabaseCleaner.clean_with(:truncation)
# end
#
# config.before(:each) do
# DatabaseCleaner.strategy = :truncation
# end
#
# config.before(:each, :js => true) do
# DatabaseCleaner.strategy = :truncation
# end
#
# config.before(:each) do
# DatabaseCleaner.start
# end
#
# config.after(:each) do
# DatabaseCleaner.clean
# end
end
And spec_helper.rb:
# This file was generated by the `rails generate rspec:install` command. Conventionally, all
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
# The generated `.rspec` file contains `--require spec_helper` which will cause
# this file to always be loaded, without a need to explicitly require it in any
# files.
#
# Given that it is always loaded, you are encouraged to keep this file as
# light-weight as possible. Requiring heavyweight dependencies from this file
# will add to the boot time of your test suite on EVERY test run, even for an
# individual file that may not need all of that loaded. Instead, consider making
# a separate helper file that requires the additional dependencies and performs
# the additional setup, and require it from the spec files that actually need
# it.
#
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
RSpec.configure do |config|
# rspec-expectations config goes here. You can use an alternate
# assertion/expectation library such as wrong or the stdlib/minitest
# assertions if you prefer.
config.expect_with :rspec do |expectations|
# This option will default to `true` in RSpec 4. It makes the `description`
# and `failure_message` of custom matchers include text for helper methods
# defined using `chain`, e.g.:
# be_bigger_than(2).and_smaller_than(4).description
# # => "be bigger than 2 and smaller than 4"
# ...rather than:
# # => "be bigger than 2"
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
end
# rspec-mocks config goes here. You can use an alternate test double
# library (such as bogus or mocha) by changing the `mock_with` option here.
config.mock_with :rspec do |mocks|
# Prevents you from mocking or stubbing a method that does not exist on
# a real object. This is generally recommended, and will default to
# `true` in RSpec 4.
mocks.verify_partial_doubles = true
end
# This option will default to `:apply_to_host_groups` in RSpec 4 (and will
# have no way to turn it off -- the option exists only for backwards
# compatibility in RSpec 3). It causes shared context metadata to be
# inherited by the metadata hash of host groups and examples, rather than
# triggering implicit auto-inclusion in groups with matching metadata.
config.shared_context_metadata_behavior = :apply_to_host_groups
# The settings below are suggested to provide a good initial experience
# with RSpec, but feel free to customize to your heart's content.
=begin
# This allows you to limit a spec run to individual examples or groups
# you care about by tagging them with `:focus` metadata. When nothing
# is tagged with `:focus`, all examples get run. RSpec also provides
# aliases for `it`, `describe`, and `context` that include `:focus`
# metadata: `fit`, `fdescribe` and `fcontext`, respectively.
config.filter_run_when_matching :focus
# Allows RSpec to persist some state between runs in order to support
# the `--only-failures` and `--next-failure` CLI options. We recommend
# you configure your source control system to ignore this file.
config.example_status_persistence_file_path = "spec/examples.txt"
# Limits the available syntax to the non-monkey patched syntax that is
# recommended. For more details, see:
# - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/
# - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
# - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode
config.disable_monkey_patching!
# Many RSpec users commonly either run the entire suite or an individual
# file, and it's useful to allow more verbose output when running an
# individual spec file.
if config.files_to_run.one?
# Use the documentation formatter for detailed output,
# unless a formatter has already been configured
# (e.g. via a command-line flag).
config.default_formatter = "doc"
end
# Print the 10 slowest examples and example groups at the
# end of the spec run, to help surface which specs are running
# particularly slow.
config.profile_examples = 10
# Run specs in random order to surface order dependencies. If you find an
# order dependency and want to debug it, you can fix the order by providing
# the seed, which is printed after each run.
# --seed 1234
config.order = :random
# Seed global randomization in this process using the `--seed` CLI option.
# Setting this allows you to use `--seed` to deterministically reproduce
# test failures related to randomization by passing the same `--seed` value
# as the one that triggered the failure.
Kernel.srand config.seed
=end
end
Problem solved - I had bad carrier_wave config which was loading active record
I'm starting to integrate Angular in my project and I want to add Jasmine tests. This is my spec/javascripts folder tree:
./
├── e2e
│ └── products_scenarios.js
├── foo_spec.js
└── support
└── jasmine.yml
When I run tests using rake spec:javascript, it only runs the test in foo_spec.js. This is my jasmine.yml file:
# # path to parent directory of src_files
# # relative path from Rails.root
# # defaults to app/assets/javascripts
# src_dir: "app/assets/javascripts"
#
# # path to parent directory of css_files
# # relative path from Rails.root
# # defaults to app/assets/stylesheets
# css_dir: "app/assets/stylesheets"
#
# # list of file expressions to include as source files
# # relative path from src_dir
# src_files:
# - "application.{js.coffee,js,coffee}"
#
# # list of file expressions to include as css files
# # relative path from css_dir
# css_files:
#
# # path to parent directory of spec_files
# # relative path from Rails.root
# # defaults to spec/javascripts
spec_dir: spec/javascripts
#
# # list of file expressions to include as helpers into spec runner
# # relative path from spec_dir
# helpers:
# - "helpers/**/*.{js.coffee,js,coffee}"
# list of file expressions to include as specs into spec runner
# relative path from spec_dir
# spec_files:
# - "**/*[Ss]pec.{js.coffee,js,coffee}"
# - "**/e2e/*[Ss]pec.{js.coffee,js,coffee}"
# path to directory of temporary files
# (spec runner and asset cache)
# defaults to tmp/jasmine
# tmp_dir: "tmp/jasmine"
How would I require everything inside of the e2e folder? Or even better, what is the usual folder structure for Jasmine tests in a Rails project?
Default setting for spec_files is:
spec_files:
- "**/*[Ss]pec.{js.coffee,js,coffee}"
Rename products_scenarios.js to products_scenarios_spec.js and required spec will run. All files with spec or Spec inside a name will be treated by jasmine as specs.
I am trying to package new vagrant base box. And I get this error while doing so.
C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.5.1/plugins/commands/package/command.rb:59:in `package_base': C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.5.1/lib/vagrant/machine.rb:358: syntax error, unexpected end-of-input, expecting keyword_end (SyntaxError)
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant1.5.1/plugins/commands/package/command.rb:42:in `execute'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.5.1/lib/vagrant/cli.rb:42:in `execute'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.5.1/lib/vagrant/environment.rb:248:in `cli'
from C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.5.1/bin/vagrant:158:in `<main>'
The content of "machine.rb" is below.
require "thread"
require "log4r"
module Vagrant
# This represents a machine that Vagrant manages. This provides a singular
# API for querying the state and making state changes to the machine, which
# is backed by any sort of provider (VirtualBox, VMWare, etc.).
class Machine
# The box that is backing this machine.
#
# #return [Box]
attr_accessor :box
# Configuration for the machine.
#
# #return [Object]
attr_accessor :config
# Directory where machine-specific data can be stored.
#
# #return [Pathname]
attr_reader :data_dir
# The environment that this machine is a part of.
#
# #return [Environment]
attr_reader :env
# ID of the machine. This ID comes from the provider and is not
# guaranteed to be of any particular format except that it is
# a string.
#
# #return [String]
attr_reader :id
# Name of the machine. This is assigned by the Vagrantfile.
#
# #return [Symbol]
attr_reader :name
# The provider backing this machine.
#
# #return [Object]
attr_reader :provider
# The provider-specific configuration for this machine.
#
# #return [Object]
attr_accessor :provider_config
# The name of the provider.
#
# #return [Symbol]
attr_reader :provider_name
# The options given to the provider when registering the plugin.
#
# #return [Hash]
attr_reader :provider_options
# The UI for outputting in the scope of this machine.
#
# #return [UI]
attr_reader :ui
# The Vagrantfile that this machine is attached to.
#
# #return [Vagrantfile]
attr_reader :vagrantfile
# Initialize a new machine.
#
# #param [String] name Name of the virtual machine.
# #param [Class] provider The provider backing this machine. This is
# currently expected to be a V1 `provider` plugin.
# #param [Object] provider_config The provider-specific configuration for
# this machine.
# #param [Hash] provider_options The provider-specific options from the
# plugin definition.
# #param [Object] config The configuration for this machine.
# #param [Pathname] data_dir The directory where machine-specific data
# can be stored. This directory is ensured to exist.
# #param [Box] box The box that is backing this virtual machine.
# #param [Environment] env The environment that this machine is a
# part of.
def initialize(name, provider_name, provider_cls, provider_config, provider_options, config, data_dir, box, env, vagrantfile, base=false)
#logger = Log4r::Logger.new("vagrant::machine")
#logger.info("Initializing machine: #{name}")
#logger.info(" - Provider: #{provider_cls}")
#logger.info(" - Box: #{box}")
#logger.info(" - Data dir: #{data_dir}")
#box = box
#config = config
#data_dir = data_dir
#env = env
#vagrantfile = vagrantfile
#guest = Guest.new(
self,
Vagrant.plugin("2").manager.guests,
Vagrant.plugin("2").manager.guest_capabilities)
#name = name
#provider_config = provider_config
#provider_name = provider_name
#provider_options = provider_options
#ui = Vagrant::UI::Prefixed.new(#env.ui, #name)
#ui_mutex = Mutex.new
# Read the ID, which is usually in local storage
#id = nil
# XXX: This is temporary. This will be removed very soon.
if base
#id = name
else
# Read the id file from the data directory if it exists as the
# ID for the pre-existing physical representation of this machine.
id_file = #data_dir.join("id")
#id = id_file.read.chomp if id_file.file?
end
# Initializes the provider last so that it has access to all the
# state we setup on this machine.
#provider = provider_cls.new(self)
#provider._initialize(#provider_name, self)
end
# This calls an action on the provider. The provider may or may not
# actually implement the action.
#
# #param [Symbol] name Name of the action to run.
# #param [Hash] extra_env This data will be passed into the action runner
# as extra data set on the environment hash for the middleware
# runner.
def action(name, extra_env=nil)
#logger.info("Calling action: #{name} on provider #{#provider}")
# Get the callable from the provider.
callable = #provider.action(name)
# If this action doesn't exist on the provider, then an exception
# must be raised.
if callable.nil?
raise Errors::UnimplementedProviderAction,
:action => name,
:provider => #provider.to_s
end
# Run the action with the action runner on the environment
env = {
:action_name => "machine_action_#{name}".to_sym,
:machine => self,
:machine_action => name,
:ui => #ui
}.merge(extra_env || {})
#env.action_runner.run(callable, env)
end
# Returns a communication object for executing commands on the remote
# machine. Note that the _exact_ semantics of this are up to the
# communication provider itself. Despite this, the semantics are expected
# to be consistent across operating systems. For example, all linux-based
# systems should have similar communication (usually a shell). All
# Windows systems should have similar communication as well. Therefore,
# prior to communicating with the machine, users of this method are
# expected to check the guest OS to determine their behavior.
#
# This method will _always_ return some valid communication object.
# The `ready?` API can be used on the object to check if communication
# is actually ready.
#
# #return [Object]
def communicate
if !#communicator
# For now, we always return SSH. In the future, we'll abstract
# this and allow plugins to define new methods of communication.
klass = Vagrant.plugin("2").manager.communicators[:ssh]
#communicator = klass.new(self)
end
#communicator
end
# Returns a guest implementation for this machine. The guest implementation
# knows how to do guest-OS specific tasks, such as configuring networks,
# mounting folders, etc.
#
# #return [Guest]
def guest
raise Errors::MachineGuestNotReady if !communicate.ready?
#guest.detect! if !#guest.ready?
#guest
end
# This sets the unique ID associated with this machine. This will
# persist this ID so that in the future Vagrant will be able to find
# this machine again. The unique ID must be absolutely unique to the
# virtual machine, and can be used by providers for finding the
# actual machine associated with this instance.
#
# **WARNING:** Only providers should ever use this method.
#
# #param [String] value The ID.
def id=(value)
#logger.info("New machine ID: #{value.inspect}")
# The file that will store the id if we have one. This allows the
# ID to persist across Vagrant runs.
id_file = #data_dir.join("id")
if value
# Write the "id" file with the id given.
id_file.open("w+") do |f|
f.write(value)
end
else
# Delete the file, since the machine is now destroyed
id_file.delete if id_file.file?
# Delete the entire data directory contents since all state
# associated with the VM is now gone.
#data_dir.children.each do |child|
begin
child.rmtree
rescue Errno::EACCES
#logger.info("EACCESS deleting file: #{child}")
end
end
end
# Store the ID locally
#id = value.nil? ? nil : value.to_s
# Notify the provider that the ID changed in case it needs to do
# any accounting from it.
#provider.machine_id_changed
end
# This returns a clean inspect value so that printing the value via
# a pretty print (`p`) results in a readable value.
#
# #return [String]
def inspect
"#<#{self.class}: #{#name} (#{#provider.class})>"
end
# This returns the SSH info for accessing this machine. This SSH info
# is queried from the underlying provider. This method returns `nil` if
# the machine is not ready for SSH communication.
#
# The structure of the resulting hash is guaranteed to contain the
# following structure, although it may return other keys as well
# not documented here:
#
# {
# :host => "1.2.3.4",
# :port => "22",
# :username => "mitchellh",
# :private_key_path => "/path/to/my/key"
# }
#
# Note that Vagrant makes no guarantee that this info works or is
# correct. This is simply the data that the provider gives us or that
# is configured via a Vagrantfile. It is still possible after this
# point when attempting to connect via SSH to get authentication
# errors.
#
# #return [Hash] SSH information.
def ssh_info
# First, ask the provider for their information. If the provider
# returns nil, then the machine is simply not ready for SSH, and
# we return nil as well.
info = #provider.ssh_info
return nil if info.nil?
# Delete out the nil entries.
info.dup.each do |key, value|
info.delete(key) if value.nil?
end
# We set the defaults
info[:host] ||= #config.ssh.default.host
info[:port] ||= #config.ssh.default.port
info[:private_key_path] ||= #config.ssh.default.private_key_path
info[:username] ||= #config.ssh.default.username
# We set overrides if they are set. These take precedence over
# provider-returned data.
info[:host] = #config.ssh.host if #config.ssh.host
info[:port] = #config.ssh.port if #config.ssh.port
info[:username] = #config.ssh.username if #config.ssh.username
info[:password] = #config.ssh.password if #config.ssh.password
# We also set some fields that are purely controlled by Varant
info[:forward_agent] = #config.ssh.forward_agent
info[:forward_x11] = #config.ssh.forward_x11
# Add in provided proxy command config
info[:proxy_command] = #config.ssh.proxy_command if #config.ssh.proxy_command
# Set the private key path. If a specific private key is given in
# the Vagrantfile we set that. Otherwise, we use the default (insecure)
# private key, but only if the provider didn't give us one.
if !info[:private_key_path] && !info[:password]
if #config.ssh.private_key_path
info[:private_key_path] = #config.ssh.private_key_path
else
info[:private_key_path] = #env.default_private_key_path
end
end
# If we have a private key in our data dir, then use that
if !#data_dir.nil?
data_private_key = #data_dir.join("private_key")
if data_private_key.file?
info[:private_key_path] = [data_private_key.to_s]
end
# Setup the keys
info[:private_key_path] ||= []
if !info[:private_key_path].is_a?(Array)
info[:private_key_path] = [info[:private_key_path]]
end
# Expand the private key path relative to the root path
info[:private_key_path].map! do |path|
File.expand_path(path, #env.root_path)
end
# Return the final compiled SSH info data
info
end
# Returns the state of this machine. The state is queried from the
# backing provider, so it can be any arbitrary symbol.
#
# #return [MachineState]
def state
result = #provider.state
raise Errors::MachineStateInvalid if !result.is_a?(MachineState)
result
end
# Temporarily changes the machine UI. This is useful if you want
# to execute an {#action} with a different UI.
def with_ui(ui)
#ui_mutex.synchronize do
begin
old_ui = #ui
#ui = ui
yield
ensure
#ui = old_ui
end
end
end
end
end
In method ssh_info you are missing an end statement after line 318:
Your code:
# If we have a private key in our data dir, then use that
if !#data_dir.nil?
data_private_key = #data_dir.join("private_key")
if data_private_key.file?
info[:private_key_path] = [data_private_key.to_s]
end
What it should be:
# If we have a private key in our data dir, then use that
if !#data_dir.nil?
data_private_key = #data_dir.join("private_key")
if data_private_key.file?
info[:private_key_path] = [data_private_key.to_s]
end
end # <-- this is missing
This type of error always gets reported on the last line of the file because it's looking to close the block and reaches the end of the file without getting enough end statements.
I have been trying to run a lua script in lighttpd. I am running gentoo and I installed lighttpd with the lua use flag. mod_magnet.so is where it is supposed to be. When I try to start the server I get this error:
2011-06-03 15:55:32: (configfile.c.912) source: /etc/lighttpd/lighttpd.conf line: 43 pos: 68 parser failed somehow near here: (
Here is my config file:
###############################################################################
# Default lighttpd.conf for Gentoo.
# $Header: /var/cvsroot/gentoo-x86/www-servers/lighttpd/files/conf/lighttpd.conf,v 1.5 2010/11/18 15:13:47 hwoarang Exp $
###############################################################################
# {{{ variables
var.basedir = "/var/www/localhost"
var.logdir = "/var/log/lighttpd"
var.statedir = "/var/lib/lighttpd"
# }}}
# {{{ modules
# At the very least, mod_access and mod_accesslog should be enabled.
# All other modules should only be loaded if necessary.
# NOTE: the order of modules is important.
server.modules = (
# "mod_rewrite",
# "mod_redirect",
# "mod_alias",
"mod_access",
"mod_magnet",
# "mod_cml",
# "mod_trigger_b4_dl",
# "mod_auth",
# "mod_status",
# "mod_setenv",
# "mod_proxy",
# "mod_simple_vhost",
# "mod_evhost",
# "mod_userdir",
# "mod_compress",
# "mod_ssi",
# "mod_usertrack",
# "mod_expire",
# "mod_secdownload",
# "mod_rrdtool",
# "mod_webdav",
"mod_accesslog"
)
# }}}
##########################################Magnet URL##########################################
magnet.attract-raw-url-to( "/var/www/localhost/scripts/redirect.lua" )
###############################################################################################
# {{{ includes
include "mime-types.conf"
# fcgi and cgi are included below
# }}}
# {{{ server settings
server.username = "lighttpd"
server.groupname = "lighttpd"
server.document-root = var.basedir + "/htdocs"
server.pid-file = "/var/run/lighttpd.pid"
server.errorlog = var.logdir + "/error.log"
# log errors to syslog instead
# server.errorlog-use-syslog = "enable"
server.indexfiles = ("index.php", "index.html",
"index.htm", "default.htm")
# server.tag = "lighttpd"
server.follow-symlink = "enable"
# event handler (defaults to "poll")
# see performance.txt
#
# for >= linux-2.4
# server.event-handler = "linux-rtsig"
# for >= linux-2.6
# server.event-handler = "linux-sysepoll"
# for FreeBSD
# server.event-handler = "freebsd-kqueue"
# chroot to directory (defaults to no chroot)
# server.chroot = "/"
# bind to port (defaults to 80)
# server.port = 81
# bind to name (defaults to all interfaces)
# server.bind = "grisu.home.kneschke.de"
# error-handler for status 404
# server.error-handler-404 = "/error-handler.html"
# server.error-handler-404 = "/error-handler.php"
# Format: <errorfile-prefix><status-code>.html
# -> ..../status-404.html for 'File not found'
# server.errorfile-prefix = var.basedir + "/error/status-"
# FAM support for caching stat() calls
# requires that lighttpd be built with USE=fam
server.stat-cache-engine = "fam"
# If lighttpd was build with IPv6 support, and you would like to listen on IPv6,
# uncomment the following:
server.use-ipv6 = "enable"
# }}}
# {{{ mod_staticfile
# which extensions should not be handled via static-file transfer
# (extensions that are usually handled by mod_cgi, mod_fastcgi, etc).
static-file.exclude-extensions = (".php", ".pl", ".cgi", ".fcgi")
# }}}
# {{{ mod_accesslog
accesslog.filename = var.logdir + "/access.log"
# }}}
# {{{ mod_dirlisting
# enable directory listings
# dir-listing.activate = "enable"
#
# don't list hidden files/directories
# dir-listing.hide-dotfiles = "enable"
#
# use a different css for directory listings
# dir-listing.external-css = "/path/to/dir-listing.css"
#
# list of regular expressions. files that match any of the
# specified regular expressions will be excluded from directory
# listings.
# dir-listing.exclude = ("^\.", "~$")
# }}}
# {{{ mod_access
# see access.txt
url.access-deny = ("~", ".inc")
# }}}
# {{{ mod_userdir
# see userdir.txt
#
# userdir.path = "public_html"
# userdir.exclude-user = ("root")
# }}}
# {{{ mod_ssi
# see ssi.txt
#
# ssi.extension = (".shtml")
# }
# {{{ mod_ssl
# see ssl.txt
#
# ssl.engine = "enable"
# ssl.pemfile = "server.pem"
# }}}
# {{{ mod_status
# see status.txt
#
# status.status-url = "/server-status"
# status.config-url = "/server-config"
# }}}
# {{{ mod_simple_vhost
# see simple-vhost.txt
#
# If you want name-based virtual hosting add the next three settings and load
# mod_simple_vhost
#
# document-root =
# virtual-server-root + virtual-server-default-host + virtual-server-docroot
# or
# virtual-server-root + http-host + virtual-server-docroot
#
# simple-vhost.server-root = "/home/weigon/wwwroot/servers/"
# simple-vhost.default-host = "grisu.home.kneschke.de"
# simple-vhost.document-root = "/pages/"
# }}}
# {{{ mod_compress
# see compress.txt
#
# compress.cache-dir = var.statedir + "/cache/compress"
# compress.filetype = ("text/plain", "text/html")
# }}}
# {{{ mod_proxy
# see proxy.txt
#
# proxy.server = ( ".php" =>
# ( "localhost" =>
# (
# "host" => "192.168.0.101",
# "port" => 80
# )
# )
# )
# }}}
# {{{ mod_auth
# see authentication.txt
#
# auth.backend = "plain"
# auth.backend.plain.userfile = "lighttpd.user"
# auth.backend.plain.groupfile = "lighttpd.group"
# auth.backend.ldap.hostname = "localhost"
# auth.backend.ldap.base-dn = "dc=my-domain,dc=com"
# auth.backend.ldap.filter = "(uid=$)"
# auth.require = ( "/server-status" =>
# (
# "method" => "digest",
# "realm" => "download archiv",
# "require" => "user=jan"
# ),
# "/server-info" =>
# (
# "method" => "digest",
# "realm" => "download archiv",
# "require" => "valid-user"
# )
# )
# }}}
# {{{ mod_rewrite
# see rewrite.txt
#
# url.rewrite = (
# "^/$" => "/server-status"
# )
# }}}
# {{{ mod_redirect
# see redirect.txt
#
# url.redirect = (
# "^/wishlist/(.+)" => "http://www.123.org/$1"
# )
# }}}
# {{{ mod_evhost
# define a pattern for the host url finding
# %% => % sign
# %0 => domain name + tld
# %1 => tld
# %2 => domain name without tld
# %3 => subdomain 1 name
# %4 => subdomain 2 name
#
# evhost.path-pattern = "/home/storage/dev/www/%3/htdocs/"
# }}}
# {{{ mod_expire
# expire.url = (
# "/buggy/" => "access 2 hours",
# "/asdhas/" => "access plus 1 seconds 2 minutes"
# )
# }}}
# {{{ mod_rrdtool
# see rrdtool.txt
#
# rrdtool.binary = "/usr/bin/rrdtool"
# rrdtool.db-name = var.statedir + "/lighttpd.rrd"
# }}}
# {{{ mod_setenv
# see setenv.txt
#
# setenv.add-request-header = ( "TRAV_ENV" => "mysql://user#host/db" )
# setenv.add-response-header = ( "X-Secret-Message" => "42" )
# }}}
# {{{ mod_trigger_b4_dl
# see trigger_b4_dl.txt
#
# trigger-before-download.gdbm-filename = "/home/weigon/testbase/trigger.db"
# trigger-before-download.memcache-hosts = ( "127.0.0.1:11211" )
# trigger-before-download.trigger-url = "^/trigger/"
# trigger-before-download.download-url = "^/download/"
# trigger-before-download.deny-url = "http://127.0.0.1/index.html"
# trigger-before-download.trigger-timeout = 10
# }}}
# {{{ mod_cml
# see cml.txt
#
# don't forget to add index.cml to server.indexfiles
# cml.extension = ".cml"
# cml.memcache-hosts = ( "127.0.0.1:11211" )
# }}}
# {{{ mod_webdav
# see webdav.txt
#
# $HTTP["url"] =~ "^/dav($|/)" {
# webdav.activate = "enable"
# webdav.is-readonly = "enable"
# }
# }}}
# {{{ extra rules
#
# set Content-Encoding and reset Content-Type for browsers that
# support decompressing on-thy-fly (requires mod_setenv)
# $HTTP["url"] =~ "\.gz$" {
# setenv.add-response-header = ("Content-Encoding" => "x-gzip")
# mimetype.assign = (".gz" => "text/plain")
# }
# $HTTP["url"] =~ "\.bz2$" {
# setenv.add-response-header = ("Content-Encoding" => "x-bzip2")
# mimetype.assign = (".bz2" => "text/plain")
# }
#
# }}}
# {{{ debug
# debug.log-request-header = "enable"
# debug.log-response-header = "enable"
# debug.log-request-handling = "enable"
# debug.log-file-not-found = "enable"
# }}}
# {{{ cgi includes
# uncomment for cgi support
# include "mod_cgi.conf"
# uncomment for php/fastcgi support
include "mod_fastcgi.conf"
# }}}
# vim: set ft=conf foldmethod=marker et :
If I comment out "mod_magnet", I still get the same error. If I comment out the line
magnet.attract-raw-url-to( "/var/www/localhost/scripts/redirect.lua" )
The problem goes away but of course I then can't use my script for testing reasons I commented out my script just to reduce complexities. My guess is the problem is that the mod_magnet isn't loading. Any ideas?
You're missing an equals sign (hence the parser failed somehow near here: ( message stating the parser doesn't understand your open-paren). Try this:
magnet.attract-raw-url-to = ( "/var/www/localhost/scripts/redirect.lua" )