hobo_support 1.3.0.pre16 → 1.3.0.pre18

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/VERSION +1 -1
  2. data/lib/hobo_support/command.rb +74 -30
  3. metadata +4 -4
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.3.0.pre16
1
+ 1.3.0.pre18
@@ -10,21 +10,39 @@ module HoboSupport
10
10
  is_hobo = gem == :hobo
11
11
  puts "#{gem.to_s.capitalize} Command Line Interface #{version}"
12
12
 
13
- banner = %(
13
+ hobo_banner = %(
14
14
  Usage:
15
- hobo new <app_name> [rails_options] Creates a new Hobo Application
16
- hobo generate|g <generator> [ARGS] [options] Fires the hobo:<generator>
17
- hobo destroy <generator> [ARGS] [options] Tries to undo generated code
18
- hobo --help|-h This help screen
15
+ hobo new <app_name> [setup_opt] [rails_opt] Creates a new Hobo Application
16
+ setup_opt:
17
+ --wizard|<none> launch the setup_wizard in interactive mode
18
+ --setup launch the setup_wizard in non-interactive mode
19
+ expect you pass other setup_wizard options
20
+ --skip-setup generate only the rails infrastructure and
21
+ expect you launch the setup_wizard manually
22
+ rails_opt: all the options accepted by the rails command
23
+ )
24
+
25
+ hobofields_banner = %(
26
+ Usage:
27
+ hobofields new <app_name> [rails_opt] Creates a new HoboFields Application
28
+ )
29
+
30
+ banner = is_hobo ? hobo_banner : hobofields_banner
31
+ banner += %(
32
+ #{gem} generate|g <generator> [ARGS] [options] Fires the hobo:<generator>
33
+ #{gem} destroy <generator> [ARGS] [options] Tries to undo generated code
34
+
35
+ #{gem} --help|-h This help screen
19
36
 
20
37
  Dev Notes:
21
- Set the HOBODEV ENV variable to your local hobo git-repository path
22
- in order to use your local dev version instead of the installed gem.
38
+ Set the HOBODEV ENV variable to your local hobo git-repository path
39
+ in order to use your local dev version instead of the installed gem.
23
40
 
24
41
  )
25
42
 
26
43
  # for hobo developers only
27
44
  setup_wizard = true
45
+ default = false
28
46
 
29
47
  command = ARGV.shift
30
48
 
@@ -41,47 +59,73 @@ Dev Notes:
41
59
 
42
60
  when 'new'
43
61
  app_name = ARGV.shift
44
- if is_hobo && ARGV.first =~ /^--skip-wizard$/
45
- setup_wizard = false
46
- ARGV.shift
47
- end
48
62
  if app_name.nil?
49
63
  puts "\nThe application name is missing!\n"
50
64
  puts banner
51
65
  exit
52
66
  end
67
+ if is_hobo
68
+ setup_wizard = case ARGV.first
69
+ when /^--skip-wizard|--skip-setup$/
70
+ ARGV.shift
71
+ :skip
72
+ when /^--setup$/
73
+ ARGV.shift
74
+ :setup
75
+ when /^--wizard$/
76
+ ARGV.shift
77
+ :wizard
78
+ else
79
+ :wizard
80
+ end
81
+ end
53
82
  template_path = File.join Dir.tmpdir, "hobo_app_template"
54
83
  File.open(template_path, 'w') do |file|
55
84
  if ENV["HOBODEV"]
56
85
  dev_root = File.expand_path ENV["HOBODEV"], FileUtils.pwd
57
86
  file.puts %(
58
- $:.unshift '#{dev_root}/hobo_support/lib'
59
- gem 'hobo_support', :path => '#{dev_root}/hobo_support'
60
- gem 'hobo_fields', :path => '#{dev_root}/hobo_fields'
61
- )
87
+ $:.unshift '#{dev_root}/hobo_support/lib'
88
+ gem 'hobo_support', :path => '#{dev_root}/hobo_support'
89
+ gem 'hobo_fields', :path => '#{dev_root}/hobo_fields'
90
+ )
62
91
  if is_hobo
63
92
  file.puts %(
64
- gem 'dryml', :path => '#{dev_root}/dryml'
65
- gem 'hobo', :path => '#{dev_root}/hobo'
66
- )
93
+ gem 'dryml', :path => '#{dev_root}/dryml'
94
+ gem 'hobo', :path => '#{dev_root}/hobo'
95
+ )
67
96
  end
68
97
  else
69
- file.puts "gem '#{gem}', '>= #{version}'"
98
+ file.puts %(
99
+ gem '#{gem}', '>= #{version}'
100
+ )
70
101
  end
71
- if is_hobo && setup_wizard
102
+ if is_hobo
72
103
  file.puts %(
73
- require 'generators/hobo_support/thor_shell'
74
- extend Generators::HoboSupport::ThorShell
75
-
76
- say_title "Hobo Setup Wizard"
77
- if yes_no?("Do you want to start the Setup Wizard now?
104
+ require 'generators/hobo_support/thor_shell'
105
+ extend Generators::HoboSupport::ThorShell
106
+ )
107
+ case setup_wizard
108
+ when :setup
109
+ file.puts %(
110
+ say 'Running Setup...'
111
+ exec 'rails g hobo:setup_wizard --skip-wizard #{ARGV * ' '} '
112
+ )
113
+ when :wizard
114
+ file.puts %(
115
+ say_title "Hobo Setup Wizard"
116
+ if yes_no?("Do you want to start the Setup Wizard now?
78
117
  (Choose 'n' if you need to manually customize any file before running the Wizard.
79
118
  You can rerun it at any time with `hobo g setup_wizard` from the application root dir.)")
80
- exec 'rails g hobo:setup_wizard --no-main-title'
81
- else
82
- say "Please, remember to run `hobo g setup_wizard` from the application root dir, in order to complete the Setup.", Thor::Shell::Color::YELLOW
83
- end
84
- )
119
+ exec 'rails g hobo:setup_wizard --no-main-title'
120
+ else
121
+ say "Please, remember to run `hobo g setup_wizard` from the application root dir, in order to complete the Setup.", Thor::Shell::Color::YELLOW
122
+ end
123
+ )
124
+ when :skip
125
+ file.puts %(
126
+ say "Please, remember to run `hobo g setup_wizard` from the application root dir, in order to complete the Setup.", Thor::Shell::Color::YELLOW
127
+ )
128
+ end
85
129
  end
86
130
  end
87
131
  puts "Generating Rails infrastructure..."
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hobo_support
3
3
  version: !ruby/object:Gem::Version
4
- hash: -1637175965
4
+ hash: -1637175967
5
5
  prerelease: true
6
6
  segments:
7
7
  - 1
8
8
  - 3
9
9
  - 0
10
- - pre16
11
- version: 1.3.0.pre16
10
+ - pre18
11
+ version: 1.3.0.pre18
12
12
  platform: ruby
13
13
  authors:
14
14
  - Tom Locke
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2010-11-08 00:00:00 -04:00
19
+ date: 2010-11-19 00:00:00 -04:00
20
20
  default_executable:
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency