rugular 0.1.5 → 0.2.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: eb10df95777c635560b5e6e1b580f2c396a2ed23
4
- data.tar.gz: 9b924893d46177021502ec708508148c37727e83
3
+ metadata.gz: a53e57efa12ebfc85b6c69ee314e074b7bab13a2
4
+ data.tar.gz: 1cc5a30c9ae68e05feec0a0b86d4d5f702840305
5
5
  SHA512:
6
- metadata.gz: 7ef97b9b65899ca20c735053f70b10db28e4e8ed8da0237bda27237f28a9f88f0bfd293fbf7967b843e480ccbc6ceabf57424ffa5cb9a8473828be55758fb301
7
- data.tar.gz: 04ac28a6b5fa74b58cdbe3a420025e694119752cc406de69f0354c4e0f480aa28ec8c24676a2a9513a9def9240aedc93208c53b46664e1c3fa701a7af578cb9f
6
+ metadata.gz: 081e9614dbf0db1e5287dda0424510d16589a22a6b004cb8b31bc1338ad163fb65f3d77360c3029edf1edfcd55d71f5130c61fd0471eda21337237160e7a9832
7
+ data.tar.gz: 046c81e05df23e184c776b80019ef5afb6d8b9c386d763a90fee778b8b2feb5bcdd5d82a6168e51f76118d373bb46250465deecf2991ed14f058709d495d4215
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.2.0
data/Gemfile CHANGED
@@ -1,5 +1,7 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
+ ruby File.read("#{__dir__}/.ruby-version").chomp
4
+
3
5
  # Specify your gem's dependencies in rugular.gemspec
4
6
  gemspec
