hippo-fw 0.9.1 → 0.9.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/Gemfile +16 -11
- data/Rakefile +0 -7
- data/bin/hippo +5 -1
- data/client/hippo/__mocks__/config.js +2 -3
- data/client/hippo/boot.jsx +0 -2
- data/client/hippo/components/asset.jsx +1 -1
- data/client/hippo/components/form.jsx +8 -4
- data/client/hippo/components/form/fields.jsx +28 -14
- data/client/hippo/components/form/model.js +65 -20
- data/client/hippo/components/form/wrapper.jsx +11 -5
- data/client/hippo/components/icon.jsx +1 -1
- data/client/hippo/components/master-detail.jsx +66 -0
- data/client/hippo/components/master-detail.scss +50 -0
- data/client/hippo/components/record-finder.jsx +5 -5
- data/client/hippo/components/tool-tip.jsx +20 -0
- data/client/hippo/config.js +5 -3
- data/client/hippo/extensions/base.js +4 -0
- data/client/hippo/lib/smooth-scroll.js +17 -16
- data/client/hippo/models/asset.js +8 -10
- data/client/hippo/models/collection.js +1 -4
- data/client/hippo/models/query/array-result.js +11 -9
- data/client/hippo/models/sync.js +3 -3
- data/client/hippo/models/tenant.js +29 -0
- data/client/hippo/screens/system-settings.jsx +5 -4
- data/client/hippo/screens/system-settings/mailer-config.jsx +11 -17
- data/client/hippo/screens/system-settings/tenant.jsx +90 -0
- data/client/hippo/screens/user-management/edit-form.jsx +15 -25
- data/client/hippo/testing/index.js +1 -0
- data/client/hippo/workspace/styles.scss +0 -23
- data/command-reference-files/initial/.babelrc +10 -8
- data/command-reference-files/initial/Gemfile +1 -1
- data/{views/index.html → command-reference-files/initial/views/index.erb} +1 -0
- data/config/routes.rb +48 -17
- data/config/webpack.config.js +7 -12
- data/db/migrate/01_create_tenants.rb +13 -0
- data/db/migrate/{01_create_system_settings.rb → 02_create_system_settings.rb} +2 -1
- data/db/migrate/{02_create_assets.rb → 03_create_assets.rb} +2 -4
- data/db/migrate/{20140615031600_create_users.rb → 04_create_users.rb} +4 -2
- data/db/seed.rb +10 -1
- data/hippo-fw.gemspec +53 -51
- data/lib/hippo.rb +7 -1
- data/lib/hippo/access.rb +0 -1
- data/lib/hippo/access/roles/basic_user.rb +2 -0
- data/lib/hippo/api.rb +4 -3
- data/lib/hippo/{access → api}/authentication_provider.rb +3 -1
- data/lib/hippo/api/controller_base.rb +2 -2
- data/lib/hippo/api/handlers/asset.rb +28 -2
- data/lib/hippo/api/handlers/tenant.rb +26 -0
- data/lib/hippo/api/helper_methods.rb +5 -13
- data/lib/hippo/api/request_wrapper.rb +8 -1
- data/lib/hippo/api/root.rb +50 -51
- data/lib/hippo/api/route_set.rb +101 -0
- data/lib/hippo/api/routing.rb +9 -98
- data/lib/hippo/api/tenant_domain_router.rb +21 -0
- data/lib/hippo/asset.rb +1 -0
- data/lib/hippo/command.rb +1 -24
- data/lib/hippo/command/app.rb +4 -3
- data/lib/hippo/command/console.rb +7 -0
- data/lib/hippo/command/generate.rb +0 -5
- data/lib/hippo/command/guard.rb +1 -0
- data/lib/hippo/command/jest.rb +2 -2
- data/lib/hippo/command/server.rb +1 -3
- data/lib/hippo/command/webpack.rb +6 -26
- data/lib/hippo/configuration.rb +21 -13
- data/lib/hippo/db.rb +2 -0
- data/lib/hippo/db/migrations.rb +9 -2
- data/lib/hippo/extension.rb +49 -14
- data/lib/hippo/extension/definition.rb +0 -4
- data/lib/hippo/guard_tasks.rb +3 -11
- data/lib/hippo/mailer.rb +28 -16
- data/lib/hippo/model.rb +10 -0
- data/lib/hippo/numbers.rb +1 -1
- data/lib/hippo/rake_tasks.rb +7 -1
- data/lib/hippo/spec_helper.rb +33 -11
- data/lib/hippo/system_settings.rb +1 -0
- data/lib/hippo/templates/base.rb +1 -1
- data/lib/hippo/templates/mail.rb +26 -0
- data/lib/hippo/templates/tenant_change.rb +23 -0
- data/lib/hippo/tenant.rb +53 -0
- data/lib/hippo/user.rb +12 -6
- data/lib/hippo/version.rb +1 -1
- data/lib/hippo/webpack.rb +57 -0
- data/lib/hippo/{command → webpack}/client_config.rb +7 -21
- data/package.json +3 -3
- data/spec/client/components/__snapshots__/master-detail.spec.jsx.snap +22 -0
- data/spec/client/components/form.spec.jsx +14 -14
- data/spec/client/components/master-detail.spec.jsx +24 -0
- data/spec/client/components/record-finder.spec.jsx +5 -2
- data/spec/client/models/asset.spec.js +2 -13
- data/spec/client/models/base.spec.js +1 -11
- data/spec/client/models/query.spec.js +2 -4
- data/spec/client/models/sync.spec.js +7 -0
- data/spec/client/screens/__snapshots__/system-settings.spec.jsx.snap +79 -0
- data/spec/client/screens/system-settings-tenants.spec.jsx +18 -0
- data/spec/client/workspace/__snapshots__/menu.spec.jsx.snap +29 -313
- data/spec/client/workspace/menu.spec.jsx +1 -9
- data/spec/factories/tenant.rb +13 -0
- data/spec/fixtures/mail/test_email.liquid +1 -0
- data/spec/fixtures/{test_printer.tex → test_printer.tex.erb} +0 -0
- data/spec/server/api/controller_base_spec.rb +1 -1
- data/spec/server/api/tenant_change_spec.rb +24 -0
- data/spec/server/api/tenant_isolation_spec.rb +37 -0
- data/spec/server/asset_spec.rb +6 -6
- data/spec/server/command_spec.rb +0 -5
- data/spec/server/mailer_spec.rb +25 -23
- data/spec/server/numbers_spec.rb +12 -13
- data/spec/server/print/form_spec.rb +2 -1
- data/spec/server/strings_spec.rb +13 -13
- data/templates/.babelrc +10 -8
- data/templates/js/screen-definitions.js +8 -10
- data/templates/mail/tenant_change.liquid +13 -0
- data/{command-reference-files/initial/views/index.html → views/index.erb} +5 -2
- data/yarn.lock +22 -169
- metadata +56 -30
- data/client/hippo/components/form/field-prop-type.js +0 -16
- data/lib/hippo/api/default_routes.rb +0 -38
- data/lib/hippo/command/generate_component.rb +0 -28
- data/lib/hippo/command/generate_component.usage +0 -11
- data/lib/hippo/command/webpack_view.rb +0 -32
- data/lib/hippo/multi_server_boot.rb +0 -26
- data/lib/hippo/reloadable_view.rb +0 -13
- data/templates/client/components/.gitkeep +0 -0
- data/templates/client/components/BaseComponent.coffee +0 -9
- data/templates/client/components/Component.cjsx +0 -4
- data/templates/client/components/template.html +0 -3
@@ -0,0 +1,21 @@
|
|
1
|
+
module Hippo
|
2
|
+
module API
|
3
|
+
class TenantDomainRouter
|
4
|
+
def initialize(app)
|
5
|
+
@app = app
|
6
|
+
end
|
7
|
+
|
8
|
+
def call(env)
|
9
|
+
domain_parts = env['SERVER_NAME'].split('.')
|
10
|
+
if domain_parts.length == 3
|
11
|
+
tenant = Hippo::Tenant.where(slug: domain_parts.first).first
|
12
|
+
MultiTenant.with(tenant) do
|
13
|
+
@app.call(env)
|
14
|
+
end
|
15
|
+
else
|
16
|
+
@app.call(env)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
data/lib/hippo/asset.rb
CHANGED
data/lib/hippo/command.rb
CHANGED
@@ -11,31 +11,8 @@ module Hippo
|
|
11
11
|
Pathname.new(__FILE__).dirname.join("command","#{file}.usage").read.gsub(/\n/,"\n\x5")
|
12
12
|
end
|
13
13
|
|
14
|
-
# Loads the code for the extension that the user is currently
|
15
|
-
# working inside. The `hippo` command uses this to detect
|
16
|
-
# what actions should be taken.
|
17
|
-
#
|
18
|
-
# Will silently swallow any exceptions that are raised when the file is required and return nil
|
19
|
-
#
|
20
|
-
# @return [Extension] extension that was loaded, nil if none was found
|
21
14
|
def load_current_extension(raise_on_fail:false)
|
22
|
-
|
23
|
-
if ext
|
24
|
-
begin
|
25
|
-
require(ext)
|
26
|
-
rescue =>e
|
27
|
-
stack = e.backtrace[0..4].join("\n")
|
28
|
-
raise Thor::Error.new("Loading ./lib/*/extension.rb failed with: #{e}\n#{stack}")
|
29
|
-
end
|
30
|
-
Extensions.controlling
|
31
|
-
else
|
32
|
-
return _maybe_fail(raise_on_fail)
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
def _maybe_fail(should_raise)
|
37
|
-
raise Thor::Error.new("Unable to locate Hippo environment.\nDoes ./lib/*/extension.rb exist?") if should_raise
|
38
|
-
return nil
|
15
|
+
Hippo::Extensions.bootstrap(raise_on_fail: raise_on_fail)
|
39
16
|
end
|
40
17
|
|
41
18
|
end
|
data/lib/hippo/command/app.rb
CHANGED
@@ -30,7 +30,7 @@ module Hippo
|
|
30
30
|
".babelrc", "config/database.yml"
|
31
31
|
].each{ |f| template(f) }
|
32
32
|
[
|
33
|
-
".eslintrc.js", ".rubocop.yml", "spec/client/.eslintrc.js"
|
33
|
+
".eslintrc.js", ".rubocop.yml", "spec/client/.eslintrc.js"
|
34
34
|
].each{ |f| template("../#{f}", f) }
|
35
35
|
template "lib/namespace.rb", "lib/#{identifier}.rb"
|
36
36
|
template "lib/namespace/version.rb", "lib/#{identifier}/version.rb"
|
@@ -44,10 +44,10 @@ module Hippo
|
|
44
44
|
template "config/jest/babel-transform.js"
|
45
45
|
template "config/initialize.rb"
|
46
46
|
template ".gitignore"
|
47
|
-
|
48
47
|
template "spec/client/setup.js"
|
49
48
|
template "spec/server/spec_helper.rb"
|
50
49
|
|
50
|
+
copy_file "../views/index.erb", "views/index.erb"
|
51
51
|
create_file "log/.gitkeep",""
|
52
52
|
create_file "tmp/.gitkeep",""
|
53
53
|
create_file "db/.gitkeep", ""
|
@@ -59,6 +59,7 @@ module Hippo
|
|
59
59
|
empty_directory "#{client_dir}/#{path.basename}"
|
60
60
|
create_file "#{client_dir}/#{path.basename}/.gitkeep"
|
61
61
|
end
|
62
|
+
create_file "#{client_dir}/components/.gitkeep", ""
|
62
63
|
template "client/models/base.js", "#{client_dir}/models/base.js"
|
63
64
|
template "client/index.js", "#{client_dir}/index.js"
|
64
65
|
template "client/extension.js", "#{client_dir}/extension.js"
|
@@ -73,7 +74,7 @@ module Hippo
|
|
73
74
|
say 'Installing node modules', :green
|
74
75
|
[
|
75
76
|
'jest',
|
76
|
-
'hippo-
|
77
|
+
'hippo-fw',
|
77
78
|
'react-router',
|
78
79
|
'webpack',
|
79
80
|
'webpack-dev-server'
|
@@ -9,10 +9,17 @@ module Hippo
|
|
9
9
|
require 'irb'
|
10
10
|
require 'irb/completion'
|
11
11
|
require 'pp'
|
12
|
+
require 'faker'
|
13
|
+
require 'factory_girl'
|
12
14
|
DB.establish_connection
|
13
15
|
ActiveRecord::Base.logger = Logger.new STDOUT
|
14
16
|
Configuration.apply
|
15
17
|
Hippo::Extensions.load_controlling_config
|
18
|
+
FactoryGirl.definition_file_paths = Hippo::Extensions.map do |ext|
|
19
|
+
ext.root_path.join('spec/factories')
|
20
|
+
end
|
21
|
+
FactoryGirl.find_definitions
|
22
|
+
MultiTenant.current_tenant = Hippo::Tenant.system
|
16
23
|
ext.on_dev_console
|
17
24
|
ARGV.clear
|
18
25
|
IRB.start
|
@@ -13,11 +13,6 @@ module Hippo
|
|
13
13
|
long_desc Command.usage_from_file("generate_screen")
|
14
14
|
method_options( GenerateScreen::OPTIONS )
|
15
15
|
register Command::GenerateScreen, 'screen', 'screen [NAME]', 'Creates a new Screen'
|
16
|
-
|
17
|
-
long_desc Command.usage_from_file("generate_component")
|
18
|
-
method_options( GenerateComponent::OPTIONS )
|
19
|
-
register Command::GenerateComponent, 'component', 'component [NAME]', 'Creates a new Component to be shared between screens'
|
20
|
-
|
21
16
|
end
|
22
17
|
|
23
18
|
end
|
data/lib/hippo/command/guard.rb
CHANGED
data/lib/hippo/command/jest.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
require_relative './client_config'
|
2
1
|
require_relative '../extension'
|
3
2
|
require_relative '../command'
|
3
|
+
require_relative '../webpack/client_config'
|
4
4
|
|
5
5
|
module Hippo
|
6
6
|
module Command
|
@@ -17,7 +17,7 @@ module Hippo
|
|
17
17
|
|
18
18
|
|
19
19
|
def configure
|
20
|
-
@config = ClientConfig.new
|
20
|
+
@config = Hippo::Webpack::ClientConfig.new
|
21
21
|
@config.invoke_all
|
22
22
|
self
|
23
23
|
end
|
data/lib/hippo/command/server.rb
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
require 'guard/cli'
|
2
2
|
require_relative '../guard_tasks'
|
3
|
-
require_relative '../multi_server_boot'
|
4
3
|
|
5
4
|
module Hippo
|
6
5
|
module Command
|
@@ -11,8 +10,7 @@ module Hippo
|
|
11
10
|
|
12
11
|
def launch
|
13
12
|
say "Launching testing server at http://localhost:8888/", :green
|
14
|
-
|
15
|
-
::Hippo::MultiServiceBoot.perform
|
13
|
+
Guard.start # will block until complete
|
16
14
|
end
|
17
15
|
end
|
18
16
|
end
|
@@ -9,49 +9,29 @@ module Hippo
|
|
9
9
|
class Webpack < Thor::Group
|
10
10
|
include Thor::Actions
|
11
11
|
|
12
|
-
attr_reader :
|
12
|
+
attr_reader :webpack
|
13
13
|
|
14
14
|
attr_accessor :config
|
15
15
|
|
16
16
|
attr_reader :wpd_config
|
17
17
|
|
18
|
-
class_option :wait, :type => :boolean, default: true,
|
19
|
-
desc: "Whether to keep running and wait for exit"
|
20
|
-
|
21
18
|
class_option :compile, :type => :boolean, default: false
|
22
19
|
|
23
20
|
def set_production_env
|
21
|
+
ext = Command.load_current_extension
|
24
22
|
Hippo.config.environment = :production if options[:compile]
|
25
23
|
end
|
26
24
|
|
27
|
-
def
|
28
|
-
|
29
|
-
@config = ClientConfig.new
|
30
|
-
config.invoke_all
|
31
|
-
end
|
32
|
-
|
33
|
-
def configure
|
34
|
-
@wpd_config = WebpackDriver::Configuration.new(
|
35
|
-
config.directory.join('webpack.config.js'),
|
36
|
-
logger: Hippo.logger,
|
37
|
-
directory: config.controlling_extension.root_path,
|
38
|
-
cmd_line_flags: (options[:compile] ? [] : ['--hot', '--inline']),
|
39
|
-
environment: { NODE_ENV: options[:compile] ? 'production' : 'development' }
|
40
|
-
)
|
41
|
-
self
|
42
|
-
end
|
43
|
-
|
44
|
-
def create_process
|
45
|
-
@process = options[:compile] ? ::WebpackDriver::Compile.new(wpd_config) :
|
46
|
-
::WebpackDriver::DevServer.new(wpd_config)
|
25
|
+
def launch
|
26
|
+
@webpack = Hippo::Webpack.new
|
47
27
|
end
|
48
28
|
|
49
29
|
def startup
|
30
|
+
process = webpack.process
|
50
31
|
process.start
|
51
|
-
process.wait
|
32
|
+
process.wait
|
52
33
|
end
|
53
34
|
|
54
35
|
end
|
55
36
|
end
|
56
|
-
|
57
37
|
end
|
data/lib/hippo/configuration.rb
CHANGED
@@ -50,7 +50,7 @@ module Hippo
|
|
50
50
|
end
|
51
51
|
|
52
52
|
def self.apply
|
53
|
-
controlling_ext = Hippo::Extensions.
|
53
|
+
controlling_ext = Hippo::Extensions.bootstrap
|
54
54
|
secrets = controlling_ext.root_path.join('config', 'secrets.yml')
|
55
55
|
@@secrets = Hashie::Mash.new(
|
56
56
|
secrets.exist? ? YAML.load(ERB.new(secrets.read).result) : {}
|
@@ -68,20 +68,24 @@ module Hippo
|
|
68
68
|
|
69
69
|
Resque.redis.namespace = "#{controlling_ext.identifier}::resque"
|
70
70
|
Resque.redis = Hippo.config.redis
|
71
|
+
Hippo::Concerns::AssetUploader.storages = {
|
72
|
+
cache: Shrine::Storage::FileSystem.new(
|
73
|
+
controlling_ext.root_path,
|
74
|
+
prefix: "tmp/cache"
|
75
|
+
),
|
76
|
+
store: Shrine::Storage::FileSystem.new(
|
77
|
+
controlling_ext.root_path,
|
78
|
+
prefix: "public/files"
|
79
|
+
)
|
80
|
+
}
|
81
|
+
Hippo::Tenant.system.perform do
|
82
|
+
Hippo::SystemSettings.for_ext('hippo').apply!
|
83
|
+
Extensions.each{|ext| ext.apply_configuration }
|
71
84
|
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
if Kernel.const_defined?(:Guard) && ::Guard.const_defined?(:Jest)
|
76
|
-
::Guard::Jest.logger = Hippo.logger
|
85
|
+
if Kernel.const_defined?(:Guard) && ::Guard.const_defined?(:Jest)
|
86
|
+
::Guard::Jest.logger = Hippo.logger
|
87
|
+
end
|
77
88
|
end
|
78
|
-
|
79
|
-
::Hippo::Concerns::AssetUploader.storages = {
|
80
|
-
cache: Shrine::Storage::FileSystem.new(controlling_ext.root_path,
|
81
|
-
prefix: "tmp/cache"),
|
82
|
-
store: Shrine::Storage::FileSystem.new(controlling_ext.root_path,
|
83
|
-
prefix: "public/files")
|
84
|
-
}
|
85
89
|
end
|
86
90
|
|
87
91
|
end
|
@@ -123,6 +127,10 @@ module Hippo
|
|
123
127
|
# Configuration for action cable
|
124
128
|
config_option :cable, { 'adapter' => 'redis' }
|
125
129
|
|
130
|
+
config_option :website_domain, 'test.com'
|
131
|
+
|
132
|
+
config_option :product_name, 'Hippo Funtime'
|
133
|
+
|
126
134
|
def api_path
|
127
135
|
mounted_at + 'api'
|
128
136
|
end
|
data/lib/hippo/db.rb
CHANGED
data/lib/hippo/db/migrations.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'pathname'
|
2
|
+
require 'scenic'
|
2
3
|
|
3
4
|
module Hippo
|
4
5
|
module DB
|
@@ -25,8 +26,14 @@ module Hippo
|
|
25
26
|
end
|
26
27
|
end
|
27
28
|
|
29
|
+
ActiveRecord::ConnectionAdapters::AbstractAdapter.include ::Hippo::DB::Migrations::TableDefinitionHelpers
|
28
30
|
|
31
|
+
module ::Scenic
|
32
|
+
class Definition
|
33
|
+
def full_path
|
34
|
+
Pathname.pwd.join(path)
|
35
|
+
end
|
36
|
+
end
|
29
37
|
|
30
|
-
ActiveRecord::ConnectionAdapters::PostgreSQL::ColumnMethods.class_eval do
|
31
|
-
include ::Hippo::DB::Migrations::TableDefinitionHelpers
|
32
38
|
end
|
39
|
+
::Scenic.load
|
data/lib/hippo/extension.rb
CHANGED
@@ -17,11 +17,11 @@ module Hippo
|
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
20
|
-
# lock the current controlling extension so that it can't
|
21
|
-
# be changed by other extensions that are loaded later
|
22
|
-
def lock_controlling!
|
23
|
-
|
24
|
-
end
|
20
|
+
# # lock the current controlling extension so that it can't
|
21
|
+
# # be changed by other extensions that are loaded later
|
22
|
+
# def lock_controlling!
|
23
|
+
# self.controlling_locked=true
|
24
|
+
# end
|
25
25
|
|
26
26
|
def add(klass)
|
27
27
|
@cached_instances = nil
|
@@ -78,16 +78,45 @@ module Hippo
|
|
78
78
|
Hippo.logger.error "Unable to find controlling extension. #{sorted} are loaded"
|
79
79
|
end
|
80
80
|
|
81
|
+
# Loads the code for the extension that the user is currently
|
82
|
+
# working inside. The `hippo` command uses this to detect
|
83
|
+
# what actions should be taken.
|
84
|
+
#
|
85
|
+
# Will silently swallow any exceptions that are raised when the file is required and return nil
|
86
|
+
#
|
87
|
+
# @return [Extension] extension that was loaded, nil if none was found
|
88
|
+
def bootstrap(raise_on_fail:false)
|
89
|
+
ext = Dir.glob("./lib/*/extension.rb").first
|
90
|
+
if ext
|
91
|
+
begin
|
92
|
+
require(ext)
|
93
|
+
rescue =>e
|
94
|
+
stack = e.backtrace[0..4].join("\n")
|
95
|
+
raise Thor::Error.new("Loading ./lib/*/extension.rb failed with: #{e}\n#{stack}")
|
96
|
+
end
|
97
|
+
Extensions.controlling
|
98
|
+
else
|
99
|
+
return _maybe_fail(raise_on_fail)
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
def _maybe_fail(should_raise)
|
104
|
+
raise Thor::Error.new("Unable to locate Hippo environment.\nDoes ./lib/*/extension.rb exist?") if should_raise
|
105
|
+
return nil
|
106
|
+
end
|
107
|
+
|
108
|
+
|
81
109
|
def client_bootstrap_data
|
82
|
-
data = {
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
110
|
+
data = {}
|
111
|
+
%w{
|
112
|
+
api_path environment website_domain product_name assets_path_prefix
|
113
|
+
}.each do |config|
|
114
|
+
data[config.to_sym] = Hippo.config.send(config)
|
115
|
+
end
|
116
|
+
data.merge(
|
117
|
+
controlling_extension: controlling.identifier,
|
118
|
+
initial_workspace_screen_id: Hippo.config.initial_workspace_screen_id
|
119
|
+
)
|
91
120
|
each do | ext |
|
92
121
|
ext_data = ext.client_bootstrap_data
|
93
122
|
data[ext.identifier] = ext_data unless ext_data.nil?
|
@@ -102,6 +131,12 @@ module Hippo
|
|
102
131
|
end
|
103
132
|
end
|
104
133
|
|
134
|
+
def client_module_paths
|
135
|
+
map { |e| e.root_path.join('client').to_s }.reverse + [
|
136
|
+
controlling.root_path.join('node_modules').to_s
|
137
|
+
]
|
138
|
+
end
|
139
|
+
|
105
140
|
end
|
106
141
|
|
107
142
|
end
|
data/lib/hippo/guard_tasks.rb
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
require_relative '../hippo'
|
2
2
|
require_relative 'command/jest'
|
3
3
|
require_relative 'reloadable_sinatra.rb'
|
4
|
-
require_relative 'reloadable_view.rb'
|
5
4
|
require 'guard/jest'
|
6
5
|
require 'guard/rspec'
|
7
6
|
|
@@ -20,7 +19,6 @@ module Hippo
|
|
20
19
|
end
|
21
20
|
end
|
22
21
|
|
23
|
-
|
24
22
|
def self.run(dsl, options, &block)
|
25
23
|
matchers = CustomMatchers.new
|
26
24
|
yield matchers
|
@@ -42,21 +40,15 @@ module Hippo
|
|
42
40
|
dsl.guard :rspec, rspec_options do
|
43
41
|
dsl.watch(%r{^spec/server/spec_helper\.rb}) { 'spec' }
|
44
42
|
dsl.watch(%r{^spec/server/.*_spec\.rb})
|
45
|
-
dsl.watch(%r{^
|
46
|
-
dsl.watch(%r{^
|
43
|
+
dsl.watch(%r{^lib/#{identifier}/(.+)\.rb}) { |m| "spec/server/#{m[1]}_spec.rb" }
|
44
|
+
dsl.watch(%r{^spec/fixtures/#{identifier}(.+)s\.yml}) { |m| "spec/server/#{m[1]}_spec.rb" }
|
47
45
|
matchers.server_matches.call if matchers.server_matches
|
48
46
|
end
|
49
47
|
|
50
48
|
dsl.guard :reloadable_sinatra do
|
51
49
|
dsl.watch(%r{^lib/.*\.rb})
|
52
|
-
dsl.watch(%r{^config
|
53
|
-
end
|
54
|
-
|
55
|
-
dsl.guard :reloadable_view do
|
56
|
-
dsl.watch(%r{^views/(.*\.html)}) { |m| m[1] }
|
50
|
+
dsl.watch(%r{^config/.*})
|
57
51
|
end
|
58
|
-
|
59
52
|
end
|
60
|
-
|
61
53
|
end
|
62
54
|
end
|