half-pipe 0.0.1 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +17 -2
  3. data/app/helpers/half_pipe_helper.rb +1 -1
  4. data/examples/rails/.bowerrc +3 -0
  5. data/examples/rails/.gitignore +21 -0
  6. data/examples/rails/.jshintrc +34 -0
  7. data/examples/rails/Gemfile +38 -0
  8. data/examples/rails/Gruntfile.js +67 -0
  9. data/examples/rails/README.rdoc +28 -0
  10. data/examples/rails/Rakefile +6 -0
  11. data/examples/rails/app/controllers/application_controller.rb +5 -0
  12. data/examples/rails/app/controllers/concerns/.keep +0 -0
  13. data/examples/rails/app/controllers/posts_controller.rb +9 -0
  14. data/examples/rails/app/helpers/application_helper.rb +2 -0
  15. data/examples/rails/app/mailers/.keep +0 -0
  16. data/examples/rails/app/models/.keep +0 -0
  17. data/examples/rails/app/models/concerns/.keep +0 -0
  18. data/examples/rails/app/models/post.rb +27 -0
  19. data/examples/rails/app/scripts/application.js +27 -0
  20. data/examples/rails/app/scripts/features/posts.js +28 -0
  21. data/examples/rails/app/scripts/main.js +17 -0
  22. data/examples/rails/app/styles/main.scss +1 -0
  23. data/examples/rails/app/views/layouts/application.html.erb +14 -0
  24. data/examples/rails/app/views/posts/index.html.erb +7 -0
  25. data/examples/rails/app/views/posts/show.html.erb +2 -0
  26. data/examples/rails/bin/bundle +3 -0
  27. data/examples/rails/bin/rails +4 -0
  28. data/examples/rails/bin/rake +4 -0
  29. data/examples/rails/bower.json +9 -0
  30. data/examples/rails/config.ru +4 -0
  31. data/examples/rails/config/application.rb +39 -0
  32. data/examples/rails/config/boot.rb +4 -0
  33. data/examples/rails/config/environment.rb +5 -0
  34. data/examples/rails/config/environments/development.rb +23 -0
  35. data/examples/rails/config/environments/production.rb +65 -0
  36. data/examples/rails/config/environments/test.rb +36 -0
  37. data/examples/rails/config/initializers/backtrace_silencers.rb +7 -0
  38. data/examples/rails/config/initializers/filter_parameter_logging.rb +4 -0
  39. data/examples/rails/config/initializers/inflections.rb +16 -0
  40. data/examples/rails/config/initializers/mime_types.rb +5 -0
  41. data/examples/rails/config/initializers/sass.rb +2 -0
  42. data/examples/rails/config/initializers/secret_token.rb +12 -0
  43. data/examples/rails/config/initializers/session_store.rb +3 -0
  44. data/examples/rails/config/initializers/wrap_parameters.rb +10 -0
  45. data/examples/rails/config/locales/en.yml +23 -0
  46. data/examples/rails/config/routes.rb +53 -0
  47. data/examples/rails/db/seeds.rb +7 -0
  48. data/examples/rails/lib/assets/.keep +0 -0
  49. data/examples/rails/lib/tasks/.keep +0 -0
  50. data/examples/rails/log/.keep +0 -0
  51. data/examples/rails/package.json +15 -0
  52. data/examples/rails/public/404.html +58 -0
  53. data/examples/rails/public/422.html +58 -0
  54. data/examples/rails/public/500.html +57 -0
  55. data/examples/rails/public/favicon.ico +0 -0
  56. data/examples/rails/public/robots.txt +5 -0
  57. data/examples/rails/vendor/assets/javascripts/.keep +0 -0
  58. data/examples/rails/vendor/assets/stylesheets/.keep +0 -0
  59. data/half-pipe.gemspec +1 -0
  60. data/lib/generators/half_pipe/install_generator.rb +6 -1
  61. data/lib/generators/half_pipe/templates/Gruntfile.js +10 -12
  62. data/lib/generators/half_pipe/templates/app/scripts/application.js +3 -2
  63. data/lib/generators/half_pipe/templates/package.json +2 -2
  64. data/lib/half-pipe/rails.rb +10 -0
  65. data/lib/half-pipe/version.rb +1 -1
  66. data/lib/rack/half-pipe.rb +26 -30
  67. data/lib/sass/half_pipe_functions.rb +7 -0
  68. data/lib/tasks/assets.rake +50 -0
  69. metadata +80 -13
