Skip to content
Merged
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
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@

* TODO

### 0.46.0

* Autoload knapsack_pro rake tasks with Rails Railties

https://github.com/KnapsackPro/knapsack_pro-ruby/pull/47

https://github.com/KnapsackPro/knapsack_pro-ruby/compare/v0.45.0...v0.46.0

### 0.45.0

* Add before and after queue hooks
Expand Down
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,12 +159,16 @@ end

And then execute:

$ bundle install

```
$ bundle install
```

Add this line at the bottom of `Rakefile` if your project has one:
If you are not using Rails then add this line at the bottom of `Rakefile`:

```ruby
# Add this only if you are not using Rails.
# If you use Rails then knapsack_pro rake tasks are already loaded
# so there is no need to explicitly load them.
KnapsackPro.load_tasks if defined?(KnapsackPro)
```

Expand Down
2 changes: 2 additions & 0 deletions lib/knapsack_pro.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@
require_relative 'knapsack_pro/crypto/decryptor'
require_relative 'knapsack_pro/crypto/digestor'

require 'knapsack_pro/railtie' if defined?(Rails::Railtie)

module KnapsackPro
class << self
def root
Expand Down
10 changes: 10 additions & 0 deletions lib/knapsack_pro/railtie.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
require 'rails'
require 'knapsack_pro'

module KnapsackPro
class Railtie < Rails::Railtie
rake_tasks do
KnapsackPro.load_tasks
end
end
end