geordi 2.11.0 → 3.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (85) hide show
  1. checksums.yaml +4 -4
  2. data/.ruby-version +1 -1
  3. data/.travis.yml +8 -2
  4. data/CHANGELOG.md +40 -0
  5. data/Gemfile +2 -5
  6. data/Gemfile.lock +50 -3
  7. data/README.md +34 -7
  8. data/Rakefile +6 -10
  9. data/{bin → exe}/b +0 -0
  10. data/{bin → exe}/cap-all +0 -0
  11. data/{bin → exe}/console-for +0 -0
  12. data/{bin → exe}/cuc +0 -0
  13. data/{bin → exe}/cuc-show +0 -0
  14. data/{bin → exe}/cuc-vnc-setup +0 -0
  15. data/{bin → exe}/deploy-to-production +0 -0
  16. data/{bin → exe}/dump-for +0 -0
  17. data/{bin → exe}/dumple +0 -0
  18. data/{bin → exe}/geordi +0 -0
  19. data/{bin → exe}/gitpt +0 -0
  20. data/{bin → exe}/launchy_browser +0 -0
  21. data/{bin → exe}/load-dump +0 -0
  22. data/{bin → exe}/migrate-all +0 -0
  23. data/{bin → exe}/rs +0 -0
  24. data/{bin → exe}/run_tests +0 -0
  25. data/{bin → exe}/shell-for +0 -0
  26. data/{bin → exe}/tests +0 -0
  27. data/geordi.gemspec +23 -20
  28. data/lib/geordi/COMMAND_TEMPLATE +4 -6
  29. data/lib/geordi/capistrano_config.rb +7 -7
  30. data/lib/geordi/chromedriver_updater.rb +9 -10
  31. data/lib/geordi/cli.rb +1 -7
  32. data/lib/geordi/commands/_setup_vnc.rb +23 -23
  33. data/lib/geordi/commands/apache_site.rb +3 -3
  34. data/lib/geordi/commands/bundle_install.rb +3 -3
  35. data/lib/geordi/commands/capistrano.rb +5 -6
  36. data/lib/geordi/commands/chromedriver_update.rb +0 -9
  37. data/lib/geordi/commands/clean.rb +5 -6
  38. data/lib/geordi/commands/commit.rb +0 -1
  39. data/lib/geordi/commands/console.rb +4 -4
  40. data/lib/geordi/commands/create_database_yml.rb +4 -4
  41. data/lib/geordi/commands/create_databases.rb +3 -3
  42. data/lib/geordi/commands/cucumber.rb +25 -25
  43. data/lib/geordi/commands/delete_dumps.rb +12 -12
  44. data/lib/geordi/commands/deploy.rb +27 -28
  45. data/lib/geordi/commands/drop_databases.rb +13 -15
  46. data/lib/geordi/commands/dump.rb +12 -13
  47. data/lib/geordi/commands/eurest.rb +2 -2
  48. data/lib/geordi/commands/firefox.rb +4 -4
  49. data/lib/geordi/commands/migrate.rb +3 -3
  50. data/lib/geordi/commands/png_optimize.rb +15 -14
  51. data/lib/geordi/commands/rake.rb +3 -3
  52. data/lib/geordi/commands/remove_executable_flags.rb +3 -3
  53. data/lib/geordi/commands/rspec.rb +11 -11
  54. data/lib/geordi/commands/security_update.rb +84 -27
  55. data/lib/geordi/commands/server.rb +6 -6
  56. data/lib/geordi/commands/setup.rb +8 -8
  57. data/lib/geordi/commands/shell.rb +3 -3
  58. data/lib/geordi/commands/tests.rb +1 -1
  59. data/lib/geordi/commands/unit.rb +3 -3
  60. data/lib/geordi/commands/update.rb +7 -7
  61. data/lib/geordi/commands/vnc.rb +1 -1
  62. data/lib/geordi/commands/with_rake.rb +3 -3
  63. data/lib/geordi/commands/yarn_install.rb +3 -3
  64. data/lib/geordi/cucumber.rb +35 -36
  65. data/lib/geordi/db_cleaner.rb +40 -41
  66. data/lib/geordi/dump_loader.rb +6 -5
  67. data/lib/geordi/firefox_for_selenium.rb +26 -29
  68. data/lib/geordi/gitpt.rb +14 -15
  69. data/lib/geordi/interaction.rb +2 -6
  70. data/lib/geordi/remote.rb +9 -10
  71. data/lib/geordi/util.rb +26 -27
  72. data/lib/geordi/version.rb +1 -1
  73. metadata +25 -37
  74. data/features/commit.feature +0 -17
  75. data/features/console.feature +0 -7
  76. data/features/cucumber.feature +0 -261
  77. data/features/deploy.feature +0 -66
  78. data/features/dump.feature +0 -34
  79. data/features/firefox.feature +0 -44
  80. data/features/server.feature +0 -31
  81. data/features/setup.feature +0 -11
  82. data/features/shell.feature +0 -78
  83. data/features/support/env.rb +0 -8
  84. data/features/support/step_definitions/aruba_backport_steps.rb +0 -5
  85. data/features/support/step_definitions/miscellaneous_steps.rb +0 -11
