xing-framework 0.2.6 → 0.2.7.pre.beta1

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 (31) hide show
  1. checksums.yaml +4 -4
  2. data/default_configuration/base_app/CONTRIBUTING.md +1 -0
  3. data/default_configuration/base_app/Gemfile +0 -1
  4. data/default_configuration/base_app/Gemfile.lock +3 -92
  5. data/default_configuration/base_app/README.md +5 -4
  6. data/default_configuration/base_app/backend/Gemfile.lock +44 -40
  7. data/default_configuration/base_app/backend/config/application.rb +2 -1
  8. data/default_configuration/base_app/backend/config/secrets.yml.ci +1 -0
  9. data/default_configuration/base_app/backend/config/secrets.yml.example +6 -4
  10. data/default_configuration/base_app/frontend/npm-shrinkwrap.json +1760 -1600
  11. data/default_configuration/base_app/frontend/package.json +24 -21
  12. data/default_configuration/templates/CHANGELOG.md +1 -0
  13. data/default_configuration/templates/CODE_OF_CONDUCT.md +50 -0
  14. data/default_configuration/templates/CONTRIBUTING.md +1 -0
  15. data/default_configuration/templates/README.md +22 -0
  16. data/default_configuration/templates/backend/config/secrets.yml +3 -0
  17. data/default_configuration/templates/backend/config/secrets.yml.ci +2 -0
  18. data/default_configuration/templates/backend/config/secrets.yml.example +4 -0
  19. data/lib/xing/cli/generators/new_project/user_input.rb +33 -0
  20. data/lib/xing/cli/generators/new_project.rb +53 -40
  21. data/lib/xing/cli/templaters/code_of_conduct_templater.rb +7 -0
  22. data/lib/xing/cli/templaters/control_files_templater.rb +12 -0
  23. data/lib/xing/cli/templaters/database_yml_templater.rb +9 -0
  24. data/lib/xing/cli/templaters/doc_files_templater.rb +9 -0
  25. data/lib/xing/cli/templaters/secrets_yml_templater.rb +9 -0
  26. data/lib/xing/cli/templaters.rb +28 -0
  27. data/spec/cli/generators/new_project/user_input_spec.rb +41 -0
  28. data/spec/cli/generators/new_project_spec.rb +46 -3
  29. data/spec/cli/templaters_spec.rb +125 -0
  30. metadata +31 -6
  31. data/default_configuration/templates/dot.gitignore +0 -50
@@ -18,33 +18,36 @@
18
18
  "angular-ui-utils": "~0.1.1",
19
19
  "bower": "~1.3.2",
20
20
  "breakpoint-sass": "^2.6.1",
21
+ "eslint": "0.x",
22
+ "estraverse": "~4.1.1",
21
23
  "font-awesome": "^4.4.0",
22
24
  "grunt": "^0.4.5",
23
- "grunt-bump": "https://registry.npmjs.org/grunt-bump/-/grunt-bump-0.0.13.tgz",
24
- "grunt-bushcaster": "https://registry.npmjs.org/grunt-bushcaster/-/grunt-bushcaster-0.0.7.tgz",
25
+ "grunt-bump": "^0.0.13",
26
+ "grunt-bushcaster": "^0.0.7",
25
27
  "grunt-cli": "~0.1.13",
26
28
  "grunt-coffeelint": "0.0.10",
27
- "grunt-concat-sourcemap": "https://registry.npmjs.org/grunt-concat-sourcemap/-/grunt-concat-sourcemap-0.4.3.tgz",
28
- "grunt-concurrent": "https://registry.npmjs.org/grunt-concurrent/-/grunt-concurrent-1.0.0.tgz",
29
- "grunt-contrib-clean": "https://registry.npmjs.org/grunt-contrib-clean/-/grunt-contrib-clean-0.5.0.tgz",
29
+ "grunt-concat-sourcemap": "^0.4.3",
30
+ "grunt-concurrent": "^1.0.0",
31
+ "grunt-contrib-clean": "~0.5.0",
30
32
  "grunt-contrib-coffee": "~0.10.1",
