Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
56 changes: 56 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby

name: Ruby

on:
push:
branches: [ 'stable' ]
pull_request:
branches: [ 'stable' ]

permissions:
contents: read

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
ruby-version:
- '3.1'
- '3.2'
- '3.3'
gemfile:
- core/Gemfile
- cli/gemfiles/sass_3_4.gemfile
- cli/gemfiles/listen_2.gemfile
component:
- cli
- core
exclude:
- gemfile: cli/gemfiles/sass_3_4.gemfile
component: core
- gemfile: cli/gemfiles/listen_2.gemfile
component: core
- gemfile: core/Gemfile
component: cli

env: # $BUNDLE_GEMFILE must be set at the job level, so it is set for all steps
BUNDLE_GEMFILE: ${{ github.workspace }}/${{ matrix.gemfile }}
CI_TEST: ${{ matrix.component }}

steps:
- uses: actions/checkout@v3
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby-version }}
bundler-cache: true

- name: Run tests
run: cd $CI_TEST && bundle exec rake
1 change: 1 addition & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ruby 3.3.0
9 changes: 5 additions & 4 deletions cli/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ gemspec unless defined?(CI)

unless ENV['PKG']

gem "sass", "~> 3.3.13" unless defined?(CI)
gem "sass", "~> 3.4.0" unless defined?(CI)
gem "compass-core", :path => "../core" unless defined?(CI)
gem "compass-import-once", :path => "../import-once" unless defined?(CI)
gem 'sass-globbing', "~> 1.1.1"
gem "cucumber", "~> 1.2.1"
gem "cucumber", "~> 2.0"
gem "rspec", "~> 2.0.0"
gem "compass-validator", "3.0.1"
gem "css_parser", "~> 1.0.1"
Expand All @@ -19,7 +19,9 @@ unless ENV['PKG']
gem 'rake'
gem 'json', '~> 1.7.7', :platforms => :ruby_18
gem 'true', "~> 0.2.3"
gem 'test-unit', '~> 3.0.9'
gem 'test-unit'
gem 'warning'
gem 'debug'

# Warning be carful adding OS dependant gems above this line it will break the CI server please
# place them below so they are excluded
Expand All @@ -34,6 +36,5 @@ unless ENV['PKG']
gem 'guard-cucumber', :platforms => [:mri_20]
# gem 'packager'
gem 'colorize'
gem 'pry'
end
end
8 changes: 4 additions & 4 deletions cli/Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Rake::TestTask.new :test do |t|
test_files = FileList['test/**/*_test.rb']
test_files.exclude('test/rails/*', 'test/haml/*')
t.test_files = test_files
t.verbose = true
t.verbose = false
end

Rake::TestTask.new :units do |t|
Expand All @@ -51,7 +51,7 @@ Rake::TestTask.new :units do |t|
test_files = FileList['test/units/**/*_test.rb']
test_files.exclude('test/rails/*', 'test/haml/*')
t.test_files = test_files
t.verbose = true
t.verbose = false
end

Rake::TestTask.new :integrations do |t|
Expand All @@ -60,7 +60,7 @@ Rake::TestTask.new :integrations do |t|
test_files = FileList['test/integrations/**/*_test.rb']
test_files.exclude('test/rails/*', 'test/haml/*')
t.test_files = test_files
t.verbose = true
t.verbose = false
end

namespace :git do
Expand All @@ -86,7 +86,7 @@ begin
test_files.exclude('test/rails/*', 'test/haml/*')
rcov.pattern = test_files
rcov.output_dir = 'coverage'
rcov.verbose = true
rcov.verbose = false
rcov.rcov_opts = %w{--exclude osx\/objc,gems\/,spec\/,features\/ --aggregate coverage.data}
rcov.rcov_opts << %[-o "coverage" --sort coverage]
end
Expand Down
4 changes: 2 additions & 2 deletions cli/features/step_definitions/command_line_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,11 @@
end

Then /an? \w+ file ([^ ]+) is (not )?removed/ do |filename, negated|
File.exists?(filename).should == !!negated
File.exist?(filename).should == !!negated
end

Then /an? \w+ file ([^ ]+) is (not )?created/ do |filename, negated|
File.exists?(filename).should == !negated
File.exist?(filename).should == !negated
end

Then "the following files are reported removed:" do |table|
Expand Down
13 changes: 6 additions & 7 deletions cli/gemfiles/listen_2.gemfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
CI=true
main_gemfile = File.expand_path(File.join(File.dirname(__FILE__), "..", "Gemfile"))
main_gemfile = File.expand_path(File.join(File.dirname(__FILE__), '..', 'Gemfile'))
eval File.read(main_gemfile), nil, main_gemfile

