rake-rails 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in rake-rails.gemspec
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2012 Andy Lindeman
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,27 @@
1
+ # rake-rails
2
+
3
+ Reduces the confusion for newcomers by allowing `rails` commands to be run via
4
+ `rake`. Inspiration from [@j3](http://twitter.com/j3)'s presentation
5
+ [Adventures on the Golden Path](https://speakerdeck.com/u/j3/p/adventures-on-the-golden-path).
6
+
7
+ ## Usage
8
+
9
+ Add to your Gemfile:
10
+
11
+ ```ruby
12
+ gem 'rake-rails'
13
+ ```
14
+
15
+ Install via:
16
+
17
+ ```
18
+ $ bundle install
19
+ ```
20
+
21
+ Use right away!
22
+
23
+ ```
24
+ $ rake generate model Post title:string
25
+ $ rake console
26
+ $ rake server
27
+ ```
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env rake
2
+ require "bundler/gem_tasks"
data/lib/rake-rails.rb ADDED
@@ -0,0 +1,2 @@
1
+ require "rake-rails/version"
2
+ require "rake-rails/railtie" if defined?(Rails)
@@ -0,0 +1,10 @@
1
+ module Rake
2
+ module Rails
3
+ class Railtie < ::Rails::Railtie
4
+ rake_tasks do
5
+ load File.join(File.dirname(__FILE__), "tasks.rb")
6
+ ::Rake::Rails::Tasks.new
7
+ end
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,50 @@
1
+ require 'rake'
2
+
3
+ module Rake
4
+ module Rails
5
+ TASKS = {
6
+ "generate" => "Generate new code (short-cut alias: \"g\")",
7
+ "console" => "Start the Rails console (short-cut alias: \"c\")",
8
+ "server" => "Start the Rails server (short-cut alias: \"s\")",
9
+ "dbconsole" => "Start a console for the database specified in config/database.yml (short-cut alias: \"db\")",
10
+
11
+ "application" => "Generate the Rails application code",
12
+ "destroy" => "Undo code generated with \"generate\"",
13
+ "benchmarker" => "See how fast a piece of code runs",
14
+ "profiler" => "Get profile information from a piece of code",
15
+ "plugin" => "Install a plugin",
16
+ "runner" => "Run a piece of code in the application environment"
17
+ }
18
+
19
+ ALIASES = {
20
+ "g" => "generate",
21
+ "c" => "console",
22
+ "s" => "server",
23
+ "db" => "dbcsonsole"
24
+ }
25
+
26
+ class Tasks
27
+ include Rake::DSL
28
+
29
+ def initialize
30
+ TASKS.each do |command, description|
31
+ desc description
32
+ task command do
33
+ prevent_additional_arguments_from_running_as_tasks
34
+ require 'rails/cli'
35
+ end
36
+ end
37
+
38
+ ALIASES.each do |alias_command, command|
39
+ task alias_command => command
40
+ end
41
+ end
42
+
43
+ private
44
+
45
+ def prevent_additional_arguments_from_running_as_tasks
46
+ Rake.application.top_level_tasks.clear
47
+ end
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,5 @@
1
+ module Rake
2
+ module Rails
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
@@ -0,0 +1,19 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path('../lib/rake-rails/version', __FILE__)
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.authors = ["Andy Lindeman"]
6
+ gem.email = ["alindeman@gmail.com"]
7
+ gem.description = %q{Allows `rails` commands to be run via `rake`. For example: `rake generate`}
8
+ gem.summary = %q{Reduces the confusion for newcomers by allowing `rails` commands to be run via `rake`.}
9
+ gem.homepage = "https://github.com/alindeman/rake-rails"
10
+
11
+ gem.files = `git ls-files`.split($\)
12
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
13
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
14
+ gem.name = "rake-rails"
15
+ gem.require_paths = ["lib"]
16
+ gem.version = Rake::Rails::VERSION
17
+
18
+ gem.add_dependency "rake"
19
+ end
metadata ADDED
@@ -0,0 +1,72 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rake-rails
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Andy Lindeman
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-05-23 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rake
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ description: ! 'Allows `rails` commands to be run via `rake`. For example: `rake generate`'
31
+ email:
32
+ - alindeman@gmail.com
33
+ executables: []
34
+ extensions: []
35
+ extra_rdoc_files: []
36
+ files:
37
+ - .gitignore
38
+ - Gemfile
39
+ - LICENSE
40
+ - README.md
41
+ - Rakefile
42
+ - lib/rake-rails.rb
43
+ - lib/rake-rails/railtie.rb
44
+ - lib/rake-rails/tasks.rb
45
+ - lib/rake-rails/version.rb
46
+ - rake-rails.gemspec
47
+ homepage: https://github.com/alindeman/rake-rails
48
+ licenses: []
49
+ post_install_message:
50
+ rdoc_options: []
51
+ require_paths:
52
+ - lib
53
+ required_ruby_version: !ruby/object:Gem::Requirement
54
+ none: false
55
+ requirements:
56
+ - - ! '>='
57
+ - !ruby/object:Gem::Version
58
+ version: '0'
59
+ required_rubygems_version: !ruby/object:Gem::Requirement
60
+ none: false
61
+ requirements:
62
+ - - ! '>='
63
+ - !ruby/object:Gem::Version
64
+ version: '0'
65
+ requirements: []
66
+ rubyforge_project:
67
+ rubygems_version: 1.8.24
68
+ signing_key:
69
+ specification_version: 3
70
+ summary: Reduces the confusion for newcomers by allowing `rails` commands to be run
71
+ via `rake`.
72
+ test_files: []