coolstrap-generator 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (126) hide show
  1. data/.DS_Store +0 -0
  2. data/.gitignore +4 -0
  3. data/.rvmrc +1 -0
  4. data/Gemfile +4 -0
  5. data/Rakefile +6 -0
  6. data/bin/coolstrap +5 -0
  7. data/coolstrap-generator.gemspec +42 -0
  8. data/lib/.DS_Store +0 -0
  9. data/lib/coolstrap-generator.rb +39 -0
  10. data/lib/coolstrap-generator/.DS_Store +0 -0
  11. data/lib/coolstrap-generator/builder/middleman.rb +0 -0
  12. data/lib/coolstrap-generator/cli.rb +71 -0
  13. data/lib/coolstrap-generator/generate/project.rb +96 -0
  14. data/lib/coolstrap-generator/generate/view.rb +54 -0
  15. data/lib/coolstrap-generator/logger.rb +13 -0
  16. data/lib/coolstrap-generator/middleman/helpers.rb +176 -0
  17. data/lib/coolstrap-generator/templates/.DS_Store +0 -0
  18. data/lib/coolstrap-generator/templates/app/.DS_Store +0 -0
  19. data/lib/coolstrap-generator/templates/app/assets/.DS_Store +0 -0
  20. data/lib/coolstrap-generator/templates/app/assets/fonts/fontawesome-webfont.eot +0 -0
  21. data/lib/coolstrap-generator/templates/app/assets/fonts/fontawesome-webfont.svg +255 -0
  22. data/lib/coolstrap-generator/templates/app/assets/fonts/fontawesome-webfont.ttf +0 -0
  23. data/lib/coolstrap-generator/templates/app/assets/fonts/fontawesome-webfont.woff +0 -0
  24. data/lib/coolstrap-generator/templates/app/assets/images/.DS_Store +0 -0
  25. data/lib/coolstrap-generator/templates/app/assets/images/coolstrap/arrow-list.png +0 -0
  26. data/lib/coolstrap-generator/templates/app/assets/images/coolstrap/arrow.png +0 -0
  27. data/lib/coolstrap-generator/templates/app/assets/images/coolstrap/menu.png +0 -0
  28. data/lib/coolstrap-generator/templates/app/assets/images/coolstrap/startup/smatphone.png +0 -0
  29. data/lib/coolstrap-generator/templates/app/assets/images/coolstrap/startup/smatphone@2x.png +0 -0
  30. data/lib/coolstrap-generator/templates/app/assets/images/coolstrap/startup/tablet-landscape.png +0 -0
  31. data/lib/coolstrap-generator/templates/app/assets/images/coolstrap/startup/tablet-landscape@2x.png +0 -0
  32. data/lib/coolstrap-generator/templates/app/assets/images/coolstrap/startup/tablet-portrait.png +0 -0
  33. data/lib/coolstrap-generator/templates/app/assets/images/coolstrap/startup/tablet-portrait@2x.png +0 -0
  34. data/lib/coolstrap-generator/templates/app/assets/images/startup/smatphone.png +0 -0
  35. data/lib/coolstrap-generator/templates/app/assets/images/startup/smatphone@2x.png +0 -0
  36. data/lib/coolstrap-generator/templates/app/assets/images/startup/tablet-landscape.png +0 -0
  37. data/lib/coolstrap-generator/templates/app/assets/images/startup/tablet-landscape@2x.png +0 -0
  38. data/lib/coolstrap-generator/templates/app/assets/images/startup/tablet-portrait.png +0 -0
  39. data/lib/coolstrap-generator/templates/app/assets/images/startup/tablet-portrait@2x.png +0 -0
  40. data/lib/coolstrap-generator/templates/app/assets/javascripts/.DS_Store +0 -0
  41. data/lib/coolstrap-generator/templates/app/assets/javascripts/app.js +18 -0
  42. data/lib/coolstrap-generator/templates/app/assets/javascripts/coolstrap/_Coolstrap.App.coffee +39 -0
  43. data/lib/coolstrap-generator/templates/app/assets/javascripts/coolstrap/_Coolstrap.Console.coffee +49 -0
  44. data/lib/coolstrap-generator/templates/app/assets/javascripts/coolstrap/_Coolstrap.Constants.coffee +89 -0
  45. data/lib/coolstrap-generator/templates/app/assets/javascripts/coolstrap/_Coolstrap.js +13 -0
  46. data/lib/coolstrap-generator/templates/app/assets/javascripts/coolstrap/build/_wrap-start.js +18 -0
  47. data/lib/coolstrap-generator/templates/app/assets/javascripts/coolstrap/coolstrap-0.1.js +20 -0
  48. data/lib/coolstrap-generator/templates/app/assets/javascripts/coolstrap/coolstrap-0.1.packed.js +23 -0
  49. data/lib/coolstrap-generator/templates/app/assets/javascripts/coolstrap/fallback/_Coolstrap.Fallback.Android.coffee +53 -0
  50. data/lib/coolstrap-generator/templates/app/assets/javascripts/coolstrap/fallback/_Coolstrap.Fallback.iOS.coffee +29 -0
  51. data/lib/coolstrap-generator/templates/app/assets/javascripts/coolstrap/framework/_Coolstrap.Framework.Articles.coffee +34 -0
  52. data/lib/coolstrap-generator/templates/app/assets/javascripts/coolstrap/framework/_Coolstrap.Framework.Dialogs.coffee +33 -0
  53. data/lib/coolstrap-generator/templates/app/assets/javascripts/coolstrap/framework/_Coolstrap.Framework.Navigation.coffee +118 -0
  54. data/lib/coolstrap-generator/templates/app/assets/javascripts/coolstrap/framework/_Coolstrap.Framework.Sections.coffee +60 -0
  55. data/lib/coolstrap-generator/templates/app/assets/javascripts/coolstrap/lib/iscroll.js +1076 -0
  56. data/lib/coolstrap-generator/templates/app/assets/javascripts/coolstrap/lib/modernizr-2.5.3.js +1265 -0
  57. data/lib/coolstrap-generator/templates/app/assets/javascripts/coolstrap/lib/zepto-1.0rc1.js +1357 -0
  58. data/lib/coolstrap-generator/templates/app/assets/javascripts/coolstrap/navigate/_Coolstrap.Navigate.History.coffee +164 -0
  59. data/lib/coolstrap-generator/templates/app/assets/javascripts/coolstrap/navigate/_Coolstrap.Navigate.coffee +105 -0
  60. data/lib/coolstrap-generator/templates/app/assets/javascripts/coolstrap/plugins/_Coolstrap.Plugins.coffee +157 -0
  61. data/lib/coolstrap-generator/templates/app/assets/javascripts/coolstrap/util/_Coolstrap.Util.Core.coffee +54 -0
  62. data/lib/coolstrap-generator/templates/app/assets/javascripts/coolstrap/util/_Coolstrap.Util.Platform.coffee +89 -0
  63. data/lib/coolstrap-generator/templates/app/assets/javascripts/coolstrap/util/_Coolstrap.Util.UI.coffee +96 -0
  64. data/lib/coolstrap-generator/templates/app/assets/javascripts/coolstrap/util/_Coolstrap.Util.coffee +41 -0
  65. data/lib/coolstrap-generator/templates/app/assets/javascripts/coolstrap/view/_Coolstrap.View.Article.coffee +43 -0
  66. data/lib/coolstrap-generator/templates/app/assets/javascripts/coolstrap/view/_Coolstrap.View.Aside.coffee +65 -0
  67. data/lib/coolstrap-generator/templates/app/assets/javascripts/coolstrap/view/_Coolstrap.View.Dialog.coffee +129 -0
  68. data/lib/coolstrap-generator/templates/app/assets/javascripts/coolstrap/view/_Coolstrap.View.Scroll.coffee +191 -0
  69. data/lib/coolstrap-generator/templates/app/assets/stylesheets/.DS_Store +0 -0
  70. data/lib/coolstrap-generator/templates/app/assets/stylesheets/coolstrap/_structure.scss +8 -0
  71. data/lib/coolstrap-generator/templates/app/assets/stylesheets/coolstrap/coolstrap.css.scss +2 -0
  72. data/lib/coolstrap-generator/templates/app/assets/stylesheets/coolstrap/structure/_components.scss +5 -0
  73. data/lib/coolstrap-generator/templates/app/assets/stylesheets/coolstrap/structure/_layout.scss +4 -0
  74. data/lib/coolstrap-generator/templates/app/assets/stylesheets/coolstrap/structure/_utilities.scss +6 -0
  75. data/lib/coolstrap-generator/templates/app/assets/stylesheets/coolstrap/structure/components/_dialog.scss +122 -0
  76. data/lib/coolstrap-generator/templates/app/assets/stylesheets/coolstrap/structure/components/_formelements.scss +89 -0
  77. data/lib/coolstrap-generator/templates/app/assets/stylesheets/coolstrap/structure/components/_listview.scss +76 -0
  78. data/lib/coolstrap-generator/templates/app/assets/stylesheets/coolstrap/structure/components/_navigations.scss +192 -0
  79. data/lib/coolstrap-generator/templates/app/assets/stylesheets/coolstrap/structure/components/_tools.scss +169 -0
  80. data/lib/coolstrap-generator/templates/app/assets/stylesheets/coolstrap/structure/layout/_layers.scss +57 -0
  81. data/lib/coolstrap-generator/templates/app/assets/stylesheets/coolstrap/structure/layout/_layout.scss +62 -0
  82. data/lib/coolstrap-generator/templates/app/assets/stylesheets/coolstrap/structure/layout/_positions.scss +38 -0
  83. data/lib/coolstrap-generator/templates/app/assets/stylesheets/coolstrap/structure/layout/_transitions.scss +35 -0
  84. data/lib/coolstrap-generator/templates/app/assets/stylesheets/coolstrap/structure/utilities/_animate.scss +63 -0
  85. data/lib/coolstrap-generator/templates/app/assets/stylesheets/coolstrap/structure/utilities/_helpers.scss +82 -0
  86. data/lib/coolstrap-generator/templates/app/assets/stylesheets/coolstrap/structure/utilities/_icons.scss +336 -0
  87. data/lib/coolstrap-generator/templates/app/assets/stylesheets/coolstrap/structure/utilities/_mixins.scss +45 -0
  88. data/lib/coolstrap-generator/templates/app/assets/stylesheets/coolstrap/structure/utilities/_reset.scss +367 -0
  89. data/lib/coolstrap-generator/templates/app/assets/stylesheets/coolstrap/structure/utilities/_variables.scss +176 -0
  90. data/lib/coolstrap-generator/templates/app/assets/stylesheets/coolstrap/themes/_default.scss +255 -0
  91. data/lib/coolstrap-generator/templates/app/assets/stylesheets/coolstrap/themes/coolstrap.css.scss +164 -0
  92. data/lib/coolstrap-generator/templates/app/assets/stylesheets/customtheme.css.scss +19 -0
  93. data/lib/coolstrap-generator/templates/app/components/_formelements.html.haml +130 -0
  94. data/lib/coolstrap-generator/templates/app/components/_tabbar.html.haml +343 -0
  95. data/lib/coolstrap-generator/templates/app/components/_toolbar.html.haml +463 -0
  96. data/lib/coolstrap-generator/templates/app/components/formelements.html.haml +196 -0
  97. data/lib/coolstrap-generator/templates/app/components/listview/_complexlistavatar.html.haml.erb +77 -0
  98. data/lib/coolstrap-generator/templates/app/components/listview/_simplelist.html.haml.erb +31 -0
  99. data/lib/coolstrap-generator/templates/app/components/tabbar.html.haml.erb +16 -0
  100. data/lib/coolstrap-generator/templates/app/components/toolbar.html.haml.erb +32 -0
  101. data/lib/coolstrap-generator/templates/app/index.html.haml.erb +21 -0
  102. data/lib/coolstrap-generator/templates/app/layout.haml.erb +79 -0
  103. data/lib/coolstrap-generator/templates/app/views/.DS_Store +0 -0
  104. data/lib/coolstrap-generator/templates/app/views/_home.haml.erb +31 -0
  105. data/lib/coolstrap-generator/templates/app/views/shared/_aside_onbottom.haml +2 -0
  106. data/lib/coolstrap-generator/templates/app/views/shared/_aside_onleft.haml +56 -0
  107. data/lib/coolstrap-generator/templates/app/views/shared/_aside_onright.haml +66 -0
  108. data/lib/coolstrap-generator/templates/app/views/shared/_aside_ontop.haml +19 -0
  109. data/lib/coolstrap-generator/templates/defaults/Gemfile.erb +3 -0
  110. data/lib/coolstrap-generator/templates/defaults/LICENSE.erb +1 -0
  111. data/lib/coolstrap-generator/templates/defaults/Readme.mkd.erb +1 -0
  112. data/lib/coolstrap-generator/templates/defaults/config.erb +42 -0
  113. data/lib/coolstrap-generator/templates/defaults/gitignore.erb +2 -0
  114. data/lib/coolstrap-generator/templates/rakefile +102 -0
  115. data/lib/coolstrap-generator/templates/specs/app_spec.coffee +3 -0
  116. data/lib/coolstrap-generator/utils.rb +82 -0
  117. data/lib/coolstrap-generator/version.rb +5 -0
  118. data/readme.md +107 -0
  119. data/spec/cli/command_spec.rb +88 -0
  120. data/spec/coolstrap-generator/generate/project_spec.rb +126 -0
  121. data/spec/coolstrap-generator/generate/view_spec.rb +26 -0
  122. data/spec/coolstrap-generator/logger_spec.rb +25 -0
  123. data/spec/coolstrap-generator/middleman/helpers_spec.rb +16 -0
  124. data/spec/coolstrap-generator/utils_spec.rb +120 -0
  125. data/spec/spec_helper.rb +39 -0
  126. metadata +321 -0
