buildless-app 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6e37691927afe6386fbbe83ce9e479ff306106f16af92eef485acf5b7c39f791
4
- data.tar.gz: a01031d0bf2835bcfc974184527a3c4d715b1c1753ff1167ab72d3b51dd716a6
3
+ metadata.gz: 219b856945bbbb1ac72ef8cadcb98d74e684c453671036748608628accd03b29
4
+ data.tar.gz: 74e038f78b8c93bbdf96ef6cad6b03575c0114685e29777d022eed69fd2944f0
5
5
  SHA512:
6
- metadata.gz: 86f1056a239d782c8e069f66db52b0de67260d70721861b88f604102755ebca9f7a8118e18b26f717446ef33ab95d1fe2970fac16a1be5d46d9c99976c88b076
7
- data.tar.gz: 3863c1f95ead8c3f5cfb53e285586951b4b073c58071b4d56d275bdd991553596cd3871a90a1aeda76dc500961f3598409a0499da8991f0480f146b8b4d72fa8
6
+ metadata.gz: 97c5bb077ed20824bd08acae3f45741b51181b8a21343c37e93e551527ab186ba155313da1760d34dfddb6310cec7ab9d33f7bcb9fe63b41133d34bd833b08b0
7
+ data.tar.gz: 1937ed9a6b2846316243888ce8a3fa7ded1133d245c13009618b5ac6b9a2c83fdef8183546dab3c6eb523ff37e852fc1d69a0f04c3619385f8479565f30e7029
@@ -26,6 +26,7 @@ Gem::Specification.new do |spec|
26
26
  spec.metadata['rubygems_mfa_required'] = 'true'
27
27
 
28
28
  spec.add_runtime_dependency 'rest-client', '2.1.0'
29
+ spec.add_runtime_dependency 'thor', '1.3.1'
29
30
 
30
31
  spec.required_ruby_version = '>= 3.2.2'
31
32
  end
@@ -0,0 +1,9 @@
1
+ module Buildless
2
+ class RailsApp < Thor
3
+ include Thor::Actions
4
+
5
+ def self.source_root
6
+ File.dirname(__FILE__)
7
+ end
8
+ end
9
+ end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Buildless
4
- VERSION = '0.0.4'
4
+ VERSION = '0.0.5'
5
5
  RAILS_VERSION = '7.1.3.2'
6
6
  end
data/lib/buildless-app.rb CHANGED
@@ -3,10 +3,12 @@
3
3
  require 'rest-client'
4
4
  require 'json'
5
5
  require 'fileutils'
6
+ require 'thor'
6
7
 
7
8
  require 'buildless/cli/fetch_template'
8
9
  require 'buildless/cli/processor'
9
10
  require 'buildless/version'
11
+ require 'buildless/rails_app'
10
12
 
11
13
  module Buildless
12
14
  RailsNotInstalled = Class.new(StandardError)
@@ -16,6 +18,12 @@ module Buildless
16
18
  verify_rails_installation
17
19
  generate_project(template)
18
20
  generate_files(template['files'])
21
+ run_bundle_commands(template['bundle_commands'])
22
+ clone_files(template['clones'])
23
+ inject_code(template['inject_code'])
24
+ append_code(template['append_code'])
25
+
26
+ puts 'Time for coding! 🚀'
19
27
  end
20
28
 
21
29
  private
@@ -40,5 +48,39 @@ module Buildless
40
48
  File.write(file_path, file['content'])
41
49
  end
42
50
  end
51
+
52
+ def run_bundle_commands(commands)
53
+ commands.each do |command|
54
+ system command
55
+ end
56
+ end
57
+
58
+ def inject_code(injections)
59
+ return if injections.nil? || injections.empty?
60
+
61
+ thor_app = ::Buildless::RailsApp.new
62
+
63
+ injections.each do |injection|
64
+ thor_app.inject_into_class(injection['file_path'], injection['class_name'], injection['content'])
65
+ end
66
+ end
67
+
68
+ def append_code(appends)
69
+ return if appends.nil? || appends.empty?
70
+
71
+ thor_app = ::Buildless::RailsApp.new
72
+
73
+ appends.each do |append|
74
+ thor_app.append_to_file(append['file_path'], append['content'])
75
+ end
76
+ end
77
+
78
+ def clone_files(files)
79
+ return if files.nil? || files.empty?
80
+
81
+ files.each do |file|
82
+ FileUtils.cp(file['from'], file['to'])
83
+ end
84
+ end
43
85
  end
44
86
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: buildless-app
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paweł Dąbrowski
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-03-24 00:00:00.000000000 Z
11
+ date: 2024-03-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
26
  version: 2.1.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: thor
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '='
32
+ - !ruby/object:Gem::Version
33
+ version: 1.3.1
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '='
39
+ - !ruby/object:Gem::Version
40
+ version: 1.3.1
27
41
  description: Speed up Rails app bootstraping
28
42
  email:
29
43
  - contact@paweldabrowski.com
@@ -38,6 +52,7 @@ files:
38
52
  - lib/buildless-app.rb
39
53
  - lib/buildless/cli/fetch_template.rb
40
54
  - lib/buildless/cli/processor.rb
55
+ - lib/buildless/rails_app.rb
41
56
  - lib/buildless/version.rb
42
57
  homepage: https://buildless.app
43
58
  licenses: