rocky 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.md ADDED
@@ -0,0 +1,29 @@
1
+ # Rocky
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'rocky'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install rocky
18
+
19
+ ## Usage
20
+
21
+ TODO: Write usage instructions here
22
+
23
+ ## Contributing
24
+
25
+ 1. Fork it
26
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
27
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
28
+ 4. Push to the branch (`git push origin my-new-feature`)
29
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,33 @@
1
+ require "generators/rocky/resource_helpers"
2
+
3
+ module Rocky
4
+ module Generators
5
+ class InstallGenerator < Rails::Generators::Base
6
+ include Rocky::Generators::ResourceHelpers
7
+
8
+ source_root File.expand_path("../templates", __FILE__)
9
+
10
+ desc "This generator installs Rocky Middleware in app/assets/javascripts/application"
11
+
12
+ class_option :skip_git, :type => :boolean, :aliases => "-G", :default => false,
13
+ :desc => "Skip Git ignores and keeps"
14
+
15
+ def inject_middleware
16
+ inject_into_file "app/assets/javascripts/application.js", :after => "//= require jquery_ujs" do
17
+ "\n//= require underscore\n//= require backbone\n//= require middleware\n//= require application/#{application_name.underscore}"
18
+ end
19
+ end
20
+
21
+ def create_dir_layout
22
+ %W{models views}.each do |dir|
23
+ empty_directory "app/assets/javascripts/application/#{dir}"
24
+ create_file "app/assets/javascripts/application/#{dir}/.gitkeep" unless options[:skip_git]
25
+ end
26
+ end
27
+
28
+ def create_app_file
29
+ template "app.coffee", "app/assets/javascripts/application/#{application_name.underscore}.js.coffee"
30
+ end
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,8 @@
1
+ #= require_self
2
+ #= require_tree ./models
3
+ #= require_tree ./views
4
+
5
+ window.<%= js_app_name %> = {
6
+ Models: {}
7
+ Views: {}
8
+ }
@@ -0,0 +1,22 @@
1
+ module Rocky
2
+ module Generators
3
+ module ResourceHelpers
4
+
5
+ def rocky_path
6
+ "app/assets/javascripts/application"
7
+ end
8
+
9
+ def js_app_name
10
+ application_name.camelize
11
+ end
12
+
13
+ def application_name
14
+ if defined?(Rails) && Rails.application
15
+ Rails.application.class.name.split('::').first
16
+ else
17
+ "application"
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,3 @@
1
+ module Rocky
2
+ VERSION = "0.0.1"
3
+ end
data/lib/rocky.rb ADDED
@@ -0,0 +1,7 @@
1
+ require "rocky/version"
2
+ require "rails"
3
+
4
+ module Rocky
5
+ class Engine < Rails::Engine
6
+ end
7
+ end