gem 'sass', '~> 3.3.12'
gem 'compass', :path => "../"
gem 'compass-core', :path => "../../core"
gem 'compass-import-once', :path => "../../import-once"
gem 'listen', '~> 2.7.1'
gem 'sass', '~> 3.4.0'
gem 'compass-core', path: '../../core'
gem 'compass-import-once', path: '../../import-once'
gem 'listen'

gemspec :path=>"../"
gemspec path: '../'
10 changes: 0 additions & 10 deletions cli/gemfiles/sass_3_3.gemfile

This file was deleted.

9 changes: 9 additions & 0 deletions cli/gemfiles/sass_3_4.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
CI=true
main_gemfile = File.expand_path(File.join(File.dirname(__FILE__), "..", "Gemfile"))
eval File.read(main_gemfile), nil, main_gemfile

gem 'sass', '~> 3.4.0'
gem 'compass-core', path: '../../core'
gem 'compass-import-once', path: '../../import-once'

gemspec path: '../'
8 changes: 4 additions & 4 deletions cli/lib/compass/actions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ def copy(from, to, options = nil, binary = false)
def directory(dir, options = nil)
options ||= self.options if self.respond_to?(:options)
options ||= {}
if File.exists?(dir) && File.directory?(dir)
if File.exist?(dir) && File.directory?(dir)
# do nothing
elsif File.exists?(dir)
elsif File.exist?(dir)
msg = "#{basename(dir)} already exists and is not a directory."
raise Compass::FilesystemConflict.new(msg)
else
Expand All @@ -38,7 +38,7 @@ def write_file(file_name, contents, options = nil, binary = false)
options ||= self.options if self.respond_to?(:options)
skip_write = false
contents = process_erb(contents, options[:erb]) if options[:erb]
if File.exists?(file_name)
if File.exist?(file_name)
existing_contents = IO.read(file_name)
if existing_contents == contents
log_action :identical, basename(file_name), options
Expand Down Expand Up @@ -73,7 +73,7 @@ def remove(file_name)
if File.directory?(file_name)
FileUtils.rm_rf file_name
log_action :remove, basename(file_name)+"/", options
elsif File.exists?(file_name)
elsif File.exist?(file_name)
File.unlink file_name
log_action :remove, basename(file_name), options
end
Expand Down
2 changes: 1 addition & 1 deletion cli/lib/compass/app_integration/stand_alone/installer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def write_configuration_files(config_file = nil)
end

def config_files_exist?
File.exists? targetize('config.rb')
File.exist? targetize('config.rb')
end

def config_contents
Expand Down
2 changes: 1 addition & 1 deletion cli/lib/compass/commands/project_base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def project_images_subdirectory
end

def assert_project_directory_exists!
if File.exists?(project_directory) && !File.directory?(project_directory)
if File.exist?(project_directory) && !File.directory?(project_directory)
raise Compass::FilesystemConflict.new("#{project_directory} is not a directory.")
elsif !File.directory?(project_directory)
raise Compass::Error.new("#{project_directory} does not exist.")
Expand Down
2 changes: 1 addition & 1 deletion cli/lib/compass/commands/project_stats.rb
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ def sass_columns(sass_file)
end

def css_columns(css_file)
if File.exists?(css_file)
if File.exist?(css_file)
cf = Compass::Stats::CssFile.new(css_file)
cf.analyze!
%w(selector_count prop_count file_size).map do |t|
Expand Down
2 changes: 1 addition & 1 deletion cli/lib/compass/commands/update_project.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def new_config?(compiler)
return false unless config_file
config_mtime = File.mtime(config_file)
compiler.file_list.each do |(_, css_filename, _)|
return config_file if File.exists?(css_filename) && config_mtime > File.mtime(css_filename)
return config_file if File.exist?(css_filename) && config_mtime > File.mtime(css_filename)
end
nil
end
Expand Down
2 changes: 1 addition & 1 deletion cli/lib/compass/compiler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def new_config?
return false unless config_file
config_mtime = File.mtime(config_file)
css_files.each do |css_filename|
return config_file if File.exists?(css_filename) && config_mtime > File.mtime(css_filename)
return config_file if File.exist?(css_filename) && config_mtime > File.mtime(css_filename)
end
nil
end
Expand Down
2 changes: 1 addition & 1 deletion cli/lib/compass/configuration/helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def add_project_configuration(*args)
# Finds the configuration file, if it exists in a known location.
def detect_configuration_file(project_path = nil)
possible_files = KNOWN_CONFIG_LOCATIONS.map{|f| projectize(f, project_path) }
possible_files.detect{|f| File.exists?(f)}
possible_files.detect{|f| File.exist?(f)}
end