31
- "grunt-contrib-compass": "https://registry.npmjs.org/grunt-contrib-compass/-/grunt-contrib-compass-1.0.1.tgz",
32
- "grunt-contrib-compress": "https://registry.npmjs.org/grunt-contrib-compress/-/grunt-contrib-compress-0.13.0.tgz",
33
+ "grunt-contrib-compass": "^1.0.1",
34
+ "grunt-contrib-compress": "^0.13.0",
33
35
  "grunt-contrib-concat": "~0.4.0",
34
- "grunt-contrib-connect": "https://registry.npmjs.org/grunt-contrib-connect/-/grunt-contrib-connect-0.8.0.tgz",
35
- "grunt-contrib-copy": "https://registry.npmjs.org/grunt-contrib-copy/-/grunt-contrib-copy-0.5.0.tgz",
36
- "grunt-contrib-jshint": "https://registry.npmjs.org/grunt-contrib-jshint/-/grunt-contrib-jshint-0.11.2.tgz",
36
+ "grunt-contrib-connect": "^0.8.0",
37
+ "grunt-contrib-copy": "^0.5.0",
38
+ "grunt-contrib-jshint": "^0.11.2",
37
39
  "grunt-contrib-sass": "^0.8.1",
38
- "grunt-contrib-uglify": "https://registry.npmjs.org/grunt-contrib-uglify/-/grunt-contrib-uglify-0.4.1.tgz",
39
- "grunt-contrib-watch": "https://registry.npmjs.org/grunt-contrib-watch/-/grunt-contrib-watch-0.6.1.tgz",
40
- "grunt-conventional-changelog": "https://registry.npmjs.org/grunt-conventional-changelog/-/grunt-conventional-changelog-1.1.0.tgz",
41
- "grunt-html2js": "https://registry.npmjs.org/grunt-html2js/-/grunt-html2js-0.2.8.tgz",
42
- "grunt-jsonlint": "https://registry.npmjs.org/grunt-jsonlint/-/grunt-jsonlint-1.0.4.tgz",
43
- "grunt-karma": "https://registry.npmjs.org/grunt-karma/-/grunt-karma-0.8.3.tgz",
44
- "grunt-ng-annotate": "https://registry.npmjs.org/grunt-ng-annotate/-/grunt-ng-annotate-0.3.2.tgz",
40
+ "grunt-contrib-uglify": "^0.4.0",
41
+ "grunt-contrib-watch": "^0.6.1",
42
+ "grunt-conventional-changelog": "~1.1.0",
43
+ "grunt-html2js": "^0.2.4",
44
+ "grunt-jsonlint": "~1.0.4",
45
+ "grunt-karma": "^0.8.3",
46
+ "grunt-ng-annotate": "^0.3.2",
45
47
  "grunt-string-replace": "^1.2.0",
46
- "grunt-xing-index": "0.0.2",
48
+ "grunt-xing-index": "^0.0.2",
47
49
  "hammerjs": "~2.0.4",
50
+ "jasmine-core": "*",
48
51
  "jquery": "^2.1.1",
49
52
  "json": "^9.0.1",
50
53
  "jsonlint": "^1.6.2",
@@ -58,7 +61,7 @@
58
61
  "karma-sourcemap-loader": "git://github.com/LRDesign/karma-sourcemap-loader",
59
62
  "lodash": "^2.4.1",
60
63
  "relayer": "0.1.0",
61
- "requirejs": "^2.1.15",
64
+ "requirejs": "~2.1.15",
62
65
  "responsive-nav": "~1.0.32",
63
66
  "sass-import-once": "~0.1.1",
64
67
  "singularitygs": "> 0",
@@ -68,8 +71,8 @@
68
71
  "xing-frontend-grunt": "0.0.8",