@@ -12,32 +12,32 @@ LONGDESC
12
12
 
13
13
  def delete_dumps(dump_directory = nil)
14
14
  deletable_dumps = []
15
- if dump_directory.nil?
16
- dump_directories = [
15
+ dump_directories = if dump_directory.nil?
16
+ [
17
17
  File.join(Dir.home, 'dumps'),
18
- Dir.pwd
18
+ Dir.pwd,
19
19
  ]
20
20
  else
21
- dump_directories = [dump_directory]
21
+ [dump_directory]
22
22
  end
23
- announce 'Looking for *.dump in ' << dump_directories.join(',')
23
+ Interaction.announce 'Looking for *.dump in ' << dump_directories.join(',')
24
24
  dump_directories.each do |d|
25
- d2 = File.expand_path(d)
26
- unless File.directory? File.realdirpath(d2)
27
- warn "Directory #{d2} does not exist"
25
+ d_2 = File.expand_path(d)
26
+ unless File.directory? File.realdirpath(d_2)
27
+ Interaction.warn "Directory #{d_2} does not exist"
28
28
  next
29
29
  end
30
- deletable_dumps.concat(Dir.glob("#{d2}/**/*.dump"))
30
+ deletable_dumps.concat(Dir.glob("#{d_2}/**/*.dump"))
31
31
  end
32
32
  if deletable_dumps.empty?
33
- success 'No dumps to delete' if deletable_dumps.empty?
33
+ Interaction.success 'No dumps to delete' if deletable_dumps.empty?
34
34
  exit 0
35
35
  end
36
36
  deletable_dumps.uniq!.sort!
37
- note 'The following dumps can be deleted:'
37
+ Interaction.note 'The following dumps can be deleted:'
38
38
  puts
39
39
  puts deletable_dumps
40
- prompt 'Delete those dumps', 'n', /y|yes/ or fail 'Cancelled.'
40
+ Interaction.prompt('Delete those dumps', 'n', /y|yes/) || raise('Cancelled.')
41
41
  deletable_dumps.each do |dump|
42
42
  File.delete dump unless File.directory? dump
43
43
  end
@@ -30,25 +30,25 @@ instead of `cap deploy:migrations`. You can force using `deploy` by passing the
30
30
  -M option: `geordi deploy -M staging`.
31
31
  LONGDESC
32
32
 
33
- option :no_migrations, :aliases => '-M', :type => :boolean,
34
- :desc => 'Run cap deploy instead of cap deploy:migrations'
35
- option :current_branch, :aliases => '-c', :type => :boolean,
36
- :desc => 'Set DEPLOY_BRANCH to the current branch during deploy'
33
+ option :no_migrations, aliases: '-M', type: :boolean,
34
+ desc: 'Run cap deploy instead of cap deploy:migrations'
35
+ option :current_branch, aliases: '-c', type: :boolean,
36
+ desc: 'Set DEPLOY_BRANCH to the current branch during deploy'
37
37
 
38
38
  def deploy(target_stage = nil)
39
39
  # Set/Infer default values
40
- branch_stage_map = { 'master' => 'staging', 'production' => 'production'}
41
- if target_stage and not Util.deploy_targets.include? target_stage
40
+ branch_stage_map = { 'master' => 'staging', 'production' => 'production' }
41
+ if target_stage && !Util.deploy_targets.include?(target_stage)
42
42
  # Target stage autocompletion from available stages
43
43
  target_stage = Util.deploy_targets.find { |t| t.start_with? target_stage }
44
- target_stage || warn('Given deployment stage not found')
44
+ target_stage || Interaction.warn('Given deployment stage not found')
45
45
  end
46
46
 
47
47
  # Ask for required information
48
- target_stage ||= prompt 'Deployment stage:', branch_stage_map.fetch(Util.current_branch, 'staging')
48
+ target_stage ||= Interaction.prompt 'Deployment stage:', branch_stage_map.fetch(Util.current_branch, 'staging')
49
49
  if options.current_branch
50
50
  stage_file = "config/deploy/#{target_stage}.rb"
51
- Util.file_containing? stage_file, 'DEPLOY_BRANCH' or fail <<-ERROR
51
+ Util.file_containing?(stage_file, 'DEPLOY_BRANCH') || Interaction.fail(<<-ERROR)
52
52
  To deploy from the current branch, configure #{stage_file} to respect the
53
53
  environment variable DEPLOY_BRANCH. Example:
54
54
 
@@ -57,38 +57,38 @@ set :branch, ENV['DEPLOY_BRANCH'] || 'master'
57
57
 
58
58
  source_branch = target_branch = Util.current_branch
59
59
  else
60
- source_branch = prompt 'Source branch:', Util.current_branch
61
- target_branch = prompt 'Deploy branch:', branch_stage_map.invert.fetch(target_stage, 'master')
60
+ source_branch = Interaction.prompt 'Source branch:', Util.current_branch
61
+ target_branch = Interaction.prompt 'Deploy branch:', branch_stage_map.invert.fetch(target_stage, 'master')
62
62
  end
63
63
 
64
64
  merge_needed = (source_branch != target_branch)
65
65
  push_needed = merge_needed || `git cherry -v | wc -l`.strip.to_i > 0
66
66
  push_needed = false if Util.testing? # Hard to test
67
67
 
68
- announce "Checking whether your #{source_branch} branch is ready" ############
68
+ Interaction.announce "Checking whether your #{source_branch} branch is ready" ############
69
69
  Util.system! "git checkout #{source_branch}"
70
- if `git status -s | wc -l`.strip != '0' and not Util.testing?
71
- warn "Your #{source_branch} branch holds uncommitted changes."
72
- prompt('Continue anyway?', 'n', /y|yes/) or fail 'Cancelled.'
70
+ if (`git status -s | wc -l`.strip != '0') && !Util.testing?
71
+ Interaction.warn "Your #{source_branch} branch holds uncommitted changes."
72
+ Interaction.prompt('Continue anyway?', 'n', /y|yes/) || raise('Cancelled.')
73
73
  else
74
- note 'All good.'
74
+ Interaction.note 'All good.'
75
75
  end
76
76
 
77
77
  if merge_needed
78
- announce "Checking what's in your #{target_branch} branch right now" #######
78
+ Interaction.announce "Checking what's in your #{target_branch} branch right now" #######
79
79
  Util.system! "git checkout #{target_branch} && git pull"
80
80
  end
81
81
 
82
- announce 'You are about to:' #################################################
83
- note "Merge branch #{source_branch} into #{target_branch}" if merge_needed
82
+ Interaction.announce 'You are about to:' #################################################
83
+ Interaction.note "Merge branch #{source_branch} into #{target_branch}" if merge_needed
84
84
  if push_needed
85
- note 'Push these commits:' if push_needed
85
+ Interaction.note 'Push these commits:' if push_needed
86
86
  Util.system! "git --no-pager log origin/#{target_branch}..#{source_branch} --oneline"
87
87
  end
88
- note "Deploy to #{target_stage}"
89
- note "From current branch #{source_branch}" if options.current_branch
88
+ Interaction.note "Deploy to #{target_stage}"
89
+ Interaction.note "From current branch #{source_branch}" if options.current_branch
90
90
 
91
- if prompt('Go ahead with the deployment?', 'n', /y|yes/)
91
+ if Interaction.prompt('Go ahead with the deployment?', 'n', /y|yes/)
92
92
  puts
93
93
  git_call = []
94
94
  git_call << "git merge #{source_branch}" if merge_needed
@@ -100,17 +100,16 @@ set :branch, ENV['DEPLOY_BRANCH'] || 'master'
100
100
  capistrano_call = "DEPLOY_BRANCH=#{source_branch} #{capistrano_call}" if options.current_branch
101
101
 
102
102
  if git_call.any?
103
- Util.system! git_call.join(' && '), :show_cmd => true
103
+ Util.system! git_call.join(' && '), show_cmd: true
104
104
  end
105
105
 
106
106
  invoke_cmd 'bundle_install'
107
107
 
108
- Util.system! capistrano_call, :show_cmd => true
108
+ Util.system! capistrano_call, show_cmd: true
109
109
 
110
- success 'Deployment complete.'
110
+ Interaction.success 'Deployment complete.'
111
111
  else
112
112
  Util.system! "git checkout #{source_branch}"
113
- fail 'Deployment cancelled.'
113
+ Interaction.fail 'Deployment cancelled.'
114
114
  end
115
-
116
115
  end
@@ -17,18 +17,18 @@ Geordi will ask for confirmation before actually dropping databases and will
17
17
  offer to edit the whitelist instead.
18
18
  LONGDESC
19
19
 
20
- option :postgres_only, :aliases => '-P', :type => :boolean,
21
- :desc => 'Only clean Postgres', :default => false
22
- option :mysql_only, :aliases => '-M', :type => :boolean,
23
- :desc => 'Only clean MySQL/MariaDB', :default => false
24
- option :postgres, :banner => 'PORT_OR_SOCKET',
25
- :desc => 'Use Postgres port or socket'
26
- option :mysql, :banner => 'PORT_OR_SOCKET',
27
- :desc => 'Use MySQL/MariaDB port or socket'
20
+ option :postgres_only, aliases: '-P', type: :boolean,
21
+ desc: 'Only clean Postgres', default: false
22
+ option :mysql_only, aliases: '-M', type: :boolean,
23
+ desc: 'Only clean MySQL/MariaDB', default: false
24
+ option :postgres, banner: 'PORT_OR_SOCKET',
25
+ desc: 'Use Postgres port or socket'
26
+ option :mysql, banner: 'PORT_OR_SOCKET',
27
+ desc: 'Use MySQL/MariaDB port or socket'
28
28
 
29
29
  def drop_databases
30
30
  require 'geordi/db_cleaner'
31
- fail '-P and -M are mutually exclusive' if options.postgres_only and options.mysql_only
31
+ Interaction.fail '-P and -M are mutually exclusive' if options.postgres_only && options.mysql_only
32
32
  mysql_flags = nil
33
33
  postgres_flags = nil
34
34
 
@@ -38,7 +38,7 @@ def drop_databases
38
38
  mysql_flags = "--port=#{mysql_port} --protocol=TCP"
39
39
  rescue AttributeError
40
40
  unless File.exist? options.mysql
41
- fail "Path #{options.mysql} is not a valid MySQL socket"
41
+ Interaction.fail "Path #{options.mysql} is not a valid MySQL socket"
42
42
  end
43
43
  mysql_flags = "--socket=#{options.mysql}"
44
44
  end
@@ -48,13 +48,11 @@ def drop_databases
48
48
  postgres_flags = "--port=#{options.postgres}"
49
49
  end
50
50
 
51
- extra_flags = {'mysql' => mysql_flags,
52
- 'postgres' => postgres_flags
53
- }
51
+ extra_flags = { 'mysql' => mysql_flags,
52
+ 'postgres' => postgres_flags }
54
53
  cleaner = DBCleaner.new(extra_flags)
55
54
  cleaner.clean_mysql unless options.postgres_only
56
55
  cleaner.clean_postgres unless options.mysql_only
57
56
 
58
- success 'Done.'
57
+ Interaction.success 'Done.'
59
58
  end
60
-
@@ -20,44 +20,43 @@ dump into the development database after downloading it.
20
20
  geordi dump staging -l
21
21
  DESC
22
22
 
23
- option :load, :aliases => ['-l'], :type => :string, :desc => 'Load a dump'
24
- option :select_server, :default => false, :type => :boolean, :aliases => '-s'
23
+ option :load, aliases: ['-l'], type: :string, desc: 'Load a dump'
24
+ option :select_server, default: false, type: :boolean, aliases: '-s'
25
25
 
26
- def dump(target = nil, *args)
26
+ def dump(target = nil, *_args)
27
27
  require 'geordi/dump_loader'
28
28
  require 'geordi/remote'
29
29
 
30
30
  if target.nil?
31
31
  if options.load
32
32
  # validate load option
33
- fail 'Missing a dump file.' if options.load == 'load'
34
- File.exists?(options.load) or fail 'Could not find the given dump file: ' + options.load
33
+ Interaction.fail 'Missing a dump file.' if options.load == 'load'
34
+ File.exist?(options.load) || raise('Could not find the given dump file: ' + options.load)
35
35
 
36
36
  loader = DumpLoader.new(options.load)
37
37
 
38
- announce "Sourcing dump into the #{loader.config['database']} db"
38
+ Interaction.announce "Sourcing dump into the #{loader.config['database']} db"
39
39
  loader.load
40
40
 
41
- success "Your #{loader.config['database']} database has now the data of #{options.load}."
41
+ Interaction.success "Your #{loader.config['database']} database has now the data of #{options.load}."
42
42
 
43
43
  else
44
- announce 'Dumping the development database'
44
+ Interaction.announce 'Dumping the development database'
45
45
  Util.system! 'dumple development'
46
- success 'Successfully dumped the development database.'
46
+ Interaction.success 'Successfully dumped the development database.'
47
47
  end
48
48
 
49
49
  else
50
- announce 'Dumping the database of ' + target
50
+ Interaction.announce 'Dumping the database of ' + target
51
51
  dump_path = Geordi::Remote.new(target).dump(options)
52
52
 
53
53
  if options.load
54
54
  loader = DumpLoader.new(dump_path)
55
55
 
56
- announce "Sourcing dump into the #{loader.config['database']} db"
56
+ Interaction.announce "Sourcing dump into the #{loader.config['database']} db"
57
57
  loader.load
58
58
 
59
- success "Your #{loader.config['database']} database has now the data of #{target}."
59
+ Interaction.success "Your #{loader.config['database']} database has now the data of #{target}."
60
60
  end
61
61
  end
62
-
63
62
  end
@@ -1,4 +1,4 @@
1
- desc 'eurest', 'Open the current Eurest cantina menu', :hide => true
1
+ desc 'eurest', 'Open the current Eurest cantina menu', hide: true
2
2
  def eurest
3
- Util.system! %{file="Speiseplan_KW`date +%V`.pdf" && wget -O/tmp/$file http://www.eurest-extranet.de/eurest/export/sites/default/sigma-technopark/de/downloads/$file && xdg-open /tmp/$file}
3
+ Util.system! %(file="Speiseplan_KW`date +%V`.pdf" && wget -O/tmp/$file http://www.eurest-extranet.de/eurest/export/sites/default/sigma-technopark/de/downloads/$file && xdg-open /tmp/$file)
4
4
  end
@@ -10,12 +10,12 @@ Useful when you need Firefox for Selenium or the VNC set up, but can't use the
10
10
  This command is aliased `chrome` for users running Selenium in Chrome.
11
11
  LONGDESC
12
12
 
13
- option :setup, :banner => 'FIREFOX_VERSION',
14
- :desc => 'Install a special test runner Firefox with the given version'
13
+ option :setup, banner: 'FIREFOX_VERSION',
14
+ desc: 'Install a special test runner Firefox with the given version'
15
15
 
16
16
  def firefox(*command)
17
17
  if options.setup
18
- fail 'Firefox version required (e.g. --setup 24.0)' if options.setup == 'setup'
18
+ Interaction.fail 'Firefox version required (e.g. --setup 24.0)' if options.setup == 'setup'
19
19
 
20
20
  require 'geordi/firefox_for_selenium'
21
21
  Geordi::FirefoxForSelenium.install(options.setup)
@@ -27,7 +27,7 @@ def firefox(*command)
27
27
  FirefoxForSelenium.setup_firefox
28
28
 
29
29
  puts
30
- note_cmd command.join(' ')
30
+ Interaction.note_cmd command.join(' ')
31
31
  system *command # Util.system! would reset the Firefox PATH
32
32
  end
33
33
  end
@@ -10,11 +10,11 @@ LONGDESC
10
10
  def migrate
11
11
  invoke_cmd 'bundle_install'
12
12
  invoke_cmd 'yarn_install'
13
- announce 'Migrating'
13
+ Interaction.announce 'Migrating'
14
14
 
15
15
  if File.directory?('db/migrate')
16
16
  if Util.file_containing?('Gemfile', /parallel_tests/)
17
- note 'Development and parallel test databases'
17
+ Interaction.note 'Development and parallel test databases'
18
18
  puts
19
19
 
20
20
  Util.system! 'bundle exec rake db:migrate parallel:prepare'
@@ -22,6 +22,6 @@ def migrate
22
22
  invoke_cmd 'rake', 'db:migrate'
23
23
  end
24
24
  else
25
- note 'No migrations directory found.'
25
+ Interaction.note 'No migrations directory found.'
26
26
  end
27
27
  end
@@ -10,10 +10,10 @@ LONGDESC
10
10
  def png_optimize(path)
11
11
  require 'fileutils'
12
12
 
13
- announce 'Optimizing .png files'
13
+ Interaction.announce 'Optimizing .png files'
14
14
 
15
15
  if `which pngcrush`.strip.empty?
16
- fail 'Please install pngcrush first (sudo apt-get install pngcrush)'
16
+ Interaction.fail 'Please install pngcrush first (sudo apt-get install pngcrush)'
17
17
  end
18
18
 
19
19
  po = PngOptimizer.new
@@ -22,10 +22,10 @@ def png_optimize(path)
22
22
  elsif File.file?(path)
23
23
  po.optimize_inplace(path)
24
24
  else
25
- fail 'Neither directory nor file: ' + path
25
+ Interaction.fail 'Neither directory nor file: ' + path
26
26
  end
27
27
 
28
- success 'PNG optimization completed.'
28
+ Interaction.success 'PNG optimization completed.'
29
29
  end
30
30
 
31
31
  class PngOptimizer
@@ -35,10 +35,10 @@ class PngOptimizer
35
35
  end
36
36
 
37
37
  def optimization_default_args
38
- args = ""
39
- args << "-rem alla " # remove everything except transparency
40
- args << "-rem text " # remove text chunks
41
- args << "-reduce " # eliminate unused colors and reduce bit-depth (if possible)
38
+ args = ''
39
+ args << '-rem alla ' # remove everything except transparency
40
+ args << '-rem text ' # remove text chunks
41
+ args << '-reduce ' # eliminate unused colors and reduce bit-depth (if possible)
42
42
  args
43
43
  end
44
44
 
@@ -50,10 +50,11 @@ class PngOptimizer
50
50
  dirname = File.dirname(original)
51
51
  basename = File.basename(original)
52
52
  count = 0
53
- begin
53
+
54
+ loop do
54
55
  tmp_name = "#{dirname}/#{basename}_temp_#{count += 1}.png"
55
- end while File.exists?(tmp_name)
56
- tmp_name
56
+ break tmp_name unless File.exist?(tmp_name)
57
+ end
57
58
  end
58
59
 
59
60
  def optimize_inplace(input_file)
@@ -61,9 +62,9 @@ class PngOptimizer
61
62
  result = optimize_file(input_file, temp_file)
62
63
  if result
63
64
  FileUtils.rm(input_file)
64
- FileUtils.mv("#{temp_file}", "#{input_file}")
65
+ FileUtils.mv(temp_file.to_s, input_file.to_s)
65
66
  else
66
- fail 'Error:' + $?
67
+ Interaction.fail 'Error:' + $?
67
68
  end
68
69
  end
69
70
 
@@ -71,7 +72,7 @@ class PngOptimizer
71
72
  # Dir[".png"] works case sensitive, so to catch all funky .png extensions we have to go the following way:
72
73
  png_relative_paths = []
73
74
  Dir["#{path}/*.*"].each do |file_name|
74
- png_relative_paths << file_name if ends_with?(File.basename(file_name.downcase), ".png")
75
+ png_relative_paths << file_name if ends_with?(File.basename(file_name.downcase), '.png')
75
76
  end
76
77
  png_relative_paths.each do |png_relative_path|
77
78
  optimize_inplace(png_relative_path)
@@ -10,10 +10,10 @@ Example: `geordi rake db:migrate`
10
10
  LONGDESC
11
11
 
12
12
  def rake(*args)
13
- for env in %w(development test cucumber) # update long_desc when changing this
14
- if File.exists? "config/environments/#{env}.rb"
13
+ %w[development test cucumber].each do |env| # update long_desc when changing this
14
+ if File.exist? "config/environments/#{env}.rb"
15
15
  call = %w[bundle exec rake] + args + ["RAILS_ENV=#{env}"]
16
- note_cmd call.join(' ')
16
+ Interaction.note_cmd call.join(' ')
17
17
 
18
18
  Util.system! *call
19
19
  end
@@ -1,13 +1,13 @@
1
1
  desc 'remove-executable-flags', 'Remove executable-flags from files that should not be executable'
2
2
  def remove_executable_flags
3
- announce 'Removing executable-flags'
3
+ Interaction.announce 'Removing executable-flags'
4
4
 
5
5
  patterns = %w[
6
6
  *.rb *.html *.erb *.haml *.yml *.css *.sass *.rake *.png *.jpg
7
7
  *.gif *.pdf *.txt *.rdoc *.feature Rakefile VERSION README Capfile
8
8
  ]
9
- for pattern in patterns
10
- note pattern
9
+ patterns.each do |pattern|
10
+ Interaction.note pattern
11
11
  `find . -name "#{pattern}" -exec chmod -x {} ';'`
12
12
  end
13
13
  puts 'Done.'
@@ -7,29 +7,29 @@ detection, etc.
7
7
  LONGDESC
8
8
 
9
9
  def rspec(*files)
10
- if File.exists?('spec/spec_helper.rb')
10
+ if File.exist?('spec/spec_helper.rb')
11
11
  invoke_cmd 'bundle_install'
12
12
  invoke_cmd 'yarn_install'
13
13
 
14
- announce 'Running specs'
14
+ Interaction.announce 'Running specs'
15
15
 
16
- if Util.file_containing?('Gemfile', /parallel_tests/) and files.empty?
17
- note 'All specs at once (using parallel_tests)'
18
- Util.system! 'bundle exec rake parallel:spec', :fail_message => 'Specs failed.'
16
+ if Util.file_containing?('Gemfile', /parallel_tests/) && files.empty?
17
+ Interaction.note 'All specs at once (using parallel_tests)'
18
+ Util.system! 'bundle exec rake parallel:spec', fail_message: 'Specs failed.'
19
19
 
20
20
  else
21
21
  # tell which specs will be run
22
22
  if files.empty?
23
23
  files << 'spec/'
24
- note 'All specs in spec/'
24
+ Interaction.note 'All specs in spec/'
25
25
  else
26
- note 'Only: ' + files.join(', ')
26
+ Interaction.note 'Only: ' + files.join(', ')
27
27
  end
28
28
 
29
29
  command = ['bundle exec']
30
- command << if File.exists?('script/spec')
30
+ command << if File.exist?('script/spec')
31
31
  'spec -c' # RSpec 1
32
- elsif File.exists?('bin/rspec')
32
+ elsif File.exist?('bin/rspec')
33
33
  'bin/rspec'
34
34
  else
35
35
  'rspec'
@@ -38,9 +38,9 @@ def rspec(*files)
38
38
  command << files.join(' ')
39
39
 
40
40
  puts
41
- Util.system! command.join(' '), :fail_message => 'Specs failed.'
41
+ Util.system! command.join(' '), fail_message: 'Specs failed.'
42
42
  end
43
43
  else
44
- note 'RSpec not employed.'
44
+ Interaction.note 'RSpec not employed.'
45
45
  end
46
46
  end