5
- gem 'guard-coffeescript', github: 'guard/guard-coffeescript', branch: 'master'
7
+ gem 'guard-sass'
data/README.md CHANGED
@@ -1,4 +1,5 @@
1
- [![Build Status](https://travis-ci.org/currica/rugular.svg)](https://travis-ci.org/currica/rugular)
1
+ ![Build
2
+ Status](https://circleci.com/gh/currica/rugular.svg?style=shield&circle-token=:circle-token)
2
3
 
3
4
  # Rugular
4
5
 
@@ -6,8 +7,8 @@ Rugular is a ruby scaffolding framework to build AngularJS apps. It builds a
6
7
  minified and compressed version of a front-end into the ``./dist`` folder that
7
8
  can be served as a standalone AngularJS app. The goal of this framework is to
8
9
  create applications written with [best AngularJS
9
- practices](https://github.com/johnpapa/angularjs-styleguide); CoffeeScript
10
- optional.
10
+ practices](https://github.com/johnpapa/angularjs-styleguide) using
11
+ CoffeeScript, Haml and Sass.
11
12
 
12
13
  ## Installation
13
14
 
@@ -99,6 +100,13 @@ contain a controller and service namespaced with a new module of the route
99
100
  name if one dos not already exist. It will also register the new module in the
100
101
  ``app.module.js`` file.
101
102
 
103
+ Routes can be nested in another folder representing a module. For example, to
104
+ nest a route inside a pre-existing 'test' module, execute:
105
+
106
+ ```bash
107
+ rugular generate route test:<route_name>
108
+ ```
109
+
102
110
  #### Create a Directive
103
111
 
104
112
  ```bash
@@ -109,6 +117,13 @@ This command will create a directive and controller namespaced with a new
109
117
  module of the feature name if one does not already exist. It will also register
110
118
  the new module in the ``app.module.js`` file.
111
119
 
120
+ Directives can be nested in another folder representing a module like routes.
121
+ For example, to nest a directive inside a pre-existing 'test' module, execute:
122
+
123
+ ```bash
124
+ rugular generate directive test:<directive_name>
125
+ ```
126
+
112
127
  #### Create a Factory (TODO)
113
128
 
114
129
  ```bash
@@ -125,7 +140,6 @@ A component refers to shareable, abstracted angular modules. To create a
125
140
  component, simply run any generator command with the ``-c`` option and the
126
141
  service will be created in the ``src/components`` folder.
127
142
 
128
-
129
143
  ## Running the Test Suite
130
144
 
131
145
  To run the test suite just once (such as in a continuous environment) execute:
data/circle.yml ADDED
@@ -0,0 +1,3 @@
1
+ test:
2
+ override:
3
+ - bundle exec rake
@@ -5,11 +5,4 @@ Feature: Rugular CLI
5
5
 
6
6
  Scenario: Running the tests for continuous integration
7
7
  When I set up Rugular with dependencies and run "rugular ci"
8
- Then the file "my-app/.tmp/index.html" should contain:
9
- """
10
- ng-app
11
- """
12
- And the file "my-app/.tmp/app/app.module.js" should contain:
13
- """
14
- angular.module
15
- """
8
+ Then the exit status should not be 1
@@ -5,7 +5,7 @@ Feature: Rugular CLI
5
5
 
6
6
  Scenario: Generating a route
7
7
  When I set up Rugular and run "rugular generate route test"
8
- And the file "my-app/src/app/test/test.controller.coffee" should contain:
8
+ Then the file "my-app/src/app/test/test.controller.coffee" should contain:
9
9
  """
10
10
  angular.module('test').controller('testController', testController)
11
11
  """
@@ -31,10 +31,58 @@ Feature: Rugular CLI
31
31
  'ui.router'
32
32
  ]
33
33
  """
34
+ And a file named "my-app/src/app/test/_test.sass" should exist
35
+ And the file "my-app/src/application.sass" should contain:
36
+ """
37
+ @import 'app/test'
38
+ """
34
39
 
35
40
  Scenario: Generating a route in the components directory
36
41
  When I set up Rugular and run "rugular generate route -c test"
37
- And the file "my-app/src/components/test/test.controller.coffee" should contain:
42
+ Then the file "my-app/src/components/test/test.controller.coffee" should contain:
38
43
  """
39
44
  angular.module('test').controller('testController', testController)
40
45
  """
46
+
47
+ Scenario: Generating a multiple word route
48
+ When I set up Rugular and run "rugular generate route credit_card"
49
+ Then the file "my-app/src/app/credit_card/credit_card.controller.coffee" should contain:
50
+ """
51
+ angular.module('creditCard').controller('creditCardController', creditCardController)
52
+ """
53
+
54
+ Scenario: Generating a nested route
55
+ When I set up Rugular and run "rugular generate route profile; rugular generate route profile:address"
56
+ Then the file "my-app/src/app/profile/address/address.controller.coffee" should contain:
57
+ """
58
+ angular.module('address').controller('addressController', addressController)
59
+ """
60
+ And the file "my-app/src/app/profile/address/address.routes.coffee" should contain:
61
+ """
62
+ angular.module('address').config(addressRouting)
63
+ """
64
+ And the file "my-app/src/app/profile/profile.module.coffee" should contain:
65
+ """
66
+ 'address'
67
+ """
68
+ And the file "my-app/src/app/profile/address/address.module.coffee" should contain:
69
+ """
70
+ angular.module 'address', [
71
+ 'ui.router'
72
+ ]
73
+ """
74
+
75
+ Scenario: Generating a doubly nested route
76
+ When I set up Rugular and run "rugular generate route profile; rugular generate route profile:address; rugular generate route profile:address:zip_code"
77
+ Then the file "my-app/src/app/profile/address/zip_code/zip_code.controller.coffee" should contain:
78
+ """
79
+ angular.module('zipCode').controller('zipCodeController', zipCodeController)
80
+ """
81
+ And the file "my-app/src/app/profile/address/zip_code/zip_code.routes.coffee" should contain:
82
+ """
83
+ angular.module('zipCode').config(zipCodeRouting)
84
+ """
85
+ And the file "my-app/src/app/profile/address/address.module.coffee" should contain:
86
+ """
87
+ 'zipCode'
88
+ """
data/features/new.feature CHANGED
@@ -6,7 +6,7 @@ Feature: Rugular CLI
6
6
  Scenario: New
7
7
  When I run `rugular new my-app`
8
8
  Then the exit status should be 0
9
- Then the file "my-app/.gitignore" should contain:
9
+ And the file "my-app/.gitignore" should contain:
10
10
  """
11
11
  bower_components
12
12
  """
@@ -24,6 +24,9 @@ Feature: Rugular CLI
24
24
  """
25
25
  And the file "my-app/src/index.haml" should contain:
26
26
  """
27
- = javascript_include_tag("./bower_components/angular-ui-router/release/angular-ui-router.js")
27
+ %link(href='application.css', media='screen', rel='stylesheet')
28
28
  """
29
+ And a directory named "my-app/src/components" should exist
30
+ And a file named "my-app/src/application.sass" should exist
31
+ And the output should contain "Thank you for installing Rugular"
29
32
 
@@ -5,29 +5,20 @@ module Rugular
5
5
  class ContinuousIntegration < Thor::Group
6
6
  include Thor::Actions
7
7
 
8
- desc('runs the tests once for continuous integration')
9
-
10
- def compile_to_tmp_folder(folder: Pathname.new(".tmp"))
11
- compile_coffescript_files(folder)
12
-
13
- complie_sass_files(folder)
14
-
15
- compile_haml_files(folder)
8
+ def self.exit_on_failure?
9
+ true
16
10
  end
17
11
 
12
+ desc('runs the tests once for continuous integration')
13
+
18
14
  def run_karma_script
19
15
  system(
20
16
  "./node_modules/karma/bin/karma start "\
21
17
  "--single-run --no-auto-watch karma.conf.js"
22
18
  )
23
-
24
- return false unless $?.exitstatus == 0
25
- end
26
-
27
- def completed_tests
28
- puts "Your tests have passed!!"
29
19
  end
30
20
 
21
+ private
31
22
  # TODO: this requires a selenium driver, such as sauce labs.
32
23
  # http://stackoverflow.com/questions/23150585/getting-started-with-protractor-travis-and-saucelabs
33
24
  # def run_protractor_script
@@ -40,52 +31,5 @@ module Rugular
40
31
  #
41
32
  # return false unless $?.exitstatus == 0
42
33
  # end
43
-
44
- private
45
-
46
- def compile_coffescript_files(folder)
47
- src_coffeescript_files.each do |file|
48
- create_file file.to_s.gsub('./src/', './.tmp/').gsub('coffee', 'js') do
49
- CoffeeScript.compile(file)
50
- end
51
- end
52
- end
53
-
54
- def compile_haml_files(folder)
55
- src_haml_files.each do |file|
56
- create_file file.to_s.gsub('./src/', './.tmp/').gsub('haml', 'html') do
57
- HamlRenderer.render(file)
58
- end
59
- end
60
- end
61
-
62
- def complie_sass_files(folder)
63
- src_sass_files.each do |file|
64
- create_file file.to_s.gsub('./src/', './.tmp/').gsub('sass', 'css') do
65
- begin
66
- Sass::Engine.new(file.read, load_paths: ["./."]).to_css
67
- rescue StandardError => e
68
- puts "!!! SASS Error: " + e.message
69
- end
70
- end
71
- end
72
- end
73
-
74
- def src_coffeescript_files
75
- Dir.glob("./src/**/*.coffee").map(&transform_to_pathname)
76
- end
77
-
78
- def src_haml_files
79
- Dir.glob("./src/**/*.haml").map(&transform_to_pathname)
80
- end
81
-
82
- def src_sass_files
83
- Dir.glob("./src/**/*.sass").map(&transform_to_pathname)
84
- end
85
-
86
- def transform_to_pathname
87
- ->(file_name) { Pathname.new(file_name) }
88
- end
89
-
90
34
  end
91
35
  end
@@ -1,5 +1,4 @@
1
- Dir.glob("#{__dir__}/helpers/**/*.rb").each {|file| require file}
2
- Dir.glob("#{__dir__}/generate/**/*.rb").each {|file| require file}
1
+ Dir.glob("#{__dir__}/{helpers,generate}/**/*.rb").each {|file| require file}
3
2
 
4
3
  module Rugular
5
4
  class Generate < Thor
@@ -18,7 +17,6 @@ module Rugular
18
17
  The angular services this command can create include:
19
18
 
20
19
  * A route (includes a route, controller, controller_spec and view)
21
- * A controller
22
20
  * A factory
23
21
  * A directive (includes a view)
24
22
 
@@ -1,4 +1,5 @@
1
1
  require 'ostruct'
2
+ require 'active_support'
2
3
 
3
4
  module Rugular
4
5
  class GeneratorBase < Thor::Group
@@ -6,7 +7,6 @@ module Rugular
6
7
 
7
8
  argument :name, desc: 'Name for your route'
8
9
 
9
- # specify a component
10
10
  class_option(
11
11
  :c,
12
12
  type: :boolean,
@@ -31,38 +31,57 @@ module Rugular
31
31
  end
32
32
  end
33
33
 
34
- def inject_module_into_app_module
35
- insert_into_file(
36
- app_module_file,
37
- module_declaration,
38
- after: "angular.module 'app', [\n"
39
- ) unless module_declaration_present?
34
+ def inject_module_into_module
35
+ if nested?
36
+ insert_into_file(
37
+ nested_module_file,
38
+ module_declaration,
39
+ after: "angular.module '#{nested_module_name}', [\n"
40
+ ) unless module_declaration_present?(nested_module_file)
41
+ else
42
+ insert_into_file(
43
+ app_module_file,
44
+ module_declaration,
45
+ after: "angular.module 'app', [\n"
46
+ ) unless module_declaration_present?(app_module_file)
47
+ end
48
+ end
49
+
50
+ def add_sass_declaration
51
+ append_to_file(
52
+ 'src/application.sass',
53
+ "@import '#{folder.sub('src/', '')}'"
54
+ ) unless sass_declaration_present?(folder)
40
55
  end
41
56
 
42
57
  def template_files; []; end
43
58
 
44
59
  protected
45
60
 
46
- def folder
47
- options[:c] ? "src/components/#{name}" : "src/app/#{name}"
61
+ def lib_directory
62
+ __dir__.chomp('tasks/generate')
48
63
  end
49
64
 
50
65
  def route_pathnames
51
- Dir.glob(template_files).map do |file_name|
52
- Pathname.new(file_name)
66
+ Dir.glob(template_files).map do |filename|
67
+ Pathname.new(filename)
53
68
  end
54
69
  end
55
70
 
71
+ def folder
72
+ options[:c] ? "src/components/#{name_folder}" : "src/app/#{name_folder}"
73
+ end
74
+
56
75
  def destination_file(pathname)
57
- "#{folder}/#{pathname.basename('.erb').to_s.gsub('app', name)}"
76
+ "#{folder}/#{pathname.basename('.erb').to_s.gsub('app', name.split(':').last)}"
58
77
  end
59
78
 
60
- def open_struct
61
- @_open_struct ||= OpenStruct.new(name: name)
79
+ def camelcase_name
80
+ name.split(':').last.camelcase(:lower)
62
81
  end
63
82
 
64
- def lib_directory
65
- __dir__.chomp('/tasks/generate')
83
+ def open_struct
84
+ @_open_struct ||= OpenStruct.new(name: camelcase_name)
66
85
  end
67
86
 
68
87
  def app_module_file
@@ -70,12 +89,36 @@ module Rugular
70
89
  end
71
90
 
72
91
  def module_declaration
73
- " '#{name}'\n"
92
+ " '#{camelcase_name}'\n"
74
93
  end
75
94
 
76
- def module_declaration_present?
77
- File.read(app_module_file).include? module_declaration
95
+ def module_declaration_present?(module_file)
96
+ File.read(module_file).include? module_declaration
78
97
  end
79
98
 
99
+ def sass_declaration_present?(folder)
100
+ File.read("src/application.sass").include? "@import #{folder}"
101
+ end
102
+
103
+ def nested?
104
+ name.split(':').length > 1
105
+ end
106
+
107
+ def name_folder
108
+ name.split(':').join('/')
109
+ end
110
+
111
+ def nested_module_name
112
+ name.split(':')[-2]
113
+ end
114
+
115
+ def nested_module_file
116
+ "src/#{app_or_component}/#{name.split(':')[0..-2].join('/')}/"\
117
+ "#{nested_module_name}.module.coffee"
118
+ end
119
+
120
+ def app_or_component
121
+ options[:c] ? 'components' : 'app'
122
+ end
80
123
  end
81
124
  end
@@ -29,13 +29,15 @@ module Rugular
29
29
  end
30
30
 
31
31
  def create_component_directory
32
- empty_directory "#{app_name}/components"
32
+ empty_directory "#{app_name}/src/components"
33
33
  end
34
34
 
35
35
  def installation_complete
36
36
  puts "Thank you for installing Rugular, please finish setting up your "\
37
37
  "project with: `cd #{app_open_struct.name} && bundle install && "\
38
- "rugular dependencies`"
38
+ "rugular dependencies`\n"\
39
+ "Please install bourbon and neat by bundle exec bourbon install "\
40
+ "--path src/ and neat with bundle exec neat install --path src/"
39
41
  end
40
42
 
41
43
  private
@@ -1,22 +1,6 @@
1
- # Only watch the src folder
1
+ require "#{__dir__}/guards/rugular.rb"
2
2
  directories %w(src)
3
3
 
4
- # Create .tmp folder for localhost server and karma
5
- ['haml', 'sass'].each do |language|
6
- guard language, input: 'src', output: '.tmp', run_at_start: true do
7
- watch %r{^src/.+\.#{language}}
8
- end
9
- end
10
-
11
-
12
- input_dir = 'src'
13
-
14
- coffeescript_options = {
15
- input: input_dir,
16
- output: '.tmp',
17
- patterns: [%r{^#{input_dir}/(.+\.(?:coffee|coffee\.md|litcoffee))$}]
18
- }
19
-
20
- guard 'coffeescript', coffeescript_options do
21
- coffeescript_options[:patterns].each { |pattern| watch(pattern) }
4
+ guard :rugular do
5
+ watch /^.+.[^sass]/
22
6
  end
@@ -1,5 +1,6 @@
1
- web: ruby -run -e httpd .tmp --port 8080 &> /dev/null
1
+ web: ruby -run -e httpd dist --port 8080 &> /dev/null
2
2
  guard: bundle exec guard --guardfile=$(bundle show rugular)/lib/rugular/tasks/server/Guardfile
3
- karma: ./node_modules/karma/bin/karma start karma.conf
3
+ sass: sass --watch src/application.css:dist/application.css
4
4
  selenium: webdriver-manager start &> /dev/null
5
+ karma: ./node_modules/karma/bin/karma start karma.conf
5
6
 
@@ -0,0 +1,17 @@
1
+ require 'guard'
2
+ require 'guard/plugin'
3
+
4
+ module Guard
5
+ class RugularCoffeeScript < Plugin
6
+ def start; true end
7
+ def stop; true end
8
+ def reload; true end
9
+ def run_all
10
+ CoffeeScript.compile
11
+
12
+ end
13
+
14
+ def run_on_change
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,140 @@
1
+ require 'guard/compat/plugin'
2
+ require 'haml'
3
+ require 'coffee_script'
4
+ require 'uglifier'
5
+
6
+ module Guard
7
+ class Rugular < Plugin
8
+
9
+ def initialize(opts = {})
10
+ super(opts)
11
+ end
12
+
13
+ def start; true end
14
+ def stop; true end
15
+ def reload; true end
16
+
17
+ def run_all
18
+ run_on_changes('src/app/app.coffee')
19
+ end
20
+
21
+ def run_on_changes(paths)
22
+ paths.each do |file|
23
+ ::Guard::UI.info "Guard received save event for #{file}"
24
+
25
+ case file.split('.').last
26
+ when 'haml' then message = compile_haml(file)
27
+ when 'coffee' then message = compile_coffee(file)
28
+ when 'yaml' then message = compile_yaml
29
+ end
30
+
31
+ ::Guard::UI.info message
32
+ end
33
+ end
34
+
35
+ def run_on_removals(paths)
36
+ run_on_changes(paths)
37
+ end
38
+
39
+ private
40
+
41
+ def compile_haml(file)
42
+ html = ::Haml::Engine.new(File.read(file)).render
43
+
44
+ if file == 'src/index.html'
45
+ File.open('dist/index.html', 'w') do |file|
46
+ file.write = html
47
+ end
48
+ else
49
+ compile_coffee('src/app/app.module.coffee')
50
+ end
51
+
52
+ message = "Successfully compiled #{file} to html!\n"
53
+ rescue StandardError => error
54
+ handle_error_in_guard(error)
55
+ end
56
+
57
+ def compile_coffee(file)
58
+ CoffeeScript.compile(file)
59
+
60
+ File.open('dist/application.js', 'w') do |file|
61
+ file.write(
62
+ Uglifier.compile(
63
+ CoffeeScript.compile(
64
+ javascript_files.map { |e| File.read(e) }.join,
65
+ ).gsub('templateUrl', 'template'),
66
+ comments: false
67
+ )
68
+ )
69
+ end
70
+
71
+ # Inline templates into javascript
72
+ (Dir.glob("**/*.haml") - ["src/index.haml"]).each do |haml_file|
73
+ html = ::Haml::Engine.new(File.read(haml_file), {}).render
74
+ haml_file.gsub!('src/', '').gsub!('haml', 'html')
75
+ IO.write('dist/application.js', File.open('dist/application.js') do |f|
76
+ f.read.gsub(haml_file, html)
77
+ end)
78
+ end
79
+
80
+ message = "Successfully compiled #{file} to js!\n"
81
+ rescue StandardError => error
82
+ handle_error_in_guard(error)
83
+ end
84
+
85
+ def compile_yaml
86
+ File.open("dist/bower_components.css", 'w') do |file|
87
+ file.write bower_css
88
+ end
89
+ File.open("dist/bower_components.js", 'w') do |file|
90
+ file.write Uglifier.compile(bower_javascript)
91
+ end
92
+
93
+ message = 'Successfully created bower_component dist files'
94
+ rescue StandardError => error
95
+ handle_error_in_guard(error)
96
+ end
97
+
98
+ def bower_css
99
+ bower_yaml.fetch('css').map do |filename|
100
+ File.read('bower_components/' + filename)
101
+ end.join
102
+ end
103
+
104
+ def bower_javascript
105
+ bower_yaml.fetch('js').map do |filename|
106
+ File.read('bower_components/' + filename)
107
+ end.join
108
+ end
109
+
110
+ def bower_yaml
111
+ YAML.load(File.read('src/bower_components.yaml'))
112
+ end
113
+
114
+ def handle_error_in_guard(error)
115
+ message = "#{error.message}"
116
+ ::Guard::UI.error message
117
+ throw :task_has_failed
118
+ end
119
+
120
+ def javascript_files
121
+ Dir.glob("**/*.module.coffee").sort(&reverse_nested) +
122
+ Dir.glob("**/*.routes.coffee").sort(&reverse_nested) +
123
+ Dir.glob("**/*.factory.coffee").sort(&reverse_nested) +
124
+ Dir.glob("**/*.controller.coffee").sort(&reverse_nested) +
125
+ Dir.glob("**/*.directive.coffee").sort(&reverse_nested)
126
+ end
127
+
128
+ def reverse_nested
129
+ lambda do |x, y|
130
+ x.scan('/').length <=> y.scan('/').length
131
+ end
132
+ end
133
+
134
+ def sass_engine
135
+ @_sass_engine ||= Sass::Engine
136
+ end
137
+
138
+ end
139
+ end
140
+
@@ -0,0 +1,21 @@
1
+ require 'guard'
2
+ require 'guard/plugin'
3
+
4
+ module Guard
5
+ class RugularSass < Plugin
6
+ def initialize(opts = {})
7
+ end
8
+
9
+ def start; true end
10
+ def stop; true end
11
+ def reload; true end
12
+ def run_all
13
+
14
+ end
15
+
16
+ def run_on_change
17
+
18
+ end
19
+ end
20
+ end
21
+
@@ -1,7 +1,6 @@
1
1
  .sass-cache
2
2
  .tmp
3
+ dist
3
4
 
4
5
  bower_components
5
6
  node_modules
6
- dist
7
- src/**/*.js
@@ -1,5 +1,3 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
3
  gem 'rugular'
4
- gem 'guard-coffeescript', github: 'guard/guard-coffeescript', branch: 'master'
5
- gem 'guard-haml', github: 'shicholas/guard-haml'
@@ -6,6 +6,22 @@ module.exports = function (config) {
6
6
 
7
7
  frameworks: ['mocha', 'chai', 'sinon', 'chai-sinon'],
8
8
 
9
+ preprocessors: {
10
+ '**/*.coffee': ['coffee']
11
+ },
12
+
13
+ coffeePreprocessor: {
14
+ // options passed to the coffee compiler
15
+ options: {
16
+ bare: true,
17
+ sourceMap: false
18
+ },
19
+ // transforming the filenames
20
+ transformPath: function(path) {
21
+ return path.replace(/\.coffee$/, '.js');
22
+ }
23
+ },
24
+
9
25
  // list of files / patterns to load in the browser
10
26
  files: [
11
27
  './test/*.js',
@@ -13,13 +29,13 @@ module.exports = function (config) {
13
29
  './bower_components/angular/angular.js',
14
30
  './bower_components/angular-ui-router/release/angular-ui-router.js',
15
31
  './bower_components/angular-mocks/angular-mocks.js',
16
- './bower_components/angular-bootstrap/ui-bootstrap-tpls.min.js',
17
32
 
18
- '.tmp/**/*.module.js',
19
- '.tmp/**/*.routes.js',
20
- '.tmp/**/*.controller.js',
21
- '.tmp/**/*.directive.js',
22
- '.tmp/**/*.spec.js'
33
+ 'src/**/*.module.coffee',
34
+ 'src/**/*.routes.coffee',
35
+ 'src/**/*.factory.coffee',
36
+ 'src/**/*.controller.coffee',
37
+ 'src/**/*.directive.coffee',
38
+ 'src/**/*.spec.coffee'
23
39
  ],
24
40
 
25
41
  // web server port
@@ -33,15 +49,12 @@ module.exports = function (config) {
33
49
  // config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
34
50
  logLevel: config.LOG_INFO,
35
51
 
36
- // enable / disable watching file and executing tests whenever any file changes
52
+ // watch file and execute tests whenever any file changes
37
53
  autoWatch: true,
38
54
 
39
- // start these browsers
40
- // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
41
- // browsers: ['Chrome', 'ChromeCanary', 'FirefoxAurora', 'Safari', 'PhantomJS'],
55
+ // other available browsers: ['Chrome', 'Firefox', 'Safari', 'PhantomJS'],
42
56
  browsers: ['PhantomJS'],
43
57
 
44
- // Continuous Integration mode
45
58
  // if true, Karma captures browsers, runs the tests and exits
46
59
  singleRun: false
47
60
  });
@@ -0,0 +1,4 @@
1
+ // This is the only file that will be compiled by rugular. Please ensure that
2
+ // all of the top level sass files in both the app and components folder are
3
+ // imported into this one
4
+ @import 'app/app'
@@ -0,0 +1,6 @@
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'
6
+
@@ -1,33 +1,18 @@
1
1
  !!!
2
- %html{"ng-app" => "app"}
2
+ %html{'ng-app' => 'app'}
3
3
  %head
4
4
  %title Hello
5
5
 
6
- -# <!--[if lte IE 8]>
7
- -# <script type="text/javascript">
8
- -# // define our custom directives here
9
- -# window.myCustomTags = ['myDirective'];
10
- -# </script>
11
- -# <script src="lib/angular-ui-ieshiv.js"></script>
12
- -# <![endif]-->
6
+ -# add a list of bower css and javascript files you wish to include in the
7
+ -# bower_components.yml file
13
8
 
14
- /it is recommended to cherry pick which bower components you want
15
- = stylesheet_link_tag("./bower_components/bootstrap/dist/css/bootstrap.min.css")
16
- = stylesheet_link_tag("./bower_components/font-awesome/css/font-awesome.min.css")
17
- = stylesheet_link_tag(*Dir.glob(".tmp/app/**/*.css"))
18
- = stylesheet_link_tag(*Dir.glob(".tmp/components/**/*.css"))
9
+ %link(href='bower_components.css', media='screen', rel='stylesheet')
10
+ %link(href='application.css', media='screen', rel='stylesheet')
19
11
 
20
12
  %body
21
- /[f lt IE 9] <a href='lthttp://browsehappy.com/'> You are using an out of date browser; this is very dangerous. I strongly urge you to update today.</a>
13
+ /[f lt IE 9] <a href='http://browsehappy.com/'> You are using an out of date browser; this is very dangerous. I strongly urge you to update today.</a>
22
14
 
23
15
  %ui-view
24
16
 
25
- /it is recommended to cherry pick which bower components you want
26
- = javascript_include_tag("./bower_components/angular/angular.js")
27
- = javascript_include_tag("./bower_components/angular-ui-router/release/angular-ui-router.js")
28
-
29
- = javascript_include_tag(*Dir.glob(".tmp/**/*.module.js"))
30
- = javascript_include_tag(*Dir.glob(".tmp/**/*.routes.js"))
31
- = javascript_include_tag(*Dir.glob(".tmp/**/*.factory.js"))
32
- = javascript_include_tag(*Dir.glob(".tmp/**/*.controller.js"))
33
- = javascript_include_tag(*Dir.glob(".tmp/**/*.directive.js"))
17
+ %script(src='bower_components.js')
18
+ %script(src='application.js')
@@ -19,11 +19,12 @@
19
19
  "dependencies": {
20
20
  "angular": "~1.2",
21
21
  "angular-sanitize": "~1.2",
22
- "bootstrap": "~3.2.0",
23
- "font-awesome": "~4.2.0",
24
- "moment": "~2.6.0",
25
- "angular-ui-router": "~0.2.12",
26
- "toastr": "~2.1.0",
27
- "angular-animate": "~1.2"
22
+ "angular-animate": "~1.2",
23
+ "font-awesome": "*",
24
+ "moment": "*",
25
+ "angular-ui-router": "*",
26
+ "toastr": "*",
27
+ "bourbon": "*",
28
+ "neat": "*"
28
29
  }
29
30
  }
@@ -12,6 +12,7 @@
12
12
  "karma": "*",
13
13
  "karma-chai": "*",
14
14
  "karma-chai-sinon": "*",
15
+ "karma-coffee-preprocessor": "*",
15
16
  "karma-chrome-launcher": "*",
16
17
  "karma-coverage": "*",
17
18
  "karma-firefox-launcher": "*",
@@ -1,6 +1,4 @@
1
- <%= name %>Routing = ($stateProvider, $urlRouterProvider) ->
2
- $urlRouterProvider.otherwise('/')
3
-
1
+ <%= name %>Routing = ($stateProvider) ->
4
2
  $stateProvider.state '<%= name %>',
5
3
  url: '/<%= name %>'
6
4
  templateUrl: '/app/<%= name %>/<%= name %>.html'
@@ -9,7 +7,7 @@
9
7
 
10
8
  return
11
9
 
12
- <%= name %>Routing.$inject = ['$stateProvider', '$urlRouterProvider']
10
+ <%= name %>Routing.$inject = ['$stateProvider']
13
11
 
14
12
  angular.module('<%= name %>').config(<%= name %>Routing)
15
13
 
@@ -1,3 +1,3 @@
1
1
  module Rugular
2
- VERSION = '0.1.5'
2
+ VERSION = '0.2.0'
3
3
  end
data/rugular.gemspec CHANGED
@@ -17,16 +17,17 @@ Gem::Specification.new do |spec|
17
17
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
18
18
  spec.require_paths = ['lib']
19
19
 
20
- spec.add_runtime_dependency 'actionview', '~> 4'
21
- spec.add_runtime_dependency 'guard', '~> 2'
22
- # spec.add_runtime_dependency 'guard-coffeescript', '~> 2'
23
- spec.add_runtime_dependency 'haml', '~> 4'
24
- spec.add_runtime_dependency 'sass', '~> 3'
25
- spec.add_runtime_dependency 'guard-sass', '~> 1'
26
- spec.add_runtime_dependency 'foreman', '~> 0'
27
- spec.add_runtime_dependency 'therubyracer', '~> 0'
28
- spec.add_runtime_dependency 'thor', '~> 0'
29
- spec.add_runtime_dependency 'uglifier', '~> 2'
20
+ spec.add_runtime_dependency 'actionview', '~> 4'
21
+ spec.add_runtime_dependency 'guard', '~> 2'
22
+ spec.add_runtime_dependency 'guard-compat', '~> 1'
23
+ spec.add_runtime_dependency 'coffee-script', '~> 2'
24
+ spec.add_runtime_dependency 'haml', '~> 4'
25
+ spec.add_runtime_dependency 'sass', '~> 3'
26
+ spec.add_runtime_dependency 'uglifier', '~> 2'
27
+ spec.add_runtime_dependency 'foreman', '~> 0'
28
+ spec.add_runtime_dependency 'thor', '~> 0'
29
+ spec.add_runtime_dependency 'bourbon', '~> 4'
30
+ spec.add_runtime_dependency 'neat', '~> 1'
30
31
 
31
32
  spec.add_development_dependency 'aruba', '~> 0'
32
33
  spec.add_development_dependency 'byebug', '~> 3'
metadata CHANGED
@@ -1,195 +1,223 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rugular
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nicholas Shook
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-18 00:00:00.000000000 Z
11
+ date: 2015-01-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionview
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '4'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '4'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: guard
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
33
  version: '2'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ~>
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '2'
41
+ - !ruby/object:Gem::Dependency
42
+ name: guard-compat
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '1'
55
+ - !ruby/object:Gem::Dependency
56
+ name: coffee-script
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '2'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
39
67
  - !ruby/object:Gem::Version
40
68
  version: '2'
41
69
  - !ruby/object:Gem::Dependency
42
70
  name: haml
43
71
  requirement: !ruby/object:Gem::Requirement
44
72
  requirements:
45
- - - ~>
73
+ - - "~>"
46
74
  - !ruby/object:Gem::Version
47
75
  version: '4'
48
76
  type: :runtime
49
77
  prerelease: false
50
78
  version_requirements: !ruby/object:Gem::Requirement
51
79
  requirements:
52
- - - ~>
80
+ - - "~>"
53
81
  - !ruby/object:Gem::Version
54
82
  version: '4'
55
83
  - !ruby/object:Gem::Dependency
56
84
  name: sass
57
85
  requirement: !ruby/object:Gem::Requirement
58
86
  requirements:
59
- - - ~>
87
+ - - "~>"
60
88
  - !ruby/object:Gem::Version
61
89
  version: '3'
62
90
  type: :runtime
63
91
  prerelease: false
64
92
  version_requirements: !ruby/object:Gem::Requirement
65
93
  requirements:
66
- - - ~>
94
+ - - "~>"
67
95
  - !ruby/object:Gem::Version
68
96
  version: '3'
69
97
  - !ruby/object:Gem::Dependency
70
- name: guard-sass
98
+ name: uglifier
71
99
  requirement: !ruby/object:Gem::Requirement
72
100
  requirements:
73
- - - ~>
101
+ - - "~>"
74
102
  - !ruby/object:Gem::Version
75
- version: '1'
103
+ version: '2'
76
104
  type: :runtime
77
105
  prerelease: false
78
106
  version_requirements: !ruby/object:Gem::Requirement
79
107
  requirements:
80
- - - ~>
108
+ - - "~>"
81
109
  - !ruby/object:Gem::Version
82
- version: '1'
110
+ version: '2'
83
111
  - !ruby/object:Gem::Dependency
84
112
  name: foreman
85
113
  requirement: !ruby/object:Gem::Requirement
86
114
  requirements:
87
- - - ~>
115
+ - - "~>"
88
116
  - !ruby/object:Gem::Version
89
117
  version: '0'
90
118
  type: :runtime
91
119
  prerelease: false
92
120
  version_requirements: !ruby/object:Gem::Requirement
93
121
  requirements:
94
- - - ~>
122
+ - - "~>"
95
123
  - !ruby/object:Gem::Version
96
124
  version: '0'
97
125
  - !ruby/object:Gem::Dependency
98
- name: therubyracer
126
+ name: thor
99
127
  requirement: !ruby/object:Gem::Requirement
100
128
  requirements:
101
- - - ~>
129
+ - - "~>"
102
130
  - !ruby/object:Gem::Version
103
131
  version: '0'
104
132
  type: :runtime
105
133
  prerelease: false
106
134
  version_requirements: !ruby/object:Gem::Requirement
107
135
  requirements:
108
- - - ~>
136
+ - - "~>"
109
137
  - !ruby/object:Gem::Version
110
138
  version: '0'
111
139
  - !ruby/object:Gem::Dependency
112
- name: thor
140
+ name: bourbon
113
141
  requirement: !ruby/object:Gem::Requirement
114
142
  requirements:
115
- - - ~>
143
+ - - "~>"
116
144
  - !ruby/object:Gem::Version
117
- version: '0'
145
+ version: '4'
118
146
  type: :runtime
119
147
  prerelease: false
120
148
  version_requirements: !ruby/object:Gem::Requirement
121
149
  requirements:
122
- - - ~>
150
+ - - "~>"
123
151
  - !ruby/object:Gem::Version
124
- version: '0'
152
+ version: '4'
125
153
  - !ruby/object:Gem::Dependency
126
- name: uglifier
154
+ name: neat
127
155
  requirement: !ruby/object:Gem::Requirement
128
156
  requirements:
129
- - - ~>
157
+ - - "~>"
130
158
  - !ruby/object:Gem::Version
131
- version: '2'
159
+ version: '1'
132
160
  type: :runtime
133
161
  prerelease: false
134
162
  version_requirements: !ruby/object:Gem::Requirement
135
163
  requirements:
136
- - - ~>
164
+ - - "~>"
137
165
  - !ruby/object:Gem::Version
138
- version: '2'
166
+ version: '1'
139
167
  - !ruby/object:Gem::Dependency
140
168
  name: aruba
141
169
  requirement: !ruby/object:Gem::Requirement
142
170
  requirements:
143
- - - ~>
171
+ - - "~>"
144
172
  - !ruby/object:Gem::Version
145
173
  version: '0'
146
174
  type: :development
147
175
  prerelease: false
148
176
  version_requirements: !ruby/object:Gem::Requirement
149
177
  requirements:
150
- - - ~>
178
+ - - "~>"
151
179
  - !ruby/object:Gem::Version
152
180
  version: '0'
153
181
  - !ruby/object:Gem::Dependency
154
182
  name: byebug
155
183
  requirement: !ruby/object:Gem::Requirement
156
184
  requirements:
157
- - - ~>
185
+ - - "~>"
158
186
  - !ruby/object:Gem::Version
159
187
  version: '3'
160
188
  type: :development
161
189
  prerelease: false
162
190
  version_requirements: !ruby/object:Gem::Requirement
163
191
  requirements:
164
- - - ~>
192
+ - - "~>"
165
193
  - !ruby/object:Gem::Version
166
194
  version: '3'
167
195
  - !ruby/object:Gem::Dependency
168
196
  name: pry
169
197
  requirement: !ruby/object:Gem::Requirement
170
198
  requirements:
171
- - - ~>
199
+ - - "~>"
172
200
  - !ruby/object:Gem::Version
173
201
  version: '0'
174
202
  type: :development
175
203
  prerelease: false
176
204
  version_requirements: !ruby/object:Gem::Requirement
177
205
  requirements:
178
- - - ~>
206
+ - - "~>"
179
207
  - !ruby/object:Gem::Version
180
208
  version: '0'
181
209
  - !ruby/object:Gem::Dependency
182
210
  name: rake
183
211
  requirement: !ruby/object:Gem::Requirement
184
212
  requirements:
185
- - - ~>
213
+ - - "~>"
186
214
  - !ruby/object:Gem::Version
187
215
  version: '10'
188
216
  type: :development
189
217
  prerelease: false
190
218
  version_requirements: !ruby/object:Gem::Requirement
191
219
  requirements:
192
- - - ~>
220
+ - - "~>"
193
221
  - !ruby/object:Gem::Version
194
222
  version: '10'
195
223
  description:
@@ -200,12 +228,13 @@ executables:
200
228
  extensions: []
201
229
  extra_rdoc_files: []
202
230
  files:
203
- - .gitignore
204
- - .travis.yml
231
+ - ".gitignore"
232
+ - ".ruby-version"
205
233
  - Gemfile
206
234
  - README.md
207
235
  - Rakefile
208
236
  - bin/rugular
237
+ - circle.yml
209
238
  - features/continuous_integration.feature
210
239
  - features/generator_for_directive.feature
211
240
  - features/generator_for_route.feature
@@ -226,11 +255,14 @@ files:
226
255
  - lib/rugular/tasks/server.rb
227
256
  - lib/rugular/tasks/server/Guardfile
228
257
  - lib/rugular/tasks/server/Procfile
258
+ - lib/rugular/tasks/server/guards/coffee.rb
259
+ - lib/rugular/tasks/server/guards/rugular.rb
260
+ - lib/rugular/tasks/server/guards/sass.rb
261
+ - lib/rugular/templates/directive/_app.sass.erb
229
262
  - lib/rugular/templates/directive/app.directive.coffee.erb
230
263
  - lib/rugular/templates/directive/app.directive.spec.coffee.erb
231
264
  - lib/rugular/templates/directive/app.haml.erb
232
265
  - lib/rugular/templates/directive/app.module.coffee.erb
233
- - lib/rugular/templates/directive/app.sass.erb
234
266
  - lib/rugular/templates/new/.gitignore
235
267
  - lib/rugular/templates/new/Gemfile
236
268
  - lib/rugular/templates/new/e2e/app_spec.coffee
@@ -242,17 +274,19 @@ files:
242
274
  - lib/rugular/templates/new/src/app/app.module.coffee
243
275
  - lib/rugular/templates/new/src/app/app.routes.coffee
244
276
  - lib/rugular/templates/new/src/app/app.sass
277
+ - lib/rugular/templates/new/src/application.sass
278
+ - lib/rugular/templates/new/src/bower_components.yaml
245
279
  - lib/rugular/templates/new/src/favicon.ico
246
280
  - lib/rugular/templates/new/src/index.haml
247
281
  - lib/rugular/templates/new/test/spec_helper.js
248
282
  - lib/rugular/templates/new_erb/bower.json.erb
249
283
  - lib/rugular/templates/new_erb/package.json.erb
284
+ - lib/rugular/templates/route/_app.sass.erb
250
285
  - lib/rugular/templates/route/app.controller.coffee.erb
251
286
  - lib/rugular/templates/route/app.controller.spec.coffee.erb
252
287
  - lib/rugular/templates/route/app.haml.erb
253
288
  - lib/rugular/templates/route/app.module.coffee.erb
254
289
  - lib/rugular/templates/route/app.routes.coffee.erb
255
- - lib/rugular/templates/route/app.sass.erb
256
290
  - lib/rugular/version.rb
257
291
  - rugular.gemspec
258
292
  homepage: http://rugular.info
@@ -265,17 +299,17 @@ require_paths:
265
299
  - lib
266
300
  required_ruby_version: !ruby/object:Gem::Requirement
267
301
  requirements:
268
- - - '>='
302
+ - - ">="
269
303
  - !ruby/object:Gem::Version
270
304
  version: '0'
271
305
  required_rubygems_version: !ruby/object:Gem::Requirement
272
306
  requirements:
273
- - - '>='
307
+ - - ">="
274
308
  - !ruby/object:Gem::Version
275
309
  version: '0'
276
310
  requirements: []
277
311
  rubyforge_project:
278
- rubygems_version: 2.0.14
312
+ rubygems_version: 2.4.5
279
313
  signing_key:
280
314
  specification_version: 4
281
315
  summary: Rugular - a ruby scaffolding framework for AngularJS
data/.travis.yml DELETED
@@ -1,4 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - '2.1.5'
4
-