mynatra 0.1.01 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +3 -1
- data/Gemfile +4 -3
- data/Gemfile.lock +28 -3
- data/README.md +143 -17
- data/Rakefile +1 -1
- data/lib/generators/Gemfile +1 -1
- data/lib/generators/Rakefile +7 -0
- data/lib/generators/public/styles/main.css +0 -17
- data/lib/generators/scaffolding.rb +1 -1
- data/lib/generators/views/footer.erb +1 -1
- data/lib/generators/views/getting_started.erb +127 -4
- data/lib/generators/views/header.erb +1 -1
- data/lib/generators/views/resource/edit.erb +1 -1
- data/lib/generators/views/resource/new.erb +1 -1
- data/lib/mynatra/cli.rb +2 -6
- data/lib/mynatra/version.rb +1 -1
- data/mynatra.gemspec +4 -3
- metadata +19 -5
- data/pkg/mynatra-0.1.0.gem +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 19e7a80d0dcb69ba9b382af5237a7328fc47599d1102ba4fa651a33925255ff4
|
4
|
+
data.tar.gz: c7dd97e562b1e0cb373c663b5a7e43e0903963d8de8d00430f5fd3126ab8a6c3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bfb7089e9bfa0fdb6024939db31ee13500c847583c80bd288c5953d244e2dfa8980fa113b9698cd93d2847b20f7c4f16a0373d3621a1fe3499deedaa921c931f
|
7
|
+
data.tar.gz: 46deffe61b11d478b13b246a2c0832034fa4049b943565cc9f97e495006113141a2ce133480dc8a93f5ecbeac1dbd77e13da1cfd762d8011248ed9b6085739ad
|
data/.gitignore
CHANGED
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,13 +1,19 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
mynatra (0.
|
5
|
-
|
4
|
+
mynatra (1.0.0)
|
5
|
+
activerecord
|
6
|
+
sinatra-activerecord
|
6
7
|
thor
|
7
8
|
|
8
9
|
GEM
|
9
10
|
remote: https://rubygems.org/
|
10
11
|
specs:
|
12
|
+
activemodel (6.1.3.2)
|
13
|
+
activesupport (= 6.1.3.2)
|
14
|
+
activerecord (6.1.3.2)
|
15
|
+
activemodel (= 6.1.3.2)
|
16
|
+
activesupport (= 6.1.3.2)
|
11
17
|
activesupport (6.1.3.2)
|
12
18
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
13
19
|
i18n (>= 1.6, < 2)
|
@@ -66,11 +72,16 @@ GEM
|
|
66
72
|
mime-types-data (3.2021.0225)
|
67
73
|
minitest (5.14.4)
|
68
74
|
multi_test (0.1.2)
|
75
|
+
mustermann (1.1.1)
|
76
|
+
ruby2_keywords (~> 0.0.1)
|
69
77
|
protobuf-cucumber (3.10.8)
|
70
78
|
activesupport (>= 3.2)
|
71
79
|
middleware
|
72
80
|
thor
|
73
81
|
thread_safe
|
82
|
+
rack (2.2.3)
|
83
|
+
rack-protection (2.1.0)
|
84
|
+
rack
|
74
85
|
rake (13.0.3)
|
75
86
|
rspec (3.10.0)
|
76
87
|
rspec-core (~> 3.10.0)
|
@@ -85,10 +96,21 @@ GEM
|
|
85
96
|
diff-lcs (>= 1.2.0, < 2.0)
|
86
97
|
rspec-support (~> 3.10.0)
|
87
98
|
rspec-support (3.10.2)
|
99
|
+
ruby2_keywords (0.0.4)
|
100
|
+
sinatra (2.1.0)
|
101
|
+
mustermann (~> 1.0)
|
102
|
+
rack (~> 2.2)
|
103
|
+
rack-protection (= 2.1.0)
|
104
|
+
tilt (~> 2.0)
|
105
|
+
sinatra-activerecord (2.0.23)
|
106
|
+
activerecord (>= 4.1)
|
107
|
+
sinatra (>= 1.0)
|
108
|
+
sqlite3 (1.4.2)
|
88
109
|
sys-uname (1.2.2)
|
89
110
|
ffi (~> 1.1)
|
90
111
|
thor (1.1.0)
|
91
112
|
thread_safe (0.3.6)
|
113
|
+
tilt (2.0.10)
|
92
114
|
tzinfo (2.0.4)
|
93
115
|
concurrent-ruby (~> 1.0)
|
94
116
|
zeitwerk (2.4.2)
|
@@ -97,11 +119,14 @@ PLATFORMS
|
|
97
119
|
x86_64-linux
|
98
120
|
|
99
121
|
DEPENDENCIES
|
122
|
+
activerecord
|
100
123
|
aruba (~> 1.1.1)
|
101
124
|
cucumber
|
102
125
|
mynatra!
|
103
126
|
rake (~> 13.0)
|
104
127
|
rspec
|
128
|
+
sinatra-activerecord
|
129
|
+
sqlite3
|
105
130
|
|
106
131
|
BUNDLED WITH
|
107
|
-
2.2.
|
132
|
+
2.2.22
|
data/README.md
CHANGED
@@ -1,35 +1,161 @@
|
|
1
|
-
|
1
|
+
```
|
2
|
+
_|_
|
3
|
+
.--.--. . ..--. .-. | .--..-.
|
4
|
+
| | | | || |( ) | | ( )
|
5
|
+
' ' `-`--|' `-`-'`-`-'' `-'`-
|
6
|
+
;
|
7
|
+
`-'
|
8
|
+
the easy to use framework.
|
9
|
+
```
|
10
|
+
|
2
11
|
By Christian Arab, CompSci Academy Q2 Student
|
3
12
|
|
4
|
-
|
5
|
-
mynatra can be used as a simple, site generator perfect for small personal projects and tasks.
|
13
|
+
## What is mynatra?
|
6
14
|
|
7
|
-
|
15
|
+
mynatra's simple command line interface allows easy creation of Ruby resource models with attributes, views, and controllers.
|
16
|
+
mynatra can be used as a simple, site generator perfect for small personal projects and tasks.
|
8
17
|
|
9
|
-
|
18
|
+
mynatra's dependancies include:
|
10
19
|
|
11
20
|
```ruby
|
12
|
-
gem
|
21
|
+
gem "activesupport"
|
22
|
+
gem "sinatra"
|
23
|
+
gem "thor"
|
13
24
|
```
|
14
25
|
|
15
|
-
|
26
|
+
## Creating a Blog with Mynatra
|
16
27
|
|
17
|
-
|
28
|
+
### 1. Create a new project
|
18
29
|
|
19
|
-
|
30
|
+
Run the following line to generate a mynatra project:
|
20
31
|
|
21
|
-
|
32
|
+
```bash
|
33
|
+
mynatra new blog
|
34
|
+
```
|
35
|
+
This will establish a new mynatra project in teh blog directory with the following structure:
|
36
|
+
|
37
|
+
```bash
|
38
|
+
# File structure
|
39
|
+
|
40
|
+
blog
|
41
|
+
├── app.rb
|
42
|
+
├── controllers
|
43
|
+
│ └── base_controller.rb
|
44
|
+
├── public
|
45
|
+
│ ├── scripts
|
46
|
+
│ │ └── main.js
|
47
|
+
│ └── styles
|
48
|
+
│ └── main.css
|
49
|
+
└── views
|
50
|
+
├── footer.erb
|
51
|
+
├── getting_started.erb
|
52
|
+
└── header.erb
|
53
|
+
```
|
54
|
+
|
55
|
+
Start your Sinatra-based mynatra project by switching to the folder and run the following
|
56
|
+
|
57
|
+
```bash
|
58
|
+
$ ruby app.rb
|
59
|
+
```
|
60
|
+
|
61
|
+
### 2. Add blog resources to your project
|
62
|
+
|
63
|
+
To add resource models to your mynatra project.
|
64
|
+
Run the following on the working directory:
|
65
|
+
|
66
|
+
```bash
|
67
|
+
$ mynatra resource post title body
|
68
|
+
```
|
69
|
+
|
70
|
+
This line tells mynatra to generate models, controllers, and basic views for the resource of `post` with the attributes of title and body.
|
71
|
+
|
72
|
+
```bash
|
73
|
+
# File structure
|
74
|
+
|
75
|
+
blog
|
76
|
+
├── app.rb
|
77
|
+
├── controllers
|
78
|
+
│ ├── base_controller.rb
|
79
|
+
│ └── post_controller.rb
|
80
|
+
├── models
|
81
|
+
│ └── post.rb
|
82
|
+
├── public
|
83
|
+
│ ├── scripts
|
84
|
+
│ │ └── main.js
|
85
|
+
│ └── styles
|
86
|
+
│ └── main.css
|
87
|
+
└── views
|
88
|
+
├── footer.erb
|
89
|
+
├── getting_started.erb
|
90
|
+
├── header.erb
|
91
|
+
└── posts
|
92
|
+
├── edit.erb
|
93
|
+
├── index.erb
|
94
|
+
└── new.erb
|
95
|
+
```
|
96
|
+
```ruby
|
97
|
+
# blog/models/post.rb
|
98
|
+
|
99
|
+
class Post
|
100
|
+
attr_accessor :id
|
101
|
+
attr_accessor :title
|
102
|
+
attr_accessor :body
|
103
|
+
|
104
|
+
@@Posts = []
|
105
|
+
@@count = 0
|
106
|
+
|
107
|
+
def delete
|
108
|
+
@@Posts.each_with_index do |post, index|
|
109
|
+
if self.id == post.id
|
110
|
+
@@Posts.delete_at(index)
|
111
|
+
end
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
def self.create(id)
|
116
|
+
post = Post.new
|
117
|
+
post.id = id
|
118
|
+
@@Posts << post
|
119
|
+
end
|
120
|
+
|
121
|
+
def self.find_by_id(id)
|
122
|
+
@@Posts.each do |post|
|
123
|
+
if post.id == id
|
124
|
+
return post
|
125
|
+
end
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
129
|
+
...
|
130
|
+
```
|
131
|
+
```html
|
132
|
+
# blog/views/posts/new.erb
|
133
|
+
...
|
134
|
+
|
135
|
+
<h1>New Post</h1>
|
136
|
+
<form method='POST' action='/posts/create'>
|
137
|
+
|
138
|
+
<p>title:
|
139
|
+
<input name='title'><br>
|
140
|
+
|
141
|
+
<p>body:
|
142
|
+
<input name='body'><br>
|
143
|
+
<input type='submit'>
|
144
|
+
...
|
145
|
+
```
|
146
|
+
### 3. Create an instance of 'post'
|
22
147
|
|
23
|
-
|
148
|
+
Congratulations! At this point you are able to instantiate a blog post. First make sure your Sinatra server is up and running by using `ruby app.rb` in working directory.
|
24
149
|
|
25
|
-
|
150
|
+
Next navigate to the 'new' page/view of your post resource. You should be able to create a new instance of post with the input text for 'title' and 'body'.
|
26
151
|
|
27
|
-
|
152
|
+
The 'index' view will allow you to display all instances and select an individual point for editing.
|
28
153
|
|
29
|
-
|
154
|
+
The 'edit' view allows you to manipulate the values, or delete a post.
|
30
155
|
|
31
|
-
|
156
|
+
## Additional information
|
32
157
|
|
33
|
-
|
158
|
+
### Contributing
|
34
159
|
|
35
|
-
Mynatra thrives off bug reports and pull requests.
|
160
|
+
Mynatra thrives off bug reports and pull requests.
|
161
|
+
Please see https://github.com/christianarab/mynatra.
|
data/Rakefile
CHANGED
data/lib/generators/Gemfile
CHANGED
@@ -12,7 +12,6 @@ nav {
|
|
12
12
|
}
|
13
13
|
|
14
14
|
h2 {
|
15
|
-
color: Tomato;
|
16
15
|
margin: auto;
|
17
16
|
text-align: center;
|
18
17
|
padding-bottom: 30px;
|
@@ -32,25 +31,9 @@ table {
|
|
32
31
|
|
33
32
|
th {
|
34
33
|
color: white;
|
35
|
-
background-color: Tomato;
|
36
34
|
opacity: 0.5;
|
37
35
|
}
|
38
36
|
|
39
37
|
td {
|
40
38
|
padding: 05px;
|
41
|
-
}
|
42
|
-
|
43
|
-
div {
|
44
|
-
background-color: #eaeae1;
|
45
|
-
margin-left: auto;
|
46
|
-
margin-right: auto;
|
47
|
-
padding: 10px;
|
48
|
-
color: #558000;
|
49
|
-
text-align: center;
|
50
|
-
width: 50%;
|
51
|
-
}
|
52
|
-
|
53
|
-
div:nth-child(odd) {
|
54
|
-
border-style: dotted;
|
55
|
-
border-radius: 5px;
|
56
39
|
}
|
@@ -4,9 +4,132 @@
|
|
4
4
|
|
5
5
|
<section>
|
6
6
|
<h1><%= @name_singular %></h1>
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
7
|
+
<pre><code> _|<span class="hljs-string">_
|
8
|
+
.--.--. . ..--. .-. </span>|<span class="hljs-string"> .--..-.
|
9
|
+
</span>|<span class="hljs-string"> </span>|<span class="hljs-string"> </span>|<span class="hljs-string"> </span>|<span class="hljs-string"> </span>||<span class="hljs-string"> </span>|<span class="hljs-string">( ) </span>|<span class="hljs-string"> </span>|<span class="hljs-string"> ( )
|
10
|
+
' ' `-`--</span>|<span class="hljs-string">' `-`-'`-`-'' `-'`-
|
11
|
+
;
|
12
|
+
`-'
|
13
|
+
the easy to use framework. </span>
|
14
|
+
</code></pre><p>By Christian Arab, CompSci Academy Q2 Student</p>
|
15
|
+
<h2 id="what-is-mynatra-">What is mynatra?</h2>
|
16
|
+
<p>mynatra's simple command line interface allows easy creation of Ruby resource models with attributes, views, and controllers.
|
17
|
+
mynatra can be used as a simple, site generator perfect for small personal projects and tasks. </p>
|
18
|
+
<p>mynatra's dependancies include:</p>
|
19
|
+
<pre><code class="lang-ruby"><span class="hljs-attribute">gem</span> <span class="hljs-string">"sinatra"</span>
|
20
|
+
gem <span class="hljs-string">"thor"</span>
|
21
|
+
</code></pre>
|
22
|
+
<h2 id="creating-a-blog-with-mynatra">Creating a Blog with Mynatra</h2>
|
23
|
+
<h3 id="1-create-a-new-project">1. Create a new project</h3>
|
24
|
+
<p>Run the following line to generate a mynatra project:</p>
|
25
|
+
<pre><code class="lang-bash">mynatra <span class="hljs-keyword">new</span> blog
|
26
|
+
</code></pre>
|
27
|
+
<p>This will establish a new mynatra project in teh blog directory with the following structure:</p>
|
28
|
+
<pre><code class="lang-bash"># <span class="hljs-selector-tag">File</span> <span class="hljs-selector-tag">structure</span>
|
29
|
+
|
30
|
+
<span class="hljs-selector-tag">blog</span>
|
31
|
+
├── <span class="hljs-selector-tag">app</span><span class="hljs-selector-class">.rb</span>
|
32
|
+
├── <span class="hljs-selector-tag">controllers</span>
|
33
|
+
│ └── <span class="hljs-selector-tag">base_controller</span><span class="hljs-selector-class">.rb</span>
|
34
|
+
├── <span class="hljs-selector-tag">public</span>
|
35
|
+
│ ├── <span class="hljs-selector-tag">scripts</span>
|
36
|
+
│ │ └── <span class="hljs-selector-tag">main</span><span class="hljs-selector-class">.js</span>
|
37
|
+
│ └── <span class="hljs-selector-tag">styles</span>
|
38
|
+
│ └── <span class="hljs-selector-tag">main</span><span class="hljs-selector-class">.css</span>
|
39
|
+
└── <span class="hljs-selector-tag">views</span>
|
40
|
+
├── <span class="hljs-selector-tag">footer</span><span class="hljs-selector-class">.erb</span>
|
41
|
+
├── <span class="hljs-selector-tag">getting_started</span><span class="hljs-selector-class">.erb</span>
|
42
|
+
└── <span class="hljs-selector-tag">header</span><span class="hljs-selector-class">.erb</span>
|
43
|
+
</code></pre>
|
44
|
+
<p>Start your Sinatra-based mynatra project by switching to the folder and run the following </p>
|
45
|
+
<pre><code class="lang-bash"><span class="hljs-variable">$ </span>ruby app.rb
|
46
|
+
</code></pre>
|
47
|
+
<h3 id="2-add-blog-resources-to-your-project">2. Add blog resources to your project</h3>
|
48
|
+
<p>To add resource models to your mynatra project.
|
49
|
+
Run the following on the working directory:</p>
|
50
|
+
<pre><code class="lang-bash">$ mynatra resource post title <span class="hljs-keyword">body</span>
|
51
|
+
</code></pre>
|
52
|
+
<p>This line tells mynatra to generate models, controllers, and basic views for the resource of <code>post</code> with the attributes of title and body.</p>
|
53
|
+
<pre><code class="lang-bash"># <span class="hljs-selector-tag">File</span> <span class="hljs-selector-tag">structure</span>
|
54
|
+
|
55
|
+
<span class="hljs-selector-tag">blog</span>
|
56
|
+
├── <span class="hljs-selector-tag">app</span><span class="hljs-selector-class">.rb</span>
|
57
|
+
├── <span class="hljs-selector-tag">controllers</span>
|
58
|
+
│ ├── <span class="hljs-selector-tag">base_controller</span><span class="hljs-selector-class">.rb</span>
|
59
|
+
│ └── <span class="hljs-selector-tag">post_controller</span><span class="hljs-selector-class">.rb</span>
|
60
|
+
├── <span class="hljs-selector-tag">models</span>
|
61
|
+
│ └── <span class="hljs-selector-tag">post</span><span class="hljs-selector-class">.rb</span>
|
62
|
+
├── <span class="hljs-selector-tag">public</span>
|
63
|
+
│ ├── <span class="hljs-selector-tag">scripts</span>
|
64
|
+
│ │ └── <span class="hljs-selector-tag">main</span><span class="hljs-selector-class">.js</span>
|
65
|
+
│ └── <span class="hljs-selector-tag">styles</span>
|
66
|
+
│ └── <span class="hljs-selector-tag">main</span><span class="hljs-selector-class">.css</span>
|
67
|
+
└── <span class="hljs-selector-tag">views</span>
|
68
|
+
├── <span class="hljs-selector-tag">footer</span><span class="hljs-selector-class">.erb</span>
|
69
|
+
├── <span class="hljs-selector-tag">getting_started</span><span class="hljs-selector-class">.erb</span>
|
70
|
+
├── <span class="hljs-selector-tag">header</span><span class="hljs-selector-class">.erb</span>
|
71
|
+
└── <span class="hljs-selector-tag">posts</span>
|
72
|
+
├── <span class="hljs-selector-tag">edit</span><span class="hljs-selector-class">.erb</span>
|
73
|
+
├── <span class="hljs-selector-tag">index</span><span class="hljs-selector-class">.erb</span>
|
74
|
+
└── <span class="hljs-selector-tag">new</span><span class="hljs-selector-class">.erb</span>
|
75
|
+
</code></pre>
|
76
|
+
<pre><code class="lang-ruby"><span class="hljs-comment"># blog/models/post.rb</span>
|
77
|
+
|
78
|
+
<span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Post</span></span>
|
79
|
+
<span class="hljs-keyword">attr_accessor</span> <span class="hljs-symbol">:id</span>
|
80
|
+
<span class="hljs-keyword">attr_accessor</span> <span class="hljs-symbol">:title</span>
|
81
|
+
<span class="hljs-keyword">attr_accessor</span> <span class="hljs-symbol">:body</span>
|
82
|
+
|
83
|
+
@@Posts = []
|
84
|
+
@@count = <span class="hljs-number">0</span>
|
85
|
+
|
86
|
+
<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">delete</span></span>
|
87
|
+
@@Posts.each_with_index <span class="hljs-keyword">do</span> <span class="hljs-params">|post, index|</span>
|
88
|
+
<span class="hljs-keyword">if</span> <span class="hljs-keyword">self</span>.id == post.id
|
89
|
+
@@Posts.delete_at(index)
|
90
|
+
<span class="hljs-keyword">end</span>
|
91
|
+
<span class="hljs-keyword">end</span>
|
92
|
+
<span class="hljs-keyword">end</span>
|
93
|
+
|
94
|
+
<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">self</span>.<span class="hljs-title">create</span><span class="hljs-params">(id)</span></span>
|
95
|
+
post = Post.new
|
96
|
+
post.id = id
|
97
|
+
@@Posts << post
|
98
|
+
<span class="hljs-keyword">end</span>
|
99
|
+
|
100
|
+
<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">self</span>.<span class="hljs-title">find_by_id</span><span class="hljs-params">(id)</span></span>
|
101
|
+
@@Posts.each <span class="hljs-keyword">do</span> <span class="hljs-params">|post|</span>
|
102
|
+
<span class="hljs-keyword">if</span> post.id == id
|
103
|
+
<span class="hljs-keyword">return</span> post
|
104
|
+
<span class="hljs-keyword">end</span>
|
105
|
+
<span class="hljs-keyword">end</span>
|
106
|
+
<span class="hljs-keyword">end</span>
|
107
|
+
|
108
|
+
...
|
109
|
+
</code></pre>
|
110
|
+
<pre><code class="lang-html"># blog/views/posts/new.erb
|
111
|
+
...
|
112
|
+
|
113
|
+
<span class="hljs-tag"><<span class="hljs-name">h1</span>></span>New Post<span class="hljs-tag"></<span class="hljs-name">h1</span>></span>
|
114
|
+
<span class="hljs-tag"><<span class="hljs-name">form</span> <span class="hljs-attr">method</span>=<span class="hljs-string">'POST'</span> <span class="hljs-attr">action</span>=<span class="hljs-string">'/posts/create'</span>></span>
|
115
|
+
|
116
|
+
<span class="hljs-tag"><<span class="hljs-name">p</span>></span>title:
|
117
|
+
<span class="hljs-tag"><<span class="hljs-name">input</span> <span class="hljs-attr">name</span>=<span class="hljs-string">'title'</span>></span><span class="hljs-tag"><<span class="hljs-name">br</span>></span>
|
118
|
+
|
119
|
+
<span class="hljs-tag"><<span class="hljs-name">p</span>></span>body:
|
120
|
+
<span class="hljs-tag"><<span class="hljs-name">input</span> <span class="hljs-attr">name</span>=<span class="hljs-string">'body'</span>></span><span class="hljs-tag"><<span class="hljs-name">br</span>></span>
|
121
|
+
<span class="hljs-tag"><<span class="hljs-name">input</span> <span class="hljs-attr">type</span>=<span class="hljs-string">'submit'</span>></span>
|
122
|
+
...
|
123
|
+
</code></pre>
|
124
|
+
<h3 id="3-create-an-instance-of-post-">3. Create an instance of 'post'</h3>
|
125
|
+
<p>Congratulations! At this point you are able to instantiate a blog post. First make sure your Sinatra server is up and running by using <code>ruby app.rb</code> in working directory.</p>
|
126
|
+
<p>Next navigate to the 'new' page/view of your post resource. You should be able to create a new instance of post with the input text for 'title' and 'body'.</p>
|
127
|
+
<p>The 'index' view will allow you to display all instances and select an individual point for editing.</p>
|
128
|
+
<p>The 'edit' view allows you to manipulate the values, or delete a post.</p>
|
129
|
+
<h2 id="additional-information">Additional information</h2>
|
130
|
+
<h3 id="contributing">Contributing</h3>
|
131
|
+
<p>Mynatra thrives off bug reports and pull requests.
|
132
|
+
Please see <a href="https://github.com/christianarab/mynatra">https://github.com/christianarab/mynatra</a>.</p>
|
133
|
+
|
11
134
|
|
12
135
|
<%%= erb :footer %>
|
@@ -3,7 +3,7 @@
|
|
3
3
|
<div>
|
4
4
|
<form method="POST" action='/<%= @name_plural %>/update/<%%= @<%= @name_singular %>.id %>'>
|
5
5
|
<% @attributes.each do |attribute| %>
|
6
|
-
<p> <%= attribute %>
|
6
|
+
<p> <%= attribute.capitalize %> </p>
|
7
7
|
<input name="<%= attribute %>" value="<%%= @<%= @name_singular %>.<%= attribute %> %>"><br>
|
8
8
|
<% end-%>
|
9
9
|
<input type="submit">
|
@@ -4,7 +4,7 @@
|
|
4
4
|
<h1>New <%= @name_singular.capitalize %></h1>
|
5
5
|
<form method='POST' action='/<%= @name_plural %>/create'>
|
6
6
|
<% @attributes.each do |attribute| %>
|
7
|
-
<p><%= attribute %>:
|
7
|
+
<p><%= attribute.capitalize %>:
|
8
8
|
<input name='<%= attribute %>'><br>
|
9
9
|
<% end -%>
|
10
10
|
<input type='submit'>
|
data/lib/mynatra/cli.rb
CHANGED
@@ -6,16 +6,12 @@ require 'generators/resource'
|
|
6
6
|
|
7
7
|
module Mynatra
|
8
8
|
class CLI < Thor
|
9
|
-
|
10
|
-
# def resource(name, dir)
|
11
|
-
# Mynatra::Generators::Resource.start([name, dir])
|
12
|
-
# end
|
13
|
-
desc "new [NAME]", "Generate mynatra scaffolding"
|
9
|
+
desc "new [NAME]", "Generate mynatra project"
|
14
10
|
def new(name)
|
15
11
|
Mynatra::Generators::Scaffolding.start([name.singularize])
|
16
12
|
end
|
17
13
|
|
18
|
-
desc "resource [NAME] [ARG1] [ARG2]", "
|
14
|
+
desc "resource [NAME] [ARG1] [ARG2]", "Generates resources (`mynatra resource post title body`)"
|
19
15
|
def resource(name, *attributes)
|
20
16
|
puts "The arguments are: #{attributes}"
|
21
17
|
puts "Args is: #{attributes.class}"
|
data/lib/mynatra/version.rb
CHANGED
data/mynatra.gemspec
CHANGED
@@ -8,7 +8,7 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.authors = ["christian"]
|
9
9
|
spec.email = ["rewindforward@gmail.com"]
|
10
10
|
|
11
|
-
spec.summary = "
|
11
|
+
spec.summary = "mynatra: the easy to use framework."
|
12
12
|
spec.homepage = "https://github.com/christianarab/mynatra"
|
13
13
|
spec.required_ruby_version = Gem::Requirement.new(">= 2.4.0")
|
14
14
|
|
@@ -29,9 +29,10 @@ Gem::Specification.new do |spec|
|
|
29
29
|
|
30
30
|
# Uncomment to register a new dependency of your gem
|
31
31
|
# spec.add_dependency "example-gem", "~> 1.0"
|
32
|
-
spec.add_dependency "
|
32
|
+
spec.add_dependency "sinatra"
|
33
33
|
spec.add_dependency "thor"
|
34
|
-
|
34
|
+
spec.add_dependency "activesupport"
|
35
|
+
|
35
36
|
spec.add_development_dependency "rspec"
|
36
37
|
spec.add_development_dependency "cucumber"
|
37
38
|
spec.add_development_dependency "aruba"
|
metadata
CHANGED
@@ -1,17 +1,17 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mynatra
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- christian
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-07-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: sinatra
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: activesupport
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: rspec
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -111,6 +125,7 @@ files:
|
|
111
125
|
- bin/thor
|
112
126
|
- exe/mynatra
|
113
127
|
- lib/generators/Gemfile
|
128
|
+
- lib/generators/Rakefile
|
114
129
|
- lib/generators/app.erb
|
115
130
|
- lib/generators/controllers/base_controller.erb
|
116
131
|
- lib/generators/controllers/resource_controller.erb
|
@@ -130,7 +145,6 @@ files:
|
|
130
145
|
- lib/mynatra/mynatra.rb
|
131
146
|
- lib/mynatra/version.rb
|
132
147
|
- mynatra.gemspec
|
133
|
-
- pkg/mynatra-0.1.0.gem
|
134
148
|
homepage: https://github.com/christianarab/mynatra
|
135
149
|
licenses: []
|
136
150
|
metadata:
|
@@ -155,5 +169,5 @@ requirements: []
|
|
155
169
|
rubygems_version: 3.2.19
|
156
170
|
signing_key:
|
157
171
|
specification_version: 4
|
158
|
-
summary: '
|
172
|
+
summary: 'mynatra: the easy to use framework.'
|
159
173
|
test_files: []
|
data/pkg/mynatra-0.1.0.gem
DELETED
Binary file
|