mynatra 0.1.01 → 1.0.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0066f16ee3cfbf12b70772a2233156372852a900c60a96619b9fd102a5321217
4
- data.tar.gz: 00d4f3658f68137320c75352657b4aa75568b5a7875a220fae7a46e4fc52bd4e
3
+ metadata.gz: 19e7a80d0dcb69ba9b382af5237a7328fc47599d1102ba4fa651a33925255ff4
4
+ data.tar.gz: c7dd97e562b1e0cb373c663b5a7e43e0903963d8de8d00430f5fd3126ab8a6c3
5
5
  SHA512:
6
- metadata.gz: c6c422d3880ce00fa84bba4428d8fd0380884331353cb635c650e01e1f0a1bc93a2ad04ff05fc92f5979274c026c699fc40ed770d9581ffd14919b84dfb773ec
7
- data.tar.gz: 97a756973649718912ecc8c7d02fdfba1adde3c53503890c6b2d3ccce970f6f3097cc22c27b004a02a39d90fdca0ba6eb552e44f62330643195803047a1f0b85
6
+ metadata.gz: bfb7089e9bfa0fdb6024939db31ee13500c847583c80bd288c5953d244e2dfa8980fa113b9698cd93d2847b20f7c4f16a0373d3621a1fe3499deedaa921c931f
7
+ data.tar.gz: 46deffe61b11d478b13b246a2c0832034fa4049b943565cc9f97e495006113141a2ce133480dc8a93f5ecbeac1dbd77e13da1cfd762d8011248ed9b6085739ad
data/.gitignore CHANGED
@@ -5,4 +5,6 @@
5
5
  /doc/
6
6
  /spec/reports/
7
7
  /tmp/
8
- /test/
8
+ /test/
9
+ /sqtest/
10
+ /testing/
data/Gemfile CHANGED
@@ -1,9 +1,10 @@
1
-
2
-
3
1
  source "https://rubygems.org"
4
2
 
5
3
  # Specify your gem's dependencies in mynatra.gemspec
6
4
  gemspec
7
5
 
8
6
  gem "rake", "~> 13.0"
9
- gem 'aruba', '~> 1.1.1'
7
+ gem 'aruba', '~> 1.1.1'
8
+ gem 'activerecord'
9
+ gem 'sinatra-activerecord'
10
+ gem 'sqlite3'
data/Gemfile.lock CHANGED
@@ -1,13 +1,19 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- mynatra (0.1.01)
5
- activesupport
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.19
132
+ 2.2.22
data/README.md CHANGED
@@ -1,35 +1,161 @@
1
- > **mynatra** : the quick, and simple application framework.
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
- mynatra is a quick, and simple application framework. mynatra's simple command line interface allows easy creation of Ruby resource models with attributes, views, and controllers.
5
- mynatra can be used as a simple, site generator perfect for small personal projects and tasks.
13
+ ## What is mynatra?
6
14
 
7
- ## Installation
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
- Add this line to your application's Gemfile:
18
+ mynatra's dependancies include:
10
19
 
11
20
  ```ruby
12
- gem 'mynatra'
21
+ gem "activesupport"
22
+ gem "sinatra"
23
+ gem "thor"
13
24
  ```
14
25
 
15
- And then execute:
26
+ ## Creating a Blog with Mynatra
16
27
 
17
- $ bundle install
28
+ ### 1. Create a new project
18
29
 
19
- Or install it yourself as:
30
+ Run the following line to generate a mynatra project:
20
31
 
21
- $ gem install mynatra
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
- ## Usage
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
- Install mynatra.
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
- Access commands, and help through `mynatra --help`.
152
+ The 'index' view will allow you to display all instances and select an individual point for editing.
28
153
 
29
- To generate a new mynatra project run `mynatra new [PROJECT NAME]`.
154
+ The 'edit' view allows you to manipulate the values, or delete a post.
30
155
 
31
- To add a new resource run `mynatra resource [NAME OF RESOURCE] [ARG_1] [ARG_2] [...]`.
156
+ ## Additional information
32
157
 
33
- ## Contributing
158
+ ### Contributing
34
159
 
