lei 0.2.5 → 0.2.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/bin/_app/_root.rb +9 -5
  3. data/bin/functions.rb +4 -0
  4. data/bin/lei +33 -9
  5. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 88432e6baf81ba924cbd6854c36e7db67687bbae8868bc3d7ef0c20c8e61a396
4
- data.tar.gz: b91686862fef7821ba0eeb77535e8f6649a682fdaddd9b62abc4083bb23ea31c
3
+ metadata.gz: 28601daa4b935e989a91bb53bbb2e140bb1931ce4981b63afb167a6b65fea6ce
4
+ data.tar.gz: 67eb66caadc418b360f87a67ee101361d4af3defbd4f118482807e5c244962f4
5
5
  SHA512:
6
- metadata.gz: 8e42031363973f6bf6f9ac4f2899291616e87b716a85cd93931a2feb0b72294a9a465ae444f481660f4769adc46ee412221e5078a63d57e88fab62f4d3fa28b4
7
- data.tar.gz: 9eefaa9d7e99adcf60af755e4fa9dce2045143ff66a48e578407eb8f0d819d88b21cedb6622241c0fddfbb3bcba270b354412c41db517efaeafe8434ba8e81dd
6
+ metadata.gz: 02b9e538e962fd4412d18169286afcbe31fc4afa545bff4cf0351d32f93a8c521cd9ae9aac2871639ba33a761e72ca95ae2aa8b4a6619a8ee7e2e572731a55a6
7
+ data.tar.gz: 31eda6c8d271fc42ac7f73a3a65f4ef8a679211b0923843c83e024710a6a2b9fde5acaf843aa130da09adce6d92bc746eb1f9394585472db64207054c10b441d
@@ -76,15 +76,19 @@ customlist = <<~CUSTOMLIST
76
76
  CUSTOMLIST
77
77
 
78
78
  dockerfile = <<~DOCKERFILE
79
- FROM starefossen/ruby-node:2-10-alpine
79
+ FROM starefossen/ruby-node:2-10
80
+
81
+ RUN gem install lei
82
+
83
+ WORKDIR /Users/EMC3/Projects/test
80
84
 
81
- WORKDIR #{`pwd`}
82
85
  COPY . .
83
86
 
84
- RUN gem install bundler
85
- RUN gem install lei
87
+ RUN bundle install
88
+
89
+ EXPOSE 80
86
90
 
87
- CMD [ "lei", "install_deps" ]
91
+ CMD puma -b tcp://0.0.0.0:80
88
92
  DOCKERFILE
89
93
 
90
94
  gems = <<~GEMS
@@ -4,4 +4,8 @@ end
4
4
 
5
5
  def makeFiles(files, loc)
6
6
  files.each { |k, v| `touch #{loc}/#{k}; echo '#{v}' > #{loc}/#{k}` }
7
+ end
8
+
9
+ def dockerVersionArgIsValid(versionArg)
10
+
7
11
  end
data/bin/lei CHANGED
@@ -6,6 +6,7 @@ class Lei
6
6
  @validArg0 = [
7
7
  "content",
8
8
  "custom",
9
+ "docker_deploy",
9
10
  "help",
10
11
  "install",
11
12
  "install_deps"
@@ -15,22 +16,23 @@ class Lei
15
16
  def help
16
17
  puts <<~MAN
17
18
 
18
- Usage: lei @(content|custom|help|install) ?(ARG)
19
+ Usage: lei @(content|custom|help|install|install_deps|docker_deploy) ?(ARG) ?(ARG)
19
20
 
20
21
  `content`: Generates new serial, filterable content section with pagination. `ARG`: Content subject; should be camel-case!
21
22
  `custom`: Generates a single, new, custom page. `ARG`: Page subject.
22
23
  `help`: Get info about Lei and its commands.
23
24
  `install`: Generates a brand-new installation of Lei.
24
25
  `install_deps`: Installs dependencies only, for use with existing app.
26
+ `docker_deploy`: Builds Docker image based on Dockerfile and deploys image to your registry (requires Docker).
25
27
 
26
28
  MAN
27
29
  end
28
30
 
29
31
  def install
30
32
  require "#{@root}/_app/_root.rb"
31
-
33
+
32
34
  Dir.glob("#{@root}/_app/_*.rb").each { |f| require f }
33
-
35
+
34
36
  install_deps
35
37
  end
36
38
 
@@ -42,25 +44,47 @@ class Lei
42
44
  `chmod +x launch.sh`
43
45
  end
44
46
 
47
+ def docker_deploy
48
+ arg1 = ARGV[1]
49
+ arg2 = ARGV[2]
50
+
51
+ if !arg1.match(/\w/)
52
+ puts "Please supply project name (one word)."
53
+
54
+ return
55
+ end
56
+
57
+ if !dockerVersionArgIsValid(arg2)
58
+ puts "Invalid version format; please adhere to SemVer (Major.Minor.Patch)."
59
+
60
+ return
61
+ end
62
+
63
+ `docker build -t #{arg1}:#{arg2} .`
64
+ `docker push #{arg1}:#{arg2}`
65
+ end
66
+
45
67
  def go
46
68
  arg0 = ARGV[0]
47
-
69
+
48
70
  if !@validArg0.include?(arg0)
49
71
  puts "Invalid first argument: `#{arg0}`."
50
72
  puts "Use argument `help` to get info about Lei and its commands."
51
-
73
+
52
74
  return
53
75
  end
54
-
76
+
55
77
  case arg0
56
78
  when "install"
57
79
  install
80
+ when "install_deps"
81
+ install_deps
82
+ when "docker_deploy"
83
+ docker_deploy
58
84
  when "content", "custom"
59
85
  require "#{@root}/_new/_#{arg0}"
60
-
86
+
61
87
  add_new(ARGV[1])
62
- when "install_deps"
63
- install_deps
64
88
  when "help"
65
89
  help
66
90
  else
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lei
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.5
4
+ version: 0.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ezra Chang
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-12-22 00:00:00.000000000 Z
11
+ date: 2018-12-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler