postmod 0.0.3 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/bin/postmod +7 -10
- data/lib/postmod/create.rb +11 -17
- data/lib/postmod/generate/action.rb +1 -1
- data/project_template/{data_store/Rakefile → Rakefile} +0 -0
- data/project_template/{data_store → db}/config.yml +0 -0
- data/project_template/{core/spec → spec/lib}/spec_helper.rb +0 -0
- metadata +5 -6
- data/project_template/core/Gemfile +0 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3844bda1c37e3f512ca1054c00b3e3bbf95edd37
|
4
|
+
data.tar.gz: 633cf298bc6ad17c8d98466eebd51cf8f555e6fd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8464504841d320f9735409b41594ea6911bd99c5abd83a68ada3fecf922f84aa293605da49e392e2482e636f4080b3530250de4b2dd2a1e070b333ac895acf41
|
7
|
+
data.tar.gz: 99680d214bea92b5a8dc0850bf003376fbbc15d5f4f5c39411340917f8f3eba8f1695cbbd86c8924313ccc16debef3129970100d95d38830dfed1ac39bf7380c
|
data/bin/postmod
CHANGED
@@ -3,19 +3,16 @@ require_relative '../lib/postmod'
|
|
3
3
|
require 'active_support/core_ext/string/inflections'
|
4
4
|
|
5
5
|
|
6
|
-
|
6
|
+
subcommand_map = {
|
7
|
+
'c' => 'create',
|
8
|
+
'gm' => 'generate/module',
|
9
|
+
'ga' => 'generate/action',
|
10
|
+
}
|
7
11
|
|
8
|
-
subcommand =
|
9
|
-
subcommand = 'generate' if subcommand == 'g'
|
10
|
-
subcommand = 'generate/module' if subcommand == 'gm'
|
11
|
-
subcommand = 'generate/action' if subcommand == 'ga'
|
12
|
+
subcommand = subcommand_map.fetch(ARGV[0], ARGV[0])
|
12
13
|
|
13
14
|
action_name = subcommand.camelize
|
14
15
|
|
15
16
|
action = "Postmod::#{action_name}".constantize
|
16
17
|
|
17
|
-
|
18
|
-
action.(ARGV[1])
|
19
|
-
else
|
20
|
-
action.()
|
21
|
-
end
|
18
|
+
action.(ARGV[1])
|
data/lib/postmod/create.rb
CHANGED
@@ -6,51 +6,45 @@ module Postmod
|
|
6
6
|
|
7
7
|
def call
|
8
8
|
create_project
|
9
|
-
|
10
|
-
create_core
|
9
|
+
create_lib
|
11
10
|
create_api
|
12
11
|
create_web
|
12
|
+
create_spec
|
13
13
|
end
|
14
14
|
|
15
15
|
private
|
16
16
|
|
17
17
|
def create_project
|
18
18
|
FileUtils.mkdir(project_path)
|
19
|
-
FileUtils.
|
20
|
-
FileUtils.cp("#{project_template_path}/Procfile", "#{project_path}/Procfile")
|
21
|
-
FileUtils.cp("#{project_template_path}/config.ru", "#{project_path}/config.ru")
|
19
|
+
FileUtils.cp_r(Dir.glob(project_template_path + "/*"), project_path)
|
22
20
|
File.write("#{project_path}/.ruby-version", '2.2.2')
|
23
21
|
end
|
24
22
|
|
25
|
-
def
|
26
|
-
|
27
|
-
end
|
28
|
-
|
29
|
-
def create_core
|
30
|
-
FileUtils.cp_r("#{project_template_path}/core", project_path)
|
31
|
-
FileUtils.mkdir("#{project_path}/core/bin")
|
32
|
-
FileUtils.mkdir("#{project_path}/core/lib")
|
33
|
-
Postmod::Generate::Module.("#{project_path}/core/lib/#{project_name}")
|
23
|
+
def create_lib
|
24
|
+
Postmod::Generate::Module.("#{project_path}/lib/#{project_name}")
|
34
25
|
end
|
35
26
|
|
36
27
|
def create_api
|
37
|
-
FileUtils.cp_r("#{project_template_path}/api", project_path)
|
38
|
-
|
39
28
|
api_file_content = File.readlines("#{project_template_path}/api/api.rb")
|
40
29
|
|
41
30
|
File.open("#{project_path}/api/api.rb", 'w') do |api_file|
|
42
|
-
api_file.puts "require_relative '../
|
31
|
+
api_file.puts "require_relative '../lib/#{project_name}'"
|
43
32
|
api_file_content.each { |line| api_file.puts line }
|
44
33
|
end
|
45
34
|
end
|
46
35
|
|
47
36
|
def create_web
|
37
|
+
FileUtils.rm_rf("#{project_path}/web")
|
48
38
|
Chaplin::New.("#{project_path}/web")
|
49
39
|
FileUtils.cp("#{project_template_path}/web/config.ru", "#{project_path}/web/config.ru")
|
50
40
|
FileUtils.cp("#{project_template_path}/web/web.rb", "#{project_path}/web/web.rb")
|
51
41
|
FileUtils.cp("#{project_template_path}/web/app.yml", "#{project_path}/web/app.yml")
|
52
42
|
end
|
53
43
|
|
44
|
+
def create_spec
|
45
|
+
FileUtils.cp_r("#{project_template_path}/spec", project_path)
|
46
|
+
end
|
47
|
+
|
54
48
|
def project_template_path
|
55
49
|
"#{__dir__}/../../project_template"
|
56
50
|
end
|
File without changes
|
File without changes
|
File without changes
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: postmod
|
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
|
- Victor Mours
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-12-
|
11
|
+
date: 2015-12-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: chaplin
|
@@ -124,13 +124,12 @@ files:
|
|
124
124
|
- lib/postmod/generate/module.rb
|
125
125
|
- project_template/Gemfile
|
126
126
|
- project_template/Procfile
|
127
|
+
- project_template/Rakefile
|
127
128
|
- project_template/api/api.rb
|
128
129
|
- project_template/api/config.ru
|
129
130
|
- project_template/config.ru
|
130
|
-
- project_template/
|
131
|
-
- project_template/
|
132
|
-
- project_template/data_store/Rakefile
|
133
|
-
- project_template/data_store/config.yml
|
131
|
+
- project_template/db/config.yml
|
132
|
+
- project_template/spec/lib/spec_helper.rb
|
134
133
|
- project_template/web/app.yml
|
135
134
|
- project_template/web/config.ru
|
136
135
|
- project_template/web/web.rb
|