backbonejs-rails 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/.gitignore +0 -0
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/Gemfile +0 -0
- data/README.md +1 -1
- data/Rakefile +0 -0
- data/backbonejs-rails.gemspec +12 -1
- data/lib/backbonejs-rails/engine.rb +0 -0
- data/lib/backbonejs-rails/version.rb +1 -1
- data/lib/backbonejs-rails.rb +1 -5
- data/lib/generators/backbonejs/install/install_generator.rb +22 -92
- data/lib/generators/backbonejs/uninstall/uninstall_generator.rb +2 -4
- data/vendor/assets/javascripts/backbone.js +0 -0
- data/vendor/assets/javascripts/backbone.min.js +0 -0
- data/vendor/assets/javascripts/icanhaz.js +0 -0
- data/vendor/assets/javascripts/icanhaz.min.js +0 -0
- data/vendor/assets/javascripts/json2.js +0 -0
- data/vendor/assets/javascripts/underscore.js +0 -0
- data/vendor/assets/javascripts/underscore.min.js +0 -0
- metadata +38 -25
- data/.rvmrc +0 -1
- data/lib/backbonejs-rails/railtie.rb +0 -16
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
MzczMzk4ODFkODg3OTU1ZmQyYzFmZjU4NTZmOGEwYWQ5M2I0ZDRhOQ==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
ZjZkYzdmMjA0NGQxODYyYTMyYmQyNTYxNGMwYmQ3MWNmZTliYmVkMg==
|
7
|
+
!binary "U0hBNTEy":
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
YTQ0YTMwYTVjMWI2MTBlZWUxMThiZDAyODdlMjAwY2UzNmM5MWY0MmU3NGY5
|
10
|
+
YjNkMDM0MzFhOTllYTIyYWFiMjRiZGRlZWE1OGRkZmJlZmMwMDEwNGQwMmEy
|
11
|
+
ZTEzMzE0Y2ExNGQ0OWU1ZjI1YjVkODUzNzM2OTc2YzQ0ZmIzMDQ=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
NjE1OWVmYjIzZDlhNGE3NWY4MTZhZjY0MWVkNDUzZTMzZTY1N2RlMWE3YWQy
|
14
|
+
NGU4NzdiZGI5NmYzMDMxZDQyYzFhOTg0NTFhYjNlMTNmNmQwNDJhNWZkNzJl
|
15
|
+
OTIxZjE1NzI5MmY5NjM1NjZmOGU5NDc0NGU1YWZlYTg2NzNjMWQ=
|
data/.gitignore
CHANGED
File without changes
|
data/.ruby-gemset
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
andrewgertig
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
ruby-2.0.0-p195
|
data/Gemfile
CHANGED
File without changes
|
data/README.md
CHANGED
data/Rakefile
CHANGED
File without changes
|
data/backbonejs-rails.gemspec
CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |s|
|
|
10
10
|
s.email = ["andrew.gertig@gmail.com"]
|
11
11
|
s.homepage = ""
|
12
12
|
s.summary = %q{Provide files needed for using Backbone.js}
|
13
|
-
s.description = %q{This gem is
|
13
|
+
s.description = %q{This gem is both Rails 3.1+ and Rails 3.0.x compatible. It creates the following files in public/javasripts: backbone.js, underscore.js, json2.js, and optionally icanhaz.js for templates. It also creates an initializer that fixes the way Rails returns JSON to Backbone.js}
|
14
14
|
|
15
15
|
s.rubyforge_project = "backbonejs-rails"
|
16
16
|
|
@@ -26,3 +26,14 @@ Gem::Specification.new do |s|
|
|
26
26
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
27
27
|
s.require_paths = ["lib"]
|
28
28
|
end
|
29
|
+
|
30
|
+
|
31
|
+
#Updating the gem from Railscast 245
|
32
|
+
|
33
|
+
# 1. Make necessary changes, then do git commit
|
34
|
+
# 2. Bump the version number in lib/backbonejs-rails/version.rb
|
35
|
+
# 3. Bump the version numbers for the js files you change in lib/generators/backbonejs/install/install_generator.rb
|
36
|
+
# 4. Bump the version number in the README.md
|
37
|
+
# 5. $ gem build backbonejs-rails.gemspec
|
38
|
+
# 6. $ gem push backbonejs-rails-0.0.X.gem
|
39
|
+
# 7. Rejoice
|
File without changes
|
data/lib/backbonejs-rails.rb
CHANGED
@@ -2,11 +2,7 @@ require 'rails/generators/base'
|
|
2
2
|
|
3
3
|
module Backbonejs
|
4
4
|
module Rails #Generators
|
5
|
-
|
6
|
-
require 'backbonejs-rails/railtie'
|
7
|
-
else
|
8
|
-
require 'backbonejs-rails/engine'
|
9
|
-
end
|
5
|
+
require 'backbonejs-rails/engine'
|
10
6
|
require 'backbonejs-rails/version'
|
11
7
|
end
|
12
8
|
end
|
@@ -2,105 +2,35 @@ require 'rails'
|
|
2
2
|
require 'net/http'
|
3
3
|
require 'uri'
|
4
4
|
|
5
|
-
if ::Rails.version < "3.1"
|
6
|
-
module Backbonejs
|
7
|
-
module Generators
|
8
|
-
class InstallGenerator < ::Rails::Generators::Base
|
9
|
-
@@backbone_version = '0.5.3'
|
10
|
-
@@underscore_version = '1.1.7'
|
11
|
-
@@icanhaz_version = '0.9'
|
12
5
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
if options[:ich]
|
27
|
-
urls.merge!(
|
28
|
-
'icanhaz' => 'https://raw.github.com/andyet/ICanHaz.js/master/ICanHaz.js',
|
29
|
-
'icanhaz.min' => 'https://raw.github.com/andyet/ICanHaz.js/master/ICanHaz.min.js'
|
30
|
-
)
|
31
|
-
end
|
32
|
-
|
33
|
-
urls.each do |file_name, file_url|
|
34
|
-
new_file = "public/javascripts/#{file_name}.js"
|
35
|
-
|
36
|
-
say_status('download', file_url, :green)
|
37
|
-
begin
|
38
|
-
url = URI.parse(file_url)
|
39
|
-
http = Net::HTTP.new(url.host, url.port)
|
40
|
-
http.use_ssl = true if url.scheme == 'https'
|
41
|
-
|
42
|
-
request = Net::HTTP::Get.new(url.request_uri)
|
43
|
-
response = http.request(request)
|
44
|
-
|
45
|
-
case response
|
46
|
-
when Net::HTTPSuccess
|
47
|
-
# No need to check if file already exists.
|
48
|
-
# Generator detects conflict and asks for action.
|
49
|
-
create_file new_file
|
50
|
-
append_to_file new_file, response.body
|
51
|
-
else
|
52
|
-
res.error!
|
53
|
-
end
|
54
|
-
|
55
|
-
rescue
|
56
|
-
say_status('failed', "Downloading #{file_url} failed", :red)
|
57
|
-
say_status('copying', "#{file_name}.js (from local copy)", :green)
|
58
|
-
copy_file "#{file_name}.js", "public/javascripts/#{file_name}.js"
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
def copy_json_false
|
64
|
-
backbone_rb = 'config/initializers/backbone.rb'
|
65
|
-
create_file backbone_rb
|
66
|
-
say_status('creating', 'backbone.rb - excludes root in json return just like Backbone likes it.', :green)
|
67
|
-
append_to_file backbone_rb, 'ActiveRecord::Base.include_root_in_json = false'
|
68
|
-
#copy_file "backbone.js", "public/javascripts/jquery.js"
|
6
|
+
module Backbonejs
|
7
|
+
module Generators
|
8
|
+
class InstallGenerator < ::Rails::Generators::Base
|
9
|
+
@@backbone_version = '0.9.1'
|
10
|
+
@@underscore_version = '1.3.1'
|
11
|
+
@@icanhaz_version = '0.10'
|
12
|
+
|
13
|
+
desc "This generator installs backbone.js #{@@backbone_version}, underscore.js #{@@underscore_version}, json2.js, and (optionally) icanhaz.js #{@@icanhaz_version}"
|
14
|
+
class_option :ich, :type => :boolean, :aliases => "-i", :default => false, :desc => 'Include ICanHaz.js'
|
15
|
+
|
16
|
+
def insert_backbone_in_applicationjs
|
17
|
+
inject_into_file "app/assets/javascripts/application.js", :before => "//= require_tree" do
|
18
|
+
"//= require json2\n//= require underscore\n//= require backbone\n"
|
69
19
|
end
|
70
|
-
|
71
|
-
end
|
72
|
-
end
|
73
|
-
end
|
74
|
-
else
|
75
|
-
module Backbonejs
|
76
|
-
module Generators
|
77
|
-
class InstallGenerator < ::Rails::Generators::Base
|
78
|
-
@@backbone_version = '0.9.1'
|
79
|
-
@@underscore_version = '1.3.1'
|
80
|
-
@@icanhaz_version = '0.10'
|
81
|
-
|
82
|
-
desc "This generator installs backbone.js #{@@backbone_version}, underscore.js #{@@underscore_version}, json2.js, and (optionally) icanhaz.js #{@@icanhaz_version}"
|
83
|
-
class_option :ich, :type => :boolean, :aliases => "-i", :default => false, :desc => 'Include ICanHaz.js'
|
84
20
|
|
85
|
-
|
21
|
+
if options[:ich]
|
86
22
|
inject_into_file "app/assets/javascripts/application.js", :before => "//= require_tree" do
|
87
|
-
"//= require
|
88
|
-
end
|
89
|
-
|
90
|
-
if options[:ich]
|
91
|
-
inject_into_file "app/assets/javascripts/application.js", :before => "//= require_tree" do
|
92
|
-
"//= require icanhaz\n"
|
93
|
-
end
|
23
|
+
"//= require icanhaz\n"
|
94
24
|
end
|
95
25
|
end
|
96
|
-
|
97
|
-
def create_dir_layout
|
98
|
-
%W{routers models views}.each do |dir|
|
99
|
-
empty_directory "app/assets/javascripts/backbone/#{dir}"
|
100
|
-
end
|
101
|
-
end
|
102
|
-
|
103
26
|
end
|
27
|
+
|
28
|
+
# def create_dir_layout
|
29
|
+
# %W{routers models views}.each do |dir|
|
30
|
+
# empty_directory "app/assets/javascripts/backbone/#{dir}"
|
31
|
+
# end
|
32
|
+
# end
|
33
|
+
|
104
34
|
end
|
105
35
|
end
|
106
36
|
end
|
@@ -14,10 +14,8 @@ module Backbonejs
|
|
14
14
|
['backbone', 'underscore', 'json2', 'icanhaz'].each do |lib|
|
15
15
|
unless [*options[:keep]].include?(lib)
|
16
16
|
# Remove full and minified version of library
|
17
|
-
|
18
|
-
|
19
|
-
remove_file file if File.exists?(file)
|
20
|
-
end
|
17
|
+
file = "public/javascripts/#{lib}.js"
|
18
|
+
remove_file file if File.exists?(file)
|
21
19
|
end
|
22
20
|
end
|
23
21
|
end
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
metadata
CHANGED
@@ -1,72 +1,86 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: backbonejs-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.0.7
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Andrew Gertig
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2013-07-08 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: railties
|
16
|
-
requirement:
|
17
|
-
none: false
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
18
16
|
requirements:
|
19
17
|
- - ~>
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: '3.0'
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
|
-
version_requirements:
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '3.0'
|
25
27
|
- !ruby/object:Gem::Dependency
|
26
28
|
name: thor
|
27
|
-
requirement:
|
28
|
-
none: false
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
29
30
|
requirements:
|
30
31
|
- - ~>
|
31
32
|
- !ruby/object:Gem::Version
|
32
33
|
version: '0.14'
|
33
34
|
type: :runtime
|
34
35
|
prerelease: false
|
35
|
-
version_requirements:
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0.14'
|
36
41
|
- !ruby/object:Gem::Dependency
|
37
42
|
name: bundler
|
38
|
-
requirement:
|
39
|
-
none: false
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
40
44
|
requirements:
|
41
45
|
- - ~>
|
42
46
|
- !ruby/object:Gem::Version
|
43
47
|
version: 1.0.0
|
44
48
|
type: :development
|
45
49
|
prerelease: false
|
46
|
-
version_requirements:
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 1.0.0
|
47
55
|
- !ruby/object:Gem::Dependency
|
48
56
|
name: rails
|
49
|
-
requirement:
|
50
|
-
none: false
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
51
58
|
requirements:
|
52
59
|
- - ~>
|
53
60
|
- !ruby/object:Gem::Version
|
54
61
|
version: '3.0'
|
55
62
|
type: :development
|
56
63
|
prerelease: false
|
57
|
-
version_requirements:
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ~>
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '3.0'
|
58
69
|
- !ruby/object:Gem::Dependency
|
59
70
|
name: rake
|
60
|
-
requirement:
|
61
|
-
none: false
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
62
72
|
requirements:
|
63
73
|
- - ~>
|
64
74
|
- !ruby/object:Gem::Version
|
65
75
|
version: 0.8.7
|
66
76
|
type: :development
|
67
77
|
prerelease: false
|
68
|
-
version_requirements:
|
69
|
-
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ~>
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 0.8.7
|
83
|
+
description: ! 'This gem is both Rails 3.1+ and Rails 3.0.x compatible. It creates
|
70
84
|
the following files in public/javasripts: backbone.js, underscore.js, json2.js,
|
71
85
|
and optionally icanhaz.js for templates. It also creates an initializer that fixes
|
72
86
|
the way Rails returns JSON to Backbone.js'
|
@@ -77,14 +91,14 @@ extensions: []
|
|
77
91
|
extra_rdoc_files: []
|
78
92
|
files:
|
79
93
|
- .gitignore
|
80
|
-
- .
|
94
|
+
- .ruby-gemset
|
95
|
+
- .ruby-version
|
81
96
|
- Gemfile
|
82
97
|
- README.md
|
83
98
|
- Rakefile
|
84
99
|
- backbonejs-rails.gemspec
|
85
100
|
- lib/backbonejs-rails.rb
|
86
101
|
- lib/backbonejs-rails/engine.rb
|
87
|
-
- lib/backbonejs-rails/railtie.rb
|
88
102
|
- lib/backbonejs-rails/version.rb
|
89
103
|
- lib/generators/backbonejs/install/install_generator.rb
|
90
104
|
- lib/generators/backbonejs/uninstall/uninstall_generator.rb
|
@@ -97,26 +111,25 @@ files:
|
|
97
111
|
- vendor/assets/javascripts/underscore.min.js
|
98
112
|
homepage: ''
|
99
113
|
licenses: []
|
114
|
+
metadata: {}
|
100
115
|
post_install_message:
|
101
116
|
rdoc_options: []
|
102
117
|
require_paths:
|
103
118
|
- lib
|
104
119
|
required_ruby_version: !ruby/object:Gem::Requirement
|
105
|
-
none: false
|
106
120
|
requirements:
|
107
121
|
- - ! '>='
|
108
122
|
- !ruby/object:Gem::Version
|
109
123
|
version: '0'
|
110
124
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
111
|
-
none: false
|
112
125
|
requirements:
|
113
126
|
- - ! '>='
|
114
127
|
- !ruby/object:Gem::Version
|
115
128
|
version: '0'
|
116
129
|
requirements: []
|
117
130
|
rubyforge_project: backbonejs-rails
|
118
|
-
rubygems_version:
|
131
|
+
rubygems_version: 2.0.3
|
119
132
|
signing_key:
|
120
|
-
specification_version:
|
133
|
+
specification_version: 4
|
121
134
|
summary: Provide files needed for using Backbone.js
|
122
135
|
test_files: []
|
data/.rvmrc
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
rvm use 1.9.2@backbonejs-rails --create
|
@@ -1,16 +0,0 @@
|
|
1
|
-
module Backbonejs
|
2
|
-
module Rails
|
3
|
-
|
4
|
-
class Railtie < ::Rails::Railtie
|
5
|
-
config.before_configuration do
|
6
|
-
|
7
|
-
js_defaults = ::Rails.env.production? ? %w(json2 underscore.min backbone.min icanhaz.min) : %w(json2 underscore backbone icanhaz)
|
8
|
-
|
9
|
-
# Merge the jQuery scripts, remove the Prototype defaults and finally add 'rails'
|
10
|
-
# at the end, because load order is important
|
11
|
-
config.action_view.javascript_expansions[:defaults] |= js_defaults
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
end
|
16
|
-
end
|