How to integrate scss-lint to run on codeship? - ruby-on-rails

I am working on a project for which we run rspec tests on codeship, along with rubocop for ruby style consistency.
We use scss-lint in development and as an editor integration for sass styles.
We would like to integrate scss-lint into codeship, so the we would get similar reports to what we get for rspec and rubocop after running our test suite.
Can anyone help with a detailed way to do this? Is there anything to achieve this in a quick and easy way? (similar to how rubocop is integrated).
I read something in the codeship documentation about docker, but we are not currently using docker, so I was wondering if there would be another solution.
Thanks for your help!

You should be able to simply install scss-lint via RubyGems (or Bundler) and then just run it against your files.
Something like
gem install scss_lint
scss-lint app/assets/stylesheets/
To supply custom configuration options, simply include a .scss-lint.yml file in the same directory. See https://github.com/codeship/documentation/ for an example. (Even though that projects is run on our Docker platform, the basic steps for using it are the same.)

Related

what is the use of test/dummy folder in rails?

I am starting to learn plugin development in rails, I was wondering what is the use of the test/dummy folder in the rails plugin environment. I understand that it has all the features of a regular app but what how does this help in the plugin environment. Furthermore I was unable to find good resources online for exploring the rails plugin development system, it would be helpful if good resources were posted.
The dummy app with /test works like fixture, to provide a basic environment to run the plugin's functional/integration tests.
Because this is a plugin(actually it's a gem), even it lives in /lib currently, it should have no dependency on your real app. But functional/integration tests need a Rails app, so here comes the dummy.

How do I set up an old Ruby on Rails project on a new server?

I'm not a RoR programmer myself, but a good client of ours has sent a project their previous web team built and I need to get it up and running on their server.
The server uses cPanel and Ruby on Rails is already installed. I've created a project via the cPanel wizard and located the file tree via SSH.
Using SSH, I've tried to replace this file tree with the project I've been sent, but when I hit 'run' in cPanel, the application doesn't actually start (although the success message would indicate that it has).
If I leave the original cPanel-created application in place, I can run/stop no problem and the web interface at :12001 opens up just fine.
I assume there are either conflicts with RoR versions that I need to resolve, or there's simply more to it than just replacing the file tree? Again I'm not a RoR programmer and I'm having a hard time finding a migration guide that tells me anything other than "set up in cPanel and replace the files".
I'd very much appreciate either some genuinely useful links to RoR application setup/migration guides (ideally for cPanel) or a step-by-step answer please.
First, forget Cpanel for now. Try in one environment where you can control everything.
Try to know better the rails version used and the associated gem19s or plugin if from 2.x days. The ruby version is important too, only then you can start defining a plan.
I'm afraid you won't get a step-by-step answer, but I'm sure you can be pointed in the right direction by providing the requested information.
Simple questions: Do you have a Gemfile file at the top at your project? Do you have any plugins (stuff in vendor/plugins)?
Update:
With the Gemfile provided here are the required steps:
Install ruby (if you haven't install it using rvm. The version 1.9.3-x should be the safest.
Install rubygems
Install bundler
Go the project dir and run bundle install
run rake db:migrate (assure you have the database setup acording to config/database.yml
run rails s and check the logs and see if the server is up.
If after installing bundler, you don't have the bundle command in your path, you need to add this your .bash_profile:
PATH=$PATH:$HOME/.local/bin:$HOME/bin
export PATH

How to handle non-gem dependencies in Rails

I have what may be a stupid question. If it is, sorry.
I recently took on a Rails project that requires PhantomJS in order for its Cucumber scenarios to run properly. Unfortunately, the app doesn't say that it depends on PhantomJS, and so when the scenarios failed, it just looked like things were broken, and it wasn't really clear why.
The only way to make the errors stop was to do brew install phantomjs. Obviously, this is not a gem, and installing the PhantomJS gem didn't do anything, either.
What's the proper way to handle non-gem dependencies in Rails projects?
I don't believe there is a standard way.
PhantomJS is a standalone application and needs to be installed as such. It would be the same as installing redis or postgreSQL if your application depended on it.
You were right to install using homebrew though, makes updating removing easier.
This is not a trivial matter. AFAIK,there is no built-in utility to declare dependencies on other things than gems / rubies. Ruby is an interpreted language, and as such may run on a variety of environments ; managing dependencies at this level would be a rather intricate task.
Many people handle this using deployment tools like capistrano or puppet to make sure that the environment in which runs the app is adequate, and install required dependencies if need be. Typically, you would create a rake task to do this, and either call it via capistrano, or have the user call it manually.
If you want to warn people about dependencies, an option would be to use an initializer to check on application boot that the required dependencies are installed on the environment, and issue a warning (or entirely shut down the app) if not.
Another option would simply to perform dependency checking as a series of tests. So if these tests fail you can provide detailed instructions on what is missing.
All in all, the least you can do is just to list environment dependencies in your documentation. Make sure this is on top of your main documentation file.

RubyMine Support for SASS

I'm wondering if anyone has managed to integrate SASS into their RubyMine environment, and if so, how they managed to configure it? I'm a little confused, because although there is a SASS plugin by default in RubyMine, I don't seem to be able to use SCSS files in my project.
Presently what I do is open up a Terminal window in my SCSS directory and run the standard sass --watch source:destination command to monitor and rewrite my SCSS files to CSS. This works OK, but I'd feel a lot smarter if I could figure out how to configure the RubyMine IDE to add it as a run-able service.
My guess is that it has something to do with the Run / Edit Configurations menu, which would add it as a run-able service like Spork and Rspec, but I'm not certain what I would actually configure that to work properly (or if that's even the right way to do it).
Any thoughts?
OK, 45 minutes of experimentation later and it's all figured out. First, you need to know the EXACT command you intend on running in SASS, so if you plan to monitor multiple directories or something else using multiple arguments, test it in a command line for functionality first. Then:
Click menu Run / Edit Configurations
Click Ruby, then the little + button to create a new Ruby configuration
Fill in the dialog boxes using the following template:
Ruby Script: /Users/username/.rvm/gems/ruby-1.9.2-p180#global/bin/sass
Script Arguments: --watch sourcedir1:destinationdir1 --watch sourcedir2:destinationdir2
Working Directory: /my_rails_project/public/stylesheets
Ruby Arguments: -e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift)
Notes: I just used the default Ruby Arguments, and I didn't put any environmental variables in. Works like a champ.

What should I do if my Rails tests don't pass?

I want to start contributing to Rails, fixing patches, submitting my own code etc, and the Rails guide states that the tests MUST run. However, they're currently not and I'm not quite sure what to do.
I'm running Mac OS X, Ruby 1.8 and I have all the needed gems installed - what can I do?
The best place to look is the Rails continuous integration server, which will tell you if there are any currently failing tests. It looks like the most recent edge Rails build failed, and if you checked out the code at any time between August 8th and 16th, you probably got a build with a few failures.
The failing CI tests were due to errors with SQLite2 (now removed from master) and Postgres. We fixed these, but none of these run from a normal rake test so your problems probably aren't related.
Make sure you have the latest Mocha gem installed and that you follow the directions provided by Mike Gunderloy on his afreshcup.com blog: http://afreshcup.com/2008/10/27/contributing-to-rails-step-by-step/

Resources