rake_rack 1.0.1 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- ZTE4MDg3YjA0ZjAzNWUxNzQyZDgwYmVmMWE5NmRmOWI5ODZhZjQwZA==
5
- data.tar.gz: !binary |-
6
- OWE2ZDIxMjUzNjQ0NjkxYTE0ODFiZDRlYTUzODY4NjgwNThiMmFkMQ==
2
+ SHA1:
3
+ metadata.gz: 779c63528007bd1658fa4b62921c28c23dcb2b4b
4
+ data.tar.gz: 8ee6732d620c16c23a8a2ca5eae7e37aa09a18f0
7
5
  SHA512:
8
- metadata.gz: !binary |-
9
- NjA4MTYwYTQ5ZjFkNWY0MTQ1MDA4NjY4NjlmNjFkODZkNTBlZTljN2MyNjYy
10
- ODI4ODJhZDZhNWE5NzIwYTMwMjA4MjJmZmJhMzJiNTk2NTAzMmYwMDhhM2Mz
11
- ZTQ4YmQ2MmZmODczNGM2MTJkZWFmNzMxNmZhNjVhZmE5MTJhYzg=
12
- data.tar.gz: !binary |-
13
- MmE1NDNiY2I1ZTRhMGJjNWU2ZjVjYmZjMjk0ZWFmNTllNjM2Y2I3ZjZmZDdm
14
- N2ZmN2Q1MjNlOGQ0MGZhYmMzZWVlMjk2ZTBmZGI2YWJmNTU3NzkzMmFhNmI3
15
- NjIyYmJmMDk0OWM4OTg2YzgwYzhkYjk5ZjQ4OTM5NDBhOTc2YzM=
6
+ metadata.gz: db7319de2d9a9acd4d888086e02bc5bd24bd15cba8f28505464e9798e5d7a6d386608310ecf50f5271e53e53550db5dd07614b66288eb3174d347fd319802f77
7
+ data.tar.gz: 8283c38a7352d8fadf04cab850f65f4a1837c27eb9d6293865b8675804b44ed42cf0e8cb060a78419d6364ea11c792dd12a29502ab41a55cf4ffdd66cccc8b2f
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.1.2
data/Gemfile CHANGED
@@ -1,7 +1,12 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- gem 'rspec'
4
- gem 'rake'
5
- gem 'simplecov'
6
- gem 'timecop'
7
- gem 'term-ansicolor', '~> 1.3'
3
+ gemspec
4
+
5
+ group :development, :test do
6
+ gem 'rake'
7
+ gem 'rspec'
8
+ gem 'bundler-audit'
9
+ gem 'simplecov'
10
+ gem 'timecop'
11
+ gem 'term-ansicolor', '~> 1.3'
12
+ end
data/Gemfile.lock CHANGED
@@ -1,6 +1,16 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ rake_rack (1.1.0)
5
+ rake (~> 10)
6
+ term-ansicolor (~> 1.3)
7
+
1
8
  GEM
2
9
  remote: https://rubygems.org/
3
10
  specs:
11
+ bundler-audit (0.3.1)
12
+ bundler (~> 1.2)
13
+ thor (~> 0.18)
4
14
  diff-lcs (1.2.5)
5
15
  docile (1.1.5)
6
16
  multi_json (1.10.1)
@@ -24,6 +34,7 @@ GEM
24
34
  simplecov-html (0.8.0)
25
35
  term-ansicolor (1.3.0)
26
36
  tins (~> 1.0)
37
+ thor (0.19.1)
27
38
  timecop (0.7.1)
28
39
  tins (1.3.2)
29
40
 
@@ -31,7 +42,9 @@ PLATFORMS
31
42
  ruby
32
43
 
33
44
  DEPENDENCIES
45
+ bundler-audit
34
46
  rake
47
+ rake_rack!
35
48
  rspec
36
49
  simplecov
37
50
  term-ansicolor (~> 1.3)
data/README.md CHANGED
@@ -1,30 +1,43 @@
1
1
  RakeRack
2
2
  ========