@@ -0,0 +1,88 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
+
3
+ describe "Coolstrap Generator Commands" do
4
+ context "Help command:" do
5
+ context "Coolstrap help" do
6
+ it "should display the basic help for the CLI" do
7
+ response, status = capture_with_status(:stdout){ Coolstrap::Generator::CLI.start(['help']) }
8
+ status.should eql(Coolstrap::Generator::CLI::STATUS_TYPES[:success])
9
+ end
10
+ end
11
+ context "Coolstrap help invalid_task" do
12
+ it "should display appropriate error message" do
13
+ response, status = capture_with_status(:stderr){ Coolstrap::Generator::CLI.start(['help', 'blah']) }
14
+ response.should eql("Could not find task \"blah\".\n")
15
+ status.should eql(Coolstrap::Generator::CLI::STATUS_TYPES[:success])
16
+ end
17
+ end
18
+ end
19
+ context "Info command:" do
20
+ context "Coolstrap info" do
21
+ it "should display the version" do
22
+ response, status = capture_with_status(:stdout){ Coolstrap::Generator::CLI.start(['info']) }
23
+ response.should eql("Version #{::Coolstrap::Generator::VERSION}\n")
24
+ status.should eql(Coolstrap::Generator::CLI::STATUS_TYPES[:success])
25
+ end
26
+ end
27
+ context "Coolstrap -v (alias)" do
28
+ it "should display the version" do
29
+ response, status = capture_with_status(:stdout){ Coolstrap::Generator::CLI.start(['-v']) }
30
+ response.should eql("Version #{::Coolstrap::Generator::VERSION}\n")
31
+ status.should eql(Coolstrap::Generator::CLI::STATUS_TYPES[:success])
32
+ end
33
+ end
34
+ context "Coolstrap --version (alias)" do
35
+ it "should display the version" do
36
+ response, status = capture_with_status(:stdout){ Coolstrap::Generator::CLI.start(['--version']) }
37
+ response.should eql("Version #{::Coolstrap::Generator::VERSION}\n")
38
+ status.should eql(Coolstrap::Generator::CLI::STATUS_TYPES[:success])
39
+ end
40
+ end
41
+ end
42
+ context "New command: " do
43
+ context "Help (Coolstrap help new)" do
44
+ it "should display help for the task 'new'" do
45
+ response, status = capture_with_status(:stdout){ Coolstrap::Generator::CLI.start(['help', 'new']) }
46
+ status.should eql(Coolstrap::Generator::CLI::STATUS_TYPES[:success])
47
+ end
48
+ end
49
+ context "Generate a new project: " do
50
+ context "with no name (Coolstrap new)" do
51
+ it "should exit with error" do
52
+ response, status = capture_with_status(:stderr){ Coolstrap::Generator::CLI.start(['new']) }
53
+ response.should eql("\"new\" was called incorrectly. Call as \"rspec new <name> <id> <platform>\".\n")
54
+ end
55
+ end
56
+ context "with custom name (Coolstrap new Demo)" do
57
+ it "should generate new project \"Demo\"" do
58
+ response, status = capture_with_status(:stdout){ Coolstrap::Generator::CLI.start(['new', 'Demo']) }
59
+ #response.should eql("\n\n\e]0;~/Workspace/ruby/Ti\aCreated iphone application project\n\n\n\e]0;~/Workspace/ruby/Ti\a\e]0;~/Workspace/ruby/Ti\a\e]0;~/Workspace/ruby/Ti\a\n\e[1m\e[32mCreating the tmp directory.\e[0m\e[0m\n\e[1m\e[32mRemoving README file.\e[0m\e[0m\n\e[1m\e[32mRemoving Resources directory.\e[0m\e[0m\n\e[1m\e[32mCreating the Resources directory.\e[0m\e[0m\n\e[1m\e[32mCreating the Resources/images directory.\e[0m\e[0m\n\e[1m\e[32mCreating the Resources/vendor directory.\e[0m\e[0m\n\e[1m\e[32mCreating the config directory.\e[0m\e[0m\n\e[1m\e[32mCreating the docs directory.\e[0m\e[0m\n\e[1m\e[32mCreating the app/demo/models directory.\e[0m\e[0m\n\e[1m\e[32mCreating the app/demo/helpers directory.\e[0m\e[0m\n\e[1m\e[32mCreating the app/demo/views directory.\e[0m\e[0m\n\e[1m\e[32mCreating the app/demo/stylesheets directory.\e[0m\e[0m\n\e[1m\e[32mCreating the app/demo/stylesheets/partials directory.\e[0m\e[0m\n\e[1m\e[32mCreating the spec/models directory.\e[0m\e[0m\n\e[1m\e[32mCreating the spec/views directory.\e[0m\e[0m\n\e[1m\e[32mCreating the spec/helpers directory.\e[0m\e[0m\n\e[1m\e[32mCreating spec/app_spec.coffee\e[0m\e[0m\n\e[1m\e[32mCreating app/demo/stylesheets/app.sass\e[0m\e[0m\n\e[1m\e[32mYour Titanium project is ready for you to get coding!\e[0m\e[0m\n")
60
+ status.should eql(Coolstrap::Generator::CLI::STATUS_TYPES[:success])
61
+ end
62
+ after (:all) do
63
+ remove_directories("Demo")
64
+ end
65
+ end
66
+ context "with custom name and id (ti new Demo com.mycompany.demo)" do
67
+ it "should generate new project \"Demo\" with id \"com.mycompany.demo\"" do
68
+ response, status = capture_with_status(:stdout){ Coolstrap::Generator::CLI.start(['new', 'Demo', 'com.mycompany.demo']) }
69
+ #response.should eql("\n\n\e]0;~/Workspace/ruby/Ti\aCreated iphone application project\n\n\n\e]0;~/Workspace/ruby/Ti\a\e]0;~/Workspace/ruby/Ti\a\e]0;~/Workspace/ruby/Ti\a\n\e[1m\e[32mCreating the tmp directory.\e[0m\e[0m\n\e[1m\e[32mRemoving README file.\e[0m\e[0m\n\e[1m\e[32mRemoving Resources directory.\e[0m\e[0m\n\e[1m\e[32mCreating the Resources directory.\e[0m\e[0m\n\e[1m\e[32mCreating the Resources/images directory.\e[0m\e[0m\n\e[1m\e[32mCreating the Resources/vendor directory.\e[0m\e[0m\n\e[1m\e[32mCreating the config directory.\e[0m\e[0m\n\e[1m\e[32mCreating the docs directory.\e[0m\e[0m\n\e[1m\e[32mCreating the app/demo/models directory.\e[0m\e[0m\n\e[1m\e[32mCreating the app/demo/helpers directory.\e[0m\e[0m\n\e[1m\e[32mCreating the app/demo/views directory.\e[0m\e[0m\n\e[1m\e[32mCreating the app/demo/stylesheets directory.\e[0m\e[0m\n\e[1m\e[32mCreating the app/demo/stylesheets/partials directory.\e[0m\e[0m\n\e[1m\e[32mCreating the spec/models directory.\e[0m\e[0m\n\e[1m\e[32mCreating the spec/views directory.\e[0m\e[0m\n\e[1m\e[32mCreating the spec/helpers directory.\e[0m\e[0m\n\e[1m\e[32mCreating spec/app_spec.coffee\e[0m\e[0m\n\e[1m\e[32mCreating app/demo/stylesheets/app.sass\e[0m\e[0m\n\e[1m\e[32mYour Titanium project is ready for you to get coding!\e[0m\e[0m\n")
70
+ status.should eql(Coolstrap::Generator::CLI::STATUS_TYPES[:success])
71
+ end
72
+ after (:all) do
73
+ remove_directories("Demo")
74
+ end
75
+ end
76
+ context "with custom name, id and platform (Coolstrap new Demo com.mycompany.demo ipad)" do
77
+ it "should generate new project \"Demo\" with id \"com.mycompany.demo\" and for platform \"ipad\"" do
78
+ response, status = capture_with_status(:stdout){ Coolstrap::Generator::CLI.start(['new', 'Demo', 'com.mycompany.demo']) }
79
+ #response.should eql("\n\n\e]0;~/Workspace/ruby/Ti\aCreated iphone application project\n\n\n\e]0;~/Workspace/ruby/Ti\a\e]0;~/Workspace/ruby/Ti\a\e]0;~/Workspace/ruby/Ti\a\n\e[1m\e[32mCreating the tmp directory.\e[0m\e[0m\n\e[1m\e[32mRemoving README file.\e[0m\e[0m\n\e[1m\e[32mRemoving Resources directory.\e[0m\e[0m\n\e[1m\e[32mCreating the Resources directory.\e[0m\e[0m\n\e[1m\e[32mCreating the Resources/images directory.\e[0m\e[0m\n\e[1m\e[32mCreating the Resources/vendor directory.\e[0m\e[0m\n\e[1m\e[32mCreating the config directory.\e[0m\e[0m\n\e[1m\e[32mCreating the docs directory.\e[0m\e[0m\n\e[1m\e[32mCreating the app/demo/models directory.\e[0m\e[0m\n\e[1m\e[32mCreating the app/demo/helpers directory.\e[0m\e[0m\n\e[1m\e[32mCreating the app/demo/views directory.\e[0m\e[0m\n\e[1m\e[32mCreating the app/demo/stylesheets directory.\e[0m\e[0m\n\e[1m\e[32mCreating the app/demo/stylesheets/partials directory.\e[0m\e[0m\n\e[1m\e[32mCreating the spec/models directory.\e[0m\e[0m\n\e[1m\e[32mCreating the spec/views directory.\e[0m\e[0m\n\e[1m\e[32mCreating the spec/helpers directory.\e[0m\e[0m\n\e[1m\e[32mCreating spec/app_spec.coffee\e[0m\e[0m\n\e[1m\e[32mCreating app/demo/stylesheets/app.sass\e[0m\e[0m\n\e[1m\e[32mYour Titanium project is ready for you to get coding!\e[0m\e[0m\n")
80
+ status.should eql(Coolstrap::Generator::CLI::STATUS_TYPES[:success])
81
+ end
82
+ after (:all) do
83
+ remove_directories("Demo")
84
+ end
85
+ end
86
+ end
87
+ end
88
+ end
@@ -0,0 +1,126 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
2
+
3
+ describe "Creating of a new Coolstrap Project" do
4
+ before(:all) do
5
+ ::Coolstrap::Generator::Generate::Project.create('dailyfocus', 'org.codewranglers.demo', 'ipad')
6
+ end
7
+
8
+ context "Directories should be created" do
9
+
10
+ it "should have created the project" do
11
+ File.directory?("dailyfocus").should be_true
12
+ end
13
+
14
+ it "should have an app directory" do
15
+ File.directory?("dailyfocus/source").should be_true
16
+ end
17
+
18
+ it "should have a assets directory" do
19
+ File.directory?("dailyfocus/source/assets").should be_true
20
+ end
21
+
22
+ it "should have a docs directory" do
23
+ File.directory?("dailyfocus/docs").should be_true
24
+ end
25
+
26
+ it "should have a specs directory" do
27
+ File.directory?("dailyfocus/spec").should be_true
28
+ end
29
+
30
+ it "should have a tmp directory" do
31
+ File.directory?("dailyfocus/tmp").should be_true
32
+ end
33
+ end
34
+
35
+ context "Top tier files should be created" do
36
+
37
+ it "should have created the LICENSE" do
38
+ File.exists?("dailyfocus/LICENSE").should be_true
39
+ end
40
+
41
+ it "should have created the config file" do
42
+ File.exists?("dailyfocus/config.rb").should be_true
43
+ end
44
+
45
+ it "should have created the Readme.mkd" do
46
+ File.exists?("dailyfocus/Readme.mkd").should be_true
47
+ end
48
+
49
+ it "should have created the Gemfile" do
50
+ File.exists?("dailyfocus/Gemfile").should be_true
51
+ end
52
+ end
53
+
54
+ context "Inside the source directory" do
55
+
56
+
57
+ it "should have created the models directory" do
58
+ File.directory?("dailyfocus/source/models").should be_true
59
+ end
60
+
61
+ it "should have created the stylesheets directory" do
62
+ File.directory?("dailyfocus/source/assets/stylesheets").should be_true
63
+ end
64
+
65
+ it "should have created the javascripts directory" do
66
+ File.directory?("dailyfocus/source/assets/javascripts").should be_true
67
+ end
68
+
69
+ it "should have created the images directory" do
70
+ File.directory?("dailyfocus/source/assets/images").should be_true
71
+ end
72
+
73
+ it "should have created the fonts directory" do
74
+ File.directory?("dailyfocus/source/assets/fonts").should be_true
75
+ end
76
+
77
+ it "should have created the views directory" do
78
+ File.directory?("dailyfocus/source/views").should be_true
79
+ end
80
+ end
81
+
82
+ context "Inside the Resources directory" do
83
+
84
+ it "should have created the images directory" do
85
+ pending
86
+ File.directory?("dailyfocus/Resources/images").should be_true
87
+ end
88
+
89
+ it "should have created the vendor directory" do
90
+ pending
91
+ File.directory?("dailyfocus/Resources/vendor").should be_true
92
+ end
93
+
94
+ it "should have created the KS_nav_ui.png within the images directory" do
95
+ pending
96
+ File.exists?("dailyfocus/Resources/images/KS_nav_ui.png").should be_true
97
+ end
98
+
99
+ it "should have created the KS_nav_views.png within the images directory" do
100
+ pending
101
+ File.exists?("dailyfocus/Resources/images/KS_nav_views.png").should be_true
102
+ end
103
+ end
104
+
105
+ context "Inside the specs directory" do
106
+ it "should have created the app_spec.coffee file" do
107
+ pending
108
+ File.exists?("dailyfocus/spec/app_spec.coffee").should be_true
109
+ end
110
+
111
+ it "should have created the models directory" do
112
+ pending
113
+ File.directory?("dailyfocus/spec/models").should be_true
114
+ end
115
+
116
+ it "should have created the views directory" do
117
+ pending
118
+ File.directory?("dailyfocus/spec/views").should be_true
119
+ end
120
+
121
+ end
122
+
123
+ after(:all) do
124
+ remove_directories('dailyfocus')
125
+ end
126
+ end
@@ -0,0 +1,26 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
2
+
3
+ describe "Creating of a view file" do
4
+ before(:all) do
5
+ ::Coolstrap::Generator::Generate::Project.create('dailyfocus', 'org.codewranglers.demo', 'ipad')
6
+ end
7
+
8
+ context "Creating a view file and its spec" do
9
+ before(:each) do
10
+ system("cd dailyfocus && coolstrap g view user")
11
+ end
12
+
13
+ it "should have created the view within the source/views directory" do
14
+ File.exists?("dailyfocus/source/views/_user.haml").should be_true
15
+ end
16
+
17
+ it "should have created the view coffee-script within the spec/views directory" do
18
+ pending
19
+ # File.exists?("spec/views/user_spec.coffee").should be_true
20
+ end
21
+ end
22
+
23
+ after(:all) do
24
+ remove_directories('dailyfocus', 'app', 'spec/views')
25
+ end
26
+ end
@@ -0,0 +1,25 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
+
3
+ describe "The Logger" do
4
+ before(:each) do
5
+ @stdout_orig = $stdout
6
+ $stdout = StringIO.new
7
+
8
+ @stderr_orig = $stderr
9
+ $stderr = StringIO.new
10
+ end
11
+
12
+ context "Reporting an error" do
13
+ it "should output a formatted message with a red color" do
14
+ Coolstrap::Generator::Logger.error("This is failing.")
15
+ $stderr.string.should == "\e[1m\e[31mThis is failing.\e[0m\e[0m\n"
16
+ end
17
+ end
18
+
19
+ context "Reporting back a success" do
20
+ it "should output a formatted message with a green color" do
21
+ Coolstrap::Generator::Logger.report("This is a success.")
22
+ $stdout.string.should == "\e[1m\e[32mThis is a success.\e[0m\e[0m\n"
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,16 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
2
+
3
+ require "middleman"
4
+ require "coolstrap-generator/middleman/helpers"
5
+
6
+ describe "Middleman Helpers" do
7
+
8
+ before(:each) do
9
+
10
+ end
11
+
12
+ it "should return the base location" do
13
+
14
+ end
15
+
16
+ end
@@ -0,0 +1,120 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
+
3
+ describe "The utilities" do
4
+
5
+ before(:each) do
6
+ class Klass
7
+ class << self
8
+ include ::Coolstrap::Generator::Utils
9
+ end
10
+ end
11
+ end
12
+
13
+ it "should return the base location" do
14
+ Klass.base_location.should == Pathname.new(Dir.pwd)
15
+ end
16
+
17
+ it "should have the base location alias, location return the base location" do
18
+ Klass.location.should == Pathname.new(Dir.pwd)
19
+ end
20
+
21
+ context "Creating new files and deleting them" do
22
+ it "should create a new file" do
23
+ Klass.create_new_file("DEMO")
24
+ File.exists?(Pathname.new(Dir.pwd).join("DEMO")).should be_true
25
+ end
26
+
27
+ it "should delete the new file" do
28
+ Klass.remove_files("DEMO")
29
+ File.exists?(Pathname.new(Dir.pwd).join("DEMO")).should be_false
30
+ end
31
+
32
+ after(:all) do
33
+ remove_directories("DEMO")
34
+ end
35
+ end
36
+
37
+ context "Touching files into existence like no one has touched a file before" do
38
+ it "should come alive!!" do
39
+ Klass.touch("File", "into", "existence")
40
+ File.exists?(Pathname.new(Dir.pwd).join("File")).should be_true
41
+ File.exists?(Pathname.new(Dir.pwd).join("into")).should be_true
42
+ File.exists?(Pathname.new(Dir.pwd).join("existence")).should be_true
43
+ end
44
+
45
+ after(:all) do
46
+ remove_directories("File", "into", "existence")
47
+ end
48
+ end
49
+
50
+ # context "Creating Model Files and their spec files" do
51
+ # it "should create the model directory" do
52
+ # Klass.create_model_file("user")
53
+ # File.directory?(Pathname.new(Dir.pwd).join("app/models")).should be_true
54
+ # File.exists?(Pathname.new(Dir.pwd).join("app/models/user.coffee")).should be_true
55
+ # File.exists?(Pathname.new(Dir.pwd).join("spec/models/user_spec.coffee")).should be_true
56
+ # end
57
+ #
58
+ # after(:all) do
59
+ # remove_directories('app', 'spec/views', 'spec/models')
60
+ # end
61
+ # end
62
+ #
63
+ # context "Creating View Files and their spec files" do
64
+ # it "should create the model directory" do
65
+ # Klass.create_view_file("user")
66
+ # File.directory?(Pathname.new(Dir.pwd).join("app/views")).should be_true
67
+ # File.exists?(Pathname.new(Dir.pwd).join("app/views/user.coffee")).should be_true
68
+ # File.exists?(Pathname.new(Dir.pwd).join("spec/views/user_spec.coffee")).should be_true
69
+ # end
70
+ #
71
+ # after(:all) do
72
+ # remove_directories('app', 'spec/views', 'spec/models')
73
+ # end
74
+ # end
75
+
76
+ context "Creating and deleting directories" do
77
+ it "should create some directories" do
78
+ Klass.create_directories("Dude", "looks", "like", "a", "lady")
79
+ File.exists?(Pathname.new(Dir.pwd).join("Dude")).should be_true
80
+ File.exists?(Pathname.new(Dir.pwd).join("looks")).should be_true
81
+ File.exists?(Pathname.new(Dir.pwd).join("like")).should be_true
82
+ File.exists?(Pathname.new(Dir.pwd).join("a")).should be_true
83
+ File.exists?(Pathname.new(Dir.pwd).join("lady")).should be_true
84
+ end
85
+
86
+ it "should delete the created directories" do
87
+ Klass.remove_directories("Dude", "looks", "like", "a", "lady")
88
+ File.exists?(Pathname.new(Dir.pwd).join("Dude")).should be_false
89
+ File.exists?(Pathname.new(Dir.pwd).join("looks")).should be_false
90
+ File.exists?(Pathname.new(Dir.pwd).join("like")).should be_false
91
+ File.exists?(Pathname.new(Dir.pwd).join("a")).should be_false
92
+ File.exists?(Pathname.new(Dir.pwd).join("lady")).should be_false
93
+ end
94
+
95
+ after(:all) do
96
+ remove_directories("Dude", "looks", "like", "a", "lady")
97
+ end
98
+ end
99
+
100
+ context "Test the Utils logging" do
101
+ before(:each) do
102
+ @stdout_orig = $stdout
103
+ $stdout = StringIO.new
104
+
105
+ @stderr_orig = $stderr
106
+ $stderr = StringIO.new
107
+ end
108
+
109
+ it "should log the error" do
110
+ Klass.error("Failed")
111
+ $stderr.string.should == "\e[1m\e[31mFailed\e[0m\e[0m\n"
112
+ end
113
+
114
+ it "should log the success" do
115
+ Klass.log("Success")
116
+ $stdout.string.should == "\e[1m\e[32mSuccess\e[0m\e[0m\n"
117
+ end
118
+ end
119
+
120
+ end
@@ -0,0 +1,39 @@
1
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib', 'ti'))
2
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
3
+ require 'rspec'
4
+ require 'coolstrap-generator'
5
+ require 'stringio'
6
+ #require 'config'
7
+
8
+ RSpec.configure do |config|
9
+
10
+ def capture_with_status(stream)
11
+ exit_status = 0
12
+ begin
13
+ stream = stream.to_s
14
+ eval "$#{stream} = StringIO.new"
15
+ begin
16
+ yield
17
+ rescue SystemExit => system_exit # catch any exit calls
18
+ exit_status = system_exit.status
19
+ end
20
+ result = eval("$#{stream}").string
21
+ ensure
22
+ eval("$#{stream} = #{stream.upcase}")
23
+ end
24
+ return result, exit_status
25
+ end
26
+
27
+ def remove_directories(*names)
28
+ project_dir = Pathname.new(Dir.pwd)
29
+ names.each do |name|
30
+ FileUtils.rm_rf(project_dir.join(name)) if FileTest.exists?(project_dir.join(name))
31
+ end
32
+ end
33
+
34
+ def fixture_file(type, filename)
35
+ dir_name = type.to_s + "s"
36
+ File.dirname(__FILE__) + "/fixtures/#{dir_name}/#{filename}"
37
+ end
38
+
39
+ end