@@ -0,0 +1,58 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The change you wanted was rejected (422)</title>
5
+ <style>
6
+ body {
7
+ background-color: #EFEFEF;
8
+ color: #2E2F30;
9
+ text-align: center;
10
+ font-family: arial, sans-serif;
11
+ }
12
+
13
+ div.dialog {
14
+ width: 25em;
15
+ margin: 4em auto 0 auto;
16
+ border: 1px solid #CCC;
17
+ border-right-color: #999;
18
+ border-left-color: #999;
19
+ border-bottom-color: #BBB;
20
+ border-top: #B00100 solid 4px;
21
+ border-top-left-radius: 9px;
22
+ border-top-right-radius: 9px;
23
+ background-color: white;
24
+ padding: 7px 4em 0 4em;
25
+ }
26
+
27
+ h1 {
28
+ font-size: 100%;
29
+ color: #730E15;
30
+ line-height: 1.5em;
31
+ }
32
+
33
+ body > p {
34
+ width: 33em;
35
+ margin: 0 auto 1em;
36
+ padding: 1em 0;
37
+ background-color: #F7F7F7;
38
+ border: 1px solid #CCC;
39
+ border-right-color: #999;
40
+ border-bottom-color: #999;
41
+ border-bottom-left-radius: 4px;
42
+ border-bottom-right-radius: 4px;
43
+ border-top-color: #DADADA;
44
+ color: #666;
45
+ box-shadow:0 3px 8px rgba(50, 50, 50, 0.17);
46
+ }
47
+ </style>
48
+ </head>
49
+
50
+ <body>
51
+ <!-- This file lives in public/422.html -->
52
+ <div class="dialog">
53
+ <h1>The change you wanted was rejected.</h1>
54
+ <p>Maybe you tried to change something you didn't have access to.</p>
55
+ </div>
56
+ <p>If you are the application owner check the logs for more information.</p>
57
+ </body>
58
+ </html>
@@ -0,0 +1,57 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>We're sorry, but something went wrong (500)</title>
5
+ <style>
6
+ body {
7
+ background-color: #EFEFEF;
8
+ color: #2E2F30;
9
+ text-align: center;
10
+ font-family: arial, sans-serif;
11
+ }
12
+
13
+ div.dialog {
14
+ width: 25em;
15
+ margin: 4em auto 0 auto;
16
+ border: 1px solid #CCC;
17
+ border-right-color: #999;
18
+ border-left-color: #999;
19
+ border-bottom-color: #BBB;
20
+ border-top: #B00100 solid 4px;
21
+ border-top-left-radius: 9px;
22
+ border-top-right-radius: 9px;
23
+ background-color: white;
24
+ padding: 7px 4em 0 4em;
25
+ }
26
+
27
+ h1 {
28
+ font-size: 100%;
29
+ color: #730E15;
30
+ line-height: 1.5em;
31
+ }
32
+
33
+ body > p {
34
+ width: 33em;
35
+ margin: 0 auto 1em;
36
+ padding: 1em 0;
37
+ background-color: #F7F7F7;
38
+ border: 1px solid #CCC;
39
+ border-right-color: #999;
40
+ border-bottom-color: #999;
41
+ border-bottom-left-radius: 4px;
42
+ border-bottom-right-radius: 4px;
43
+ border-top-color: #DADADA;
44
+ color: #666;
45
+ box-shadow:0 3px 8px rgba(50, 50, 50, 0.17);
46
+ }
47
+ </style>
48
+ </head>
49
+
50
+ <body>
51
+ <!-- This file lives in public/500.html -->
52
+ <div class="dialog">
53
+ <h1>We're sorry, but something went wrong.</h1>
54
+ </div>
55
+ <p>If you are the application owner check the logs for more information.</p>
56
+ </body>
57
+ </html>
File without changes
@@ -0,0 +1,5 @@
1
+ # See http://www.robotstxt.org/wc/norobots.html for documentation on how to use the robots.txt file
2
+ #
3
+ # To ban all spiders from the entire site uncomment the next two lines:
4
+ # User-agent: *
5
+ # Disallow: /
File without changes
File without changes
data/half-pipe.gemspec CHANGED
@@ -18,4 +18,5 @@ Gem::Specification.new do |gem|
18
18
  gem.require_paths = ["lib"]
