rugular 0.6.6 → 0.6.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3d071512d3ab5d3a4c2dc9feb577a2bf915cdc7e
4
- data.tar.gz: 6d7ade01d611534225776c420ab1135317ef1e2a
3
+ metadata.gz: 6b72e78b18b21cfe1e4ac2a4b05b03540b270f27
4
+ data.tar.gz: b4fed9cde117145d9abafbc1ed8146938e256224
5
5
  SHA512:
6
- metadata.gz: 05717e162826c18155fe5866a61e6e40cfb2284bdd147f37047e71ff973f0f6daa28b56c2f9278186b62d2b9404f0ed1a85affc4ba27742f4191f65861bda03f
7
- data.tar.gz: 2c1327afd4319480e045028c4b8749c3ed89add1def4d3a849ad7d4d2e1ee4f601724d03f4e7bc0a1e53f96a0084397fa9fd7a1cb8a11d948ccb8f5786a9bdf9
6
+ metadata.gz: 01215319deab4e9e794dd35dc47f00dcbb35db0451b87371fc4ea01ee5d17ce88a47e3275233d0614a9c1e04b77693eae93b6f0f59059d3fb82adb34e38cc27f
7
+ data.tar.gz: aff35dd9b8db79d498b142b662068a4c2c7bca3eabdcf880f0283e789493af58df3706dbb2ce516f40749527158c88c640c3a6c990b6cfced6e37420e00709a6
data/README.md CHANGED
@@ -60,7 +60,7 @@ A new Rugular project contains the following folders and files:
60
60
  │ ├── components/
61
61
  │ ├── favico.ico
62
62
  ├── vendor/
63
- ├── vendor_and_bower_components.yaml
63
+ ├── bower_components.yaml
64
64
  </pre>
65
65
 
66
66
  | Folder/File Name | Description |
