Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix 'rails generate' with path corrections #24

Merged
merged 3 commits into from Jan 7, 2015
Merged

Fix 'rails generate' with path corrections #24

merged 3 commits into from Jan 7, 2015

Conversation

hdm
Copy link
Contributor

@hdm hdm commented Jan 13, 2013

The 'rails generate reportable_migration' command was looking in lib, but the actual requires were looking in the top-level directory. This moves generators back to lib and fixes the require path in railties.rb.

Prior to this, none of the generators would be available under Rails 3.2.11.

Afterwards:

$ rails generate 
Usage: rails generate GENERATOR [args] [options]
[ snip ]

ReportableJqueryFlotAssets:
  reportable_jquery_flot_assets

ReportableMigration:
  reportable_migration

ReportableRaphaelAssets:
  reportable_raphael_assets

HD Moore added 3 commits January 12, 2013 18:54
rails generate is unable to find the generators unless they
are placed into the lib subdirectory.
@hdm
Copy link
Contributor Author

hdm commented Jan 13, 2013

The last commit allows all three generators to work in rails 3.2.11

@marcoow
Copy link
Contributor

marcoow commented Jan 13, 2013

The build seems to fail with these changes: https://travis-ci.org/saulabs/reportable/builds/4117262. Can you fix that?

@hdm
Copy link
Contributor Author

hdm commented Jan 13, 2013

The master branch has these failures as well without my changes, it looks like the spec is out of date or broken. I updated the spec where my changes were concerned (any new failures).

/y$ git clone git://github.com/saulabs/reportable.git
Cloning into 'reportable'...
remote: Counting objects: 2531, done.
remote: Compressing objects: 100% (796/796), done.
remote: Total 2531 (delta 1496), reused 2481 (delta 1458)
Receiving objects: 100% (2531/2531), 626.87 KiB, done.
Resolving deltas: 100% (1496/1496), done.
/y$ cd reportable/
/y/reportable$ rake spec
/usr/local/rvm/rubies/ruby-1.9.3-p194/bin/ruby -S rspec ./spec/classes/cumulated_report_spec.rb ./spec/classes/grouping_spec.rb ./spec/classes/report_cache_spec.rb ./spec/classes/report_spec.rb ./spec/classes/reporting_period_spec.rb ./spec/other/report_method_spec.rb ./spec/other/report_tag_helper_spec.rb
-- create_table(:users, {:force=>true})
-> 0.0163s
-- create_table(:reportable_cache, {:force=>true})
-> 0.0007s
-- add_index(:reportable_cache, [:model_name, :report_name, :grouping, :aggregation, :conditions], {:name=>"name_model_grouping_agregation"})
-> 0.0003s
-- add_index(:reportable_cache, [:model_name, :report_name, :grouping, :aggregation, :conditions, :reporting_period], {:unique=>true, :name=>"name_model_grouping_aggregation_period"})
-> 0.0004s
-- initialize_schema_migrations_table()
-> 0.0006s
-- assume_migrated_upto_version(1, ["db/migrate"])
-> 0.0003s
...................................................................................................................................F..F....F....................FFF.............................................FFFFFFFFF..FFFFFFFFFFFF...........................................................................................................................

Failures:

  1. Saulabs::Reportable::Report#run for grouping :hour optimized querying with contiguously cached data should be optimized with specified end_date

[ snip ]

Finished in 3.63 seconds
354 examples, 27 failures

Failed examples:

