pullentity-client 0.0.1

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 (75) hide show
  1. checksums.yaml +15 -0
  2. data/.DS_Store +0 -0
  3. data/.gitignore +47 -0
  4. data/CHANGELOG.md +6 -0
  5. data/Gemfile +5 -0
  6. data/LICENSE.txt +22 -0
  7. data/README.md +29 -0
  8. data/Rakefile +1 -0
  9. data/bin/pullentity +5 -0
  10. data/lib/.DS_Store +0 -0
  11. data/lib/pullentity-client/.DS_Store +0 -0
  12. data/lib/pullentity-client/builder/middleman.rb +14 -0
  13. data/lib/pullentity-client/cli.rb +85 -0
  14. data/lib/pullentity-client/generate/auth.rb +173 -0
  15. data/lib/pullentity-client/generate/exporter.rb +107 -0
  16. data/lib/pullentity-client/generate/project.rb +99 -0
  17. data/lib/pullentity-client/generate/view.rb +47 -0
  18. data/lib/pullentity-client/helpers.rb +146 -0
  19. data/lib/pullentity-client/logger.rb +14 -0
  20. data/lib/pullentity-client/templates/.DS_Store +0 -0
  21. data/lib/pullentity-client/templates/app/.DS_Store +0 -0
  22. data/lib/pullentity-client/templates/app/assets/.DS_Store +0 -0
  23. data/lib/pullentity-client/templates/app/assets/fonts/fontawesome-webfont.eot +0 -0
  24. data/lib/pullentity-client/templates/app/assets/fonts/fontawesome-webfont.svg +255 -0
  25. data/lib/pullentity-client/templates/app/assets/fonts/fontawesome-webfont.ttf +0 -0
  26. data/lib/pullentity-client/templates/app/assets/fonts/fontawesome-webfont.woff +0 -0
  27. data/lib/pullentity-client/templates/app/assets/images/.DS_Store +0 -0
  28. data/lib/pullentity-client/templates/app/assets/images/favicon.ico +0 -0
  29. data/lib/pullentity-client/templates/app/assets/javascripts/application.js.erb +4 -0
  30. data/lib/pullentity-client/templates/app/assets/javascripts/mustache.js +535 -0
  31. data/lib/pullentity-client/templates/app/assets/stylesheets/application.css.scss +1 -0
  32. data/lib/pullentity-client/templates/app/assets/stylesheets/customtheme.css.scss +1 -0
  33. data/lib/pullentity-client/templates/app/index.html.haml +15 -0
  34. data/lib/pullentity-client/templates/app/views/.DS_Store +0 -0
  35. data/lib/pullentity-client/templates/app/views/list.haml +11 -0
  36. data/lib/pullentity-client/templates/app/views/shared/body.haml +26 -0
  37. data/lib/pullentity-client/templates/app/views/shared/css.haml +48 -0
  38. data/lib/pullentity-client/templates/app/views/shared/head.haml +19 -0
  39. data/lib/pullentity-client/templates/app/views/shared/js.haml +43 -0
  40. data/lib/pullentity-client/templates/app/views/themes/home.haml +21 -0
  41. data/lib/pullentity-client/templates/app/views/themes/theme1.haml +21 -0
  42. data/lib/pullentity-client/templates/defaults/Gemfile.erb +8 -0
  43. data/lib/pullentity-client/templates/defaults/LICENSE.erb +1 -0
  44. data/lib/pullentity-client/templates/defaults/Readme.mkd.erb +1 -0
  45. data/lib/pullentity-client/templates/defaults/build.yml.erb +2 -0
  46. data/lib/pullentity-client/templates/defaults/config.erb +23 -0
  47. data/lib/pullentity-client/templates/defaults/gitignore.erb +2 -0
  48. data/lib/pullentity-client/templates/defaults/layout.haml.erb +13 -0
  49. data/lib/pullentity-client/templates/defaults/pullentity.yml.erb +5 -0
  50. data/lib/pullentity-client/templates/defaults/test-data.js.erb +87 -0
  51. data/lib/pullentity-client/templates/rakefile +0 -0
  52. data/lib/pullentity-client/templates/specs/app_spec.coffee.erb +3 -0
  53. data/lib/pullentity-client/utils.rb +81 -0
  54. data/lib/pullentity-client/version.rb +5 -0
  55. data/lib/pullentity-client.rb +39 -0
  56. data/pullentity-client.gemspec +39 -0
  57. data/spec/cli/command_spec.rb +90 -0
  58. data/spec/pullentity-client/builder/middleman_spec.rb +22 -0
  59. data/spec/pullentity-client/generate/exporter_spec.rb +53 -0
  60. data/spec/pullentity-client/generate/project_spec.rb +90 -0
  61. data/spec/pullentity-client/logger_spec.rb +25 -0
  62. data/spec/pullentity-client/utils_spec.rb +94 -0
  63. data/spec/spec_helper.rb +42 -0
  64. data/vendor/assets/fonts/fontawesome-webfont.eot +0 -0
  65. data/vendor/assets/fonts/fontawesome-webfont.svg +255 -0
  66. data/vendor/assets/fonts/fontawesome-webfont.ttf +0 -0
  67. data/vendor/assets/fonts/fontawesome-webfont.woff +0 -0
  68. data/vendor/assets/images/.DS_Store +0 -0
  69. data/vendor/assets/images/pullentity/.DS_Store +0 -0
  70. data/vendor/assets/javascripts/pullentity/.DS_Store +0 -0
  71. data/vendor/assets/javascripts/pullentity.js +0 -0
  72. data/vendor/assets/stylesheets/.DS_Store +0 -0
  73. data/vendor/assets/stylesheets/pullentity/themes/default.css.scss +0 -0
  74. data/vendor/assets/stylesheets/pullentity.css.scss +1 -0
  75. metadata +335 -0
