yeg-ng 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: b1b43fec04351a8ec290a3bc7d6aea6a7bc8802e
4
+ data.tar.gz: aea6ed9cc365e8086a67963f2c3f1d2a97a22062
5
+ SHA512:
6
+ metadata.gz: f520defc7dc4248fd12e66b0613b46de4436b3ec9a4c2f7b9616956e1202833ae0a800101d9e73abb33875fb73f94db347ad08b11e274f4e954a500722326479
7
+ data.tar.gz: f89e60caffceeb384cf049e25c8c9f7531fa7a8e8e7e6564b5bc5a6348c6d773d862843d0d4548da983abedef0626b570d596bdf5356c14d9e60e8b1f6a3e04d
data/bin/yeg-ng ADDED
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'yeg-ng'
4
+ puts Yeg::Ng.init(ARGV[0])
data/lib/yeg-ng.rb ADDED
@@ -0,0 +1,35 @@
1
+ require 'fileutils'
2
+ module Yeg
3
+ class Ng
4
+ def self.init(app_name)
5
+ if app_name == nil || app_name.length == 0
6
+ return puts "app name is not given ex: 'yeg-ng my_app'"
7
+ end
8
+ if not app_name =~ /^[a-z_][a-zA-Z_0-9]*$/
9
+ return puts "app name should match ruby variable naming convention"
10
+ end
11
+ app_name_camelized = app_name.split('_').collect(&:capitalize).join
12
+ app_name_pretty = app_name.split('_').collect(&:capitalize).join(' ')
13
+ app_name_js = app_name.split('_').collect(&:capitalize).join(' ')
14
+ p = Pathname(__dir__)
15
+ Dir.mkdir(app_name)
16
+ target_folder = File.absolute_path(app_name)
17
+ templates_path = (p.split[0] + 'templates/.').to_path
18
+ FileUtils.cp_r templates_path, target_folder
19
+ Dir.glob(target_folder+'/**/*') do |item|
20
+ next if item == '.' or item == '..'
21
+ if File.file?(item)
22
+ text = File.read(item)
23
+ text = text.gsub('[APPNAME]', app_name_camelized)
24
+ text = text.gsub('[APPNAMEJS]', app_name_js)
25
+ text = text.gsub('{APPNAME}', app_name_pretty)
26
+ File.open(item, "w") {|file| file.puts text }
27
+ end
28
+ end
29
+
30
+ %x[cd #{app_name}; npm install]
31
+ %x[cd #{app_name}; bower-installer]
32
+
33
+ end
34
+ end
35
+ end
@@ -0,0 +1 @@
1
+ Home
@@ -0,0 +1,26 @@
1
+ <!DOCTYPE html>
2
+ <html ng-app="[APPNAMEJS]">
3
+ <head>
4
+ <title>Welcome to {APPNAME}</title>
5
+ <meta charset="utf-8">
6
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
7
+ <meta name="viewport" content="width=device-width, initial-scale=1">
8
+ <meta name="description" content="">
9
+ <meta name="author" content="">
10
+
11
+
12
+ <script src="bower/angular/angular.js" type="text/javascript"></script>
13
+ <script src="bower/angular-route/angular-route.js" type="text/javascript"></script>
14
+ <script src="bower/jquery/jquery.js" type="text/javascript"></script>
15
+
16
+ <script src="js/main.js" type="text/javascript"></script>
17
+ <script src="js/routes.js" type="text/javascript"></script>
18
+ <script src="js/controllers/home_controller.js" type="text/javascript"></script>
19
+
20
+ </head>
21
+ <body>
22
+
23
+ <div ng-view data-autoscroll="true" autoscroll="true"></div>
24
+
25
+ </body>
26
+ </html>
@@ -0,0 +1,3 @@
1
+ [APPNAMEJS].controller('homeController', function ($scope) {
2
+
3
+ })
@@ -0,0 +1,4 @@
1
+ var [APPNAMEJS] = angular.module('[APPNAMEJS]', ['ngRoute'])
2
+ .run(function ($rootScope, $location) {
3
+ $rootScope.location = $location;
4
+ });
@@ -0,0 +1,11 @@
1
+ [APPNAMEJS].config(function ($routeProvider) {
2
+ $routeProvider
3
+ .when('/', {
4
+ templateUrl: 'html/pages/home.html',
5
+ controller: 'homeController'
6
+ })
7
+ .otherwise({
8
+ redirectTo: '/'
9
+ });
10
+ });
11
+
@@ -0,0 +1,14 @@
1
+ {
2
+ "name": "[APPNAME]",
3
+ "description": "{APPNAME}",
4
+ "version": "0.0.1b",
5
+ "private": true,
6
+ "dependencies": {
7
+ "angular": "",
8
+ "jquery": "",
9
+ "angular-route": ""
10
+ },
11
+ "install" : {
12
+ "path" : "app/bower"
13
+ }
14
+ }
@@ -0,0 +1,10 @@
1
+ {
2
+ "version": "0.0.0",
3
+ "private": true,
4
+ "name": "[APPNAME]",
5
+ "main": "app/index.html",
6
+ "devDependencies": {
7
+ "bower": "^1.3.1"
8
+ },
9
+ "scripts": {}
10
+ }
metadata ADDED
@@ -0,0 +1,53 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: yeg-ng
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.3
5
+ platform: ruby
6
+ authors:
7
+ - Yunus Eren Güzel
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2010-12-17 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Angular-js template
14
+ email: yunuserenguzel@gmail.com
15
+ executables:
16
+ - yeg-ng
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - bin/yeg-ng
21
+ - lib/yeg-ng.rb
22
+ - templates/app/html/pages/home.html
23
+ - templates/app/index.html
24
+ - templates/app/js/controllers/home_controller.js
25
+ - templates/app/js/main.js
26
+ - templates/app/js/routes.js
27
+ - templates/bower.json
28
+ - templates/package.json
29
+ homepage: https://github.com/yunuserenguzel/yeg-ng
30
+ licenses:
31
+ - MIT
32
+ metadata: {}
33
+ post_install_message:
34
+ rdoc_options: []
35
+ require_paths:
36
+ - lib
37
+ required_ruby_version: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - ">="
40
+ - !ruby/object:Gem::Version
41
+ version: '0'
42
+ required_rubygems_version: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: '0'
47
+ requirements: []
48
+ rubyforge_project:
49
+ rubygems_version: 2.2.1
50
+ signing_key:
51
+ specification_version: 3
52
+ summary: yeg-ng!
53
+ test_files: []