label_weaver 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +31 -0
- data/label_weaver.gemspec +1 -3
- data/lib/label_weaver/cli/actions/develop/start.rb +6 -2
- data/lib/label_weaver/cli/actions/develop/stop.rb +4 -2
- data/lib/label_weaver/cli/shell.rb +0 -1
- data/lib/label_weaver/configuration/contract.rb +12 -4
- data/lib/label_weaver/configuration/defaults.yml +4 -0
- data/lib/label_weaver/configuration/model.rb +7 -3
- data/lib/label_weaver/container.rb +15 -6
- data/lib/label_weaver/hooks.rb +12 -0
- metadata +3 -30
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7c9548ad5700605d0b7809e4a1e7d41444728bdfdb31aefa23da2aab812bf250
|
4
|
+
data.tar.gz: 9eff12ebcc85a52eb4e46768d3a37f72a61eb9087464fcaea50bfdf731918115
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b825c71ab2b865e46af1df187f5f125ee5ec234b900e2f9e9e5df5105410cf2ee013aec6ada2ea306e8aa90362ed562d93259634a71eb4abcec60c7a1a19d00f
|
7
|
+
data.tar.gz: d04fb881bcc8ff5ad003b6fd2664bee1b0359d920d550754e95db838572857fe2c0b7eb23b20ea57669a224eb1a82b53245bb25411259a322c8aec4f5c334990
|
data/README.md
CHANGED
@@ -1,3 +1,34 @@
|
|
1
1
|
# LabelWeaver
|
2
2
|
|
3
3
|
[![Ruby Code Style](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://github.com/standardrb/standard)
|
4
|
+
[![Gem Version](https://badge.fury.io/rb/label_weaver.svg)](https://badge.fury.io/rb/label_weaver)
|
5
|
+
|
6
|
+
<!-- TOC -->
|
7
|
+
* [LabelWeaver](#labelweaver)
|
8
|
+
* [Installation](#installation)
|
9
|
+
* [Setting up a new whitelabel project](#setting-up-a-new-whitelabel-project)
|
10
|
+
* [Developing the whitelabel project](#developing-the-whitelabel-project)
|
11
|
+
* [CI Usage](#ci-usage)
|
12
|
+
<!-- TOC -->
|
13
|
+
|
14
|
+
LabelWeaver is a gem to help developing whitelabel applications of an existing code base.
|
15
|
+
|
16
|
+
It does so by automatically merging the base code into the whitelabel code, leading to only the
|
17
|
+
changed files being part of a new repository or branch.
|
18
|
+
|
19
|
+
## Installation
|
20
|
+
|
21
|
+
```bash
|
22
|
+
gem install label_weaver
|
23
|
+
```
|
24
|
+
|
25
|
+
## Setting up a new whitelabel project
|
26
|
+
|
27
|
+
|
28
|
+
## Developing a whitelabel project
|
29
|
+
|
30
|
+
### Local Development
|
31
|
+
|
32
|
+
### Diffs
|
33
|
+
|
34
|
+
## CI Usage
|
data/label_weaver.gemspec
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |spec|
|
4
4
|
spec.name = "label_weaver"
|
5
|
-
spec.version = "0.0.
|
5
|
+
spec.version = "0.0.4"
|
6
6
|
spec.authors = ["Stefan Exner"]
|
7
7
|
spec.email = ["stex@stex.codes"]
|
8
8
|
spec.homepage = "https://gitlab.com/lopo-tech/label_weaver"
|
@@ -17,10 +17,8 @@ Gem::Specification.new do |spec|
|
|
17
17
|
spec.required_ruby_version = "~> 3.3"
|
18
18
|
spec.add_dependency "cogger", "~> 0.21"
|
19
19
|
spec.add_dependency "containable", "~> 0.0"
|
20
|
-
spec.add_dependency "dry-monads", "~> 1.6"
|
21
20
|
spec.add_dependency "dry-schema", "~> 1.6"
|
22
21
|
spec.add_dependency "diffy", "~> 3.4"
|
23
|
-
spec.add_dependency "etcher", "~> 1.6"
|
24
22
|
spec.add_dependency "git", "~> 2.1.1"
|
25
23
|
spec.add_dependency "infusible", "~> 3.5"
|
26
24
|
spec.add_dependency "ruby-next-core", "~> 1.0"
|
@@ -22,8 +22,12 @@ module LabelWeaver
|
|
22
22
|
kernel.exit(1)
|
23
23
|
end
|
24
24
|
|
25
|
+
Hooks.new.run(:develop, :before_start)
|
26
|
+
|
25
27
|
repo.clone_or_update
|
26
28
|
copy_repository_files
|
29
|
+
|
30
|
+
Hooks.new.run(:develop, :after_start)
|
27
31
|
end
|
28
32
|
|
29
33
|
private
|
@@ -52,8 +56,8 @@ module LabelWeaver
|
|
52
56
|
def repo
|
53
57
|
@repo ||= LabelWeaver::TempRepo.new(
|
54
58
|
context.repository_dir,
|
55
|
-
repository_url: configuration.
|
56
|
-
branch: configuration.
|
59
|
+
repository_url: configuration.git[:repository],
|
60
|
+
branch: configuration.git[:branch],
|
57
61
|
excludes: configuration.excludes,
|
58
62
|
logger: logger
|
59
63
|
)
|
@@ -22,7 +22,9 @@ module LabelWeaver
|
|
22
22
|
kernel.exit(1)
|
23
23
|
end
|
24
24
|
|
25
|
+
Hooks.new.run(:develop, :before_stop)
|
25
26
|
remove_base_files
|
27
|
+
Hooks.new.run(:develop, :after_stop)
|
26
28
|
end
|
27
29
|
|
28
30
|
private
|
@@ -64,8 +66,8 @@ module LabelWeaver
|
|
64
66
|
def repo
|
65
67
|
@repo ||= LabelWeaver::TempRepo.new(
|
66
68
|
context.repository_dir,
|
67
|
-
repository_url: configuration.
|
68
|
-
branch: configuration.
|
69
|
+
repository_url: configuration.git[:repository],
|
70
|
+
branch: configuration.git[:branch],
|
69
71
|
excludes: configuration.excludes,
|
70
72
|
logger: logger
|
71
73
|
)
|
@@ -39,7 +39,6 @@ module LabelWeaver
|
|
39
39
|
project_root_dir: Pathname.new(Dir.pwd),
|
40
40
|
local_tmp_dir: Pathname.new(Dir.pwd).join(".config", "label_weaver"),
|
41
41
|
repository_dir: Pathname.new(Dir.pwd).join(".config", "label_weaver", "repository"),
|
42
|
-
tracking_file: Pathname.new(Dir.pwd).join(".config", "label_weaver", "files.yml"),
|
43
42
|
defaults_path:,
|
44
43
|
xdg_config:,
|
45
44
|
version_label: specification.labeled_version
|
@@ -2,14 +2,22 @@
|
|
2
2
|
|
3
3
|
require "dry/schema"
|
4
4
|
|
5
|
-
Dry::Schema.load_extensions :monads
|
6
|
-
|
7
5
|
module LabelWeaver
|
8
6
|
module Configuration
|
9
7
|
Contract = Dry::Schema.Params do
|
10
|
-
required(:
|
11
|
-
|
8
|
+
required(:git).hash do
|
9
|
+
required(:repository).filled(:string)
|
10
|
+
required(:branch).filled(:string)
|
11
|
+
end
|
12
12
|
optional(:excludes).array :string
|
13
|
+
optional(:hooks).hash do
|
14
|
+
optional(:develop).hash do
|
15
|
+
optional(:before_start).array(:string)
|
16
|
+
optional(:after_start).array(:string)
|
17
|
+
optional(:before_stop).array(:string)
|
18
|
+
optional(:after_stop).array(:string)
|
19
|
+
end
|
20
|
+
end
|
13
21
|
end
|
14
22
|
end
|
15
23
|
end
|
@@ -5,6 +5,10 @@ git:
|
|
5
5
|
# Shell filename globbing rules apply, not regular expressions
|
6
6
|
excludes:
|
7
7
|
- .git/**
|
8
|
+
hooks:
|
9
|
+
develop:
|
10
|
+
after_start:
|
11
|
+
- echo "Development Mode Started"
|
8
12
|
# Files here will be appended on whitelabel development instead of being skipped if the
|
9
13
|
# file already exists in a project
|
10
14
|
#append:
|
@@ -5,8 +5,12 @@ module LabelWeaver
|
|
5
5
|
# Defines the configuration model for use throughout the gem.
|
6
6
|
Model = Data.define(
|
7
7
|
:excludes,
|
8
|
-
:
|
9
|
-
:
|
10
|
-
)
|
8
|
+
:git,
|
9
|
+
:hooks
|
10
|
+
) do
|
11
|
+
def initialize(git:, hooks: {}, excludes: [])
|
12
|
+
super
|
13
|
+
end
|
14
|
+
end
|
11
15
|
end
|
12
16
|
end
|
@@ -2,7 +2,6 @@
|
|
2
2
|
|
3
3
|
require "cogger"
|
4
4
|
require "containable"
|
5
|
-
require "etcher"
|
6
5
|
require "runcom"
|
7
6
|
require "spek"
|
8
7
|
|
@@ -12,19 +11,29 @@ module LabelWeaver
|
|
12
11
|
extend Containable
|
13
12
|
|
14
13
|
register :configuration do
|
15
|
-
|
16
|
-
|
14
|
+
if self[:xdg_config].active
|
15
|
+
data = self[:defaults].merge(YAML.load_file(self[:xdg_config].active, symbolize_names: true))
|
16
|
+
contract = Configuration::Contract.call(**data)
|
17
|
+
|
18
|
+
raise ArgumentError.new(contract.errors.to_h) if contract.failure?
|
19
|
+
|
20
|
+
Configuration::Model.new(**data)
|
21
|
+
else
|
22
|
+
Configuration::Model.new(**self[:defaults])
|
23
|
+
end
|
17
24
|
end
|
18
25
|
|
19
26
|
register :defaults do
|
20
|
-
|
21
|
-
.add_loader(:yaml, self[:defaults_path])
|
27
|
+
YAML.load_file(self[:defaults_path], symbolize_names: true)
|
22
28
|
end
|
23
29
|
|
24
30
|
register(:specification) { Spek::Loader.call "#{__dir__}/../../label_weaver.gemspec" }
|
25
31
|
register(:defaults_path) { Pathname(__dir__).join("configuration/defaults.yml") }
|
26
32
|
register(:xdg_config) { Runcom::Config.new("label_weaver/configuration.yml") }
|
27
|
-
register(:logger)
|
33
|
+
register(:logger) do
|
34
|
+
Cogger.add_emoji :any, "🪝"
|
35
|
+
Cogger.new(id: "label_weaver")
|
36
|
+
end
|
28
37
|
register :kernel, Kernel
|
29
38
|
end
|
30
39
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: label_weaver
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stefan Exner
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-09-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cogger
|
@@ -38,20 +38,6 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0.0'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: dry-monads
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - "~>"
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '1.6'
|
48
|
-
type: :runtime
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - "~>"
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '1.6'
|
55
41
|
- !ruby/object:Gem::Dependency
|
56
42
|
name: dry-schema
|
57
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -80,20 +66,6 @@ dependencies:
|
|
80
66
|
- - "~>"
|
81
67
|
- !ruby/object:Gem::Version
|
82
68
|
version: '3.4'
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: etcher
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - "~>"
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: '1.6'
|
90
|
-
type: :runtime
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - "~>"
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: '1.6'
|
97
69
|
- !ruby/object:Gem::Dependency
|
98
70
|
name: git
|
99
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -246,6 +218,7 @@ files:
|
|
246
218
|
- lib/label_weaver/configuration/defaults.yml
|
247
219
|
- lib/label_weaver/configuration/model.rb
|
248
220
|
- lib/label_weaver/container.rb
|
221
|
+
- lib/label_weaver/hooks.rb
|
249
222
|
- lib/label_weaver/import.rb
|
250
223
|
- lib/label_weaver/temp_repo.rb
|
251
224
|
homepage: https://gitlab.com/lopo-tech/label_weaver
|