19
19
 
20
20
  gem.add_dependency "rack-asset-compiler"
21
+ gem.add_dependency "sass"
21
22
  end
@@ -23,6 +23,10 @@ module HalfPipe
23
23
  gsub_file "app/views/layouts/application.html.erb", %r{\s*<%= javascript_include_tag "application" %>$}, ''
24
24
  insert_into_file "app/views/layouts/application.html.erb", %Q{ <%= requirejs_include_tag "/scripts/application.js" %>\n }, before: "</body>"
25
25
 
26
+ gsub_file "config/environments/development.rb", "config.assets.debug = true", "config.middleware.use Rack::HalfPipe"
27
+
28
+ append_to_file ".gitignore", %w(node_modules bower_components public/scripts public/styles public/images).join("\n"), force: true
29
+
26
30
  directory "app"
27
31
 
28
32
  empty_directory "app/scripts"
@@ -35,7 +39,8 @@ module HalfPipe
35
39
  initializer "sass.rb" do
36
40
  %Q{
37
41
  require 'sass/importers/bower_importer'
38
- Sass.load_paths << Sass::Importers::BowerImporter.new("components")
42
+ require 'sass/half_pipe_functions'
43
+ Sass.load_paths << Sass::Importers::BowerImporter.new("bower_components")
39
44
  }
40
45
  end
41
46
 
@@ -31,21 +31,19 @@ module.exports = function(grunt) {
31
31
  },
32
32
 
33
33
  requirejs: {
34
- options: {
35
- baseUrl: "app/scripts",
36
- mainConfigFile: "app/scripts/application.js",
37
- name: "main",
38
- out: "public/scripts/application.js"
39
- },
40
34
  scripts: {
35
+ options: {
36
+ almond: true,
37
+ baseUrl: "app/scripts",
38
+ mainConfigFile: "app/scripts/application.js",
39
+ name: "oral-health",
40
+ out: "public/scripts/application.js",
41
+ wrap: true
42
+ }
41
43
  }
42
44
  },
43
45
 
44
- copy: {
45
- 'public/scripts/require.js': 'components/requirejs/require.js'
46
- },
47
-
48
- clean: ['public/assets/', 'tmp/']
46
+ clean: ['public/scripts/', 'public/styles', 'tmp/']
49
47
 
50
48
  });
51
49
 