35
- Mynatra thrives off bug reports and pull requests. Please see https://github.com/christianarab/mynatra.
160
+ Mynatra thrives off bug reports and pull requests.
161
+ Please see https://github.com/christianarab/mynatra.
data/Rakefile CHANGED
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "bundler/gem_tasks"
4
- task default: %i[]
4
+ task default: %i[]
@@ -1,8 +1,8 @@
1
1
  source "https://rubygems.org"
2
2
 
3
3
  # Specify your gem's dependencies in mynatra.gemspec
4
- gemspec
5
4
 
6
5
  gem "sinatra"
7
6
  gem "activesupport"
8
7
  gem "thor"
8
+ gem "rake"
@@ -0,0 +1,7 @@
1
+ require "sinatra/activerecord/rake"
2
+
3
+ namespace :db do
4
+ task :load_config do
5
+ require "./app"
6
+ end
7
+ end
@@ -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
  }
@@ -9,7 +9,7 @@ module Mynatra
9
9
  # Takes in dir, name arguments
10
10
  argument :name, type: :string
11
11
 
12
- # Generates empty directory
12
+ # Generates directory
13
13
  def create_dir
14
14
  empty_directory(name)
15
15
  end
@@ -1,3 +1,3 @@
1
1
  <link rel="stylesheet" href="/styles/main.css">
2
2
 
3
- <p> <%= Time.now.year %> myatra
3
+ <p> <%= Time.now.year %> mynatra </p>
@@ -4,9 +4,132 @@
4
4
 
5
5
  <section>
6
6
  <h1><%= @name_singular %></h1>
7
- <h1>Getting Started with mynatra</h1>
8
- <p>This is the home page of mynatra
9
- <p>Please come again!
10
- </section>
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&#39;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&#39;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 &lt;&lt; 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">&lt;<span class="hljs-name">h1</span>&gt;</span>New Post<span class="hljs-tag">&lt;/<span class="hljs-name">h1</span>&gt;</span>
114
+ <span class="hljs-tag">&lt;<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>&gt;</span>
115
+
116
+ <span class="hljs-tag">&lt;<span class="hljs-name">p</span>&gt;</span>title:
117
+ <span class="hljs-tag">&lt;<span class="hljs-name">input</span> <span class="hljs-attr">name</span>=<span class="hljs-string">'title'</span>&gt;</span><span class="hljs-tag">&lt;<span class="hljs-name">br</span>&gt;</span>
118
+
119
+ <span class="hljs-tag">&lt;<span class="hljs-name">p</span>&gt;</span>body:
120
+ <span class="hljs-tag">&lt;<span class="hljs-name">input</span> <span class="hljs-attr">name</span>=<span class="hljs-string">'body'</span>&gt;</span><span class="hljs-tag">&lt;<span class="hljs-name">br</span>&gt;</span>
121
+ <span class="hljs-tag">&lt;<span class="hljs-name">input</span> <span class="hljs-attr">type</span>=<span class="hljs-string">'submit'</span>&gt;</span>
122
+ ...
123
+ </code></pre>
124
+ <h3 id="3-create-an-instance-of-post-">3. Create an instance of &#39;post&#39;</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 &#39;new&#39; page/view of your post resource. You should be able to create a new instance of post with the input text for &#39;title&#39; and &#39;body&#39;.</p>
127
+ <p>The &#39;index&#39; view will allow you to display all instances and select an individual point for editing.</p>
128
+ <p>The &#39;edit&#39; 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 %>
@@ -1,5 +1,5 @@
1
1
  <link rel="stylesheet" href="/styles/main.css">
2
- gem
2
+
3
3
  <nav>
4
4
  <ul>
5
5
  <li>
@@ -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
- # desc "resource [RESOURCE_NAME] [DIRECTORY DESTINATION]", "Generate a resource"
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]", "Generate a resource with 2 arguments i.e mynatra resource post title body"
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}"
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Mynatra
4
- VERSION = "0.1.01"
4
+ VERSION = "1.0.0"
5
5
  end
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 = "Mynatra: the quick, and simple application framework."
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 "activesupport"
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.1.01
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-06-23 00:00:00.000000000 Z
11
+ date: 2021-07-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: activesupport
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: 'Mynatra: the quick, and simple application framework.'
172
+ summary: 'mynatra: the easy to use framework.'
159
173
  test_files: []
Binary file