rake_rack 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 4b37c469e25f3c2ea4ef209b6c5cf9fb2f3b6ab6
4
+ data.tar.gz: c04cdd7b8773e565f3524a5d17129d9db79d6a18
5
+ SHA512:
6
+ metadata.gz: 91613707fe7fd09dbd641aeeb835a8c9aed8061bd335edc51130346c79e55bcbca7b96262aabf10a3435d81a2f0fd945cfbf2bfd1062c06765f6e263c53240cf
7
+ data.tar.gz: 2e91f9c622319e18e8f7645e5a82e6b0cab2ab71e7495f66b3f4c65f5008ed5289093e3e4266d514e1f073895fb91959cfec9ca5506ecabad0da345c2a235ea2
data/.gitignore ADDED
@@ -0,0 +1,2 @@
1
+ *.gem
2
+ *.sw?
data/README.md ADDED
@@ -0,0 +1,24 @@
1
+ RakeRack
2
+ ========
3
+
4
+ Common rake tasks I use a lot
5
+ -----------------------------------------
6
+
7
+ PoolNet is a collection of rake tasks myself and other commanly use on our projects.
8
+ They have been extracted into a gem to allow them to easily be reused.
9
+
10
+ Installation
11
+ ------------
12
+ * Install the gem or add `gem "rake_rack"` to your Gemfile.
13
+
14
+ Usage
15
+ -----
16
+ PoolNet is made up of many rake tasks, add `require "rake_rack"` to the top of your default.rake file to gain access to them.
17
+ You can then call them like you would any other rake task.
18
+
19
+ ToDo
20
+ ----
21
+ 1. Namespace all PoolNet rake tasks
22
+ 2. Add a list of all the rake tasks to the Readme
23
+ 2. Add a cucumber rake task
24
+ 3. Add a code coverage rake task
data/lib/rake_rack.rb ADDED
@@ -0,0 +1,4 @@
1
+ require 'rake'
2
+
3
+ dir = File.expand_path("../tasks", File.dirname(__FILE__))
4
+ Dir.glob("#{dir}/*.rake").each { |r| import r}
data/rake_rack.gemspec ADDED
@@ -0,0 +1,19 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "rake_rack"
7
+ spec.version = '0.0.1'
8
+ spec.authors = ["Richard Vickerstaff"]
9
+ spec.email = ["m3akq@btinternet.com"]
10
+ spec.description = "A set of rake tasks I commonly use - Formerly known as pool_net"
11
+ spec.summary = "A set of rake tasks I commonly use"
12
+ spec.homepage = "https://github.com/RichardVickerstaff/rake_rack"
13
+ spec.license = "MIT"
14
+ spec.files = `git ls-files`.split($/)
15
+ spec.require_paths = ["lib","tasks"]
16
+
17
+ spec.add_runtime_dependency "rake", "~> 10"
18
+ spec.add_runtime_dependency "rspec", "~> 3.0"
19
+ end
@@ -0,0 +1,85 @@
1
+ namespace :rake_rack do
2
+ namespace :code_quality do
3
+ desc 'Runs all code quality checks'
4
+ task :all => [:trailing_spaces, :shoulds, :debugger, :pry, :console_log, :time_check]
5
+
6
+ desc 'check for trailing spaces'
7
+ task :trailing_spaces do
8
+ grep_for_trailing_space %w{spec features lib app factories db}
9
+ end
10
+
11
+ desc %(check for legacy 'it "should blah"' style specs)
12
+ task :shoulds do
13
+ grep_for_shoulds %w{spec}
14
+ end
15
+
16
+ desc 'check for debugger statements'
17
+ task :debugger do
18
+ grep_for_debugger %w{lib app spec features}
19
+ end
20
+
21
+ desc 'check for binding.pry statements'
22
+ task :pry do
23
+ grep_for_pry %w{lib app spec features}
24
+ end
25
+
26
+ desc 'check for console.log'
27
+ task :console_log do
28
+ grep_for_console_log %w{app/assets/javascripts }
29
+ end
30
+
31
+ desc 'check for Time.now should use Time.zone.now'
32
+ task :time_check do
33
+ grep_for_time_now %w{app lib}
34
+ end
35
+
36
+ def grep_for_trailing_space *file_patterns
37
+ grep '^.*[[:space:]]+$', file_patterns, 'trailing spaces', ['*.yml', '*.csv']
38
+ end
39
+
40
+ def grep_for_shoulds *file_patterns
41
+ grep '^[[:space:]]*it "should.*$',
42
+ file_patterns,
43
+ 'it block description starting with should'
44
+ end
45
+
46
+ def grep_for_pry *file_patterns
47
+ grep 'binding.pry',
48
+ file_patterns,
49
+ 'binding.pry statement found',
50
+ %w[common_spec_helper.rb code_quality.rake]
51
+ end
52
+
53
+ def grep_for_debugger *file_patterns
54
+ grep 'debugger',
55
+ file_patterns,
56
+ 'debugger statement found',
57
+ %w[common_spec_helper.rb code_quality.rake angular.js]
58
+ end
59
+
60
+ def grep_for_console_log *file_patterns
61
+ grep 'console.log',
62
+ file_patterns,
63
+ 'console.log statement found',
64
+ %w[angular.js jquery.flot-0.8.1.js]
65
+ end
66
+
67
+ def grep_for_time_now *file_patterns
68
+ grep "Time.now",
69
+ file_patterns,
70
+ "Time.now found, use Time.zone.now to prevent timezone conflicts",
71
+ %w{*.rake}
72
+ end
73
+
74
+ def grep regex, file_patterns, error_message, exclude_patterns=[], perl_regex=false
75
+ files_found = ""
76
+ command = "grep -r -n --binary-files=without-match '#{regex}' #{file_patterns.join(' ')}"
77
+ exclude_patterns.each do |exclude_pattern|
78
+ command << " --exclude '#{exclude_pattern}'"
79
+ end
80
+ command << (perl_regex ? ' -P' : ' -E')
81
+ files_found << `#{command}`
82
+ abort("#{error_message} found:\n#{files_found}") unless files_found.empty?
83
+ end
84
+ end
85
+ end
data/tasks/ok.rake ADDED
@@ -0,0 +1,12 @@
1
+ namespace :rake_rack do
2
+ task :ok do
3
+ red = "\e[31m"
4
+ yellow = "\e[33m"
5
+ green = "\e[32m"
6
+ blue = "\e[34m"
7
+ purple = "\e[35m"
8
+ bold = "\e[1m"
9
+ normal = "\e[0m"
10
+ puts "", "#{bold}#{red}*#{yellow}*#{green}*#{blue}*#{purple}*#{green} ALL TESTS PASSED #{purple}*#{blue}*#{green}*#{yellow}*#{red}*#{normal}"
11
+ end
12
+ end
data/tasks/rspec.rake ADDED
@@ -0,0 +1,13 @@
1
+ begin
2
+ require 'rspec/core/rake_task'
3
+
4
+ RSpec::Core::RakeTask.new(:"rake_rack:rspec") do |t|
5
+ t.verbose = false
6
+ end
7
+
8
+ - Formerly known as pool_netRSpec::Core::RakeTask.new(:"rake_rack:rspec_test_prepare" => :"test:prepare") do |t|
9
+ t.verbose = false
10
+ end
11
+ rescue LoadError
12
+ $stderr.puts 'Warning: RSpec not available.'
13
+ end
metadata ADDED
@@ -0,0 +1,80 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rake_rack
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Richard Vickerstaff
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-07-11 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rake
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '10'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
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
+ description: A set of rake tasks I commonly use - Formerly known as pool_net
42
+ email:
43
+ - m3akq@btinternet.com
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - ".gitignore"
49
+ - README.md
50
+ - lib/rake_rack.rb
51
+ - rake_rack.gemspec
52
+ - tasks/code_quality.rake
53
+ - tasks/ok.rake
54
+ - tasks/rspec.rake
55
+ homepage: https://github.com/RichardVickerstaff/rake_rack
56
+ licenses:
57
+ - MIT
58
+ metadata: {}
59
+ post_install_message:
60
+ rdoc_options: []
61
+ require_paths:
62
+ - lib
63
+ - tasks
64
+ required_ruby_version: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ required_rubygems_version: !ruby/object:Gem::Requirement
70
+ requirements:
71
+ - - ">="
72
+ - !ruby/object:Gem::Version
73
+ version: '0'
74
+ requirements: []
75
+ rubyforge_project:
76
+ rubygems_version: 2.2.2
77
+ signing_key:
78
+ specification_version: 4
79
+ summary: A set of rake tasks I commonly use
80
+ test_files: []