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

Remove dummy app from spec folder and instead create rake task which wil... #149

Merged
merged 4 commits into from
Feb 20, 2012
Merged

Remove dummy app from spec folder and instead create rake task which wil... #149

merged 4 commits into from
Feb 20, 2012

Conversation

ugisozols
Copy link
Contributor

...l generate dummy app when needed.

Hello gentlemen!

I noticed #141 and decided to do something about it. I basically copy/pasted the code which is in Refinery CMS with some tweaks for the specs to pass.

Please review it and let me know if there's anything else needed.

@parndt
Copy link
Contributor

parndt commented Feb 15, 2012

Looks good to me! @radar? @knewter?

@knewter
Copy link
Contributor

knewter commented Feb 15, 2012

README needs updating...

also blah blah something about refinery, amirite @pardnt

@parndt
Copy link
Contributor

parndt commented Feb 15, 2012

@knewter nice spelling ;) What do we need about Refinery?

@knewter
Copy link
Contributor

knewter commented Feb 15, 2012

I was mocking me-on-other-ticket getting confused about which project I was talking about :) whoosh

@parndt
Copy link
Contributor

parndt commented Feb 15, 2012

@knewter :trollface:

@benatkin
Copy link
Contributor

I found one problem with this pull request. If I create a new rails app and add this to the Gemfile:

gem 'forem', :git => 'https://github.com/ugisozols/forem.git', :branch => 'dummy_app'

When I run bundle install and then rails g -h I get this:

Forem:
  forem:dummy
  forem:install
  forem:views

@ugisozols
Copy link
Contributor Author

I'm sorry but what's the problem?

@benatkin
Copy link
Contributor

It adds an extra generator, forem:dummy, which isn't relevant for rails apps that use forem. It's for forem development only. Refinery puts it in a separate folder, testing/lib/generators.

@benatkin
Copy link
Contributor

I made a pull request to your branch , @ugisozols, with changes to hide forem:dummy from rails g -h inside of an app that uses forem. I moved it to spec/lib instead of spec/support because rspec automatically pulls in everything in spec/support including templates and that caused the specs to fail.

move dummy app generators from lib to spec/lib so "rails g -h"doesn't show them
@ugisozols
Copy link
Contributor Author

👍 @benatkin. I agree with you that dummy_app rake task should be only available when developing forem. Thanks!

@radar
Copy link
Collaborator

radar commented Feb 20, 2012

So you guys reckon this is cool to merge then?

@ugisozols
Copy link
Contributor Author

Specs pass - what's cooler than that? :)

@radar
Copy link
Collaborator

radar commented Feb 20, 2012

ICE COLD.

radar added a commit that referenced this pull request Feb 20, 2012
Remove dummy app from spec folder and instead create rake task which wil...
@radar radar merged commit a433d80 into rubysherpas:master Feb 20, 2012
@jgadbois
Copy link
Contributor

How do I regenerate the dummy app for development purposes?

@ugisozols
Copy link
Contributor Author

bundle exec rake forem:dummy_app

@jgadbois
Copy link
Contributor

yeah sorry, just saw the updated readme

@jgadbois
Copy link
Contributor

Should spec/dummy/ be added to the .gitignore file?

@radar
Copy link
Collaborator

radar commented Feb 20, 2012

Yes.

@jgadbois
Copy link
Contributor

Ok, sorry I must not have been looking at the correct branch - my .gitignore didn't have it and git was prompting me to readd the dummy files. I see that it was added in the initial commit.

@stas
Copy link

stas commented Nov 21, 2012

I was looking for something like this and came up with a different solution, thought you might be interested to check it:

require 'rails/generators'
require 'rails/generators/rails/plugin_new/plugin_new_generator'

module MyEngine
  class DummyGenerator < Rails::Generators::PluginNewGenerator

    def self.default_source_root
      Rails::Generators::PluginNewGenerator.default_source_root
    end

    def do_nothing
    end

    alias :create_root :do_nothing
    alias :create_root_files :do_nothing
    alias :create_app_files :do_nothing
    alias :create_config_files :do_nothing
    alias :create_lib_files :do_nothing
    alias :create_public_stylesheets_files :do_nothing
    alias :create_javascript_files :do_nothing
    alias :create_script_files :do_nothing
    alias :update_gemfile :do_nothing
    alias :create_test_files :do_nothing
    alias :finish_template :do_nothing

  end
end

Where in Rakefile I just call the generator:

task :setup do
  require 'rails'
  require 'myengine'
  require 'myengine/generators/dummy_generator'

  MyEngine::DummyGenerator.start(
    %w(. --quiet --force --skip-bundle --old-style-hash --dummy-path=spec/dummy)
  )
end

Thanks

@radar
Copy link
Collaborator

radar commented Nov 22, 2012

I've been looking at using the dummier gem for things like this. I think we should switch over to using that. It provides its own Rake task for generating the dummy application as well as some very useful hooks.

@stas
Copy link

stas commented Nov 22, 2012

Thanks for dummier, it seems nice.
Still It looks pretty tied to Test::Unit, so it will likely have to be patched first.

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.

8 participants