3
+
4
+ Commonly used Rake tasks
5
+ ------------------------
6
+ ...collected together and given a new coat of paint (and nothing to do with [Rack](http://rack.github.io/))
7
+
8
+
3
9
  [![Build Status](https://travis-ci.org/RichardVickerstaff/rake_rack.svg?branch=master)](https://travis-ci.org/RichardVickerstaff/rake_rack)
4
10
  [![Gem Version](https://badge.fury.io/rb/rake_rack.svg)](http://badge.fury.io/rb/rake_rack)
5
- Common rake tasks I use a lot
6
- -----------------------------------------
7
11
 
8
- RakeRack is a collection of rake tasks myself and other commanly use on our projects.
9
- They have been extracted into a gem to allow them to easily be reused.
12
+ RakeRack is a collection of widely applicable Rake tasks used on many projects.
13
+ They have been extracted into a gem to allow them to easily be reused and maintained.
14
+
15
+ RakeRack tasks are used on the project itself, so you can always take a peek at our [Rakefile](https://github.com/RichardVickerstaff/rake_rack/blob/master/Rakefile) or the [tasks themselves](https://github.com/RichardVickerstaff/rake_rack/tree/master/tasks) to work out what is going on
10
16
 
11
17
  Installation
12
18
  ------------
13
- * Install the gem or add `gem "rake_rack"` to your Gemfile.
19
+ Install the gem or add `gem "rake_rack"` to your Gemfile.
14
20
 
15
21
  Usage
16
22
  -----
17
- RakeRack is made up of many rake tasks, add `require "rake_rack"` to the top of your default.rake file to gain access to them.
18
- You can then call them like you would any other rake task.
23
+ 1. Add `require "rake_rack"` to your Rakefile
24
+ 2. Call the tasks that you want, in with your usual Rake tasks.
19
25
 
20
- All tasks are namespaced with `:rake_rack` to prevent clashing with other tasks
26
+ Tasks are namespaced under `:rake_rack` to prevent clashes.
27
+ For example, this means the `:ok` task is called by invoking `:rake_rack:ok`
28
+
29
+ Tasks
30
+ -----
31
+ ### :bundler_audit
32
+ Check the current Gemfile.lock for gem versions with known security issues, courtesy of [Bundler Audit](https://github.com/rubysec/bundler-audit#readme)
21
33
 
22
34
  ### :check_external_dependencies
23
35
  Check that each command in the `@external_dependencies` array is present on the system path (and fails the task if it isn't)
24
36
  For example:
25
- ```ruby
26
- @external_dependencies = ['ruby', 'postgres', 'foo']
27
- ```
37
+ ```ruby
38
+ @external_dependencies = ['ruby', 'postgres', 'foo']
39
+ ```
40
+ You can also use the underlying checker object by creating an instance of `RakeRack::DependencyChecker` with your array of dependencies and calling `#check` or `#missing` on it.
28
41
 
29
42
  ### :code_quality
30
43
  #### :all
@@ -50,12 +63,13 @@ Look at SimpleCov results for spec coverage in `log/coverage/spec` and fail the
50
63
  Look at SimpleCov results for Cucumber coverage in `log/coverage/features` and fail the build if not 100%
51
64
 
52
65
  ### :ok
53
- Run this task last to print `***** ALL TESTS PASSED *****` showing you rake has passed.
66
+ Useful at the end of any Rake tasks which test your application, it prints `***** ALL TESTS PASSED *****`.
54
67
 
55
68
  ### :ok_rainbow
56
- Run this task last to print a more magical version of the 'ALL TESTS PASSED' message
69
+ Run this task last to print a more magical version of `:ok`
57
70
 
58
-
59
- ToDo
60
- ----
61
- 1. Add a cucumber rake task
71
+ Contributing
72
+ ------------
73
+ 1. Make a fork
74
+ 2. Make and push your changes to your fork
75
+ 3. Create a Pull Reques
data/Rakefile CHANGED
@@ -1,7 +1,7 @@
1
1
  require 'rake/clean'
2
2
  require './lib/rake_rack'
3
3
 
4
- @external_dependencies = %w[ruby rake tput]
4
+ @external_dependencies = %w[ruby rake]
5
5
 
6
6
  task :default => [
7
7
  :clean,
@@ -9,5 +9,6 @@ task :default => [
9
9
  :"rake_rack:code_quality:all",
10
10
  :"rake_rack:rspec",
11
11
  :"rake_rack:coverage:check_specs",
12
+ :"rake_rack:bundler_audit",
12
13
  :"rake_rack:ok",
13
14
  ]
data/history.rdoc CHANGED
@@ -1,3 +1,5 @@
1
+ == 1.1.0 (16 October 2014)
2
+
1
3
  == 1.0.1 (05 September 2014)
2
4
 
3
5
  == 1.0.0 (05 September 2014)
@@ -0,0 +1,26 @@
1
+ require 'term/ansicolor'
2
+
3
+ class RakeRack
4
+ class DependencyChecker
5
+ include Term::ANSIColor
6
+
7
+ def initialize dependencies
8
+ @dependencies = Array(dependencies)
9
+ end
10
+
11
+ def check silent = false
12
+ @results = @dependencies.each_with_object({}) do |dep, results|
13
+ results[dep] = system "which #{dep} >/dev/null"
14
+ unless silent
15
+ results[dep] ? print(".".green) : print("F".red)
16
+ end
17
+ end
18
+ end
19
+
20
+ def missing
21
+ @results ||= check(true)
22
+ @results.select{|_, present| present == false}.keys
23
+ end
24
+
25
+ end
26
+ end
data/lib/rake_rack.rb CHANGED
@@ -1,7 +1,9 @@
1
1
  $:.unshift File.dirname(__FILE__)
2
2
 
3
3
  require 'rake'
4
- require 'version'
4
+
5
+ lib = File.expand_path("../lib", File.dirname(__FILE__))
6
+ Dir.glob("#{lib}/*.rb").each{|l| require l}
5
7
 
6
8
  dir = File.expand_path("../tasks", File.dirname(__FILE__))
7
9
  Dir.glob("#{dir}/*.rake").each { |r| import r}
data/rake_rack.gemspec CHANGED
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = "rake_rack"
7
- spec.version = '1.0.1'
7
+ spec.version = '1.1.0'
8
8
  spec.authors = ["Richard Vickerstaff"]
9
9
  spec.email = ["m3akq@btinternet.com"]
10
10
  spec.description = "A set of rake tasks I commonly use - Formerly known as pool_net"
@@ -15,6 +15,5 @@ Gem::Specification.new do |spec|
15
15
  spec.require_paths = ["lib","tasks"]
16
16
 
17
17
  spec.add_runtime_dependency "rake", "~> 10"
18
- spec.add_runtime_dependency "rspec", "~> 3.0"
19
18
  spec.add_runtime_dependency "term-ansicolor", "~> 1.3"
20
19
  end
@@ -0,0 +1,41 @@
1
+ require 'spec_helper'
2
+ require 'term/ansicolor'
3
+ include Term::ANSIColor
4
+
5
+ describe RakeRack::DependencyChecker do
6
+
7
+ # Note that this test will fail if you, somehow, have this insane string define on your path
8
+ let(:missing) {'jajfjfjosojfnbje3nknq'}
9
+ let(:present) {'rspec'}
10
+ let(:list){ [present, missing] }
11
+
12
+ subject{RakeRack::DependencyChecker.new list}
13
+
14
+ describe '#check' do
15
+ before { $stdout = StringIO.new }
16
+
17
+ it 'returns a hash of dependencies => presence' do
18
+ result = subject.check
19
+ expect(result).to eq({present => true, missing => false})
20
+ end
21
+
22
+ it 'prints a dot for dependencies which are present' do
23
+ expect{subject.check}.to output(/\./).to_stdout
24
+ end
25
+
26
+ it 'prints a F for missing dependencies' do
27
+ expect{subject.check}.to output(/F/).to_stdout
28
+ end
29
+
30
+ it 'can be run without printing anything out' do
31
+ expect{subject.check(true)}.to_not output.to_stdout
32
+ end
33
+ end
34
+
35
+ describe '#missing_from' do
36
+ it 'returns only missing dependencies' do
37
+ expect(subject.missing).to eq [missing]
38
+ end
39
+ end
40
+
41
+ end
data/spec/spec_helper.rb CHANGED
@@ -2,7 +2,6 @@ require 'simplecov'
2
2
  require 'timecop'
3
3
  require 'tempfile'
4
4
 
5
-
6
5
  SimpleCov.start do
7
6
  add_filter '/vendor/'
8
7
  coverage_dir 'log/coverage/spec'
@@ -0,0 +1,8 @@
1
+ require 'bundler/audit/cli'
2
+
3
+ namespace :rake_rack do
4
+ desc 'Check Gemfile.lock for security issues'
5
+ task :bundler_audit do
6
+ Bundler::Audit::CLI.start
7
+ end
8
+ end
@@ -1,23 +1,16 @@
1
+ require 'term/ansicolor'
2
+
1
3
  namespace :rake_rack do
2
4
  task :check_external_dependencies do
5
+ include Term::ANSIColor
6
+ checker = RakeRack::DependencyChecker.new(@external_dependencies)
7
+
3
8
  puts 'Checking external dependencies...'
4
- green = `tput setaf 2`
5
- red = `tput setaf 1`
6
- reset = `tput sgr0`
9
+ checker.check
10
+ puts
7
11
 
8
- results = Array(@external_dependencies).each_with_object({}) do |exe, status|
9
- system "which #{exe} > /dev/null"
10
- status[exe] = if($? == 0)
11
- print "#{green}.#{reset}"
12
- true
13
- else
14
- print "#{red}F#{reset}"
15
- false
16
- end
17
- end
12
+ missing = checker.missing
13
+ fail("The following dependencies are missing: \n#{missing.join(%Q[\n])}") unless missing.empty?
18
14
  puts
19
- missing = results.select{|k,v| v == false}
20
- fail "The following dependencies are missing: \n#{missing.keys.join(%Q[\n])}" unless missing.empty?
21
- 2.times{puts}
22
15
  end
23
16
  end
data/tasks/ok.rake CHANGED
@@ -1,7 +1,9 @@
1
+ require 'term/ansicolor'
2
+
1
3
  namespace :rake_rack do
2
- require 'term/ansicolor'
3
4
  include Term::ANSIColor
4
5
 
6
+ desc 'Print the "ALL TESTS PASSED" message'
5
7
  task :ok do
6
8
  puts
7
9
  print [
@@ -20,6 +22,7 @@ namespace :rake_rack do
20
22
  puts
21
23
  end
22
24
 
25
+ desc 'Print the "ALL TESTS PASSED" message WITH A SWEET RAINBOW!!!'
23
26
  task :ok_rainbow do
24
27
  puts
25
28
  print " ", " ", " ", " ".on_red, " ", " ", " ", "\n"
metadata CHANGED
@@ -1,55 +1,41 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rake_rack
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Richard Vickerstaff
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-09-05 00:00:00.000000000 Z
11
+ date: 2014-10-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '10'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '10'
27
- - !ruby/object:Gem::Dependency
28
- name: rspec
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ~>
32
- - !ruby/object:Gem::Version
33
- version: '3.0'
34
- type: :runtime
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - ~>
39
- - !ruby/object:Gem::Version
40
- version: '3.0'
41
27
  - !ruby/object:Gem::Dependency
42
28
  name: term-ansicolor
43
29
  requirement: !ruby/object:Gem::Requirement
44
30
  requirements:
45
- - - ~>
31
+ - - "~>"
46
32
  - !ruby/object:Gem::Version
47
33
  version: '1.3'
48
34
  type: :runtime
49
35
  prerelease: false
50
36
  version_requirements: !ruby/object:Gem::Requirement
51
37
  requirements:
52
- - - ~>
38
+ - - "~>"
53
39
  - !ruby/object:Gem::Version
54
40
  version: '1.3'
55
41
  description: A set of rake tasks I commonly use - Formerly known as pool_net
@@ -59,20 +45,23 @@ executables: []
59
45
  extensions: []
60
46
  extra_rdoc_files: []
61
47
  files:
62
- - .gitignore
63
- - .rvmrc
64
- - .travis.yml
48
+ - ".gitignore"
49
+ - ".ruby-version"
50
+ - ".travis.yml"
65
51
  - Gemfile
66
52
  - Gemfile.lock
67
53
  - README.md
68
54
  - Rakefile
69
55
  - history.rdoc
56
+ - lib/dependency_checker.rb
70
57
  - lib/rake_rack.rb
71
58
  - lib/version.rb
72
59
  - rake_rack.gemspec
73
60
  - spec/.keep
61
+ - spec/dependency_checker_spec.rb
74
62
  - spec/spec_helper.rb
75
63
  - spec/version_spec.rb
64
+ - tasks/bundler_audit.rake
76
65
  - tasks/check_external_deps.rake
77
66
  - tasks/code_quality.rake
78
67
  - tasks/coverage.rake
@@ -90,17 +79,17 @@ require_paths:
90
79
  - tasks
91
80
  required_ruby_version: !ruby/object:Gem::Requirement
92
81
  requirements:
93
- - - ! '>='
82
+ - - ">="
94
83
  - !ruby/object:Gem::Version
95
84
  version: '0'
96
85
  required_rubygems_version: !ruby/object:Gem::Requirement
97
86
  requirements:
98
- - - ! '>='
87
+ - - ">="
99
88
  - !ruby/object:Gem::Version
100
89
  version: '0'
101
90
  requirements: []
102
91
  rubyforge_project:
103
- rubygems_version: 2.4.1
92
+ rubygems_version: 2.2.2
104
93
  signing_key:
105
94
  specification_version: 4
106
95
  summary: A set of rake tasks I commonly use
data/.rvmrc DELETED
@@ -1 +0,0 @@
1
- rvm use --create --install ruby-2.1.2@rake_rack