mayday-framework 0.0.5
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 +7 -0
- data/bin/mayday +85 -0
- metadata +60 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: e581e5e5934f1ef05d5af206bd4076d5fb9a3107
|
4
|
+
data.tar.gz: 7c0b348da369a6bf2689126a9cc0278ca6d962bb
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: c0e69a1850dc3e37d9101366a367b2f76d9c4b20f4f119bb27f8088aa3492513e189e7625a2072dcd66fca5f734ffc676c39668353c70cff4db7004110e70e19
|
7
|
+
data.tar.gz: 04b82c0af7ef0cff2ef5056c8adb791fdc05c2ec147f82f54d0be8629bd00da14e698d785e4cd876acc94e9ed50012b04648209e2bf2e0d26ae56836a8f4410b
|
data/bin/mayday
ADDED
@@ -0,0 +1,85 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'fileutils'
|
4
|
+
require 'irb'
|
5
|
+
require 'active_support/inflector'
|
6
|
+
|
7
|
+
puts 'MayDay (https://github.com/Bahaika/mayday) v0.0.5'
|
8
|
+
|
9
|
+
def migration_file(name, include_create_table)
|
10
|
+
create_table = "create_table :#{name.tableize} do |t|
|
11
|
+
end"
|
12
|
+
return "class #{name} < ActiveRecord::Migration
|
13
|
+
def change
|
14
|
+
#{create_table if include_create_table}
|
15
|
+
end
|
16
|
+
end
|
17
|
+
#{name}.new.change"
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_file(name)
|
21
|
+
"require 'rack'
|
22
|
+
require 'rack/test'
|
23
|
+
Rack::Builder.parse_file('./config.ru').first
|
24
|
+
|
25
|
+
describe '#{name} Tests' do
|
26
|
+
include Rack::Test::Methods
|
27
|
+
|
28
|
+
def app
|
29
|
+
Router
|
30
|
+
end
|
31
|
+
|
32
|
+
end"
|
33
|
+
end
|
34
|
+
|
35
|
+
case ARGV[0]
|
36
|
+
when 'new'
|
37
|
+
path = ARGV[1]
|
38
|
+
puts "Creating empty MayDay project in : #{path}."
|
39
|
+
FileUtils.mkdir_p path
|
40
|
+
Dir.chdir(path) do
|
41
|
+
puts `git clone --depth=1 https://github.com/Bahaika/mayday ./`
|
42
|
+
FileUtils.rm_rf('.git')
|
43
|
+
FileUtils.rm_rf('bin')
|
44
|
+
puts 'Running bundle install...'
|
45
|
+
puts `bundle install --without production`
|
46
|
+
end
|
47
|
+
puts 'Project generated !'
|
48
|
+
puts '==================='
|
49
|
+
puts 'Thank you for using MayDay to create your JSON API !'
|
50
|
+
puts 'If you want to suggest or report a bug use GitHub : '
|
51
|
+
puts 'https://github.com/Bahaika/mayday'
|
52
|
+
when 'console'
|
53
|
+
Dir['./models/*.rb'].each do |file|
|
54
|
+
require file
|
55
|
+
end
|
56
|
+
ARGV.clear
|
57
|
+
IRB.start
|
58
|
+
when 'generate', 'g'
|
59
|
+
case ARGV[1]
|
60
|
+
when 'model', 'mo'
|
61
|
+
migration_filename = "./db/migrations/#{Time.now.to_f.to_s.gsub('.','')}_create_#{ARGV[2].underscore}.rb"
|
62
|
+
migration_content = migration_file "Create#{ARGV[2]}", true
|
63
|
+
File.write(migration_filename, migration_content)
|
64
|
+
puts "\tcreate #{migration_filename}"
|
65
|
+
model_filename = "./models/#{ARGV[2].underscore}.rb"
|
66
|
+
model_content = "class #{ARGV[2]} < ActiveRecord::Base\n\nend"
|
67
|
+
File.write(model_filename, model_content)
|
68
|
+
puts "\tcreate #{model_filename}"
|
69
|
+
when 'router', 'r'
|
70
|
+
router_filename = "./routers/#{ARGV[2].underscore}.rb"
|
71
|
+
router_content = "class Router\n\nend"
|
72
|
+
File.write(router_filename, router_content)
|
73
|
+
puts "\tcreate #{router_filename}"
|
74
|
+
when 'migration', 'mi'
|
75
|
+
migration_filename = "./db/migrations/#{Time.now.to_f.to_s.gsub('.','')}_migrate_#{ARGV[2].underscore}.rb"
|
76
|
+
migration_content = migration_file "Migrate#{ARGV[2]}", false
|
77
|
+
File.write(migration_filename, migration_content)
|
78
|
+
puts "\tcreate #{migration_filename}"
|
79
|
+
when 'test', 't'
|
80
|
+
test_filename = "./tests/#{ARGV[2].underscore}.rb"
|
81
|
+
test_content = test_file ARGV[2]
|
82
|
+
File.write(test_filename, test_content)
|
83
|
+
puts "\tcreate #{test_filename}"
|
84
|
+
end
|
85
|
+
end
|
metadata
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: mayday-framework
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.5
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Jérémy SEBAN
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-12-25 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: activesupport
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 4.2.5
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 4.2.5
|
27
|
+
description: A minimal JSON REST API framework created upon Sinatra and some Rails
|
28
|
+
components.
|
29
|
+
email: jeremy@seban.eu
|
30
|
+
executables:
|
31
|
+
- mayday
|
32
|
+
extensions: []
|
33
|
+
extra_rdoc_files: []
|
34
|
+
files:
|
35
|
+
- bin/mayday
|
36
|
+
homepage: https://github.com/Bahaika/mayday
|
37
|
+
licenses:
|
38
|
+
- GPL3
|
39
|
+
metadata: {}
|
40
|
+
post_install_message:
|
41
|
+
rdoc_options: []
|
42
|
+
require_paths:
|
43
|
+
- lib
|
44
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - ">="
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '0'
|
49
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - ">="
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
requirements: []
|
55
|
+
rubyforge_project:
|
56
|
+
rubygems_version: 2.4.5.1
|
57
|
+
signing_key:
|
58
|
+
specification_version: 4
|
59
|
+
summary: A minimal JSON REST API framework.
|
60
|
+
test_files: []
|