@@ -0,0 +1,21 @@
1
+ .span4
2
+ %h2 {{project.title}}
3
+ {{{project.body}}}
4
+ .span8
5
+ #myCarousel.carousel.slide{:style => "float:left"}
6
+ .carousel-inner
7
+ {{#photos}}
8
+
9
+ .item
10
+ %img{:alt => "", :src => "{{img_large}}"}/
11
+ .carousel-caption
12
+ %h4 {{title}}
13
+ %p {{caption}}
14
+
15
+ {{/photos}}
16
+
17
+ %a.left.carousel-control{"data-slide" => "prev", :href => "#myCarousel"} ‹
18
+
19
+ %a.right.carousel-control{"data-slide" => "next", :href => "#myCarousel"} ›
20
+
21
+ {{{fb_comments}}}
@@ -0,0 +1,21 @@
1
+ .span4
2
+ %h2 {{project.title}}
3
+ {{{project.body}}}
4
+ .span8
5
+ #myCarousel.carousel.slide{:style => "float:left"}
6
+ .carousel-inner
7
+ {{#photos}}
8
+
9
+ .item
10
+ %img{:alt => "", :src => "{{img_large}}"}/
11
+ .carousel-caption
12
+ %h4 {{title}}
13
+ %p {{caption}}
14
+
15
+ {{/photos}}
16
+
17
+ %a.left.carousel-control{"data-slide" => "prev", :href => "#myCarousel"} ‹
18
+
19
+ %a.right.carousel-control{"data-slide" => "next", :href => "#myCarousel"} ›
20
+
21
+ {{{fb_comments}}}
@@ -0,0 +1,8 @@
1
+ source "http://rubygems.org"
2
+
3
+
4
+ <% if ENV["pullentity_rspec"] == "test" %>
5
+ gem "pullentity-client" , path: "<%= File.join(File.expand_path File.dirname(__FILE__)) %>"
6
+ <% else %>
7
+ gem "pullentity-client"
8
+ <% end %>
@@ -0,0 +1 @@
1
+ <%= app_name %> <%= Time.now.year %>, made with pullentity, see pullentity license.
@@ -0,0 +1 @@
1
+ # <%= app_name %> - Created with Pullentity Client Generator
@@ -0,0 +1,2 @@
1
+ <%= JSON.pretty_generate json %>
2
+
@@ -0,0 +1,23 @@
1
+ # coding: utf-8
2
+
3
+ #"<%= app_name %>"
4
+
5
+ require "pullentity-client/helpers"
6
+ helpers Pullentity::Client::Helpers
7
+
8
+ set :sass_assets_paths, []
9
+ set :relative_links, false
10
+ set :images_dir, "assets/images"
11
+ set :fonts_dir, "assets/fonts"
12
+ set :css_dir, "assets/stylesheets"
13
+ set :js_dir, "assets/javascripts"
14
+ set :markdown, :layout_engine => :haml
15
+ set :default_encoding, 'utf-8'
16
+
17
+ page "views/*", :layout => false
18
+
19
+ configure :build do
20
+ activate :minify_css
21
+ activate :minify_javascript
22
+ activate :relative_assets
23
+ end
@@ -0,0 +1,2 @@
1
+ # Generated by Pullentity Client Generator
2
+ #
@@ -0,0 +1,13 @@
1
+ !!! Strict
2
+ %html{:xmlns => 'http://www.w3.org/1999/xhtml', 'xml:lang' => 'en', :lang => 'en'}
3
+ %head
4
+ = partial("views/shared/head")
5
+
6
+ = partial "views/shared/js"
7
+ = partial "views/shared/css"
8
+
9
+ %body
10
+
11
+ = partial("views/shared/body")
12
+
13
+
@@ -0,0 +1,5 @@
1
+ # Pullentity main configuration file
2
+
3
+ theme_name: <%= app_name %>
4
+ auth_token: "" # run => pullentity login your-pullentity-user@email.com
5
+ site: "" #run => pullentity select_site and choice options
@@ -0,0 +1,87 @@
1
+ //= require "mustache"
2
+
3
+ $(document).ready(function() {
4
+
5
+ var template, html;
6
+
7
+ window.data = {
8
+ site_link: "/",
9
+ site: {
10
+ name: "<%= app_name %>",
11
+ },
12
+ sections: [
13
+ { public_url: "#home", title: "photos", show_in_menu: true },
14
+ { public_url: "#list", title: "books", show_in_menu: true },
15
+ { public_url: "#theme1", title: "theme1", show_in_menu: true }
16
+ ],
17
+ project: {
18
+ title: "My Awesome Project",
19
+ body: "lorem bla bla"
20
+ },
21
+ photos: [
22
+ { title: "my favorite things",
23
+ caption: "donuts, pizza, computers",
24
+ img_large: "http://farm7.staticflickr.com/6161/6187349656_4be054c2d8_z_d.jpg"
25
+ },
26
+ {
27
+ title: "mexican",
28
+ caption: "Mexican letters",
29
+ img_large: "http://farm7.staticflickr.com/6155/6187348764_4565f30184_z_d.jpg"
30
+ },
31
+ {
32
+ title: "Rome",
33
+ caption: "When in Rome",
34
+ img_large: "http://farm7.staticflickr.com/6158/6186830089_81d4fc3382_z_d.jpg"
35
+ },
36
+ {
37
+ title: "Salvo",
38
+ caption: "Salvo",
39
+ img_large: "http://farm7.staticflickr.com/6065/6132525393_6a61e20cd9_z_d.jpg"
40
+ }
41
+
42
+ ],
43
+ section: {
44
+ title: "some section here"
45
+ },
46
+ projects: [
47
+ {
48
+ project_photo: "http://farm7.staticflickr.com/6161/6187349656_4be054c2d8_z_d.jpg",
49
+ title: "project title",
50
+ project_path: "#home"
51
+ },
52
+ {
53
+ project_photo: "http://farm7.staticflickr.com/6161/6187349656_4be054c2d8_z_d.jpg",
54
+ title: "project title 2",
55
+ project_path: "#home"
56
+ },
57
+ {
58
+ project_photo: "http://farm7.staticflickr.com/6161/6187349656_4be054c2d8_z_d.jpg",
59
+ title: "project title 3",
60
+ project_path: "#home"
61
+ }
62
+ ],
63
+ public_url: "http://artenlinea.com",
64
+ url : function () {
65
+ return function (text, render) {
66
+ text = render(text);
67
+ var url = text.trim().toLowerCase().split('tuts+')[0] + '.tutsplus.com';
68
+ return '<a href="' + url + '">' + text + '</a>';
69
+ }
70
+ }
71
+ };
72
+
73
+ // layout
74
+ template = $("#layout").html();
75
+ layout = Mustache.to_html(template, data);
76
+ $("body").html(layout);
77
+
78
+
79
+ $(window).on('hashchange', function(e) {
80
+ theme = $("#yield-scripts " + window.location.hash + " ").html();
81
+ console.log( theme );
82
+ view = Mustache.to_html(theme, window.data);
83
+ $("#loadScripts").html(view);
84
+ });
85
+
86
+
87
+ });
File without changes
@@ -0,0 +1,3 @@
1
+ describe '<%= name %>', ->
2
+ it 'should require you to write your tests', ->
3
+ expect(yourCode).toBeLotsBetter()
@@ -0,0 +1,81 @@
1
+ module Pullentity
2
+ module Client
3
+ module Utils
4
+ include Thor::Actions
5
+
6
+ def self.source_root
7
+ File.dirname(__FILE__)
8
+ end
9
+
10
+ def create_new_file(name, file=nil)
11
+ log "Creating #{name}"
12
+ contents = file.nil? ? '' : File.read(file)
13
+ unless File.file?(location.join(name))
14
+ File.open(location.join(name), 'w') { |f| f.write(contents) }
15
+ end
16
+ end
17
+
18
+ def remove_files(*files)
19
+ files.each do |file|
20
+ log "Removing #{file} file."
21
+ FileUtils.rm(location.join(file))
22
+ end
23
+ end
24
+
25
+ def touch(*filenames)
26
+ filenames.each do |filename|
27
+ log "Creating #{filename} file."
28
+ FileUtils.touch(location.join(filename))
29
+ end
30
+ end
31
+
32
+ def create_directories(*dirs)
33
+ dirs.each do |dir|
34
+ log "Creating the #{dir} directory."
35
+ FileUtils.mkdir_p(location.join(dir))
36
+ end
37
+ end
38
+
39
+ def remove_directories(*names)
40
+ names.each do |name|
41
+ log "Removing #{name} directory."
42
+ FileUtils.rm_rf(location.join(name))
43
+ end
44
+ end
45
+
46
+ def create_with_template(name, template_location, contents={})
47
+ template = templates("#{template_location}.erb")
48
+ eruby = Erubis::Eruby.new(File.read(template))
49
+ File.open(location.join(name.gsub(/^\//, '')), 'w') { |f| f.write(eruby.result(contents))}
50
+ end
51
+
52
+ def templates(path)
53
+ ::Pullentity::Client.root.join('pullentity-client/templates').join(path)
54
+ end
55
+
56
+ def log(msg)
57
+ ::Pullentity::Client::Logger.report(msg)
58
+ end
59
+
60
+ def error(msg)
61
+ ::Pullentity::Client::Logger.error(msg)
62
+ end
63
+
64
+ def base_location
65
+ @location ||= Pathname.new(Dir.pwd)
66
+ end
67
+
68
+ alias_method :location, :base_location
69
+
70
+ def underscore(string)
71
+ string.gsub(/::/, '/').
72
+ gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
73
+ gsub(/([a-z\d])([A-Z])/,'\1_\2').
74
+ tr("-", "_").
75
+ downcase
76
+ end
77
+
78
+ end
79
+
80
+ end
81
+ end
@@ -0,0 +1,5 @@
1
+ module Pullentity
2
+ module Client
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
@@ -0,0 +1,39 @@
1
+ require "pullentity-client/version"
2
+
3
+ require 'rubygems'
4
+ require 'pathname'
5
+ require 'fileutils'
6
+ require 'rbconfig'
7
+ require 'colored'
8
+ require 'rocco'
9
+ require 'thor'
10
+ require 'erubis'
11
+ require 'nokogiri'
12
+ require 'json'
13
+
14
+ module Pullentity
15
+ module Client
16
+ ROOT_PATH = Pathname(__FILE__).dirname.expand_path
17
+
18
+ autoload :VERSION, 'pullentity-client/version.rb'
19
+ autoload :CLI, 'pullentity-client/cli.rb'
20
+ autoload :Logger, "pullentity-client/logger.rb"
21
+ autoload :Utils, "pullentity-client/utils.rb"
22
+
23
+ module Generate
24
+ autoload :Project, "pullentity-client/generate/project.rb"
25
+ autoload :Model, "pullentity-client/generate/model.rb"
26
+ autoload :Exporter, "pullentity-client/generate/exporter.rb"
27
+ autoload :Auth, "pullentity-client/generate/auth.rb"
28
+
29
+ end
30
+
31
+ module Builder
32
+ autoload :Middleman, 'pullentity-client/builder/middleman.rb'
33
+ end
34
+
35
+ def self.root
36
+ @root ||= Pathname(__FILE__).dirname.expand_path
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,39 @@
1
+ # -*- encoding: utf-8 -*-
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'pullentity-client/version'
5
+
6
+ Gem::Specification.new do |gem|
7
+ gem.name = "pullentity-client"
8
+ gem.version = Pullentity::Client::VERSION
9
+ gem.authors = ["miguel michelson"]
10
+ gem.email = ["miguelmichelson@gmail.com"]
11
+ gem.description = %q{Pullentity client for build pullentity.com sites}
12
+ gem.summary = %q{This gem provides a simple builder workspace for make pullentity sites with haml and sass}
13
+ gem.homepage = ""
14
+
15
+ gem.files = `git ls-files`.split($/)
16
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
17
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
18
+ gem.require_paths = ["lib"]
19
+
20
+
21
+ gem.add_runtime_dependency(%q<coffee-script>, ["~> 2.2.0"])
22
+
23
+ gem.add_runtime_dependency(%q<colored>, ["~> 1.2"])
24
+ gem.add_runtime_dependency(%q<rake>, ["~> 0.9.2"])
25
+ gem.add_runtime_dependency(%q<nokogiri>, ["~> 1.4.4"])
26
+ gem.add_runtime_dependency(%q<erubis>, ["~> 2.7.0"])
27
+ gem.add_runtime_dependency(%q<rocco>, ["~> 0.7"])
28
+ gem.add_runtime_dependency(%q<thor>, ["~> 0.15.4"])
29
+ gem.add_runtime_dependency(%q<compass>, ["~> 0.12.2"])
30
+ gem.add_runtime_dependency(%q<session>, ["~> 3.1"])
31
+ gem.add_runtime_dependency(%q<middleman>, ["3.0.12"])
32
+ gem.add_runtime_dependency(%q<faraday>)
33
+ gem.add_runtime_dependency("json")
34
+
35
+ # gem.add_development_dependency(%q<bundler>, ["~> 1.0.14"])
36
+ gem.add_development_dependency(%q<bundler>, ["~> 1.1"])
37
+ gem.add_development_dependency(%q<rspec>, ["~> 2.6.0"])
38
+ gem.add_development_dependency("debugger")
39
+ end
@@ -0,0 +1,90 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
2
+
3
+ describe "PullentityClient Generator Commands" do
4
+ context "Help command:" do
5
+ context "PullentityClient help" do
6
+ it "should display the basic help for the CLI" do
7
+ response, status = capture_with_status(:stdout){ Pullentity::Client::CLI.start(['help']) }
8
+ status.should eql(Pullentity::Client::CLI::STATUS_TYPES[:success])
9
+ end
10
+ end
11
+ context "PullentityClient help invalid_task" do
12
+ it "should display appropriate error message" do
13
+ response, status = capture_with_status(:stderr){ Pullentity::Client::CLI.start(['help', 'blah']) }
14
+ response.should eql("Could not find task \"blah\".\n")
15
+ status.should eql(Pullentity::Client::CLI::STATUS_TYPES[:success])
16
+ end
17
+ end
18
+ end
19
+ context "Info command:" do
20
+ context "PullentityClient info" do
21
+ it "should display the version" do
22
+ response, status = capture_with_status(:stdout){ Pullentity::Client::CLI.start(['info']) }
23
+ #response.should eql("Version #{::Pullentity::Client::VERSION}\n")
24
+ status.should eql(Pullentity::Client::CLI::STATUS_TYPES[:success])
25
+ end
26
+ end
27
+ context "PullentityClient -v (alias)" do
28
+ it "should display the version" do
29
+ response, status = capture_with_status(:stdout){ Pullentity::Client::CLI.start(['-v']) }
30
+ #response.should eql("Version #{::Pullentity::Client::VERSION}\n")
31
+ status.should eql(Pullentity::Client::CLI::STATUS_TYPES[:success])
32
+ end
33
+ end
34
+ context "PullentityClient --version (alias)" do
35
+ it "should display the version" do
36
+ response, status = capture_with_status(:stdout){ Pullentity::Client::CLI.start(['--version']) }
37
+ #response.should eql("Version #{::Pullentity::Client::VERSION}\n")
38
+ status.should eql(Pullentity::Client::CLI::STATUS_TYPES[:success])
39
+ end
40
+ end
41
+ end
42
+ context "New command: " do
43
+ context "Help (PullentityClient help new)" do
44
+ it "should display help for the task 'new'" do
45
+ response, status = capture_with_status(:stdout){ Pullentity::Client::CLI.start((["project", "help", "new"])) }
46
+ status.should eql(Pullentity::Client::CLI::STATUS_TYPES[:success])
47
+ end
48
+ end
49
+ context "Generate a new project: " do
50
+ context "with no name (PullentityClient new)" do
51
+ it "should exit with error" do
52
+ response, status = capture_with_status(:stderr){ Pullentity::Client::CLI.start(['project', 'new']) }
53
+ #puts response
54
+ #response.include?("new was called incorrectly. Call as").should be_true
55
+ #response.should eql("\"new\" was called incorrectly. Call as \"rspec new <name> <id> <platform>\".\n")
56
+ end
57
+ end
58
+ context "with custom name (PullentityClient new Demo)" do
59
+ it "should generate new project \"Demo\"" do
60
+ response, status = capture_with_status(:stdout){ Pullentity::Client::CLI.start(['project', 'new', 'Demo']) }
61
+
62
+ status.should eql(Pullentity::Client::CLI::STATUS_TYPES[:success])
63
+ end
64
+ after (:all) do
65
+ remove_directories("Demo")
66
+ end
67
+ end
68
+ context "with custom name and id (ti new Demo com.mycompany.demo)" do
69
+ it "should generate new project \"Demo\" with id \"com.mycompany.demo\"" do
70
+ response, status = capture_with_status(:stdout){ Pullentity::Client::CLI.start(['project', 'new', 'Demo', 'com.mycompany.demo']) }
71
+
72
+ status.should eql(Pullentity::Client::CLI::STATUS_TYPES[:success])
73
+ end
74
+ after (:all) do
75
+ remove_directories("Demo")
76
+ end
77
+ end
78
+ context "with custom name, id and platform (PullentityClient new Demo com.mycompany.demo ipad)" do
79
+ it "should generate new project \"Demo\" with id \"com.mycompany.demo\" and for platform \"ipad\"" do
80
+ response, status = capture_with_status(:stdout){ Pullentity::Client::CLI.start(['project', 'new', 'Demo', 'com.mycompany.demo']) }
81
+
82
+ status.should eql(Pullentity::Client::CLI::STATUS_TYPES[:success])
83
+ end
84
+ after (:all) do
85
+ remove_directories("Demo")
86
+ end
87
+ end
88
+ end
89
+ end
90
+ end
@@ -0,0 +1,22 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
2
+
3
+ describe "Creating of a view file" do
4
+ before(:all) do
5
+ ::Pullentity::Client::Generate::Project.create('dailyfocus')
6
+ end
7
+
8
+ context "Creating a view file and its spec" do
9
+ before(:each) do
10
+ system("cd dailyfocus && bundle exec pullentity build mm")
11
+ end
12
+
13
+ it "should have created the build directory" do
14
+ File.directory?("dailyfocus/build").should be_true
15
+ end
16
+
17
+ end
18
+
19
+ after(:all) do
20
+ #remove_directories('dailyfocus', 'app', 'spec/views')
21
+ end
22
+ end
@@ -0,0 +1,53 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
2
+
3
+ describe "Creating of a new Pullentity Client Project" do
4
+
5
+ before(:all) do
6
+ ::Pullentity::Client::Generate::Project.create('dailyfocus')
7
+ end
8
+
9
+ context "Directories should be created" do
10
+ before :all do
11
+ system("cd dailyfocus && bundle exec pullentity export new name")
12
+ end
13
+
14
+ it "should generate the export build json" do
15
+ File.exists?("dailyfocus/pullentity_build.json").should be_true
16
+ end
17
+
18
+ it "should be a valid json" do
19
+ json = JSON.parse( IO.read("dailyfocus/pullentity_build.json") )
20
+ json["themes"].size.should == 2
21
+ json["theme_name"].should_not be_empty
22
+ json["theme_name"].should == "name"
23
+ json["layout"].should_not be_empty
24
+ json["list"].should_not be_empty
25
+ json["css"].should_not be_empty
26
+ json["js"].should_not be_empty
27
+ json["head"].should_not be_empty
28
+ json["assets"].should_not be_empty
29
+ json["assets"].keys.should eql ["images", "js", "css", "fonts"]
30
+ end
31
+
32
+ end
33
+
34
+ context "Directories should be created" do
35
+ before :all do
36
+ system("cd dailyfocus && bundle exec pullentity export new")
37
+ end
38
+
39
+ it "should generate the export build json" do
40
+ File.exists?("dailyfocus/pullentity_build.json").should be_true
41
+ end
42
+
43
+ it "should be a valid json" do
44
+ json = JSON.parse( IO.read("dailyfocus/pullentity_build.json") )
45
+ json["theme_name"].should == "dailyfocus"
46
+ end
47
+
48
+ end
49
+
50
+ after(:all) do
51
+ #remove_directories('dailyfocus')
52
+ end
53
+ end
@@ -0,0 +1,90 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
2
+
3
+ describe "Creating of a new Pullentity Client Project" do
4
+ before(:all) do
5
+ ::Pullentity::Client::Generate::Project.create('dailyfocus')
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
+
34
+ end
35
+
36
+ context "Top tier files should be created" do
37
+
38
+ it "should have created the LICENSE" do
39
+ File.exists?("dailyfocus/LICENSE").should be_true
40
+ end
41
+
42
+ it "should have created the config file" do
43
+ File.exists?("dailyfocus/config.rb").should be_true
44
+ end
45
+
46
+ it "should have created the Readme.mkd" do
47
+ File.exists?("dailyfocus/Readme.mkd").should be_true
48
+ end
49
+
50
+ it "should have created the Gemfile" do
51
+ File.exists?("dailyfocus/Gemfile").should be_true
52
+ end
53
+
54
+ it "should have created Pullentity Client config file" do
55
+ File.exists?("dailyfocus/pullentity.yml").should be_true
56
+ end
57
+ end
58
+
59
+ context "Inside the source directory" do
60
+
61
+
62
+ it "should have created the models directory" do
63
+ File.directory?("dailyfocus/source/models").should be_true
64
+ end
65
+
66
+ it "should have created the stylesheets directory" do
67
+ File.directory?("dailyfocus/source/assets/stylesheets").should be_true
68
+ end
69
+
70
+ it "should have created the javascripts directory" do
71
+ File.directory?("dailyfocus/source/assets/javascripts").should be_true
72
+ end
73
+
74
+ it "should have created the images directory" do
75
+ File.directory?("dailyfocus/source/assets/images").should be_true
76
+ end
77
+
78
+ it "should have created the fonts directory" do
79
+ File.directory?("dailyfocus/source/assets/fonts").should be_true
80
+ end
81
+
82
+ it "should have created the views directory" do
83
+ File.directory?("dailyfocus/source/views").should be_true
84
+ end
85
+ end
86
+
87
+ after(:all) do
88
+ remove_directories('dailyfocus')
89
+ end
90
+ 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
+ Pullentity::Client::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
+ Pullentity::Client::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