@@ -78,13 +78,13 @@ A new Rugular project contains the following folders and files:
78
78
  | src/components | A folder for isolate-scope directives to be used in your application code. This folder is also described in [How to Write Rugular apps](#how-to-write-rugular-apps). |
79
79
  | src/assets | A folder to place assets, including but not limited to, ``.png``, ``.woff``, ``.svg``, ``.pdf``. All files placed in the assets folder can be linked by their relative filename, e.g. ``src/assets/logo.png`` can be linked as ``<img src='assets/logo.png'></img>``
80
80
  | vendor | 3rd-party javascript, coffeescript, css, and sass files that do not come with bower management. All of these files are included before any code in src. |
81
- | vendor_and_bower_components.yaml | A file to declare what third party files in the bower_components and vendor folder you would like to include. |
81
+ | bower_components.yaml | A file to declare what third party files in the bower_components and vendor folder you would like to include. |
82
82
 
83
83
  ## How to Write Rugular Apps
84
84
 
85
85
  Application specific code lies in the ``src`` folder. Other files, such as
86
86
  bower_components or other 3rd party vendor files are declared in the
87
- ``vendor_and_bower_components.yaml`` file.
87
+ ``bower_components.yaml`` file.
88
88
 
89
89
  Code in the src folder are written in Coffeescript, Haml and Sass and designed
90
90
  to follow [Google's Best Practices for an Angular App
@@ -102,10 +102,10 @@ folder (e.g. ``src/app/dashboard/dashboard.module.coffee``) are to be included
102
102
  in the ``app.module.coffee`` declaration.
103
103
 
104
104
  The ``src/app/app.routes.coffee`` file declares a base route, ``root`` for the
105
- application from which all other routes are derived from; all other routes
105
+ application from which all other routes are derived from; all other routes
106
106
  should be prepended with ``'root.'``.
107
107
 
108
- The``src/app/app.haml`` file serves as an application layout for the rest of
108
+ The``src/app/app.haml`` file serves as an application layout for the rest of
109
109
  your application. If you have directives such as a ``navbar`` or ``footer``
110
110
  directive, it is advised to add these directives to this ``haml`` file.
111
111
 
@@ -40,7 +40,7 @@ module Rugular
40
40
  File.open('dist/application.js', 'w') do |file|
41
41
  file.write(
42
42
  Uglifier.compile(
43
- javascript_files.map do |file|
43
+ Rugular::JavascriptFiles.map do |file|
44
44
  text = File.read(file).gsub('templateUrl', 'template')
45
45
  CoffeeScript.compile(text)
46
46
  end.join
@@ -105,21 +105,6 @@ module Rugular
105
105
  end.join
106
106
  end
107
107
 
108
- def javascript_files
109
- Dir.glob("src/components/**/*.module.coffee") +
110
- Dir.glob("src/components/**/*.factory.coffee") +
111
- Dir.glob("src/components/**/*.filter.coffee") +
112
- Dir.glob("src/components/**/*.controller.coffee") +
113
- Dir.glob("src/components/**/*.directive.coffee") +
114
- Dir.glob("src/components/**/*.routes.coffee") +
115
- Dir.glob("src/app/**/*.module.coffee") +
116
- Dir.glob("src/app/**/*.factory.coffee") +
117
- Dir.glob("src/app/**/*.filter.coffee") +
118
- Dir.glob("src/app/**/*.controller.coffee") +
119
- Dir.glob("src/app/**/*.directive.coffee") +
120
- Dir.glob("src/app/**/*.routes.coffee")
121
- end
122
-
123
108
  def bower_css
124
109
  bower_yaml.fetch('bower_components').fetch('css').map do |filename|
125
110
  File.read('bower_components/' + filename)
@@ -128,7 +113,7 @@ module Rugular
128
113
 
129
114
 
130
115
  def bower_yaml
131
- YAML.load(File.read('src/vendor_and_bower_components.yaml'))
116
+ YAML.load(File.read('src/bower_components.yaml'))
132
117
  end
133
118
 
134
119
  def lib_directory
@@ -0,0 +1,18 @@
1
+ module Rugular
2
+ class JavascriptFiles
3
+ def self.ordered_array
4
+ Dir.glob("src/components/**/*.module.coffee") +
5
+ Dir.glob("src/components/**/*.factory.coffee") +
6
+ Dir.glob("src/components/**/*.filter.coffee") +
7
+ Dir.glob("src/components/**/*.controller.coffee") +
8
+ Dir.glob("src/components/**/*.directive.coffee") +
9
+ Dir.glob("src/components/**/*.routes.coffee") +
10
+ Dir.glob("src/app/**/*.module.coffee") +
11
+ Dir.glob("src/app/**/*.factory.coffee") +
12
+ Dir.glob("src/app/**/*.filter.coffee") +
13
+ Dir.glob("src/app/**/*.controller.coffee") +
14
+ Dir.glob("src/app/**/*.directive.coffee") +
15
+ Dir.glob("src/app/**/*.routes.coffee")
16
+ end
17
+ end
18
+ end
@@ -1,6 +1,6 @@
1
1
  require "#{__dir__}/guards/rugular.rb"
2
2
 
3
3
  guard :rugular do
4
- watch /^src\/.+\.[^sass]/
5
- watch 'vendor_and_bower_components.yaml'
4
+ watch /^src\/.+\.(coffee|haml|png|jpg|ttf|woff)$/
5
+ watch 'bower_components.yaml'
6
6
  end
@@ -1,7 +1,7 @@
1
1
  require 'guard'
2
2
  require_relative 'rugular_haml'
3
3
  require_relative 'rugular_coffee'
4
- require_relative 'rugular_vendor_and_bower_components'
4
+ require_relative 'rugular_bower_components'
5
5
  require_relative 'rugular_index_html'
6
6
  require_relative 'rugular_assets'
7
7
 
@@ -13,6 +13,10 @@ module Guard
13
13
  end
14
14
 
15
15
  def start
16
+ create_tmp_directory
17
+
18
+ run_on_changes('src/index.haml')
19
+
16
20
  run_all
17
21
  end
18
22
 
@@ -20,23 +24,22 @@ module Guard
20
24
  def reload; true end
21
25
 
22
26
  def run_all
23
- run_on_changes(
24
- Dir.glob('src/**/*').unshift('vendor_and_bower_components.yaml')
25
- )
27
+ run_on_changes(Dir.glob('src/**/*').push('bower_components.yaml'))
26
28
  end
27
29
 
28
30
  def run_on_changes(paths)
29
31
  [*paths].each do |file|
30
- message = case File.extname(file)
31
- when '.coffee' then ::RugularCoffee.compile(file)
32
- when '.haml' then ::RugularHaml.compile(file)
33
- when '.yaml' then ::RugularVendorAndBowerComponents.compile
34
- when '.png' then ::RugularAssets.copy_asset(file)
35
- when '.jpg' then ::RugularAssets.copy_asset(file)
36
- when '.ttf' then ::RugularAssets.copy_asset(file)
37
- when '.woff' then ::RugularAssets.copy_asset(file)
38
- else next 'Rugular does not know how to handle this file'
39
- end
32
+ message =
33
+ case File.extname(file)
34
+ when '.coffee' then ::RugularCoffee.compile(file)
35
+ when '.haml' then ::RugularHaml.compile(file)
36
+ when '.yaml' then ::RugularBowerComponents.compile
37
+ when '.png' then ::RugularAssets.copy_asset(file)
38
+ when '.jpg' then ::RugularAssets.copy_asset(file)
39
+ when '.ttf' then ::RugularAssets.copy_asset(file)
40
+ when '.woff' then ::RugularAssets.copy_asset(file)
41
+ else "Rugular does not know how to handle #{file}"
42
+ end
40
43
 
41
44
  ::RugularIndexHtml.update_javascript_script_tags
42
45
 
@@ -50,17 +53,13 @@ module Guard
50
53
  [*paths].each do |file|
51
54
  ::Guard::UI.info "Guard received delete event for #{file}"
52
55
 
53
- message = case File.extname(file)
54
- when '.coffee' then ::RugularCoffee.delete(file)
55
- when '.haml' then ::RugularHaml.delete(file)
56
- when '.png' then ::RugularAssets.delete_asset(file)
57
- when '.jpg' then ::RugularAssets.delete_asset(file)
58
- when '.ttf' then ::RugularAssets.delete_asset(file)
59
- when '.woff' then ::RugularAssets.delete_asset(file)
60
- when '.yaml'
61
- then fail 'what are you doing? trying to break rugular?!'
62
- else next 'Rugular does not know how to handle this file'
63
- end
56
+ message =
57
+ case File.extname(file)
58
+ when '.coffee' then ::RugularCoffee.delete(file)
59
+ when '.haml' then ::RugularHaml.delete(file)
60
+ when '.yaml' then fail 'Please do not delete yaml files'
61
+ else ::RugularAssets.delete_asset(file)
62
+ end
64
63
 
65
64
  ::RugularIndexHtml.update_javascript_script_tags
66
65
 
@@ -72,10 +71,13 @@ module Guard
72
71
 
73
72
  private
74
73
 
74
+ def create_tmp_directory
75
+ FileUtils.mkdir '.tmp' unless File.directory? '.tmp'
76
+ end
77
+
75
78
  def handle_error_in_guard(error)
76
79
  ::Guard::UI.error error.message
77
80
  throw :task_has_failed
78
81
  end
79
82
  end
80
83
  end
81
-
@@ -0,0 +1,46 @@
1
+ require 'uglifier'
2
+ require 'coffee_script'
3
+ require 'uglifier'
4
+
5
+ class RugularBowerComponents
6
+ def self.compile
7
+ new.compile
8
+ end
9
+
10
+ def initialize; end
11
+
12
+ def compile
13
+ ::Guard::UI.info 'Beginning to create a manifest bower files'
14
+
15
+ File.open('.tmp/vendor.css', 'w') do |file|
16
+ file.write bower_css
17
+ end
18
+ File.open('.tmp/vendor.js', 'w') do |file|
19
+ file.write(Uglifier.compile(bower_javascript))
20
+ end
21
+
22
+ 'Successfully created manifest bower files'
23
+ end
24
+
25
+ private
26
+
27
+ def bower_css
28
+ bower_yaml.fetch('css').map do |filename|
29
+ bower_component_file = 'bower_components/' + filename
30
+ next unless File.file? bower_component_file
31
+ File.read('bower_components/' + filename)
32
+ end.join
33
+ end
34
+
35
+ def bower_javascript
36
+ bower_yaml.fetch('js').map do |filename|
37
+ bower_component_file = 'bower_components/' + filename
38
+ next unless File.file? bower_component_file
39
+ File.read('bower_components/' + filename)
40
+ end.join
41
+ end
42
+
43
+ def bower_yaml
44
+ YAML.load(File.read('bower_components.yaml'))
45
+ end
46
+ end
@@ -1,4 +1,5 @@
1
1
  require 'nokogiri'
2
+ require_relative '../../helpers/javascript_files'
2
3
 
3
4
  class RugularIndexHtml
4
5
  def self.update_javascript_script_tags
@@ -28,25 +29,10 @@ class RugularIndexHtml
28
29
  def javascript_file_script_tags
29
30
  Nokogiri::XML::NodeSet.new(
30
31
  application_html,
31
- javascript_files.map(&convert_to_script_tag)
32
+ Rugular::JavascriptFiles.ordered_array.map(&convert_to_script_tag)
32
33
  )
33
34
  end
34
35
 
35
- def javascript_files
36
- Dir.glob("src/components/**/*.module.coffee") +
37
- Dir.glob("src/components/**/*.factory.coffee") +
38
- Dir.glob("src/components/**/*.filter.coffee") +
39
- Dir.glob("src/components/**/*.controller.coffee") +
40
- Dir.glob("src/components/**/*.directive.coffee") +
41
- Dir.glob("src/components/**/*.routes.coffee") +
42
- Dir.glob("src/app/**/*.module.coffee") +
43
- Dir.glob("src/app/**/*.factory.coffee") +
44
- Dir.glob("src/app/**/*.filter.coffee") +
45
- Dir.glob("src/app/**/*.controller.coffee") +
46
- Dir.glob("src/app/**/*.directive.coffee") +
47
- Dir.glob("src/app/**/*.routes.coffee")
48
- end
49
-
50
36
  def convert_to_script_tag
51
37
  lambda do |javascript_file|
52
38
  tmp_filename = javascript_file.gsub('src', '').gsub('coffee', 'js')
@@ -0,0 +1,5 @@
1
+ css:
2
+ - 'font-awesome/css/font-awesome.min.css'
3
+ js:
4
+ - 'angular/angular.js'
5
+ - 'angular-ui-router/release/angular-ui-router.js'
@@ -1,3 +1,3 @@
1
1
  module Rugular
2
- VERSION = '0.6.6'
2
+ VERSION = '0.6.7'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rugular
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.6
4
+ version: 0.6.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nicholas Shook
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-19 00:00:00.000000000 Z
11
+ date: 2015-02-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionview
@@ -312,16 +312,17 @@ files:
312
312
  - lib/rugular/tasks/helpers/app_checker.rb
313
313
  - lib/rugular/tasks/helpers/backend_url_injector.rb
314
314
  - lib/rugular/tasks/helpers/haml_renderer.rb
315
+ - lib/rugular/tasks/helpers/javascript_files.rb
315
316
  - lib/rugular/tasks/new.rb
316
317
  - lib/rugular/tasks/server.rb
317
318
  - lib/rugular/tasks/server/Guardfile
318
319
  - lib/rugular/tasks/server/Procfile
319
320
  - lib/rugular/tasks/server/guards/rugular.rb
320
321
  - lib/rugular/tasks/server/guards/rugular_assets.rb
322
+ - lib/rugular/tasks/server/guards/rugular_bower_components.rb
321
323
  - lib/rugular/tasks/server/guards/rugular_coffee.rb
322
324
  - lib/rugular/tasks/server/guards/rugular_haml.rb
323
325
  - lib/rugular/tasks/server/guards/rugular_index_html.rb
324
- - lib/rugular/tasks/server/guards/rugular_vendor_and_bower_components.rb
325
326
  - lib/rugular/tasks/tmux.rb
326
327
  - lib/rugular/tasks/tmux/tmuxinator.yml
327
328
  - lib/rugular/templates/directive/_app.sass.erb
@@ -338,6 +339,7 @@ files:
338
339
  - lib/rugular/templates/new/.application.sass
339
340
  - lib/rugular/templates/new/.gitignore
340
341
  - lib/rugular/templates/new/Gemfile
342
+ - lib/rugular/templates/new/bower_components.yaml
341
343
  - lib/rugular/templates/new/config.yaml
342
344
  - lib/rugular/templates/new/e2e/app_spec.coffee
343
345
  - lib/rugular/templates/new/karma.conf.js
@@ -351,7 +353,6 @@ files:
351
353
  - lib/rugular/templates/new/src/app/backend.contsant.coffee
352
354
  - lib/rugular/templates/new/src/favicon.ico
353
355
  - lib/rugular/templates/new/test/spec_helper.js
354
- - lib/rugular/templates/new/vendor_and_bower_components.yaml
355
356
  - lib/rugular/templates/new_erb/bower.json.erb
356
357
  - lib/rugular/templates/new_erb/package.json.erb
357
358
  - lib/rugular/templates/new_erb/src/index.haml.erb
@@ -1,63 +0,0 @@
1
- require 'uglifier'
2
- require 'coffee_script'
3
-
4
- class RugularVendorAndBowerComponents
5
- def self.compile
6
- new.compile
7
- end
8
-
9
- def initialize; end
10
-
11
- def compile
12
- ::Guard::UI.info 'Beginning to create vendor asset files'
13
-
14
- File.open('.tmp/vendor.css', 'w') do |file|
15
- file.write bower_css
16
- end
17
- File.open('.tmp/vendor.js', 'w') do |file|
18
- file.write(Uglifier.compile(bower_and_vendor_javascript))
19
- end
20
-
21
- 'Successfully created vendor asset files'
22
- end
23
-
24
- private
25
-
26
- def bower_and_vendor_javascript
27
- bower_javascript + vendor_javascript
28
- end
29
-
30
- def bower_css
31
- bower_yaml.fetch('bower_components').fetch('css').map do |filename|
32
- bower_component_file = 'bower_components/' + filename
33
- next unless File.file? bower_component_file
34
- File.read('bower_components/' + filename)
35
- end.join
36
- end
37
-
38
- def bower_javascript
39
- bower_yaml.fetch('bower_components').fetch('js').map do |filename|
40
- bower_component_file = 'bower_components/' + filename
41
- next unless File.file? bower_component_file
42
- File.read('bower_components/' + filename)
43
- end.join
44
- end
45
-
46
- def vendor_javascript
47
- bower_yaml.fetch('vendor').fetch('javascript').map do |filename|
48
- vendor_file = 'vendor/' + filename
49
- next unless File.file? vendor_file
50
- File.read(vendor_file)
51
- end.join +
52
-
53
- bower_yaml.fetch('vendor').fetch('coffee').map do |filename|
54
- vendor_file = 'vendor/' + filename
55
- next unless File.file? vendor_file
56
- CoffeeScript.compile(File.read('vendor/' + filename))
57
- end.join
58
- end
59
-
60
- def bower_yaml
61
- YAML.load(File.read('vendor_and_bower_components.yaml'))
62
- end
63
- end
@@ -1,11 +0,0 @@
1
- bower_components:
2
- css:
3
- - 'font-awesome/css/font-awesome.min.css'
4
- js:
5
- - 'angular/angular.js'
6
- - 'angular-ui-router/release/angular-ui-router.js'
7
- vendor:
8
- coffee:
9
- - 'some coffee script file'
10
- javascript:
11
- - 'some javascript file'