mno-enterprise-core 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (138) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +1 -0
  3. data/Rakefile +12 -0
  4. data/app/assets/images/mno_enterprise/main-logo.png +0 -0
  5. data/app/controllers/mno_enterprise/application_controller.rb +116 -0
  6. data/app/helpers/mno_enterprise/application_helper.rb +67 -0
  7. data/app/helpers/mno_enterprise/impersonate_helper.rb +27 -0
  8. data/app/models/mno_enterprise/ability.rb +6 -0
  9. data/app/models/mno_enterprise/app.rb +72 -0
  10. data/app/models/mno_enterprise/app_instance.rb +36 -0
  11. data/app/models/mno_enterprise/app_instances_sync.rb +6 -0
  12. data/app/models/mno_enterprise/arrears_situation.rb +6 -0
  13. data/app/models/mno_enterprise/audit_event.rb +21 -0
  14. data/app/models/mno_enterprise/base_resource.rb +228 -0
  15. data/app/models/mno_enterprise/credit_card.rb +40 -0
  16. data/app/models/mno_enterprise/deletion_request.rb +35 -0
  17. data/app/models/mno_enterprise/impac/dashboard.rb +36 -0
  18. data/app/models/mno_enterprise/impac/dashboard_provisioner.rb +5 -0
  19. data/app/models/mno_enterprise/impac/kpi.rb +9 -0
  20. data/app/models/mno_enterprise/impac/widget.rb +13 -0
  21. data/app/models/mno_enterprise/invoice.rb +53 -0
  22. data/app/models/mno_enterprise/org_invite.rb +50 -0
  23. data/app/models/mno_enterprise/organization.rb +33 -0
  24. data/app/models/mno_enterprise/team.rb +50 -0
  25. data/app/models/mno_enterprise/tenant.rb +5 -0
  26. data/app/models/mno_enterprise/tenant_invoice.rb +5 -0
  27. data/app/models/mno_enterprise/user.rb +183 -0
  28. data/app/pdf/mno_enterprise/invoice_pdf.rb +516 -0
  29. data/config/initializers/audit_log.rb +5 -0
  30. data/config/locales/devise.en.yml +60 -0
  31. data/config/routes.rb +2 -0
  32. data/config/styleguide.yml +106 -0
  33. data/lib/accountingjs_serializer.rb +51 -0
  34. data/lib/devise/controllers/extension_helpers.rb +52 -0
  35. data/lib/devise/extension_routes.rb +11 -0
  36. data/lib/devise/hooks/password_expirable.rb +5 -0
  37. data/lib/devise/models/password_expirable.rb +28 -0
  38. data/lib/devise/models/remote_authenticatable.rb +48 -0
  39. data/lib/devise/strategies/remote_authenticatable.rb +44 -0
  40. data/lib/devise_extension.rb +36 -0
  41. data/lib/faraday/adapter/net_http_no_proxy.rb +19 -0
  42. data/lib/generators/mno_enterprise/database_extension/USAGE +11 -0
  43. data/lib/generators/mno_enterprise/database_extension/database_extension_generator.rb +36 -0
  44. data/lib/generators/mno_enterprise/database_extension/templates/model.rb +9 -0
  45. data/lib/generators/mno_enterprise/dummy/dummy_generator.rb +98 -0
  46. data/lib/generators/mno_enterprise/dummy/templates/rails/application.rb.erb +9 -0
  47. data/lib/generators/mno_enterprise/dummy/templates/rails/boot.rb.erb +6 -0
  48. data/lib/generators/mno_enterprise/dummy/templates/rails/database.yml +22 -0
  49. data/lib/generators/mno_enterprise/dummy/templates/rails/routes.rb +8 -0
  50. data/lib/generators/mno_enterprise/dummy/templates/rails/test-env.rb +45 -0
  51. data/lib/generators/mno_enterprise/install/install_generator.rb +140 -0
  52. data/lib/generators/mno_enterprise/install/templates/Procfile +1 -0
  53. data/lib/generators/mno_enterprise/install/templates/config/initializers/mno_enterprise.rb +135 -0
  54. data/lib/generators/mno_enterprise/install/templates/config/mno_enterprise_styleguide.yml +104 -0
  55. data/lib/generators/mno_enterprise/install/templates/javascripts/mno_enterprise_extensions.js +7 -0
  56. data/lib/generators/mno_enterprise/install/templates/stylesheets/main.less_erb +25 -0
  57. data/lib/generators/mno_enterprise/install/templates/stylesheets/theme.less_erb +59 -0
  58. data/lib/generators/mno_enterprise/install/templates/stylesheets/variables.less +337 -0
  59. data/lib/generators/mno_enterprise/install/templates/tasks/sprites.rake +14 -0
  60. data/lib/generators/mno_enterprise/puma_stack/puma_stack_generator.rb +58 -0
  61. data/lib/generators/mno_enterprise/templates/scripts/monit/app-server.conf +8 -0
  62. data/lib/generators/mno_enterprise/templates/scripts/nginx/app +51 -0
  63. data/lib/generators/mno_enterprise/templates/scripts/puma.rb +25 -0
  64. data/lib/generators/mno_enterprise/templates/scripts/setup.sh +27 -0
  65. data/lib/generators/mno_enterprise/templates/scripts/upstart/app-web-hotrestart.conf +26 -0
  66. data/lib/generators/mno_enterprise/templates/scripts/upstart/app-web-server.conf +34 -0
  67. data/lib/generators/mno_enterprise/templates/scripts/upstart/app-web.conf +2 -0
  68. data/lib/generators/mno_enterprise/templates/scripts/upstart/app.conf +11 -0
  69. data/lib/her_extension/her_orm_adapter.rb +54 -0
  70. data/lib/her_extension/middleware/mnoe_api_v1_parse_json.rb +54 -0
  71. data/lib/her_extension/model/associations/association.rb +61 -0
  72. data/lib/her_extension/model/associations/association_proxy.rb +34 -0
  73. data/lib/her_extension/model/associations/has_many_association.rb +115 -0
  74. data/lib/her_extension/model/attributes.rb +43 -0
  75. data/lib/her_extension/model/orm.rb +59 -0
  76. data/lib/her_extension/model/parse.rb +40 -0
  77. data/lib/her_extension/model/relation.rb +92 -0
  78. data/lib/her_extension/validations/remote_uniqueness_validation.rb +33 -0
  79. data/lib/html_processor.rb +106 -0
  80. data/lib/mandrill_client.rb +58 -0
  81. data/lib/mno-enterprise-core.rb +1 -0
  82. data/lib/mno_enterprise/concerns.rb +4 -0
  83. data/lib/mno_enterprise/concerns/controllers.rb +6 -0
  84. data/lib/mno_enterprise/concerns/controllers/angular_csrf.rb +59 -0
  85. data/lib/mno_enterprise/concerns/controllers/auth.rb +9 -0
  86. data/lib/mno_enterprise/concerns/controllers/auth/confirmations_controller.rb +187 -0
  87. data/lib/mno_enterprise/concerns/controllers/auth/passwords_controller.rb +54 -0
  88. data/lib/mno_enterprise/concerns/controllers/auth/registrations_controller.rb +136 -0
  89. data/lib/mno_enterprise/concerns/controllers/auth/sessions_controller.rb +54 -0
  90. data/lib/mno_enterprise/concerns/controllers/auth/unlocks_controller.rb +50 -0
  91. data/lib/mno_enterprise/concerns/models.rb +6 -0
  92. data/lib/mno_enterprise/concerns/models/ability.rb +108 -0
  93. data/lib/mno_enterprise/concerns/models/app_instance.rb +100 -0
  94. data/lib/mno_enterprise/concerns/models/organization.rb +102 -0
  95. data/lib/mno_enterprise/core.rb +279 -0
  96. data/lib/mno_enterprise/database_extendable.rb +57 -0
  97. data/lib/mno_enterprise/engine.rb +33 -0
  98. data/lib/mno_enterprise/testing_support/ability_test_helper.rb +10 -0
  99. data/lib/mno_enterprise/testing_support/common_rake.rb +19 -0
  100. data/lib/mno_enterprise/testing_support/factories.rb +13 -0
  101. data/lib/mno_enterprise/testing_support/factories/app_instances.rb +30 -0
  102. data/lib/mno_enterprise/testing_support/factories/apps.rb +45 -0
  103. data/lib/mno_enterprise/testing_support/factories/arrears_situation.rb +14 -0
  104. data/lib/mno_enterprise/testing_support/factories/audit_event.rb +15 -0
  105. data/lib/mno_enterprise/testing_support/factories/credit_card.rb +33 -0
  106. data/lib/mno_enterprise/testing_support/factories/deletion_request.rb +17 -0
  107. data/lib/mno_enterprise/testing_support/factories/impac/dashboards.rb +15 -0
  108. data/lib/mno_enterprise/testing_support/factories/impac/kpis.rb +20 -0
  109. data/lib/mno_enterprise/testing_support/factories/impac/widgets.rb +15 -0
  110. data/lib/mno_enterprise/testing_support/factories/invoices.rb +51 -0
  111. data/lib/mno_enterprise/testing_support/factories/org_invite.rb +24 -0
  112. data/lib/mno_enterprise/testing_support/factories/organizations.rb +25 -0
  113. data/lib/mno_enterprise/testing_support/factories/team.rb +17 -0
  114. data/lib/mno_enterprise/testing_support/factories/tenant.rb +12 -0
  115. data/lib/mno_enterprise/testing_support/factories/tenant_invoice.rb +29 -0
  116. data/lib/mno_enterprise/testing_support/factories/users.rb +48 -0
  117. data/lib/mno_enterprise/testing_support/jpi_v1_test_helper.rb +49 -0
  118. data/lib/mno_enterprise/testing_support/mno_enterprise_api_test_helper.rb +167 -0
  119. data/lib/mno_enterprise/testing_support/mnoe_faraday_test_adapter.rb +173 -0
  120. data/lib/mno_enterprise/testing_support/organizations_shared_helpers.rb +175 -0
  121. data/lib/mno_enterprise/testing_support/user_action_shared.rb +47 -0
  122. data/lib/mno_enterprise/version.rb +3 -0
  123. data/lib/tasks/mno_enterprise_tasks.rake +22 -0
  124. data/spec/controllers/mno_enterprise/angular_csrf_spec.rb +42 -0
  125. data/spec/lib/her_extension/her_orm_adapter.rb +7 -0
  126. data/spec/lib/her_extension/model/relation_spec.rb +7 -0
  127. data/spec/lib/mandrill_client_spec.rb +64 -0
  128. data/spec/mno_enterprise_spec.rb +79 -0
  129. data/spec/models/mno_enterprise/app_instance_spec.rb +7 -0
  130. data/spec/models/mno_enterprise/app_spec.rb +62 -0
  131. data/spec/models/mno_enterprise/base_resource_spec.rb +28 -0
  132. data/spec/models/mno_enterprise/deletion_request_spec.rb +26 -0
  133. data/spec/models/mno_enterprise/invoice_spec.rb +7 -0
  134. data/spec/models/mno_enterprise/organization_spec.rb +7 -0
  135. data/spec/models/mno_enterprise/user_spec.rb +44 -0
  136. data/spec/rails_helper.rb +73 -0
  137. data/spec/spec_helper.rb +78 -0
  138. metadata +421 -0