@@ -55,7 +53,7 @@ module.exports = function(grunt) {
55
53
  grunt.loadNpmTasks('grunt-contrib-cssmin');
56
54
  grunt.loadNpmTasks('grunt-contrib-copy');
57
55
  grunt.loadNpmTasks('grunt-contrib-clean');
58
- grunt.loadNpmTasks('grunt-contrib-requirejs');
56
+ grunt.loadNpmTasks('grunt-requirejs');
59
57
 
60
58
  // Default task.
61
59
  grunt.registerTask('default', 'build');
@@ -8,10 +8,11 @@ require.config({
8
8
  require(
9
9
  [
10
10
  // Add your dependencies here
11
- '<%= main_module_name %>'
12
11
  ],
13
12
 
14
13
  function(initialize/*, modules */){
15
- initialize();
14
+ require(['<%= main_module_name %>'], function(initialize){
15
+ initialize();
16
+ });
16
17
  }
17
18
  );
@@ -3,13 +3,13 @@
3
3
  "devDependencies": {
4
4
  "grunt-cli": "~0.1.7",
5
5
  "grunt": "~0.4.1",
6
- "bower": "~0.9.2",
6
+ "bower": "~0.10.0",
7
7
  "grunt-contrib-sass": "~0.3.0",
8
8
  "grunt-contrib-copy": "~0.4.1",
9
9
  "grunt-contrib-clean": "~0.4.1",
10
10
  "grunt-contrib-jshint": "~0.4.3",
11
11
  "grunt-contrib-cssmin": "~0.6.0",
12
- "grunt-contrib-requirejs": "~0.4.0"
12
+ "grunt-requirejs": "~0.3.5"
13
13
  }
14
14
  }
15
15
 
@@ -1,4 +1,14 @@
1
1
  module HalfPipe
2
2
  class Engine < Rails::Engine
3
+
4
+ config.before_configuration do
5
+ config.half_pipe = ActiveSupport::OrderedOptions.new
6
+ config.half_pipe.serve_assets = false
7
+ end
8
+
9
+ initializer "half_pipe.middleware", after: "build_middleware_stack" do |app|
10
+ app.config.middleware.use Rack::HalfPipe if config.half_pipe.serve_assets
11
+ end
12
+
3
13
  end
4
14
  end
@@ -1,5 +1,5 @@
1
1
  module Half
2
2
  module Pipe
3
- VERSION = "0.0.1"
3
+ VERSION = "0.1.0"
4
4
  end
5
5
  end
@@ -10,45 +10,28 @@ module Rack
10
10
  @compilers << Rack::AssetCompiler.new(app, scripts_config)
11
11
  @compilers << Rack::AssetCompiler.new(app, bower_js_config)
12
12
  @compilers << Rack::AssetCompiler.new(app, bower_css_config)
13
+ @compilers << Rack::AssetCompiler.new(app, images_config)
13
14
  @compilers << Rack::SassCompiler.new(app, sass_config)
14
15
 
15
16
  @app = app
16
17
  end
17
18
 
18
19
  def call(env)
19
- res = @compilers[0].call(env)
20
20
 
21
- if res[0] != 404
22
- return res
21
+ res = @compilers.reduce([404]) do |memo,compiler|
22
+ if memo[0] == 404
23
+ compiler.call(env)
24
+ else
25
+ memo
26
+ end
23
27
  end
24
28
 
25
- res = @compilers[1].call(env)
26
-
27
- if res[0] != 404
28
- return res
29
+ if res[0] == 404
30
+ @app.call(env)
31
+ else
32
+ res
29
33
  end
30
34
 
31
- res = @compilers[2].call(env)
32
-
33
- if res[0] != 404
34
- return res
35
- end
36
-
37
- res = @compilers[3].call(env)
38
-
39
- if res[0] != 404
40
- return res
41
- end
42
-
43
- @app.call(env)
44
-
45
-
46
- # @compilers.reduce(nil) do |response,compiler|
47
- # response.tap{ |u| puts "response: #{response.inspect}" } || compiler.call(env).tap { |u| puts "call returned: #{u.inspect}" }
48
- # end
49
-
50
- # res || @app.call(env)
51
-
52
35
  end
53
36
 
54
37
  private
@@ -65,7 +48,7 @@ module Rack
65
48
 
66
49
  def bower_js_config
67
50
  {
68
- source_dir: 'components',
51
+ source_dir: 'bower_components',
69
52
  url: '/components',
70
53
  source_extension: 'js',
71
54
  content_type: 'application/javascript',
@@ -73,6 +56,14 @@ module Rack
73
56
  }
74
57
  end
75
58
 
59
+ def images_config
60
+ {
61
+ source_dir: 'app/images',
62
+ url: '/images',
63
+ compiler: pass_thru_compiler
64
+ }
65
+ end
66
+
76
67
  def bower_css_config
77
68
  {
78
69
  source_dir: 'components',
@@ -86,7 +77,12 @@ module Rack
86
77
  def sass_config
87
78
  {
88
79
  :source_dir => 'app/styles',
89
- :url => '/styles'
80
+ :url => '/styles',
81
+ sass_options: {
82
+ debug_info: true,
83
+ line_comments: false,
84
+ style: :expanded
85
+ }
90
86
  }
91
87
  end
92
88
 
@@ -0,0 +1,7 @@
1
+ module Sass::Script::Functions
2
+
3
+ def image_url(path)
4
+ Sass::Script::String.new("url(#{File.join("/images", path.value)})")
5
+ end
6
+
7
+ end
@@ -0,0 +1,50 @@
1
+ require 'active_support/ordered_options'
2
+
3
+ namespace :half_pipe do
4
+
5
+ half_pipe = ActiveSupport::OrderedOptions.new
6
+
7
+ task :clean do
8
+ Rake::Task["half_pipe:environment"].invoke
9
+ Rake::Task["half_pipe:execute_grunt_command"].invoke("clean")
10
+ end
11
+
12
+ task :execute_grunt_command, [:command] => ["half_pipe:environment",
13
+ "half_pipe:generate_grunt_runner"] do |_,params|
14
+ half_pipe.grunt_command = "#{half_pipe.grunt_runner} #{params[:command]}"
15
+ puts "executing: #{half_pipe.grunt_command.inspect}"
16
+ system half_pipe.grunt_command
17
+ end
18
+
19
+ task :generate_grunt_runner do
20
+ paths = %W(#{half_pipe.cwd} node_modules .bin grunt)
21
+ half_pipe.grunt_runner = File.join(*paths)
22
+ end
23
+
24
+ task :environment do
25
+
26
+ # For great Capistrano
27
+ half_pipe.cwd = (respond_to?(:release_path) ? release_path : Dir.pwd)
28
+
29
+ end
30
+
31
+ namespace :precompile do
32
+
33
+ task :noop
34
+
35
+ task :all do
36
+ Rake::Task["half_pipe:environment"].invoke
37
+ Rake::Task["half_pipe:execute_grunt_command"].invoke("build")
38
+ end
39
+
40
+ end
41
+
42
+ desc "Precompile half-pipe-managed assets"
43
+ task :precompile => ["half_pipe:precompile:all"]
44
+
45
+ end
46
+
47
+ task "assets:precompile" => ["half_pipe:precompile"]
48
+ task "assets:clean" => ["half_pipe:clean"]
49
+ task "assets:clobber" => ["half_pipe:clean"]
50
+ task "assets:environemnt" => ["half_pipe:environment"]
metadata CHANGED
@@ -1,30 +1,41 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: half-pipe
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
5
- prerelease:
4
+ version: 0.1.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Joe Fiorini
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-05-15 00:00:00.000000000 Z
11
+ date: 2013-07-19 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: rack-asset-compiler
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - '>='
20
18
  - !ruby/object:Gem::Version
21
19
  version: '0'
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: sass
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
+ - - '>='
28
39
  - !ruby/object:Gem::Version
29
40
  version: '0'
30
41
  description: Grunt-based workflow for your Rails assets
@@ -40,6 +51,61 @@ files:
40
51
  - README.md
41
52
  - Rakefile
42
53
  - app/helpers/half_pipe_helper.rb
54
+ - examples/rails/.bowerrc
55
+ - examples/rails/.gitignore
56
+ - examples/rails/.jshintrc
57
+ - examples/rails/Gemfile
58
+ - examples/rails/Gruntfile.js
59
+ - examples/rails/README.rdoc
60
+ - examples/rails/Rakefile
61
+ - examples/rails/app/controllers/application_controller.rb
62
+ - examples/rails/app/controllers/concerns/.keep
63
+ - examples/rails/app/controllers/posts_controller.rb
64
+ - examples/rails/app/helpers/application_helper.rb
65
+ - examples/rails/app/mailers/.keep
66
+ - examples/rails/app/models/.keep
67
+ - examples/rails/app/models/concerns/.keep
68
+ - examples/rails/app/models/post.rb
69
+ - examples/rails/app/scripts/application.js
70
+ - examples/rails/app/scripts/features/posts.js
71
+ - examples/rails/app/scripts/main.js
72
+ - examples/rails/app/styles/main.scss
73
+ - examples/rails/app/views/layouts/application.html.erb
74
+ - examples/rails/app/views/posts/index.html.erb
75
+ - examples/rails/app/views/posts/show.html.erb
76
+ - examples/rails/bin/bundle
77
+ - examples/rails/bin/rails
78
+ - examples/rails/bin/rake
79
+ - examples/rails/bower.json
80
+ - examples/rails/config.ru
81
+ - examples/rails/config/application.rb
82
+ - examples/rails/config/boot.rb
83
+ - examples/rails/config/environment.rb
84
+ - examples/rails/config/environments/development.rb
85
+ - examples/rails/config/environments/production.rb
86
+ - examples/rails/config/environments/test.rb
87
+ - examples/rails/config/initializers/backtrace_silencers.rb
88
+ - examples/rails/config/initializers/filter_parameter_logging.rb
89
+ - examples/rails/config/initializers/inflections.rb
90
+ - examples/rails/config/initializers/mime_types.rb
91
+ - examples/rails/config/initializers/sass.rb
92
+ - examples/rails/config/initializers/secret_token.rb
93
+ - examples/rails/config/initializers/session_store.rb
94
+ - examples/rails/config/initializers/wrap_parameters.rb
95
+ - examples/rails/config/locales/en.yml
96
+ - examples/rails/config/routes.rb
97
+ - examples/rails/db/seeds.rb
98
+ - examples/rails/lib/assets/.keep
99
+ - examples/rails/lib/tasks/.keep
100
+ - examples/rails/log/.keep
101
+ - examples/rails/package.json
102
+ - examples/rails/public/404.html
103
+ - examples/rails/public/422.html
104
+ - examples/rails/public/500.html
105
+ - examples/rails/public/favicon.ico
106
+ - examples/rails/public/robots.txt
107
+ - examples/rails/vendor/assets/javascripts/.keep
108
+ - examples/rails/vendor/assets/stylesheets/.keep
43
109
  - half-pipe.gemspec
44
110
  - lib/generators/half_pipe/install_generator.rb
45
111
  - lib/generators/half_pipe/templates/Gruntfile.js
@@ -55,30 +121,31 @@ files:
55
121
  - lib/half-pipe/rails.rb
56
122
  - lib/half-pipe/version.rb
57
123
  - lib/rack/half-pipe.rb
124
+ - lib/sass/half_pipe_functions.rb
58
125
  - lib/sass/importers/bower_importer.rb
126
+ - lib/tasks/assets.rake
59
127
  homepage: ''
60
128
  licenses: []
129
+ metadata: {}
61
130
  post_install_message:
62
131
  rdoc_options: []
63
132
  require_paths:
64
133
  - lib
65
134
  required_ruby_version: !ruby/object:Gem::Requirement
66
- none: false
67
135
  requirements:
68
- - - ! '>='
136
+ - - '>='
69
137
  - !ruby/object:Gem::Version
70
138
  version: '0'
71
139
  required_rubygems_version: !ruby/object:Gem::Requirement
72
- none: false
73
140
  requirements:
74
- - - ! '>='
141
+ - - '>='
75
142
  - !ruby/object:Gem::Version
76
143
  version: '0'
77
144
  requirements: []
78
145
  rubyforge_project:
79
- rubygems_version: 1.8.23
146
+ rubygems_version: 2.0.2
80
147
  signing_key:
81
- specification_version: 3
148
+ specification_version: 4
82
149
  summary: Gem to replace the Rails asset pipeline with a Grunt.js-based workflow, providing
83
150
  dependencies via Bower.
84
151
  test_files: []