hound_breeder 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +7 -0
- data/.hound.yml +2 -0
- data/Gemfile +3 -0
- data/MIT-LICENSE +20 -0
- data/README.md +25 -0
- data/app/controllers/activations_controller.rb +5 -0
- data/hound_breeder.gemspec +21 -0
- data/lib/generators/hound_breeder/install_generator.rb +13 -0
- data/lib/generators/hound_breeder/repo.js.coffee.erb +62 -0
- data/lib/hound_breeder.rb +1 -0
- data/lib/hound_breeder/engine.rb +11 -0
- data/lib/hound_breeder/version.rb +3 -0
- metadata +85 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 9b0a069bc9d707f668ce5fa5f5c49ffcd6818722
|
4
|
+
data.tar.gz: c35fd1f1ef2764a4b1472ea30449e656a3e19920
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: f40523e35d8395021ee83337d681cd95e760df910f2fafa64e7c7436993c9ab5ac118fe3fdeea01ea2f76bf412117f8231602341669777d2e5c767e1be88ce31
|
7
|
+
data.tar.gz: f80e6b45936f6b496cd9e18f4dbff4783f31be24582ec8d80d6d5571b68abef0563aa43d56d0b98b88d5504ac9d61ab5cf64cedd39e06841dd41ed06304df9b7
|
data/.gitignore
ADDED
data/.hound.yml
ADDED
data/Gemfile
ADDED
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2012 YOURNAME
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
Hound Breeder
|
2
|
+
===================
|
3
|
+
|
4
|
+
Hound for free rider.
|
5
|
+
|
6
|
+
### Hound
|
7
|
+
|
8
|
+
https://github.com/thoughtbot/hound
|
9
|
+
|
10
|
+
|
11
|
+
Installation
|
12
|
+
=======
|
13
|
+
|
14
|
+
Add this gem to your Hound's Gemfile:
|
15
|
+
|
16
|
+
```ruby
|
17
|
+
gem "hound_breeder"
|
18
|
+
```
|
19
|
+
|
20
|
+
Then run:
|
21
|
+
|
22
|
+
```
|
23
|
+
bundle install
|
24
|
+
rails g hound_breeder:install
|
25
|
+
```
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# Maintain your gem's version:
|
2
|
+
$:.push File.expand_path('../lib', __FILE__)
|
3
|
+
require 'hound_breeder/version'
|
4
|
+
|
5
|
+
# Describe your gem and declare its dependencies:
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = 'hound_breeder'
|
8
|
+
s.version = HoundBreeder::VERSION
|
9
|
+
s.authors = ['Masahiro Saito']
|
10
|
+
s.email = ['camelmasa@gmail.com']
|
11
|
+
s.summary = 'hound for free rider'
|
12
|
+
s.description = 'hound for free rider'
|
13
|
+
s.homepage = 'https://github.com/camelmasa/hound_breeder'
|
14
|
+
s.license = 'MIT'
|
15
|
+
|
16
|
+
s.files = `git ls-files`.split($/)
|
17
|
+
s.require_paths = ['lib']
|
18
|
+
|
19
|
+
s.add_dependency 'rails'
|
20
|
+
s.add_dependency 'pry'
|
21
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module HoundBreeder
|
2
|
+
module Generators
|
3
|
+
class InstallGenerator < ::Rails::Generators::Base
|
4
|
+
|
5
|
+
desc "This generator installs HoundBreader to Asset Pipeline"
|
6
|
+
source_root File.expand_path("../", __FILE__)
|
7
|
+
|
8
|
+
def add_assets
|
9
|
+
copy_file "repo.js.coffee.erb", "app/assets/javascripts/directives/repo.js.coffee.erb"
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
# https://github.com/thoughtbot/hound/blob/master/app/assets/javascripts/directives/repo.js.coffee.erb
|
2
|
+
App.directive 'repo', ['Subscription', 'StripeCheckout', (Subscription, StripeCheckout) ->
|
3
|
+
scope: true
|
4
|
+
templateUrl: '/templates/repo'
|
5
|
+
link: (scope, element, attributes) ->
|
6
|
+
repo = scope.repo
|
7
|
+
scope.processing = false
|
8
|
+
|
9
|
+
activate = ->
|
10
|
+
repo.$activate()
|
11
|
+
.then(->
|
12
|
+
scope.processing = false
|
13
|
+
).catch(-> alert('Your repo failed to activate.'))
|
14
|
+
|
15
|
+
deactivate = ->
|
16
|
+
repo.$deactivate()
|
17
|
+
.then(-> scope.processing = false)
|
18
|
+
.catch(-> alert('Your repo failed to deactivate.'))
|
19
|
+
|
20
|
+
createSubscription = (stripeToken) ->
|
21
|
+
scope.processing = true
|
22
|
+
|
23
|
+
subscription = new Subscription(
|
24
|
+
repo_id: repo.id
|
25
|
+
card_token: stripeToken.id
|
26
|
+
email_address: stripeToken.email
|
27
|
+
)
|
28
|
+
|
29
|
+
subscription.$save().then(->
|
30
|
+
scope.processing = false
|
31
|
+
repo.active = true
|
32
|
+
, ->
|
33
|
+
scope.processing = false
|
34
|
+
alert('Your subscription failed.')
|
35
|
+
)
|
36
|
+
|
37
|
+
scope.toggle = ->
|
38
|
+
if repo.active
|
39
|
+
if repo.stripe_subscription_id
|
40
|
+
scope.processing = true
|
41
|
+
subscription = new Subscription(repo_id: repo.id)
|
42
|
+
subscription.$delete().then(->
|
43
|
+
repo.active = false
|
44
|
+
scope.processing = false
|
45
|
+
, ->
|
46
|
+
alert('Your repo could not be disabled')
|
47
|
+
scope.processing = false
|
48
|
+
)
|
49
|
+
else
|
50
|
+
scope.processing = true
|
51
|
+
deactivate(repo)
|
52
|
+
else
|
53
|
+
# if repo.private
|
54
|
+
# StripeCheckout.open(
|
55
|
+
# name: repo.full_plan_name,
|
56
|
+
# amount: repo.price_in_cents,
|
57
|
+
# createSubscription
|
58
|
+
# )
|
59
|
+
# else
|
60
|
+
scope.processing = true
|
61
|
+
activate(repo)
|
62
|
+
]
|
@@ -0,0 +1 @@
|
|
1
|
+
require "hound_breeder/engine"
|
@@ -0,0 +1,11 @@
|
|
1
|
+
module HoundBreeder
|
2
|
+
class Engine < ::Rails::Engine
|
3
|
+
def self.activate
|
4
|
+
Dir.glob(File.join(root, "app/**/*.rb")) do |c|
|
5
|
+
Rails.application.config.cache_classes ? require(c) : load(c)
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
config.to_prepare &method(:activate).to_proc
|
10
|
+
end
|
11
|
+
end
|
metadata
ADDED
@@ -0,0 +1,85 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: hound_breeder
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Masahiro Saito
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-09-12 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rails
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: pry
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
description: hound for free rider
|
42
|
+
email:
|
43
|
+
- camelmasa@gmail.com
|
44
|
+
executables: []
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- ".gitignore"
|
49
|
+
- ".hound.yml"
|
50
|
+
- Gemfile
|
51
|
+
- MIT-LICENSE
|
52
|
+
- README.md
|
53
|
+
- app/controllers/activations_controller.rb
|
54
|
+
- hound_breeder.gemspec
|
55
|
+
- lib/generators/hound_breeder/install_generator.rb
|
56
|
+
- lib/generators/hound_breeder/repo.js.coffee.erb
|
57
|
+
- lib/hound_breeder.rb
|
58
|
+
- lib/hound_breeder/engine.rb
|
59
|
+
- lib/hound_breeder/version.rb
|
60
|
+
homepage: https://github.com/camelmasa/hound_breeder
|
61
|
+
licenses:
|
62
|
+
- MIT
|
63
|
+
metadata: {}
|
64
|
+
post_install_message:
|
65
|
+
rdoc_options: []
|
66
|
+
require_paths:
|
67
|
+
- lib
|
68
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
69
|
+
requirements:
|
70
|
+
- - ">="
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: '0'
|
73
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
74
|
+
requirements:
|
75
|
+
- - ">="
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
78
|
+
requirements: []
|
79
|
+
rubyforge_project:
|
80
|
+
rubygems_version: 2.2.2
|
81
|
+
signing_key:
|
82
|
+
specification_version: 4
|
83
|
+
summary: hound for free rider
|
84
|
+
test_files: []
|
85
|
+
has_rdoc:
|