@@ -0,0 +1,19 @@
1
+ module Faraday
2
+ class Adapter
3
+ class NetHttpNoProxy < Faraday::Adapter::NetHttp
4
+ def net_http_connection(env)
5
+ # Monkey Patch, never use the request to set the proxy settings, let Net::HTTP figure out by itself from
6
+ # the environment variables
7
+
8
+ # Original code:
9
+ # if proxy = env[:request][:proxy]
10
+ # Net::HTTP::Proxy(proxy[:uri].host, proxy[:uri].port, proxy[:user], proxy[:password])
11
+ # else
12
+ # Net::HTTP
13
+ # end.new(env[:url].host, env[:url].port || (env[:url].scheme == 'https' ? 443 : 80))
14
+
15
+ Net::HTTP.new(env[:url].host, env[:url].port || (env[:url].scheme == 'https' ? 443 : 80))
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,11 @@
1
+ Description:
2
+ Create a database extension of an existing Mnoe model
3
+
4
+ Example:
5
+ rails generate mno_enterprise:database_extension Organization growth_type:string
6
+
7
+ This will create:
8
+ Model: app/models/mno_enterprise/organization.rb
9
+ Model: app/models/mno_enterprise/organization_extension.rb
10
+ Spec: spec/models/mno_enterprise/organization_extension_spec.rb
11
+ Migration: db/migrate/XXX_create_mno_enterprise_organization_extensions.rb
@@ -0,0 +1,36 @@
1
+ class MnoEnterprise::DatabaseExtensionGenerator < Rails::Generators::NamedBase
2
+ source_root File.expand_path('../templates', __FILE__)
3
+
4
+ argument :fields, type: :array, default: [], banner: "field[:type][:index] field[:type][:index]"
5
+
6
+ # Check the class we want to extend exists
7
+ def check_class_exists
8
+ klass = "MnoEnterprise::#{class_name}"
9
+ klass.constantize
10
+ rescue NameError
11
+ raise Thor::Error, "The class '#{klass}' does not exist in Maestrano Enterprise"
12
+ end
13
+
14
+ def check_class_is_decorator_ready
15
+ klass = "MnoEnterprise::Concerns::Models::#{class_name}"
16
+ klass.constantize
17
+ rescue NameError
18
+ raise Thor::Error, "The class '#{class_name}' is not decorator ready. Please extract it to #{klass}."
19
+ end
20
+
21
+ # Check the class we want to extend doesn't exist
22
+ def check_class_collision
23
+ @model_name = "MnoEnterprise::#{class_name}Extension"
24
+ @model_name.constantize rescue nil # To preload class in dev?
25
+ class_collisions @model_name
26
+ end
27
+
28
+ def generate_extension_model
29
+ params = "#{@model_name} #{file_name}_uid:string:uniq " + fields.join(' ') + " --no-fixture -t rspec"
30
+ generate "model", params
31
+ end
32
+
33
+ def generate_mnoe_model
34
+ template 'model.rb', File.join('app/models/mno_enterprise', "#{file_name}.rb")
35
+ end
36
+ end
@@ -0,0 +1,9 @@
1
+ module MnoEnterprise
2
+ class <%= class_name %> < BaseResource
3
+ include MnoEnterprise::Concerns::Models::<%= class_name %>
4
+
5
+ include MnoEnterprise::DatabaseExtendable
6
+
7
+ database_extendable <%= fields.map {|field| ":#{field.split(':').first}"}.join(', ') %>
8
+ end
9
+ end
@@ -0,0 +1,98 @@
1
+ require 'rails/generators'
2
+ require 'rails/generators/rails/app/app_generator'
3
+
4
+ module MnoEnterprise
5
+ class DummyGenerator < Rails::Generators::Base
6
+ desc "Creates blank Rails application, installs MNOE"
7
+
8
+ class_option :lib_name, default: ''
9
+ class_option :database, default: ''
10
+
11
+ def self.source_paths
12
+ paths = self.superclass.source_paths
13
+ paths << File.expand_path('../templates', __FILE__)
14
+ paths.flatten
15
+ end
16
+
17
+ def clean_up
18
+ remove_directory_if_exists(dummy_path)
19
+ end
20
+
21
+ PASSTHROUGH_OPTIONS = [
22
+ :skip_active_record, :skip_javascript, :database, :javascript, :quiet, :pretend, :force, :skip
23
+ ]
24
+
25
+ def generate_test_dummy
26
+ # calling slice on a Thor::CoreExtensions::HashWithIndifferentAccess
27
+ # object has been known to return nil
28
+ opts = {}.merge(options).slice(*PASSTHROUGH_OPTIONS)
29
+ opts[:database] = 'sqlite3' if opts[:database].blank?
30
+ opts[:force] = true
31
+ opts[:skip_bundle] = true
32
+
33
+ say "Generating dummy Rails application..."
34
+ invoke Rails::Generators::AppGenerator,
35
+ [ File.expand_path(dummy_path, destination_root) ], opts
36
+ end
37
+
38
+ def test_dummy_config
39
+ @lib_name = options[:lib_name]
40
+ @database = options[:database]
41
+
42
+ template "rails/database.yml", "#{dummy_path}/config/database.yml", force: true
43
+ template "rails/boot.rb.erb", "#{dummy_path}/config/boot.rb", force: true
44
+ template "rails/application.rb.erb", "#{dummy_path}/config/application.rb", force: true
45
+ template "rails/routes.rb", "#{dummy_path}/config/routes.rb", force: true
46
+ template "rails/test-env.rb", "#{dummy_path}/config/environments/test.rb", force: true
47
+ end
48
+
49
+ def test_dummy_clean
50
+ inside dummy_path do
51
+ remove_file ".gitignore"
52
+ remove_file "doc"
53
+ remove_file "Gemfile"
54
+ remove_file "lib/tasks"
55
+ remove_file "app/assets/images/rails.png"
56
+ remove_file "public/index.html"
57
+ remove_file "public/robots.txt"
58
+ remove_file "README"
59
+ remove_file "test"
60
+ remove_file "vendor"
61
+ end
62
+ end
63
+
64
+ attr :lib_name
65
+ attr :database
66
+
67
+ protected
68
+
69
+ def dummy_path
70
+ ENV['DUMMY_PATH'] || 'spec/dummy'
71
+ end
72
+
73
+ def module_name
74
+ 'Dummy'
75
+ end
76
+
77
+ def application_definition
78
+ @application_definition ||= begin
79
+
80
+ dummy_application_path = File.expand_path("#{dummy_path}/config/application.rb", destination_root)
81
+ unless options[:pretend] || !File.exists?(dummy_application_path)
82
+ contents = File.read(dummy_application_path)
83
+ contents[(contents.index("module #{module_name}"))..-1]
84
+ end
85
+ end
86
+ end
87
+ alias :store_application_definition! :application_definition
88
+
89
+ def remove_directory_if_exists(path)
90
+ remove_dir(path) if File.directory?(path)
91
+ end
92
+
93
+ def gemfile_path
94
+ '../../../../Gemfile'
95
+ end
96
+
97
+ end
98
+ end
@@ -0,0 +1,9 @@
1
+ require File.expand_path('../boot', __FILE__)
2
+
3
+ require 'rails/all'
4
+
5
+ Bundler.require(*Rails.groups(assets: %w(development test)))
6
+
7
+ # require 'mno-enterprise/core'
8
+
9
+ <%= application_definition %>
@@ -0,0 +1,6 @@
1
+ require 'rubygems'
2
+ gemfile = File.expand_path("<%= gemfile_path %>", __FILE__)
3
+
4
+ ENV['BUNDLE_GEMFILE'] = gemfile
5
+ require 'bundler'
6
+ Bundler.setup
@@ -0,0 +1,22 @@
1
+ # SQLite version 3.x
2
+ # gem install sqlite3
3
+ #
4
+ # Ensure the SQLite 3 gem is defined in your Gemfile
5
+ # gem 'sqlite3'
6
+ #
7
+ default: &default
8
+ adapter: sqlite3
9
+ pool: 5
10
+ timeout: 5000
11
+
12
+ development:
13
+ <<: *default
14
+ database: db/development.sqlite3
15
+
16
+ test:
17
+ <<: *default
18
+ database: db/test.sqlite3
19
+
20
+ production:
21
+ <<: *default
22
+ database: db/production.sqlite3
@@ -0,0 +1,8 @@
1
+ Rails.application.routes.draw do
2
+
3
+ # MnoEnterprise Engine
4
+ mount MnoEnterprise::Engine => "/mnoe", as: :mno_enterprise
5
+
6
+ # Root to login page
7
+ root to: redirect('/mnoe/auth/users/sign_in')
8
+ end
@@ -0,0 +1,45 @@
1
+ Rails.application.configure do
2
+ # Settings specified here will take precedence over those in config/application.rb.
3
+
4
+ # The test environment is used exclusively to run your application's
5
+ # test suite. You never need to work with it otherwise. Remember that
6
+ # your test database is "scratch space" for the test suite and is wiped
7
+ # and recreated between test runs. Don't rely on the data there!
8
+ config.cache_classes = true
9
+
10
+ # Do not eager load code on boot. This avoids loading your whole application
11
+ # just for the purpose of running a single test. If you are using a tool that
12
+ # preloads Rails for running tests, you may have to set it to true.
13
+ config.eager_load = false
14
+
15
+ # Configure static file server for tests with Cache-Control for performance.
16
+ config.serve_static_files = true
17
+ config.static_cache_control = 'public, max-age=3600'
18
+
19
+ # Show full error reports and disable caching.
20
+ config.consider_all_requests_local = true
21
+ config.action_controller.perform_caching = false
22
+
23
+ # Raise exceptions instead of rendering exception templates.
24
+ config.action_dispatch.show_exceptions = false
25
+
26
+ # Disable request forgery protection in test environment.
27
+ config.action_controller.allow_forgery_protection = false
28
+
29
+ # Specify host to use when sending emails
30
+ config.action_mailer.default_url_options = { host: 'localhost:3000' }
31
+
32
+ # Tell Action Mailer not to deliver emails to the real world.
33
+ # The :test delivery method accumulates sent emails in the
34
+ # ActionMailer::Base.deliveries array.
35
+ config.action_mailer.delivery_method = :test
36
+
37
+ # Randomize the order test cases are executed.
38
+ config.active_support.test_order = :random
39
+
40
+ # Print deprecation notices to the stderr.
41
+ config.active_support.deprecation = :stderr
42
+
43
+ # Raises error for missing translations
44
+ # config.action_view.raise_on_missing_translations = true
45
+ end
@@ -0,0 +1,140 @@
1
+ require 'rails/generators/rails/app/app_generator'
2
+
3
+ module MnoEnterprise
4
+ module Generators
5
+ class InstallGenerator < ::Rails::Generators::Base
6
+ source_root File.expand_path("../templates", __FILE__)
7
+ desc "Description:\n Install Maestrano Enterprise Engine in your application\n\n"
8
+
9
+ class_option :skip_rspec, type: :boolean, default: false, desc: 'Skip rspec-rails installation'
10
+ class_option :skip_sprite, type: :boolean, default: false, desc: 'Skip sprite-factory installation'
11
+ class_option :skip_factory_girl, type: :boolean, default: false, desc: 'Skip sprite-factory installation'
12
+
13
+
14
+
15
+ def copy_initializer
16
+ template "Procfile"
17
+ template "config/initializers/mno_enterprise.rb"
18
+ template "config/mno_enterprise_styleguide.yml"
19
+ end
20
+
21
+ def setup_assets
22
+ if defined?(MnoEnterprise::Frontend) || Rails.env.test?
23
+ # JavaScript
24
+ copy_file "javascripts/mno_enterprise_extensions.js", "app/assets/javascripts/mno_enterprise_extensions.js"
25
+
26
+
27
+ # Stylesheets
28
+ copy_file "stylesheets/main.less_erb", "app/assets/stylesheets/main.less.erb"
29
+ copy_file "stylesheets/theme.less_erb", "app/assets/stylesheets/theme.less.erb"
30
+ copy_file "stylesheets/variables.less", "app/assets/stylesheets/variables.less"
31
+
32
+ # Require main stylesheet file
33
+ inject_into_file 'app/assets/stylesheets/application.css', before: " */" do
34
+ " *= require main\n"
35
+ end
36
+
37
+ # Disable require_tree which breaks the app
38
+ gsub_file 'app/assets/stylesheets/application.css', /\*= require_tree ./, '* require_tree .'
39
+ end
40
+ end
41
+
42
+ # Inject engine routes
43
+ def notify_about_routes
44
+ if (routes_file = destination_path.join('config', 'routes.rb')).file? && (routes_file.read !~ %r{mount\ MnoEnterprise::Engine})
45
+ mount = %Q{
46
+ # This line mount Maestrano Enterprise routes in your application under /mnoe.
47
+ # If you would like to change where this engine is mounted, simply change the :at option to something different
48
+ #
49
+ # We ask that you don't use the :as option here, as Mnoe relies on it being the default of "mno_enterprise"
50
+ mount MnoEnterprise::Engine, at: '/mnoe', as: :mno_enterprise
51
+
52
+ }
53
+ inject_into_file routes_file, mount, after: "Rails.application.routes.draw do\n"
54
+ end
55
+
56
+ unless options[:quiet]
57
+ say " "
58
+ say "We added the following line to your application's config/routes.rb file:"
59
+ say " "
60
+ say " mount MnoEnterprise::Engine, at: '/mnoe'"
61
+ end
62
+ end
63
+
64
+ def install_sprite_generator
65
+ if (defined?(MnoEnterprise::Frontend) || Rails.env.test?) && !options[:skip_sprite]
66
+ say("\n")
67
+ @install_sprite = ask_with_default('Would you like to install sprite-factory?')
68
+ if @install_sprite
69
+ gem_group :development do
70
+ gem "chunky_png"
71
+ gem "sprite-factory"
72
+ end
73
+ template "tasks/sprites.rake", "lib/tasks/sprites.rake"
74
+ end
75
+ end
76
+ end
77
+
78
+ def install_rspec_rails
79
+ unless options[:skip_rspec]
80
+ say("\n")
81
+ @install_rspec = ask_with_default("Would you like to install rspec-rails?")
82
+ if @install_rspec
83
+ gem_group :test do
84
+ gem "rspec-rails"
85
+ end
86
+ generate "rspec:install"
87
+ end
88
+ end
89
+ end
90
+
91
+ def install_factory_girl
92
+ unless options[:skip_factory_girl]
93
+ say("\n")
94
+ @install_facto_girl = ask_with_default("Would you like to install factory_girl_rails?")
95
+ if @install_facto_girl
96
+ gem_group :test do
97
+ gem "factory_girl_rails"
98
+ end
99
+ end
100
+ end
101
+ end
102
+
103
+ def install_summary
104
+ unless options[:quiet]
105
+ say("\n\n")
106
+ say_status("==> Maestrano Enterprise has been installed ==", nil)
107
+ say("- You can generate deployment configs by running: 'rails g mno_enterprise:puma_stack'")
108
+ say("- You can start the server with: 'foreman start'")
109
+ if @install_sprite =~ /y/i
110
+ say("\n\n")
111
+ say("==> Sprite Factory has been installed")
112
+ say("- Drop your icons in vendor/sprites/icons then run: 'rake assets:resprite'")
113
+ say("- Add more icons folders to vendor/sprites then modify lib/tasks/sprites.rake")
114
+ end
115
+ say("\n\n")
116
+ end
117
+ end
118
+
119
+ private
120
+ # Helper method to quickly convert destination_root to a Pathname for easy file path manipulation
121
+ def destination_path
122
+ @destination_path ||= Pathname.new(self.destination_root)
123
+ end
124
+
125
+ # Ask a question with a default answer
126
+ # Returns a boolean
127
+ def ask_with_default(message, default = 'yes', color = nil)
128
+ question = "#{message} (yes/no) [#{default}]"
129
+
130
+ valid = false
131
+ until valid
132
+ answer = ask(question)
133
+ answer = default if answer.empty?
134
+ valid = (answer =~ /\Ay(?:es)?|no?\Z/i)
135
+ end
136
+ answer.downcase[0] == ?y
137
+ end
138
+ end
139
+ end
140
+ end
@@ -0,0 +1 @@
1
+ web: bundle exec rails s -p 7000
@@ -0,0 +1,135 @@
1
+ # require 'mno-enterprise'
2
+
3
+ MnoEnterprise.configure do |config|
4
+ #===============================================
5
+ # General Configuration
6
+ #===============================================
7
+ # Name of your company/application
8
+ config.app_name = "My Company"
9
+
10
+ # Fallback default country.
11
+ # Used as default in geolocalised fields (e.g.: country, phone number)
12
+ # config.app_country = 'US'
13
+
14
+ # Fallback default currency.
15
+ # config.app_currency = 'USD'
16
+
17
+ #===============================================
18
+ # Maestrano Enterprise Tenant Authentication
19
+ #===============================================
20
+ # Configure your tenant ID
21
+ config.tenant_id = "my_tenant_id"
22
+
23
+ # Configure your tenant Key
24
+ config.tenant_key = "my_tenant_access_key"
25
+
26
+ #===============================================
27
+ # Emailing
28
+ #===============================================
29
+ # Mandrill API key for sending email
30
+ # Defaulted to Maestrano Enterprise demo account
31
+ # config.mandrill_key = 'some-mandrill-api-key'
32
+
33
+ # Support email address
34
+ config.support_email = 'support@example.com'
35
+
36
+ # Default sender for system generated emails
37
+ config.default_sender_name = 'My Company'
38
+ config.default_sender_email = 'no-reply@example.com'
39
+
40
+ #===============================================
41
+ # External Routes
42
+ #===============================================
43
+ # URL of the Terms and Conditions page.
44
+ # Used on Devise Registration pages
45
+ # config.router.terms_url = 'http://mywebsite.com/terms'
46
+
47
+ # After sign out URL. Default to the root_path
48
+ # config.router.after_sign_out_url = 'http://mywebsite.com/'
49
+
50
+ #===============================================
51
+ # Optional Modules
52
+ #===============================================
53
+ # Angular CSRF protection - Only needed if the AngularJS App
54
+ # is not served through Rails asset pipeline
55
+ # config.include_angular_csrf = false
56
+
57
+ #===============================================
58
+ # Third Party Plugins
59
+ #===============================================
60
+ # Google Tag Manager
61
+ # config.google_tag_container = nil
62
+
63
+ #===============================================
64
+ # API Configuration
65
+ #===============================================
66
+ # ==> Maestrano Enterprise API Configuration
67
+ # Configure the API host
68
+ # config.mno_api_host = "https://api-enterprise.maestrano.com"
69
+
70
+ # Configure the API root path
71
+ # config.mno_api_root_path = "/v1"
72
+
73
+ #===============================================
74
+ # Impac! Reporting Configuration
75
+ #===============================================
76
+ # ==> Impac! API Configuration
77
+ # Configure the API host
78
+ # config.impac_api_host = "https://api-impac-uat.maestrano.io"
79
+
80
+ # Configure the API root path
81
+ # config.impac_api_root_path = "/api"
82
+
83
+ #===============================================
84
+ # Marketplace Listing
85
+ #===============================================
86
+ # List of applications that should be offered on the marketplace
87
+ # Set to nil to offer everything
88
+ # config.marketplace_listing = nil
89
+ # config.marketplace_listing = [
90
+ # "allocpsa",
91
+ # "boxsuite",
92
+ # "bugzilla",
93
+ # "collabtive",
94
+ # "dolibarr",
95
+ # "drupal",
96
+ # "egroupware",
97
+ # "eventbrite",
98
+ # "feng-office",
99
+ # "front-accounting",
100
+ # "group-office",
101
+ # "hummingbirdshare",
102
+ # "interleave",
103
+ # "jenkins",
104
+ # "joomla",
105
+ # "limesurvey",
106
+ # "mantisbt",
107
+ # "magento",
108
+ # "megaventory",
109
+ # "moodle",
110
+ # "myob",
111
+ # "office-365",
112
+ # "opendocman",
113
+ # "openerp",
114
+ # "openx",
115
+ # "orangehrm",
116
+ # "pentaho-bi",
117
+ # "phreedom",
118
+ # "plandora",
119
+ # "prestashop",
120
+ # "processmaker",
121
+ # "projectpier",
122
+ # "quickbooks",
123
+ # "ranqx",
124
+ # "receipt-bank",
125
+ # "signmee",
126
+ # "simpleinvoices",
127
+ # "so-planning",
128
+ # "spotlight-reporting",
129
+ # "sugarcrm",
130
+ # "timetrex",
131
+ # "vtiger6",
132
+ # "xero",
133
+ # "wordpress"
134
+ # ]
135
+ end