def handle_configuration_change!
Expand Down
2 changes: 1 addition & 1 deletion cli/lib/compass/installers/manifest.rb
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ def with_manifest(manifest_file)
# evaluated in a Manifest instance context
def parse(manifest_file)
with_manifest(manifest_file) do
if File.exists?(manifest_file)
if File.exist?(manifest_file)
open(manifest_file) do |f|
eval(f.read, instance_binding, manifest_file)
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ def save(filename)
end
end
end
end
end
2 changes: 1 addition & 1 deletion cli/lib/compass/sass_extensions/sprites/image.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def file
def find_file
Compass.configuration.sprite_load_path.compact.each do |path|
f = File.join(path, relative_file)
if File.exists?(f)
if File.exist?(f)
return f
end
end
Expand Down
4 changes: 2 additions & 2 deletions cli/lib/compass/sass_extensions/sprites/sprite_methods.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def cleanup_old_sprites

# Does this sprite need to be generated
def generation_required?
!File.exists?(filename) || outdated? || options[:force]
!File.exist?(filename) || outdated? || options[:force]
end

# Returns the uniqueness hash for this sprite object
Expand Down Expand Up @@ -109,7 +109,7 @@ def image_filenames

# Checks whether this sprite is outdated
def outdated?
if File.exists?(filename)
if File.exist?(filename)
return @images.any? {|image| image.mtime.to_i > self.mtime.to_i }
end
true
Expand Down
8 changes: 4 additions & 4 deletions cli/test/integrations/compass_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def test_on_stylesheet_error_callback
def test_empty_project
# With no sass files, we should have no css files.
within_project(:empty) do |proj|
return unless proj.css_path && File.exists?(proj.css_path)
return unless proj.css_path && File.exist?(proj.css_path)
Dir.new(proj.css_path).each do |f|
fail "This file should not have been generated: #{f}" unless f == "." || f == ".."
end
Expand Down Expand Up @@ -186,7 +186,7 @@ def assert_renders_correctly(*arguments)

def within_project(project_name, config_block = nil)
@current_project = project_name
Compass.add_configuration(configuration_file(project_name)) if File.exists?(configuration_file(project_name))
Compass.add_configuration(configuration_file(project_name)) if File.exist?(configuration_file(project_name))
Compass.configuration.project_path = project_path(project_name)
Compass.configuration.environment = :production
Compass.configuration.sourcemap = false unless Compass.configuration.sourcemap_set?
Expand All @@ -195,7 +195,7 @@ def within_project(project_name, config_block = nil)
config_block.call(Compass.configuration)
end

if Compass.configuration.sass_path && File.exists?(Compass.configuration.sass_path)
if Compass.configuration.sass_path && File.exist?(Compass.configuration.sass_path)
compiler = Compass.sass_compiler
compiler.logger = Compass::NullLogger.new
compiler.clean!
Expand All @@ -221,7 +221,7 @@ def each_sass_file(sass_dir = nil)

def save_output(dir)
FileUtils.rm_rf(save_path(dir))
FileUtils.cp_r(tempfile_path(dir), save_path(dir)) if File.exists?(tempfile_path(dir))
FileUtils.cp_r(tempfile_path(dir), save_path(dir)) if File.exist?(tempfile_path(dir))
end

def project_path(project_name)
Expand Down
13 changes: 13 additions & 0 deletions cli/test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,19 @@
test_dir = File.dirname(__FILE__)
$:.unshift(test_dir) unless $:.include?(test_dir)

require 'warning'

Warning.process do |w|
if w.include?("The $start value for random")
$stderr.puts(w)
elsif w.include?("keyword")
$stderr.puts(w)
elsif w.match?(/this is a warning/)
$stderr.puts(w)
else
nil
end
end
require 'compass'
require 'test/unit'
require 'true'
Expand Down
6 changes: 3 additions & 3 deletions cli/test/units/command_line_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def test_print_version
def test_basic_install
within_tmp_directory do
compass(*%w(create --boring basic))
assert File.exists?("basic/sass/screen.scss")
assert File.exist?("basic/sass/screen.scss")
assert_action_performed :directory, "basic/"
assert_action_performed :create, "basic/sass/screen.scss"
end
Expand All @@ -34,8 +34,8 @@ def test_basic_install
define_method "test_#{framework.name}_installation" do
within_tmp_directory do
compass(*%W(create --boring --using #{framework.name} #{framework.name}_project))
assert File.exists?("#{framework.name}_project/sass/screen.scss"), "sass/screen.scss is missing. Found: #{Dir.glob("#{framework.name}_project/**/*").join(", ")}"
assert File.exists?("#{framework.name}_project/stylesheets/screen.css")
assert File.exist?("#{framework.name}_project/sass/screen.scss"), "sass/screen.scss is missing. Found: #{Dir.glob("#{framework.name}_project/**/*").join(", ")}"
assert File.exist?("#{framework.name}_project/stylesheets/screen.css")
assert_action_performed :directory, "#{framework.name}_project/"
assert_action_performed :create, "#{framework.name}_project/sass/screen.scss"
assert_action_performed :write, "#{framework.name}_project/stylesheets/screen.css"
Expand Down
Loading
Loading