rugular 0.0.95

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 (53) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +17 -0
  3. data/.travis.yml +4 -0
  4. data/Gemfile +5 -0
  5. data/README.md +149 -0
  6. data/Rakefile +11 -0
  7. data/bin/rugular +8 -0
  8. data/features/generator_for_directive.feature +35 -0
  9. data/features/generator_for_route.feature +40 -0
  10. data/features/new.feature +29 -0
  11. data/features/step_definitions/rugular_steps.rb +3 -0
  12. data/features/support/setup.rb +2 -0
  13. data/lib/rugular/tasks/build.rb +27 -0
  14. data/lib/rugular/tasks/dependencies.rb +28 -0
  15. data/lib/rugular/tasks/generate/directive.rb +11 -0
  16. data/lib/rugular/tasks/generate/generator_base.rb +81 -0
  17. data/lib/rugular/tasks/generate/route.rb +11 -0
  18. data/lib/rugular/tasks/generate.rb +44 -0
  19. data/lib/rugular/tasks/helpers/app_checker.rb +41 -0
  20. data/lib/rugular/tasks/new.rb +52 -0
  21. data/lib/rugular/tasks/server/Guardfile +22 -0
  22. data/lib/rugular/tasks/server/Procfile +5 -0
  23. data/lib/rugular/tasks/server.rb +28 -0
  24. data/lib/rugular/templates/directive/app.directive.coffee.erb +23 -0
  25. data/lib/rugular/templates/directive/app.directive.spec.coffee.erb +16 -0
  26. data/lib/rugular/templates/directive/app.haml.erb +1 -0
  27. data/lib/rugular/templates/directive/app.module.coffee.erb +2 -0
  28. data/lib/rugular/templates/directive/app.sass.erb +2 -0
  29. data/lib/rugular/templates/new/.gitignore +7 -0
  30. data/lib/rugular/templates/new/Gemfile +5 -0
  31. data/lib/rugular/templates/new/karma.conf.js +48 -0
  32. data/lib/rugular/templates/new/protractor.conf.js +32 -0
  33. data/lib/rugular/templates/new/src/app/app.controller.coffee +6 -0
  34. data/lib/rugular/templates/new/src/app/app.controller.spec.coffee +19 -0
  35. data/lib/rugular/templates/new/src/app/app.haml +1 -0
  36. data/lib/rugular/templates/new/src/app/app.module.coffee +4 -0
  37. data/lib/rugular/templates/new/src/app/app.routes.coffee +15 -0
  38. data/lib/rugular/templates/new/src/app/app.sass +2 -0
  39. data/lib/rugular/templates/new/src/favicon.ico +0 -0
  40. data/lib/rugular/templates/new/src/index.haml +21 -0
  41. data/lib/rugular/templates/new/test/spec_helper.js +168 -0
  42. data/lib/rugular/templates/new_erb/bower.json.erb +29 -0
  43. data/lib/rugular/templates/new_erb/package.json.erb +30 -0
  44. data/lib/rugular/templates/route/app.controller.coffee.erb +8 -0
  45. data/lib/rugular/templates/route/app.controller.spec.coffee.erb +19 -0
  46. data/lib/rugular/templates/route/app.haml.erb +1 -0
  47. data/lib/rugular/templates/route/app.module.coffee.erb +4 -0
  48. data/lib/rugular/templates/route/app.routes.coffee.erb +15 -0
  49. data/lib/rugular/templates/route/app.sass.erb +2 -0
  50. data/lib/rugular/version.rb +3 -0
  51. data/lib/rugular.rb +36 -0
  52. data/rugular.gemspec +33 -0
  53. metadata +255 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 5146630b5d70b0d26d71eb5bb4d4eff347405f98
