mayday-framework 0.0.6 → 0.0.7

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/bin/mayday +26 -15
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bebf3567ca1ec7f1eb4d775120c5cf432102bcd2
4
- data.tar.gz: 451b63fd317630083bb22d2e8f6b4d26ffb5c870
3
+ metadata.gz: 7ff4a99b65bfc3539c96ef866d7b4c78487e035a
4
+ data.tar.gz: 9909110e03c343b67125fccf8122456c3c079c21
5
5
  SHA512:
6
- metadata.gz: 792375dc43fccf3a54fc09eac7b819500679ab90af738aeab8c088f5cc7e8bd3a1923fe769b9a92c96a3d9296d857d31a8252a82e9688adf4e3c196bbd2b5ef1
7
- data.tar.gz: d5cb1ec566f7a331ea3299e4e0eb962c9bac2d59d703f6e719d5c6b5461fe68e06a46017785107ecb6c65cedd60a66878591fdc84894d67eecd1b56394f8a6c2
6
+ metadata.gz: 4a2e324043e7337cc7efcf8fb0233226cb2aa212027fda97c5929275631acdbbca87593eda2e63f411df91db358a8947e3a56b078dd50d340554e1010929c58e
7
+ data.tar.gz: a8401fd543e53eab2b398fe86137b2e49b64a1c4d5e31db93a05e3e7285680290b27d0b988955cac67ea4ca7edf0443364fc7a432ba1b831e5dde22489b0a51e
data/bin/mayday CHANGED
@@ -4,7 +4,7 @@ require 'fileutils'
4
4
  require 'irb'
5
5
  require 'active_support/inflector'
6
6
 
7
- puts 'MayDay v0.0.6'
7
+ puts 'MayDay v0.0.7'
8
8
 
9
9
  class String
10
10
  # colorization
@@ -65,6 +65,7 @@ end
65
65
 
66
66
  def puts_usage
67
67
  puts 'Usage : ' + 'COMMAND'.blue + ' ARGS...'.yellow
68
+ puts 'https://github.com/Bahaika/mayday'.light_blue
68
69
  puts "\n"
69
70
  puts ' new'.blue + ' FOLDER'.yellow + "\t" + ' : Create a new MayDay project in the specified ' + 'FOLDER'.yellow + '.'
70
71
  puts " console\t".blue + ' : Open an interactive ruby shell within the application context.'
@@ -74,6 +75,7 @@ end
74
75
 
75
76
  def puts_generator_usage
76
77
  puts 'Usage : ' + 'generate'.blue + ' TYPE'.yellow + ' NAME'.yellow
78
+ puts 'https://github.com/Bahaika/mayday'.light_blue
77
79
  puts "\n"
78
80
  puts ' model '.blue + " CamelCaseName\t\t".yellow + ' : Generate a new model based on ActiveRecord.'
79
81
  puts ' router '.blue + " CamelCaseName\t\t".yellow + ' : Generate a file to extend the router of the application.'
@@ -86,6 +88,10 @@ end
86
88
  case ARGV[0]
87
89
  when 'new', 'n'
88
90
  path = ARGV[1]
91
+ unless path
92
+ puts 'You must precise a path !'.red
93
+ exit 1
94
+ end
89
95
  puts "Creating empty MayDay project in : #{path}."
90
96
  FileUtils.mkdir_p path
91
97
  Dir.chdir(path) do
@@ -95,11 +101,11 @@ case ARGV[0]
95
101
  puts 'Running bundle install...'
96
102
  puts `bundle install --without production`
97
103
  end
98
- puts 'Project generated !'
99
- puts '==================='
100
- puts 'Thank you for using MayDay to create your JSON API !'
101
- puts 'If you want to suggest or report a bug use GitHub : '
102
- puts 'https://github.com/Bahaika/mayday'
104
+ puts 'Project generated !'.green
105
+ puts '==================='.green
106
+ puts 'Thank you for using MayDay to create your JSON API !'.light_blue
107
+ puts 'If you want to suggest or report a bug use GitHub : '.light_blue
108
+ puts 'https://github.com/Bahaika/mayday'.light_blue
103
109
  when 'console', 'c'
104
110
  Dir['./models/*.rb'].each do |file|
105
111
  require file
@@ -107,29 +113,34 @@ case ARGV[0]
107
113
  ARGV.clear
108
114
  IRB.start
109
115
  when 'generate', 'g'
116
+ name = ARGV[2]
117
+ unless name
118
+ puts 'You must precise a name !'.red
119
+ exit 1
120
+ end
110
121
  case ARGV[1]
111
122
  when 'model', 'mo'
112
- migration_filename = "./db/migrations/#{Time.now.to_f.to_s.gsub('.','')}_create_#{ARGV[2].underscore}.rb"
113
- migration_content = migration_file "Create#{ARGV[2]}", true
123
+ migration_filename = "./db/migrations/#{Time.now.to_f.to_s.gsub('.','')}_create_#{name.underscore}.rb"
124
+ migration_content = migration_file "Create#{name}", true
114
125
  File.write(migration_filename, migration_content)
115
126
  puts "\tcreate #{migration_filename}"
116
- model_filename = "./models/#{ARGV[2].underscore}.rb"
117
- model_content = "class #{ARGV[2]} < ActiveRecord::Base\n\nend"
127
+ model_filename = "./models/#{name.underscore}.rb"
128
+ model_content = "class #{name} < ActiveRecord::Base\n\nend"
118
129
  File.write(model_filename, model_content)
119
130
  puts "\tcreate #{model_filename}"
120
131
  when 'router', 'r'
121
- router_filename = "./routers/#{ARGV[2].underscore}.rb"
132
+ router_filename = "./routers/#{name.underscore}.rb"
122
133
  router_content = "class Router\n\nend"
123
134
  File.write(router_filename, router_content)
124
135
  puts "\tcreate #{router_filename}"
125
136
  when 'migration', 'mi'
126
- migration_filename = "./db/migrations/#{Time.now.to_f.to_s.gsub('.','')}_migrate_#{ARGV[2].underscore}.rb"
127
- migration_content = migration_file "Migrate#{ARGV[2]}", false
137
+ migration_filename = "./db/migrations/#{Time.now.to_f.to_s.gsub('.','')}_migrate_#{name.underscore}.rb"
138
+ migration_content = migration_file "Migrate#{name}", false
128
139
  File.write(migration_filename, migration_content)
129
140
  puts "\tcreate #{migration_filename}"
130
141
  when 'test', 't'
131
- test_filename = "./tests/#{ARGV[2].underscore}.rb"
132
- test_content = test_file ARGV[2]
142
+ test_filename = "./tests/#{name.underscore}.rb"
143
+ test_content = test_file name
133
144
  File.write(test_filename, test_content)
134
145
  puts "\tcreate #{test_filename}"
135
146
  when 'help', 'h'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mayday-framework
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jérémy SEBAN