lib/glimmer/rake_task/scaffold.rb in glimmer-dsl-libui-0.11.5 vs lib/glimmer/rake_task/scaffold.rb in glimmer-dsl-libui-0.11.6

- old
+ new

@@ -19,11 +19,11 @@ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. require 'fileutils' require 'os' -require 'facets' +require 'facets/string/titlecase' # TODO refactor to nest under RakeTask namespace MAIN_OBJECT = self @@ -576,36 +576,11 @@ if window_type == :app custom_window_file_content += <<-MULTI_LINE_STRING before_body do @greeting = Model::Greeting.new - - menu('File') { - menu_item('Preferences...') { - on_clicked do - display_preferences_dialog - end - } - - # Enables quitting with CMD+Q on Mac with Mac Quit menu item - quit_menu_item if OS.mac? - } - menu('Help') { - if OS.mac? - about_menu_item { - on_clicked do - display_about_dialog - end - } - end - - menu_item('About') { - on_clicked do - display_about_dialog - end - } - } + menu_bar end MULTI_LINE_STRING elsif window_type == :gem custom_window_file_content += <<-MULTI_LINE_STRING before_body do @@ -667,9 +642,42 @@ custom_window_file_content += <<-MULTI_LINE_STRING } } MULTI_LINE_STRING + + if %i[app].include?(window_type) + custom_window_file_content += <<-MULTI_LINE_STRING + + def menu_bar + menu('File') { + menu_item('Preferences...') { + on_clicked do + display_preferences_dialog + end + } + + # Enables quitting with CMD+Q on Mac with Mac Quit menu item + quit_menu_item if OS.mac? + } + menu('Help') { + if OS.mac? + about_menu_item { + on_clicked do + display_about_dialog + end + } + end + + menu_item('About') { + on_clicked do + display_about_dialog + end + } + } + end + MULTI_LINE_STRING + end if %i[gem app].include?(window_type) custom_window_file_content += <<-MULTI_LINE_STRING def display_about_dialog