4
+ data.tar.gz: 747b7d81fcdfaa2c70a9a64a32860b692eac5b40
5
+ SHA512:
6
+ metadata.gz: 044165ce25868e12bc7457233718287d08722e5685a92c9eda1476dfff299738b064fb7fb65359da33caa0bba331ecbb80726eb468859e01bc4c8b73676040db
7
+ data.tar.gz: 090bf7d3aa4e36468082421d00846f4bdaff2f9cea94b6fdd6867299b4fa37b1e0d13cd62112514892fd3fe34b8553daa41aa42b76d8d45f59c0c87c7a4ae3cb
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.bundle
11
+ *.so
12
+ *.o
13
+ *.a
14
+ mkmf.log
15
+ *.gem
16
+ .sass-cache/
17
+ tags
data/.travis.yml ADDED
@@ -0,0 +1,4 @@
1
+ language: ruby
2
+ rvm:
3
+ - '2.1.5'
4
+
data/Gemfile ADDED
@@ -0,0 +1,5 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in rugular.gemspec
4
+ gemspec
5
+ gem 'guard-coffeescript', github: 'guard/guard-coffeescript', branch: 'master'
data/README.md ADDED
@@ -0,0 +1,149 @@
1
+ [![Build Status](https://travis-ci.org/currica/rugular.svg)](https://travis-ci.org/currica/rugular)
2
+
3
+ # Rugular
4
+
5
+ Rugular is a ruby scaffolding framework to build AngularJS apps. It builds a
6
+ minified and compressed version of a front-end into the ``./dist`` folder that
7
+ can be served as a standalone AngularJS app. The goal of this framework is to
8
+ create applications written with [best AngularJS
9
+ practices](https://github.com/johnpapa/angularjs-styleguide); CoffeeScript
10
+ optional.
11
+
12
+ ## Installation
13
+
14
+ Add this line to your application's Gemfile:
15
+
16
+ ```ruby
17
+ gem 'rugular'
18
+ ```
19
+
20
+ And then execute:
21
+
22
+ $ bundle
23
+
24
+ Or install it yourself as:
25
+
26
+ $ gem install rugular
27
+
28
+ ## Start a new project
29
+
30
+ ```bash
31
+ rugular new <project_name>
32
+ ```
33
+
34
+ This will create the initial project template that follows [Google's Best
35
+ Practices for an Angular App
36
+ Structure](https://docs.google.com/document/d/1XXMvReO8-Awi1EZXAXS4PzDzdNvV6pGcuaF4Q9821Es/pub).
37
+ <pre>
38
+ ├── bower_components/
39
+ ├── bower.json
40
+ ├── Gemfile
41
+ ├── package.json
42
+ ├── src/
43
+ │ ├── app/
44
+ │ │ ├── app.module.coffee
45
+ │ │ ├── app.config.coffee
46
+ │ │ ├── app.controller.coffee
47
+ │ │ ├── app.controller.spec.coffee
48
+ │ │ ├── app.routes.coffee
49
+ │ │ ├── index.haml
50
+ │ │ ├── index.sass
51
+ │ ├── components/
52
+ │ ├── 404.html
53
+ │ ├── 500.html
54
+ │ ├── favico.ico
55
+ </pre>
56
+
57
+ ## Development Server
58
+
59
+ Rugular includes a built in server that will interpret Coffeescript/Haml/Sass
60
+ and run a server on ``localhost:8080``. To run the server, type:
61
+
62
+ ```bash
63
+ bundle exec rugular server
64
+ ```
65
+
66
+ ## Running the tests
67
+
68
+ ### Unit Tests
69
+
70
+ Unit tests are included in the development server. To run these tests just once
71
+ (perhaps for CI) run:
72
+
73
+ ```
74
+ karma start karma.conf.js --single-run
75
+ ```
76
+
77
+ ### End to End tests
78
+
79
+ End to end tests with protractor can be run with:
80
+
81
+ ```bash
82
+ protractor
83
+ ```
84
+
85
+ Please make sure you have mocha installed globally!
86
+
87
+ ### Rugular Generators
88
+
89
+ #### Create a Route
90
+
91
+ A route creates a angular route, controller, and view in the app folder.
92
+
93
+ ```bash
94
+ rugular generate route <route_name>
95
+ ```
96
+
97
+ This command will create a folder in the ``src/app`` directory that will
98
+ contain a controller and service namespaced with a new module of the route
99
+ name if one dos not already exist. It will also register the new module in the
100
+ ``app.module.js`` file.
101
+
102
+ #### Create a Directive
103
+
104
+ ```bash
105
+ rugular generate directive <directive_name>
106
+ ```
107
+
108
+ This command will create a directive and controller namespaced with a new
109
+ module of the feature name if one does not already exist. It will also register
110
+ the new module in the ``app.module.js`` file.
111
+
112
+ #### Create a Factory (TODO)
113
+
114
+ ```bash
115
+ rugular generate factory <factory_name>
116
+ ```
117
+
118
+ This command will create contain a factory namespaced with a new module of the
119
+ feature name if one does not already exist. It will also register the new
120
+ module in the ``app.module.js`` file.
121
+
122
+ ### Creating a component
123
+
124
+ A component refers to shareable, abstracted angular modules. To create a
125
+ component, simply run any generator command with the ``-c`` option and the
126
+ service will be created in the ``src/components`` folder.
127
+
128
+
129
+ ## TODO (need to build)
130
+
131
+ ### Building the app
132
+
133
+ Rugular builds a minified, compressed version of your app in the ``/dist``
134
+ folder. To build the app run:
135
+
136
+ ```
137
+ rugular build
138
+ ```
139
+
140
+ ## Contributing
141
+
142
+ 1. Fork it ( https://github.com/currica/rugular/fork )
143
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
144
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
145
+ 4. Push to the branch (`git push origin my-new-feature`)
146
+ 5. Create a new Pull Request
147
+
148
+ ## License
149
+ Copyright 2014. Q-Centrix. MIT License.
data/Rakefile ADDED
@@ -0,0 +1,11 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rubygems'
3
+
4
+ require 'cucumber'
5
+ require 'cucumber/rake/task'
6
+
7
+ task default: %i(features)
8
+
9
+ Cucumber::Rake::Task.new(:features) do |t|
10
+ t.cucumber_opts = "features --format pretty"
11
+ end
data/bin/rugular ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'thor'
4
+
5
+ require_relative '../lib/rugular'
6
+
7
+ Rugular::Rugular.start
8
+
@@ -0,0 +1,35 @@
1
+ Feature: Rugular CLI
2
+ In order to generate an application route
3
+ As a user of the rugular framework
4
+ I want to bootstrap the templates necessary to carry this out
5
+
6
+ Scenario: Generating a route
7
+ When I set up Rugular and run "rugular generate directive test"
8
+ And the file "my-app/src/app/test/test.directive.coffee" should contain:
9
+ """
10
+ angular.module('test').controller('testController', testController)
11
+ """
12
+ And the file "my-app/src/app/test/test.directive.spec.coffee" should contain:
13
+ """
14
+ describe 'testController', ->
15
+ """
16
+ And the file "my-app/src/app/test/test.haml" should contain:
17
+ """
18
+ %h1 test
19
+ """
20
+ And the file "my-app/src/app/app.module.coffee" should contain:
21
+ """
22
+ 'test'
23
+ """
24
+ And the file "my-app/src/app/test/test.module.coffee" should contain:
25
+ """
26
+ angular.module 'test', [
27
+ ]
28
+ """
29
+
30
+ Scenario: Generating a route in the components directory
31
+ When I set up Rugular and run "rugular generate directive -c test"
32
+ And the file "my-app/src/components/test/test.directive.coffee" should contain:
33
+ """
34
+ angular.module('test').controller('testController', testController)
35
+ """
@@ -0,0 +1,40 @@
1
+ Feature: Rugular CLI
2
+ In order to generate an application route
3
+ As a user of the rugular framework
4
+ I want to bootstrap the templates necessary to carry this out
5
+
6
+ Scenario: Generating a route
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:
9
+ """
10
+ angular.module('test').controller('testController', testController)
11
+ """
12
+ And the file "my-app/src/app/test/test.routes.coffee" should contain:
13
+ """
14
+ angular.module('test').config(testRouting)
15
+ """
16
+ And the file "my-app/src/app/test/test.controller.spec.coffee" should contain:
17
+ """
18
+ describe 'testController', ->
19
+ """
20
+ And the file "my-app/src/app/test/test.haml" should contain:
21
+ """
22
+ %h1 test
23
+ """
24
+ And the file "my-app/src/app/app.module.coffee" should contain:
25
+ """
26
+ 'test'
27
+ """
28
+ And the file "my-app/src/app/test/test.module.coffee" should contain:
29
+ """
30
+ angular.module 'test', [
31
+ 'ui.router'
32
+ ]
33
+ """
34
+
35
+ Scenario: Generating a route in the components directory
36
+ 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:
38
+ """
39
+ angular.module('test').controller('testController', testController)
40
+ """
@@ -0,0 +1,29 @@
1
+ Feature: Rugular CLI
2
+ In order to generate initial files
3
+ As a user of the rugular framework
4
+ I want bootstrap the files necessary to start hacking!
5
+
6
+ Scenario: New
7
+ When I run `rugular new my-app`
8
+ Then the exit status should be 0
9
+ Then the file "my-app/.gitignore" should contain:
10
+ """
11
+ bower_components
12
+ """
13
+ And the file "my-app/bower.json" should contain:
14
+ """
15
+ "name": "my-app",
16
+ """
17
+ And the file "my-app/package.json" should contain:
18
+ """
19
+ "name": "my-app",
20
+ """
21
+ And the file "my-app/karma.conf.js" should contain:
22
+ """
23
+ frameworks: ['mocha', 'chai', 'sinon', 'chai-sinon'],
24
+ """
25
+ And the file "my-app/src/index.haml" should contain:
26
+ """
27
+ = javascript_include_tag("./bower_components/angular-ui-router/release/angular-ui-router.js")
28
+ """
29
+
@@ -0,0 +1,3 @@
1
+ When (/^I set up Rugular and run "(.*?)"$/) do |command|
2
+ system("cd tmp/aruba && rugular new my-app && cd my-app && #{command}")
3
+ end
@@ -0,0 +1,2 @@
1
+ Dir.glob("#{__dir__}/**/*.rb").each { |file| require file }
2
+ require 'aruba/cucumber'
@@ -0,0 +1,27 @@
1
+ Dir.glob("#{__dir__}/helpers/**/*.rb").each {|file| require file}
2
+
3
+ module Rugular
4
+ class Build < Thor::Group
5
+ include Thor::Actions
6
+
7
+ desc('Creates a minified, compressed version in the dist folder')
8
+
9
+ Rugular::AppChecker.check_rugular!(self.name, new.destination_root)
10
+
11
+ # TODO: build from the ./.tmp folder
12
+ def compile_coffeescript
13
+ puts CoffeeScript.compile File.read("app.coffee")
14
+ end
15
+
16
+ def uglify_css
17
+ puts Uglifier.compile(CoffeeScript.compile File.read("app.coffee"))
18
+ end
19
+
20
+ def interpret_sass
21
+ template = File.load('stylesheets/sassy.sass')
22
+ sass_engine = Sass::Engine.new(template)
23
+ output = sass_engine.render
24
+ puts output
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,28 @@
1
+ Dir.glob("#{__dir__}/helpers/**/*.rb").each {|file| require file}
2
+
3
+ module Rugular
4
+ class Dependencies < Thor::Group
5
+ include Thor::Actions
6
+
7
+ desc('Installs dependencies (bundle, bower and npm)')
8
+
9
+ Rugular::AppChecker.check_rugular!(self.name, new.destination_root)
10
+
11
+ def bundle
12
+ `bundle install`
13
+ end
14
+
15
+ def bower
16
+ `bower install`
17
+ end
18
+
19
+ def npm_install
20
+ `npm install`
21
+ end
22
+
23
+ # Protractor needs to be installed globally
24
+ def install_protractor
25
+ `npm install -g protractor coffee-script mocha`
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,11 @@
1
+ require_relative 'generator_base'
2
+
3
+ module Rugular
4
+ class Directive < GeneratorBase
5
+
6
+ def template_files
7
+ Dir.glob("#{lib_directory}/templates/directive/*.erb")
8
+ end
9
+
10
+ end
11
+ end
@@ -0,0 +1,81 @@
1
+ require 'ostruct'
2
+
3
+ module Rugular
4
+ class GeneratorBase < Thor::Group
5
+ include Thor::Actions
6
+
7
+ argument :name, desc: 'Name for your route'
8
+
9
+ # specify a component
10
+ class_option(
11
+ :c,
12
+ type: :boolean,
13
+ desc: 'create the route in the component folder'
14
+ )
15
+
16
+ def self.source_root
17
+ __dir__.chomp('/tasks/generate')
18
+ end
19
+
20
+ def create_route_folders
21
+ route_pathnames.each do |pathname|
22
+ next(
23
+ "#{destination_file(pathname)} already exists"
24
+ ) if File.exists? destination_file(pathname)
25
+
26
+ create_file destination_file(pathname) do
27
+ ERB.new(pathname.read).result(
28
+ open_struct.instance_eval { binding }
29
+ )
30
+ end
31
+ end
32
+ end
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?
40
+ end
41
+
42
+ def template_files; []; end
43
+
44
+ protected
45
+
46
+ def folder
47
+ options[:c] ? "src/components/#{name}" : "src/app/#{name}"
48
+ end
49
+
50
+ def route_pathnames
51
+ Dir.glob(template_files).map do |file_name|
52
+ Pathname.new(file_name)
53
+ end
54
+ end
55
+
56
+ def destination_file(pathname)
57
+ "#{folder}/#{pathname.basename('.erb').to_s.gsub('app', name)}"
58
+ end
59
+
60
+ def open_struct
61
+ @_open_struct ||= OpenStruct.new(name: name)
62
+ end
63
+
64
+ def lib_directory
65
+ __dir__.chomp('/tasks/generate')
66
+ end
67
+
68
+ def app_module_file
69
+ 'src/app/app.module.coffee'
70
+ end
71
+
72
+ def module_declaration
73
+ " '#{name}'\n"
74
+ end
75
+
76
+ def module_declaration_present?
77
+ File.read(app_module_file).include? module_declaration
78
+ end
79
+
80
+ end
81
+ end
@@ -0,0 +1,11 @@
1
+ require_relative 'generator_base'
2
+
3
+ module Rugular
4
+ class Route < GeneratorBase
5
+
6
+ def template_files
7
+ Dir.glob("#{lib_directory}/templates/route/*.erb")
8
+ end
9
+
10
+ end
11
+ end
@@ -0,0 +1,44 @@
1
+ Dir.glob("#{__dir__}/helpers/**/*.rb").each {|file| require file}
2
+ Dir.glob("#{__dir__}/generate/**/*.rb").each {|file| require file}
3
+
4
+ module Rugular
5
+ class Generate < Thor
6
+ include Thor::Actions
7
+
8
+ Rugular::AppChecker.check_rugular!(self.name, new.destination_root)
9
+
10
+ desc(
11
+ 'generate <angular_service> <name>',
12
+ 'generates an angular service'
13
+ )
14
+ long_desc <<-LONGDESC
15
+ The generate command creates a new angular service in either the app
16
+ folder (default) or the components folder with the `-c` option.
17
+
18
+ The angular services this command can create include:
19
+
20
+ * A route (includes a route, controller, controller_spec and view)
21
+ * A controller
22
+ * A factory
23
+ * A directive (includes a view)
24
+
25
+ The name that is passed in is the name of the angular service. The
26
+ command will also create an angular module if one does not already exist.
27
+ LONGDESC
28
+
29
+ register(
30
+ Rugular::Route,
31
+ 'route',
32
+ 'route',
33
+ 'build an angular route'
34
+ )
35
+
36
+ register(
37
+ Rugular::Directive,
38
+ 'directive',
39
+ 'directive',
40
+ 'build an angular directive'
41
+ )
42
+
43
+ end
44
+ end
@@ -0,0 +1,41 @@
1
+ module Rugular
2
+ class AppChecker
3
+ include Thor::Shell
4
+
5
+ def self.check_rugular!(task_name, root_directory)
6
+ new(task_name: task_name, root_directory: root_directory).check_rugular!
7
+ end
8
+
9
+ def initialize(task_name:, root_directory:)
10
+ @task_name = task_name
11
+ @root_directory = root_directory
12
+ end
13
+
14
+ def check_rugular!
15
+ error(rugular_app_message) unless rugular_app?
16
+ end
17
+
18
+ private
19
+
20
+ attr_reader :task_name, :root_directory
21
+
22
+ def rugular_app_message
23
+ "#{task_name} requires a pre-existing Rugular application"
24
+ end
25
+
26
+ def rugular_app?
27
+ [
28
+ 'bower.json',
29
+ 'package.json',
30
+ 'src/index.haml',
31
+ 'Gemfile',
32
+ '.tmp'
33
+ ].each do |file_name|
34
+ destination_file_name = root_directory + '/' + file_name
35
+
36
+ return false unless File.exists?(destination_file_name)
37
+ end
38
+ end
39
+
40
+ end
41
+ end
@@ -0,0 +1,52 @@
1
+ require 'ostruct'
2
+ require 'pathname'
3
+
4
+ module Rugular
5
+ class New < Thor::Group
6
+ include Thor::Actions
7
+
8
+ argument :app_name, desc: 'Name for your application'
9
+ desc('Creates an initial folder structure for developing apps')
10
+
11
+ def self.source_root
12
+ __dir__.chomp('/tasks')
13
+ end
14
+
15
+ def create_application_directory
16
+ directory "#{lib_directory}/templates/new/", app_open_struct.name
17
+ end
18
+
19
+ def create_custom_files
20
+ Dir.glob("#{lib_directory}/templates/new_erb/*.erb").each do |file_name|
21
+ pathname = Pathname.new(file_name)
22
+
23
+ create_file "#{app_name}/#{pathname.basename('.erb').to_s}" do
24
+ ERB.new(pathname.read).result(
25
+ app_open_struct.instance_eval { binding }
26
+ )
27
+ end
28
+ end
29
+ end
30
+
31
+ def create_component_directory
32
+ empty_directory "#{app_name}/components"
33
+ end
34
+
35
+ def installation_complete
36
+ puts "Thank you for installing Rugular, please finish setting up your "\
37
+ "project with: `cd #{app_open_struct.name} && bundle install && "\
38
+ "rugular dependencies`"
39
+ end
40
+
41
+ private
42
+
43
+ def app_open_struct
44
+ @_app_open_struct ||= OpenStruct.new(name: app_name)
45
+ end
46
+
47
+ def lib_directory
48
+ __dir__.chomp('/tasks')
49
+ end
50
+
51
+ end
52
+ end
@@ -0,0 +1,22 @@
1
+ # Only watch the src folder
2
+ directories %w(src)
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) }
22
+ end
@@ -0,0 +1,5 @@
1
+ web: ruby -run -e httpd .tmp --port 8080 &> /dev/null
2
+ guard: bundle exec guard --guardfile=$(bundle show rugular)/lib/rugular/tasks/server/Guardfile
3
+ karma: ./node_modules/karma/bin/karma start karma.conf
4
+ selenium: webdriver-manager start &> /dev/null
5
+
@@ -0,0 +1,28 @@
1
+ Dir.glob("#{__dir__}/helpers/**/*.rb").each {|file| require file}
2
+ require 'open3'
3
+
4
+ module Rugular
5
+ class Server < Thor::Group
6
+ include Thor::Actions
7
+
8
+ Rugular::AppChecker.check_rugular!(self.name, new.destination_root)
9
+
10
+ desc(
11
+ "runs the test suite and a dev server on localhost:8080 "\
12
+ "(set in lib/rugular/tasks/server/Procfile)"
13
+ )
14
+
15
+ def start_server
16
+ system(
17
+ "bundle exec foreman start --color --root=#{destination_root} " \
18
+ "--procfile=#{rugular_procfile}"
19
+ )
20
+ end
21
+
22
+ private
23
+
24
+ def rugular_procfile
25
+ "#{__dir__}/server/Procfile"
26
+ end
27
+ end
28
+ end