69
72
  "xing-frontend-token-auth": "0.0.3",
70
73
  "xing-frontend-utils": "0.0.1-beta6",
71
- "xing-grunt-revise": "0.0.1",
74
+ "xing-grunt-revise": "^0.0.1",
72
75
  "xing-inflector": "0.0.2",
73
- "xing-traceur": "0.0.8"
76
+ "xing-traceur": "^0.0.8"
74
77
  }
75
78
  }
@@ -0,0 +1 @@
1
+ * initial version
@@ -0,0 +1,50 @@
1
+ # Contributor Code of Conduct
2
+
3
+ As contributors and maintainers of this project, and in the interest of
4
+ fostering an open and welcoming community, we pledge to respect all people who
5
+ contribute through reporting issues, posting feature requests, updating
6
+ documentation, submitting pull requests or patches, and other activities.
7
+
8
+ We are committed to making participation in this project a harassment-free
9
+ experience for everyone, regardless of level of experience, gender, gender
10
+ identity and expression, sexual orientation, disability, personal appearance,
11
+ body size, race, ethnicity, age, religion, or nationality.
12
+
13
+ Examples of unacceptable behavior by participants include:
14
+
15
+ * The use of sexualized language or imagery
16
+ * Personal attacks
17
+ * Trolling or insulting/derogatory comments
18
+ * Public or private harassment
19
+ * Publishing other's private information, such as physical or electronic
20
+ addresses, without explicit permission
21
+ * Other unethical or unprofessional conduct
22
+
23
+ Project maintainers have the right and responsibility to remove, edit, or
24
+ reject comments, commits, code, wiki edits, issues, and other contributions
25
+ that are not aligned to this Code of Conduct, or to ban temporarily or
26
+ permanently any contributor for other behaviors that they deem inappropriate,
27
+ threatening, offensive, or harmful.
28
+
29
+ By adopting this Code of Conduct, project maintainers commit themselves to
30
+ fairly and consistently applying these principles to every aspect of managing
31
+ this project. Project maintainers who do not follow or enforce the Code of
32
+ Conduct may be permanently removed from the project team.
33
+
34
+ This Code of Conduct applies both within project spaces and in public spaces
35
+ when an individual is representing the project or its community.
36
+
37
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
38
+ reported by contacting a project maintainer at {{email}}. All
39
+ complaints will be reviewed and investigated and will result in a response that
40
+ is deemed necessary and appropriate to the circumstances. Maintainers are
41
+ obligated to maintain confidentiality with regard to the reporter of an
42
+ incident.
43
+
44
+
45
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
46
+ version 1.3.0, available at
47
+ [http://contributor-covenant.org/version/1/3/0/][version]
48
+
49
+ [homepage]: http://contributor-covenant.org
50
+ [version]: http://contributor-covenant.org/version/1/3/0/
@@ -0,0 +1 @@
1
+ This file is a good place to put instructions about your contribution process -- how do you want teams or open source contributors to submit code code to your repository.
@@ -0,0 +1,22 @@
1
+ == {{app_name}}
2
+
3
+ This README would normally document whatever steps are necessary to get the
4
+ application up and running.
5
+
6
+ Things you may want to cover:
7
+
8
+ * Ruby version
9
+
10
+ * Node/Npm Version
11
+
12
+ * System dependencies
13
+
14
+ * Configuration
15
+
16
+ * Services (job queues, cache servers, search engines, etc.)
17
+
18
+ * Deployment instructions
19
+
20
+ * ...
21
+
22
+ {{code_of_conduct_reference}}
@@ -31,6 +31,8 @@ development:
31
31
  password: password
32
32
  sitemap_base_url: http://localhost:3000/
33
33
  asset_host: http://localhost:3000/
34
+ # don't use this value in production
35
+ allowed_origins: '*'
34
36
 
35
37
  test:
36
38
  secret_key_base: {{test_secret_key_base}}
@@ -50,6 +52,7 @@ test:
50
52
  password: password
51
53
  sitemap_base_url: http://localhost:3000/
52
54
  asset_host: http://localhost:3000/
55
+ allowed_origins: '*'
53
56
 
54
57
  # Do not keep production secrets in the repository,
55
58
  # instead read values from the environment.
@@ -16,6 +16,8 @@ test:
16
16
  password: password
17
17
  sitemap_base_url: http://localhost:3000/
18
18
  asset_host: http://localhost:3000/
19
+ # don't use this value in production
20
+ allowed_origins: '*'
19
21
 
20
22
  development:
21
23
  <<: *test
@@ -31,6 +31,8 @@ development:
31
31
  password: password
32
32
  sitemap_base_url: http://localhost:3000/
33
33
  asset_host: http://localhost:3000/
34
+ # don't use this value in production
35
+ allowed_origins: '*'
34
36
 
35
37
  test:
36
38
  secret_key_base: {{test_secret_key_base}}
@@ -50,6 +52,8 @@ test:
50
52
  password: password
51
53
  sitemap_base_url: http://localhost:3000/
52
54
  asset_host: http://localhost:3000/
55
+ # don't use this value in production
56
+ allowed_origins: '*'
53
57
 
54
58
  # Do not keep production secrets in the repository,
55
59
  # instead read values from the environment.
@@ -0,0 +1,33 @@
1
+ require 'highline'
2
+
3
+ module Xing::CLI::Generators
4
+ class NewProject
5
+ class UserInput
6
+ attr_accessor :code_of_conduct, :coc_contact_email
7
+
8
+ def gather
9
+ self.code_of_conduct = yesno("Add a Code of Conduct? (Contributor Covenant)")
10
+ if code_of_conduct
11
+ self.coc_contact_email = highline.ask("Enter a contact email for your Code of Conduct:") { |q| q.validate = /\A[^@\s]+@([^@\s]+\.)+[^@\s]+\z/ }
12
+ end
13
+ end
14
+
15
+ protected
16
+
17
+ def highline
18
+ @highline ||= HighLine.new
19
+ end
20
+
21
+ def yesno(prompt = 'Continue?', default = true)
22
+ answer = ''
23
+ options = default ? '[Y/n]' : '[y/N]'
24
+ def_answer = default ? 'y' : 'n'
25
+ until %w[y n].include? answer
26
+ answer = highline.ask("#{prompt} #{options} ") { |q| q.limit = 1; q.case = :downcase }
27
+ answer = def_answer if answer.length == 0
28
+ end
29
+ answer == 'y'
30
+ end
31
+ end
32
+ end
33
+ end
@@ -1,12 +1,12 @@
1
1
  require 'caliph'
2
2
  require 'bundler'
3
- require 'architecture/dsl'
4
3
  require 'securerandom'
4
+ require 'xing/cli/templaters'
5
+ require 'xing/cli/generators/new_project/user_input'
5
6
 
6
7
  module Xing::CLI::Generators
7
8
  class NewProject
8
9
  include Caliph::CommandLineDSL
9
- include Architecture
10
10
 
11
11
  attr_accessor :target_name
12
12
  attr_accessor :ruby_version
@@ -20,6 +20,9 @@ module Xing::CLI::Generators
20
20
  # For the moment, this is the simplest thing that can work. Zero templating
21
21
  # is done so the project will still have the default module names etc.
22
22
  def generate
23
+
24
+ user_input.gather
25
+
23
26
  command = cmd('cp', '-a', File.expand_path('../../../../../default_configuration/base_app/', __FILE__), target_name)
24
27
  result = shell.run(command)
25
28
 
@@ -37,10 +40,11 @@ module Xing::CLI::Generators
37
40
  write_ruby_gemset "backend"
38
41
  end
39
42
 
40
- write_database_yml
41
- write_secrets_yml
42
-
43
- write_git_control_files
43
+ database_yml_templater.template
44
+ secrets_yml_templater.template
45
+ control_files_templater.template
46
+ doc_files_templater.template
47
+ code_of_conduct_templater.template
44
48
 
45
49
  Bundler.with_clean_env do
46
50
  if with_gemset
@@ -69,50 +73,54 @@ module Xing::CLI::Generators
69
73
 
70
74
  end
71
75
 
72
- def write_database_yml
73
- dbyml_path = File.join(target_name, "backend", "config", "database.yml")
74
- if !File.exist?(dbyml_path)
75
- with_templates do |arc|
76
- arc.copy file: "backend/config/database.yml", context: { app_name: target_name }
77
- arc.copy file: "backend/config/database.yml.example", context: { app_name: target_name }
78
- arc.copy file: "backend/config/database.yml.ci", context: { app_name: target_name }
79
- end
76
+ def database_yml_templater
77
+ @database_yml_templater ||= begin
78
+ dbyml_path = File.join(target_name, "backend", "config", "database.yml")
79
+ Xing::CLI::Templaters::DatabaseYmlTemplater.new(target_name, context, File.exist?(dbyml_path))
80
80
  end
81
81
  end
82
82
 
83
- def write_git_control_files
84
- with_templates do |arc|
85
- arc.copy file: "gitignore", as: ".gitignore"
86
- arc.copy file: "backend/gitignore", as:"backend/.gitignore"
87
- arc.copy file: "frontend/gitignore", as: "frontend/.gitignore"
88
- arc.copy file: "gitattributes", as: ".gitattributes"
89
- arc.copy file: "backend/gitattributes", as: "backend/.gitattributes"
90
- arc.copy file: "frontend/gitattributes", as: "frontend/.gitattributes"
91
- end
83
+ def control_files_templater
84
+ @control_files_templater ||= Xing::CLI::Templaters::ControlFilesTemplater.new(
85
+ target_name, context)
92
86
  end
93
87
 
94
- def write_secrets_yml
95
- secyml_path = File.join(target_name, "backend", "config", "secrets.yml")
96
- if !File.exist?(secyml_path)
97
- context = {
98
- dev_secret_key_base: SecureRandom.hex(64),
99
- test_secret_key_base: SecureRandom.hex(64),
100
- app_name: target_name
101
- }
102
- with_templates do |arc|
103
- arc.copy file: "backend/config/secrets.yml", context: context
104
- arc.copy file: "backend/config/secrets.yml.example", context: context
105
- arc.copy file: "backend/config/secrets.yml.ci", context: context
106
- end
107
- end
88
+ def doc_files_templater
89
+ @doc_files_templater ||= Xing::CLI::Templaters::DocFilesTemplater.new(
90
+ target_name,
91
+ context.merge({
92
+ code_of_conduct_reference: (user_input.code_of_conduct ?
93
+ "All contributors must abide by the [Code of Conduct](CODE_OF_CONDUCT.md)" : "")
94
+ }))
108
95
  end
109
96
 
110
- def with_templates
111
- architecture source: File.expand_path('../../../../../default_configuration/templates/', __FILE__) , destination: target_name do |arc|
112
- yield(arc)
97
+ def secrets_yml_templater
98
+ @secrets_yml_templater ||= begin
99
+ secyml_path = File.join(target_name, "backend", "config", "secrets.yml")
100
+ Xing::CLI::Templaters::SecretsYmlTemplater.new(
101
+ target_name,
102
+ context.merge({
103
+ dev_secret_key_base: SecureRandom.hex(64),
104
+ test_secret_key_base: SecureRandom.hex(64),
105
+ }),
106
+ File.exist?(secyml_path)
107
+ )
113
108
  end
114
109
  end
115
110
 
111
+ def code_of_conduct_templater
112
+ @code_of_conduct_templater ||= Xing::CLI::Templaters::CodeOfConductTemplater.new(
113
+ target_name,
114
+ context.merge({
115
+ email: user_input.coc_contact_email
116
+ }),
117
+ !user_input.code_of_conduct)
118
+ end
119
+
120
+ def context
121
+ { app_name: target_name }
122
+ end
123
+
116
124
  def write_file_to(name, subdir)
117
125
  File.open(File.join(*([target_name] + subdir + [name])), "w") do |rv|
118
126
  yield(rv)
@@ -141,5 +149,10 @@ module Xing::CLI::Generators
141
149
  cmd(":")
142
150
  end
143
151
  end
152
+
153
+ def user_input
154
+ @user_input ||= UserInput.new
155
+ end
156
+
144
157
  end
145
158
  end
@@ -0,0 +1,7 @@
1
+ module Xing::CLI::Templaters
2
+ class CodeOfConductTemplater < Templater
3
+ def template_files(arc)
4
+ arc.copy file: "CODE_OF_CONDUCT.md", context: context
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,12 @@
1
+ module Xing::CLI::Templaters
2
+ class ControlFilesTemplater < Templater
3
+ def template_files(arc)
4
+ arc.copy file: "gitignore", as: ".gitignore"
5
+ arc.copy file: "backend/gitignore", as:"backend/.gitignore"
6
+ arc.copy file: "frontend/gitignore", as: "frontend/.gitignore"
7
+ arc.copy file: "gitattributes", as: ".gitattributes"
8
+ arc.copy file: "backend/gitattributes", as: "backend/.gitattributes"
9
+ arc.copy file: "frontend/gitattributes", as: "frontend/.gitattributes"
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,9 @@
1
+ module Xing::CLI::Templaters
2
+ class DatabaseYmlTemplater < Templater
3
+ def template_files(arc)
4
+ arc.copy file: "backend/config/database.yml", context: context
5
+ arc.copy file: "backend/config/database.yml.example", context: context
6
+ arc.copy file: "backend/config/database.yml.ci", context: context
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ module Xing::CLI::Templaters
2
+ class DocFilesTemplater < Templater
3
+ def template_files(arc)
4
+ arc.copy file: "README.md", context: context
5
+ arc.copy file: "CONTRIBUTING.md"
6
+ arc.copy file: "CHANGELOG.md"
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ module Xing::CLI::Templaters
2
+ class SecretsYmlTemplater < Templater
3
+ def template_files(arc)
4
+ arc.copy file: "backend/config/secrets.yml", context: context
5
+ arc.copy file: "backend/config/secrets.yml.example", context: context
6
+ arc.copy file: "backend/config/secrets.yml.ci", context: context
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,28 @@
1
+ require 'xing'
2
+ require 'architecture/dsl'
3
+
4
+ module Xing::CLI::Templaters
5
+ class Templater
6
+
7
+ include Architecture
8
+
9
+ def initialize(target_name, context, guard = false)
10
+ @target_name = target_name
11
+ @context = context
12
+ @guard = guard
13
+ end
14
+
15
+ attr_reader :target_name, :context, :guard
16
+
17
+ def template
18
+ if !guard
19
+ architecture source: File.expand_path('../../../../default_configuration/templates/', __FILE__),
20
+ destination: target_name do |arc|
21
+ template_files(arc)
22
+ end
23
+ end
24
+ end
25
+ end
26
+
27
+ Dir[File.dirname(__FILE__) + '/templaters/*.rb'].each { |file| require file }
28
+ end
@@ -0,0 +1,41 @@
1
+ require 'xing'
2
+ require 'xing/cli/generators/new_project/user_input'
3
+
4
+ describe Xing::CLI::Generators::NewProject::UserInput do
5
+ let :highline_mock do
6
+ double("HighLine")
7
+ end
8
+
9
+ let :user_input do
10
+ Xing::CLI::Generators::NewProject::UserInput.new
11
+ end
12
+
13
+ before do
14
+ expect(HighLine).to receive(:new).and_return(highline_mock)
15
+ end
16
+
17
+ describe "no code of conduct" do
18
+ before do
19
+ expect(highline_mock).to receive(:ask).with("Add a Code of Conduct? (Contributor Covenant) [Y/n] ").and_return('n')
20
+ user_input.gather
21
+ end
22
+
23
+ it "should have no code of conduct" do
24
+ expect(user_input.code_of_conduct).to eq(false)
25
+ end
26
+ end
27
+
28
+ describe "with code of conduct" do
29
+ before do
30
+ expect(highline_mock).to receive(:ask).with("Add a Code of Conduct? (Contributor Covenant) [Y/n] ").and_return('y')
31
+ expect(highline_mock).to receive(:ask).with("Enter a contact email for your Code of Conduct:").and_return("cheese@landofcheese.com")
32
+ user_input.gather
33
+ end
34
+
35
+ it "should have a code of conduct and a contact email" do
36
+ expect(user_input.code_of_conduct).to eq(true)
37
+ expect(user_input.coc_contact_email).to eq("cheese@landofcheese.com")
38
+ end
39
+ end
40
+
41
+ end
@@ -21,17 +21,60 @@ describe Xing::CLI::Generators::NewProject do
21
21
  npg
22
22
  end
23
23
 
24
+ let :templater do
25
+ double("templater")
26
+ end
27
+
28
+ let :user_input_mock do
29
+ double("UserInput", :code_of_conduct => true, :coc_contact_email => "abcd@gefh.com")
30
+ end
31
+
24
32
  before do
33
+ allow(Xing::CLI::Generators::NewProject::UserInput).to receive(:new).and_return(user_input_mock)
34
+ allow(user_input_mock).to receive(:gather)
25
35
  allow(File).to receive(:expand_path)
26
36
  allow(File).to receive(:open)
27
37
  allow(File).to receive(:join)
28
- allow(File).to receive(:exist?)
38
+ allow(File).to receive(:exist?).and_return(false)
29
39
  allow(new_project_generator.shell).to receive(:run).and_return(mock_result)
30
40
  allow(new_project_generator).to receive(:cmd)
31
- allow(new_project_generator).to receive(:architecture)
41
+ allow(templater).to receive(:template)
32
42
  end
33
43
 
34
- it "should succeed" do
44
+ it "should succeed and do templating" do
45
+ expect(Xing::CLI::Templaters::SecretsYmlTemplater).to receive(:new).with(
46
+ "awesome",
47
+ {
48
+ dev_secret_key_base: kind_of(String),
49
+ test_secret_key_base: kind_of(String),
50
+ app_name: "awesome"
51
+ },
52
+ false).and_return(templater)
53
+ expect(Xing::CLI::Templaters::DatabaseYmlTemplater).to receive(:new).with(
54
+ "awesome",
55
+ {
56
+ app_name: "awesome"
57
+ },
58
+ false).and_return(templater)
59
+ expect(Xing::CLI::Templaters::DocFilesTemplater).to receive(:new).with(
60
+ "awesome",
61
+ {
62
+ app_name: "awesome",
63
+ code_of_conduct_reference: "All contributors must abide by the [Code of Conduct](CODE_OF_CONDUCT.md)"
64
+ }).and_return(templater)
65
+ expect(Xing::CLI::Templaters::CodeOfConductTemplater).to receive(:new).with(
66
+ "awesome",
67
+ {
68
+ app_name: "awesome",
69
+ email: "abcd@gefh.com"
70
+ },
71
+ false
72
+ ).and_return(templater)
73
+ expect(Xing::CLI::Templaters::ControlFilesTemplater).to receive(:new).with(
74
+ "awesome",
75
+ {
76
+ app_name: "awesome"
77
+ }).and_return(templater)
35
78
  new_project_generator.generate
36
79
  end
37
80
  end