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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
PATH
remote: .
specs:
xing-root (0.0.7)
xing-root (0.0.8)
caliph (~> 0.3)
edict (< 1.0)
mattock (~> 0.10)
xing-dev-assets (> 0, <= 1.0)

GEM
remote: https://rubygems.org/
Expand Down Expand Up @@ -37,6 +38,7 @@ GEM
tilt (> 0)
valise (~> 1.1.1)
paint (0.8.7)
rack (1.6.4)
rake (10.4.2)
rspec (3.3.0)
rspec-core (~> 3.3.0)
Expand All @@ -62,6 +64,8 @@ GEM
thor (0.19.1)
tilt (2.0.1)
valise (1.1.4)
xing-dev-assets (0.0.1)
rack (~> 1.6)

PLATFORMS
ruby
Expand All @@ -71,3 +75,6 @@ DEPENDENCIES
codeclimate-test-reporter
corundum
xing-root!

BUNDLED WITH
1.11.2
2 changes: 1 addition & 1 deletion lib/xing/tasks/develop.rb
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ def define
words << "-p#{static_server_port}" #ok
words << "static-app.ru"

sa.dir = "backend"
sa.dir = "."
sa.shell_cmd = words
sa.env_hash = {
"LRD_BACKEND_PORT" => "#{rails_server_port}", # deprecate for 1.0
Expand Down
62 changes: 27 additions & 35 deletions lib/xing/tasks/spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,18 @@
require 'xing/tasks/tasklib'

module Xing
module Edicts
class Spec < CleanRun
setting :spec_targets, "spec/"
setting :shell_cmd, %w{bundle exec rspec}

def action
self.shell_cmd += [*spec_targets]
super
end
end
end

module Tasks
class Spec < Tasklib
default_namespace :spec
Expand Down Expand Up @@ -29,48 +41,28 @@ def define
pd.shell_cmd = %w{bundle exec rake db:test:prepare}
end

full_spec_edict = Edicts::CleanRun.new do |eddie|
copy_settings_to(eddie)
eddie.dir = "backend"
eddie.shell_cmd = %w{bundle exec rspec}
end
task :full, [:spec_files] => [:check_dependencies, 'frontend:code_structure', :grunt_ci_test, 'backend:setup', :prepare_db] do |_task, args|
if args[:spec_files]
full_spec_edict.shell_cmd.push(args[:spec_files])
end
full_spec_edict.enact
edict_task(:backend_spec, {%i(spec_targets) => %w(backend:setup prepare_db)}, Edicts::Spec) do |full_spec|
full_spec.dir = "backend"
end
task :full => [:check_dependencies, 'frontend:code_structure', :grunt_ci_test, 'backend:setup', :prepare_db, :backend_spec]

desc "Run all feature specs, repeating with each browser width as default"
responsivity_edict = Edicts::CleanRun.new do |eddie|
copy_settings_to(eddie)
eddie.dir = "backend"
end
task :responsivity, [:spec_files] => ['backend:setup', :prepare_db] do |_task, args|
namespace :responsivity do
%w{mobile small medium desktop}.each do |size|
responsivity_edict.shell_cmd = ["bundle", "exec", "rspec", "-o", "tmp/rspec_#{size}.txt"]
responsivity_edict.env_hash = {'BROWSER_SIZE' => size}
if args[:spec_files]
responsivity_edict.shell_cmd.push(args[:spec_files])
else
responsivity_edict.shell_cmd.push('spec/features')
edict_task(size, {%i(spec_files) => %w(backend:setup prepare_db)}, Edicts::Spec) do |resp|
resp.shell_cmd = ["bundle", "exec", "rspec", "-o", "tmp/rspec_#{size}.txt"]
resp.env_hash = {'BROWSER_SIZE' => size}
resp.dir = 'backend'
end
responsivity_edict.enact rescue true
end
end

fast_edict = Edicts::CleanRun.new do |eddie|
copy_settings_to(eddie)
eddie.dir = "backend"
eddie.shell_cmd = %w{bundle exec rspec}
end
task :fast, [:spec_files] => ['backend:setup', :prepare_db] do |_task, args|
if args[:spec_files]
fast_edict.shell_cmd.push(args[:spec_files])
else
fast_edict.shell_cmd.push("--tag").push("~type:feature")
end
fast_edict.enact
desc "Run all feature specs, repeating with each browser width as default"
task :responsivity, [:spec_files] => %w{responsivity:mobile responsivity:small responsivity:medium responsivity:desktop}

edict_task(:fast, {%i(spec_targets) => %w(backend:setup prepare_db)}, Edicts::Spec) do |fast_spec|
fast_spec.dir = "backend"
fast_spec.shell_cmd = %w{bundle exec rspec}
fast_spec.spec_targets = %w(--tag ~type:feature)
end
end
end
Expand Down
15 changes: 13 additions & 2 deletions lib/xing/tasks/tasklib.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,23 @@
module Xing
module Tasks
class Tasklib < Mattock::Tasklib
def edict_task(name, klass, &_block)
def edict_task(*args)
klass = args.pop
raise "expected a subclass of Edict::Rule, got #{klass}" unless klass < Edict::Rule
edict = klass.new do |eddie|
copy_settings_to(eddie)
yield eddie if block_given?
end
edict_task = task name do

edict_task = task *args do |task, args|
set_args = Hash[
(args.keys||[]).find_all do |name|
!args[name].nil?
end.map do |name|
[name, args[name]]
end
]
edict.from_hash(set_args)
edict.enact
end

Expand Down
5 changes: 2 additions & 3 deletions xing-root.gemspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Gem::Specification.new do |spec|
spec.name = "xing-root"
#{MAJOR: incompatible}.{MINOR added feature}.{PATCH bugfix}-{LABEL}
spec.version = "0.0.7"
spec.version = "0.0.8"
author_list = {
"Judson Lester" => "judson@lrdesign.com",
"Patricia Ho" => "patricia@lrdesign.com"
Expand Down Expand Up @@ -63,6 +63,5 @@ Gem::Specification.new do |spec|
spec.add_dependency("edict", "< 1.0")
spec.add_dependency("caliph", "~> 0.3")
spec.add_dependency("mattock", "~> 0.10")

#spec.post_install_message = "Thanks for installing my gem!"
spec.add_dependency("xing-dev-assets", "> 0", "<= 1.0")
end