rspec ./spec/classes/report_spec.rb:81 # Saulabs::Reportable::Report#run for grouping :hour optimized querying with contiguously cached data should be optimized with specified end_date
rspec ./spec/classes/report_spec.rb:149 # Saulabs::Reportable::Report#run for grouping :hour non optimized querying when gaps present in cached data should not be optimized with specified end_date
rspec ./spec/classes/report_spec.rb:245 # Saulabs::Reportable::Report#run for grouping :hour when :end_date is specified the returned result should end with the reporting period of the specified end date
rspec ./spec/classes/report_spec.rb:445 # Saulabs::Reportable::Report#run for grouping :hour with :live_data = false should return correct data for aggregation :count when :end_date is specified
rspec ./spec/classes/report_spec.rb:460 # Saulabs::Reportable::Report#run for grouping :hour with :live_data = false should return correct data for aggregation :sum when :end_date is specified
rspec ./spec/classes/report_spec.rb:476 # Saulabs::Reportable::Report#run for grouping :hour with :live_data = false should return correct results when run twice in a row with an end date further in the past on the second run
rspec ./spec/classes/report_spec.rb:286 # Saulabs::Reportable::Report#run for grouping :week with :live_data = true should return correct data for aggregation :count
rspec ./spec/classes/report_spec.rb:302 # Saulabs::Reportable::Report#run for grouping :week with :live_data = true should return correct data for aggregation :count with distinct: true
rspec ./spec/classes/report_spec.rb:320 # Saulabs::Reportable::Report#run for grouping :week with :live_data = true should return correct data for aggregation :sum
rspec ./spec/classes/report_spec.rb:337 # Saulabs::Reportable::Report#run for grouping :week with :live_data = true should return correct data for aggregation :maximum
rspec ./spec/classes/report_spec.rb:354 # Saulabs::Reportable::Report#run for grouping :week with :live_data = true should return correct data for aggregation :minimum
rspec ./spec/classes/report_spec.rb:371 # Saulabs::Reportable::Report#run for grouping :week with :live_data = true should return correct data for aggregation :average
rspec ./spec/classes/report_spec.rb:388 # Saulabs::Reportable::Report#run for grouping :week with :live_data = true should return correct data for aggregation :count when custom conditions are specified
rspec ./spec/classes/report_spec.rb:404 # Saulabs::Reportable::Report#run for grouping :week with :live_data = true should return correct data for aggregation :sum when custom conditions are specified
rspec ./spec/classes/report_spec.rb:421 # Saulabs::Reportable::Report#run for grouping :week with :live_data = true should return correct results when run twice in a row with a higher limit on the second run
rspec ./spec/classes/report_spec.rb:286 # Saulabs::Reportable::Report#run for grouping :week with :live_data = false should return correct data for aggregation :count
rspec ./spec/classes/report_spec.rb:302 # Saulabs::Reportable::Report#run for grouping :week with :live_data = false should return correct data for aggregation :count with distinct: true
rspec ./spec/classes/report_spec.rb:320 # Saulabs::Reportable::Report#run for grouping :week with :live_data = false should return correct data for aggregation :sum
rspec ./spec/classes/report_spec.rb:337 # Saulabs::Reportable::Report#run for grouping :week with :live_data = false should return correct data for aggregation :maximum
rspec ./spec/classes/report_spec.rb:354 # Saulabs::Reportable::Report#run for grouping :week with :live_data = false should return correct data for aggregation :minimum
rspec ./spec/classes/report_spec.rb:371 # Saulabs::Reportable::Report#run for grouping :week with :live_data = false should return correct data for aggregation :average
rspec ./spec/classes/report_spec.rb:388 # Saulabs::Reportable::Report#run for grouping :week with :live_data = false should return correct data for aggregation :count when custom conditions are specified
rspec ./spec/classes/report_spec.rb:404 # Saulabs::Reportable::Report#run for grouping :week with :live_data = false should return correct data for aggregation :sum when custom conditions are specified
rspec ./spec/classes/report_spec.rb:421 # Saulabs::Reportable::Report#run for grouping :week with :live_data = false should return correct results when run twice in a row with a higher limit on the second run
rspec ./spec/classes/report_spec.rb:445 # Saulabs::Reportable::Report#run for grouping :week with :live_data = false should return correct data for aggregation :count when :end_date is specified
rspec ./spec/classes/report_spec.rb:460 # Saulabs::Reportable::Report#run for grouping :week with :live_data = false should return correct data for aggregation :sum when :end_date is specified
rspec ./spec/classes/report_spec.rb:476 # Saulabs::Reportable::Report#run for grouping :week with :live_data = false should return correct results when run twice in a row with an end date further in the past on the second run
rake aborted!
/usr/local/rvm/rubies/ruby-1.9.3-p194/bin/ruby -S rspec ./spec/classes/cumulated_report_spec.rb ./spec/classes/grouping_spec.rb ./spec/classes/report_cache_spec.rb ./spec/classes/report_spec.rb ./spec/classes/reporting_period_spec.rb ./spec/other/report_method_spec.rb ./spec/other/report_tag_helper_spec.rb failed
/usr/local/rvm/gems/ruby-1.9.3-p194/gems/rspec-core-2.8.0/lib/rspec/core/rake_task.rb:137:in block (2 levels) in initialize' /usr/local/rvm/gems/ruby-1.9.3-p194/gems/rspec-core-2.8.0/lib/rspec/core/rake_task.rb:127:inblock in initialize'
/usr/local/rvm/gems/ruby-1.9.3-p194/bin/ruby_noexec_wrapper:14:in eval' /usr/local/rvm/gems/ruby-1.9.3-p194/bin/ruby_noexec_wrapper:14:in

'
Tasks: TOP => spec
(See full trace by running task with --trace)

@kellydunn
Copy link

Bumping this issue.

Running rails generate reportable_migration from a fresh install currently errors out with:

Could not find "/home/kelly/.rvm/gems/ruby-1.9.2-p180/gems/reportable-1.2.0/generators/reportable_migration/templates/migration.rb" in any of your source paths. Please invoke ReportableMigrationGenerator.source_root(PATH) with the PATH containing your templates. Currently you have no source paths.

For what it's worth, @hmoore-r7 's set of commits generated the expected migrations on my machines after pointing to his latest commit on this pull request in my Gemfile.

@mahemoff
Copy link

mahemoff commented May 8, 2013

With Rails 3.2 fresh install, I'm seeing Could not find "/path/to//gems/reportable-1.2.0/generators/reportable_migration/templates/migration.rb" in any of your source paths. Please invoke ReportableMigrationGenerator.source_root(PATH) with the PATH containing your templates. Currently you have no source paths.

@szechyjs
Copy link

+1 bump

@mk mk merged commit 0df483b into saulabs:master Jan 7, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants