buildless-app 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/buildless +3 -1
- data/buildless-app.gemspec +2 -0
- data/lib/buildless/cli/fetch_template.rb +18 -0
- data/lib/buildless/cli/processor.rb +37 -0
- data/lib/buildless/version.rb +2 -1
- data/lib/buildless-app.rb +34 -0
- metadata +19 -3
- data/lib/buildless.rb +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9a17ef6c2aaa7cc1e8c0c6ca0849876cc5312d7696ee8801e4bfe08922c65d02
|
4
|
+
data.tar.gz: b7883b1ec3992ca998de9346bc31e7a7e6d8288546d243600db18eeacbe8e5bd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 54cf9ba6cc10f4a29dd745187bf6b788e47efc5033f5ff98a8cf319186dce026f7a698d4ed12389c5b8a9191fff73afaf1b302fe32053079148bc205a29eb67f
|
7
|
+
data.tar.gz: f764535a632957d3e16aa6d07c97cd38847ca944b588672d505cfea782b02a3dc5866da76151ff2410f1e31be05cfb9eb27d068784cde6281bd524071d16622b
|
data/bin/buildless
CHANGED
data/buildless-app.gemspec
CHANGED
@@ -25,5 +25,7 @@ Gem::Specification.new do |spec|
|
|
25
25
|
spec.metadata['bug_tracker_uri'] = 'https://github.com/pdabrowski6/buildless/issues'
|
26
26
|
spec.metadata['rubygems_mfa_required'] = 'true'
|
27
27
|
|
28
|
+
spec.add_runtime_dependency 'rest-client', '2.1.0'
|
29
|
+
|
28
30
|
spec.required_ruby_version = '>= 3.2.2'
|
29
31
|
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Buildless
|
4
|
+
module Cli
|
5
|
+
class FetchTemplate
|
6
|
+
COMMANDS = %w[apply].freeze
|
7
|
+
API_URL = 'https://buildless.app/api/v1'
|
8
|
+
|
9
|
+
def call(uid)
|
10
|
+
response = RestClient.get(API_URL + "/configurations/#{uid}") { |res| res }
|
11
|
+
|
12
|
+
return if response.code != 200
|
13
|
+
|
14
|
+
JSON.parse(response.body)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Buildless
|
4
|
+
module Cli
|
5
|
+
class Processor
|
6
|
+
COMMANDS = %w[apply].freeze
|
7
|
+
|
8
|
+
InvalidCommand = Class.new(StandardError)
|
9
|
+
InvalidUid = Class.new(StandardError)
|
10
|
+
|
11
|
+
def initialize(args)
|
12
|
+
@command = args[0]
|
13
|
+
@uid = args[1]
|
14
|
+
end
|
15
|
+
|
16
|
+
def call
|
17
|
+
validate_command
|
18
|
+
|
19
|
+
raise InvalidUid, "Configuration not found for #{@uid}" if json_template.nil?
|
20
|
+
|
21
|
+
::Buildless.apply(json_template)
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
def validate_command
|
27
|
+
raise InvalidCommand, "command #{@command} is not supported!" unless COMMANDS.include?(@command.to_s.downcase)
|
28
|
+
end
|
29
|
+
|
30
|
+
def json_template
|
31
|
+
return @json_template if defined?(@json_template)
|
32
|
+
|
33
|
+
@json_template = ::Buildless::Cli::FetchTemplate.new.call(@uid)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
data/lib/buildless/version.rb
CHANGED
@@ -0,0 +1,34 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'rest-client'
|
4
|
+
require 'json'
|
5
|
+
require 'fileutils'
|
6
|
+
|
7
|
+
require 'buildless/cli/fetch_template'
|
8
|
+
require 'buildless/cli/processor'
|
9
|
+
require 'buildless/version'
|
10
|
+
|
11
|
+
module Buildless
|
12
|
+
RailsNotInstalled = Class.new(StandardError)
|
13
|
+
|
14
|
+
class << self
|
15
|
+
def apply(template)
|
16
|
+
verify_rails_installation
|
17
|
+
generate_project(template)
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
def verify_rails_installation
|
23
|
+
return if system("gem list ^rails$ --version #{Buildless::RAILS_VERSION} -i")
|
24
|
+
|
25
|
+
raise RailsNotInstalled, "Please install Rails #{Buildless::RAILS_VERSION} and retry"
|
26
|
+
end
|
27
|
+
|
28
|
+
def generate_project(template)
|
29
|
+
system template['installation_command']
|
30
|
+
|
31
|
+
Dir.chdir(template['name'])
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: buildless-app
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Paweł Dąbrowski
|
@@ -9,7 +9,21 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
date: 2024-03-24 00:00:00.000000000 Z
|
12
|
-
dependencies:
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rest-client
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 2.1.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 2.1.0
|
13
27
|
description: Speed up Rails app bootstraping
|
14
28
|
email:
|
15
29
|
- contact@paweldabrowski.com
|
@@ -21,7 +35,9 @@ files:
|
|
21
35
|
- README.md
|
22
36
|
- bin/buildless
|
23
37
|
- buildless-app.gemspec
|
24
|
-
- lib/buildless.rb
|
38
|
+
- lib/buildless-app.rb
|
39
|
+
- lib/buildless/cli/fetch_template.rb
|
40
|
+
- lib/buildless/cli/processor.rb
|
25
41
|
- lib/buildless/version.rb
|
26
42
|
homepage: https://buildless.app
|
27
43
|
licenses:
|
data/lib/buildless.rb
DELETED
File without changes
|