Class: Jets::Core::Config::Project
- Defined in:
- lib/jets/core/config/project.rb
Overview
Intentionally keep this class simple. Frameworks should do the heavy lifting.
Instance Attribute Summary collapse
-
#autoload_paths ⇒ Object
Returns the value of attribute autoload_paths.
-
#base64_encode ⇒ Object
Returns the value of attribute base64_encode.
-
#dotenv ⇒ Object
Returns the value of attribute dotenv.
-
#git ⇒ Object
Returns the value of attribute git.
-
#ignore_paths ⇒ Object
Returns the value of attribute ignore_paths.
- #name ⇒ Object
-
#tips ⇒ Object
Returns the value of attribute tips.
Instance Method Summary collapse
-
#all_load_paths ⇒ Object
Useful for jets rails engine Used to ignore all paths managed by Jets.
- #extension_paths ⇒ Object
-
#initialize ⇒ Project
constructor
A new instance of Project.
- #jets_info_project_name ⇒ Object
- #name_inferred? ⇒ Boolean
- #namespace ⇒ Object
- #s3_bucket ⇒ Object
Methods inherited from Base
Methods included from Util::Camelize
Constructor Details
#initialize ⇒ Project
Returns a new instance of Project.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/jets/core/config/project.rb', line 13 def initialize(*) @autoload_paths = Set.new(%w[ app/events app/extensions shared/resources shared/extensions ]) @ignore_paths = Set.new(%w[ app/functions shared/functions ]) # Jets does not implement the concept of eager_load_paths like Rails for simplicity. # Also Jets always does an eager load of app code that it manages above. # This is because shared/extensions and shared/resources needed to be defined # early to generate the CloudFormation templates. @dotenv = ActiveSupport::OrderedOptions.new @dotenv.ssm = ActiveSupport::OrderedOptions.new @dotenv.ssm.autoload = ActiveSupport::OrderedOptions.new @dotenv.ssm.autoload.default_skip = ["BASIC_AUTH_USERNAME", "BASIC_AUTH_PASSWORD", "BASIC_AUTH_CREDENTIALS"] @dotenv.ssm.autoload.enable = true # autoloads parameters by path IE: /demo/dev/ @dotenv.ssm.autoload.skip = [] @dotenv.ssm.convention_resolver = nil # proc receives ssm_leaf_name @dotenv.ssm.envs = ActiveSupport::OrderedOptions.new @dotenv.ssm.envs.fallback = "dev" @dotenv.ssm.envs.unique = ["dev", "prod"] @dotenv.ssm.long_env_helper = false # for completeness @dotenv.ssm.long_env_name = false # helps with Jets 5 legacy @base64_encode = true # Not yet documented because the config interface may change. @git = ActiveSupport::OrderedOptions.new @git.push = ActiveSupport::OrderedOptions.new @git.push.branch = ActiveSupport::OrderedOptions.new @tips = ActiveSupport::OrderedOptions.new @tips.enable = true @tips.concurrency_change = true @tips.env_change = true @tips.faster_deploy = true @tips.remote_run = true @tips.ssm_change = true end |
Instance Attribute Details
#autoload_paths ⇒ Object
Returns the value of attribute autoload_paths.
5 6 7 |
# File 'lib/jets/core/config/project.rb', line 5 def autoload_paths @autoload_paths end |
#base64_encode ⇒ Object
Returns the value of attribute base64_encode.
5 6 7 |
# File 'lib/jets/core/config/project.rb', line 5 def base64_encode @base64_encode end |
#dotenv ⇒ Object
Returns the value of attribute dotenv.
5 6 7 |
# File 'lib/jets/core/config/project.rb', line 5 def dotenv @dotenv end |
#git ⇒ Object
Returns the value of attribute git.
5 6 7 |
# File 'lib/jets/core/config/project.rb', line 5 def git @git end |
#ignore_paths ⇒ Object
Returns the value of attribute ignore_paths.
5 6 7 |
# File 'lib/jets/core/config/project.rb', line 5 def ignore_paths @ignore_paths end |
#name ⇒ Object
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
# File 'lib/jets/core/config/project.rb', line 59 def name if ENV["JETS_PROJECT"] && !ENV["JETS_PROJECT"].blank? return ENV["JETS_PROJECT"] end # Too easy to call a method that requires the project name before Jets.boot. # Ran into this a few times. # IE: Ran into this with Jets API ping. That's no longer requires Jets.project.name # But will leave this here in case we miss Jets.boot in the future. Jets::Core::Booter.require_config(:project) return @name if @name project_name = jets_info_project_name unless project_name puts "ERROR: Jets project name not set".color(:red) abort <<~EOL Please set config.name in config/jets/project.rb or the JETS_PROJECT environment variable Example: config/jets/project.rb Jets.project.configure do config.name = "demo" end Or set the JETS_PROJECT environment variable: export JETS_PROJECT=demo EOL end end |
#tips ⇒ Object
Returns the value of attribute tips.
5 6 7 |
# File 'lib/jets/core/config/project.rb', line 5 def tips @tips end |
Instance Method Details
#all_load_paths ⇒ Object
Useful for jets rails engine Used to ignore all paths managed by Jets
116 117 118 |
# File 'lib/jets/core/config/project.rb', line 116 def all_load_paths @autoload_paths + @ignore_paths end |
#extension_paths ⇒ Object
110 111 112 |
# File 'lib/jets/core/config/project.rb', line 110 def extension_paths @autoload_paths.select { |path| path.ends_with?("/extensions") } end |
#jets_info_project_name ⇒ Object
92 93 94 95 |
# File 'lib/jets/core/config/project.rb', line 92 def jets_info_project_name info = Jets::Core::Config::Info.instance info.project_name if info.respond_to?(:project_name) end |
#name_inferred? ⇒ Boolean
97 98 99 100 |
# File 'lib/jets/core/config/project.rb', line 97 def name_inferred? name # trigger memoization !!@name_inferred end |