rama 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rama/project.rb +88 -6
- data/lib/rama/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fc36da9d18a5e58919995b1f50e9f6198a334843ad80ea61acc47a28080205a6
|
4
|
+
data.tar.gz: fd7af6fb2120659dd35e4353c3a27234e79e02ab00c403bc3a0ff3b266f19fec
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: efdf6b67971435318ab05ab74d2f69beab29132c7390b18211a596ed6d9794a5c5e6d782b2227d03acbef2b93970b98f07d5a1595f13b549f6d102b2e184b919
|
7
|
+
data.tar.gz: 4c32cd2adb03fb798ce18094795f9b68a7caf92c248a0bb8f8f23138ebb068868aa0b221412a57d7ca463f3687a261b4c0a24de97932d81138f0a66e52b1fd12
|
data/lib/rama/project.rb
CHANGED
@@ -19,9 +19,13 @@ module Rama
|
|
19
19
|
create_project_directory
|
20
20
|
create_lib_directory
|
21
21
|
create_sources_directory
|
22
|
+
create_test_directory
|
22
23
|
create_gemfile_file
|
24
|
+
create_rakefile_file
|
23
25
|
create_gitignore_file
|
24
26
|
create_module_file
|
27
|
+
create_test_file
|
28
|
+
create_readme_file
|
25
29
|
end
|
26
30
|
|
27
31
|
def create_project_directory
|
@@ -32,6 +36,10 @@ module Rama
|
|
32
36
|
FileUtils.mkdir_p("#{@directory}/lib")
|
33
37
|
end
|
34
38
|
|
39
|
+
def create_test_directory
|
40
|
+
FileUtils.mkdir_p("#{@directory}/test")
|
41
|
+
end
|
42
|
+
|
35
43
|
def create_sources_directory
|
36
44
|
FileUtils.mkdir_p("#{@directory}/lib/#{@name}")
|
37
45
|
end
|
@@ -41,8 +49,31 @@ module Rama
|
|
41
49
|
end
|
42
50
|
|
43
51
|
def gemfile_content
|
44
|
-
|
45
|
-
|
52
|
+
<<~CONTENT
|
53
|
+
# frozen_string_literal: true
|
54
|
+
|
55
|
+
source 'https://rubygems.org'
|
56
|
+
|
57
|
+
gem 'minitest'
|
58
|
+
CONTENT
|
59
|
+
end
|
60
|
+
|
61
|
+
def create_rakefile_file
|
62
|
+
File.write("#{@directory}/Rakefile", rakefile_content)
|
63
|
+
end
|
64
|
+
|
65
|
+
def rakefile_content
|
66
|
+
<<~CONTENT
|
67
|
+
# frozen_string_literal: true
|
68
|
+
|
69
|
+
require 'rake/testtask'
|
70
|
+
|
71
|
+
Rake::TestTask.new do |t|
|
72
|
+
t.libs.push('lib')
|
73
|
+
t.verbose = true
|
74
|
+
t.test_files = FileList['test/*_test.rb']
|
75
|
+
end
|
76
|
+
CONTENT
|
46
77
|
end
|
47
78
|
|
48
79
|
def create_gitignore_file
|
@@ -55,13 +86,64 @@ module Rama
|
|
55
86
|
end
|
56
87
|
|
57
88
|
def module_file_content
|
58
|
-
|
59
|
-
|
60
|
-
|
89
|
+
<<~CONTENT
|
90
|
+
# frozen_string_literal: true
|
91
|
+
|
92
|
+
module #{module_name}
|
93
|
+
class << self
|
94
|
+
def main
|
95
|
+
:ok
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
99
|
+
CONTENT
|
100
|
+
end
|
101
|
+
|
102
|
+
def create_test_file
|
103
|
+
File.write("#{@directory}/test/#{@name}_test.rb", test_file_content)
|
104
|
+
end
|
105
|
+
|
106
|
+
def test_file_content
|
107
|
+
<<~CONTENT
|
108
|
+
# frozen_string_literal: true
|
109
|
+
|
110
|
+
require 'minitest/autorun'
|
111
|
+
require '#{@name}'
|
112
|
+
|
113
|
+
class #{module_name}Test < Minitest::Test
|
114
|
+
def test_main
|
115
|
+
assert_equal(#{module_name}.main, :ok)
|
116
|
+
end
|
117
|
+
end
|
118
|
+
CONTENT
|
119
|
+
end
|
120
|
+
|
121
|
+
def create_readme_file
|
122
|
+
File.write("#{@directory}/README.md", readme_file_content)
|
123
|
+
end
|
124
|
+
|
125
|
+
def readme_file_content
|
126
|
+
<<~CONTENT
|
127
|
+
# #{@name}
|
128
|
+
|
129
|
+
## Getting Started
|
130
|
+
|
131
|
+
### Install Dependencies
|
132
|
+
|
133
|
+
``` bash
|
134
|
+
bundle install
|
135
|
+
```
|
136
|
+
|
137
|
+
### Run Tests
|
138
|
+
|
139
|
+
``` bash
|
140
|
+
rake test
|
141
|
+
```
|
142
|
+
CONTENT
|
61
143
|
end
|
62
144
|
|
63
145
|
def module_name
|
64
|
-
@name.downcase.split('_').map!(&:capitalize).join
|
146
|
+
@module_name ||= @name.downcase.split('_').map!(&:capitalize).join
|
65
147
|
end
|
66
148
|
end
|
67
149
|
end
|
data/lib/rama/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rama
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ramonsantos
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-06-
|
11
|
+
date: 2020-06-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|