lift_off 0.1.0

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.
data/README.md ADDED
@@ -0,0 +1,22 @@
1
+ LIFT OFF
2
+ ========
3
+
4
+ Lift off is a ruby based CLI for spinning up new Iora Full-Stack™ Apps.
5
+
6
+ INSTALL
7
+ -------
8
+
9
+ ```sh
10
+ $ gem install lift_off
11
+ ```
12
+
13
+ Don't chuck this guy in gemfiles. Just keep it in your system rubies.
14
+
15
+ USAGE
16
+ -----
17
+
18
+ ```sh
19
+ $ lift_off RapBattle
20
+ ```
21
+
22
+ This will create a new rails app named RapBattle under the current directory.
data/bin/lift_off ADDED
@@ -0,0 +1,82 @@
1
+ #!/usr/bin/env ruby
2
+ require 'fileutils'
3
+ require 'tempfile'
4
+
5
+ ORIGINAL_NAME = 'FlightPlan'
6
+
7
+ if ARGV.count!=1
8
+ puts "Usage: lift_off <Newname>"
9
+ exit 1
10
+ end
11
+
12
+ p "*" * 100
13
+ p "HOWDY FRIEND!!!"
14
+ p "*" * 100
15
+ p "I'm going to rename your Rails app for you. Just sit back and enjoy the ride."
16
+ p "=" * 100
17
+
18
+ def underscore(string)
19
+ string.gsub(/::/, '/').
20
+ gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
21
+ gsub(/([a-z\d])([A-Z])/,'\1_\2').
22
+ tr("-", "_").
23
+ downcase
24
+ end
25
+
26
+ def replace_in_file(filename, new_value)
27
+ temp_file = Tempfile.new(File.basename(filename))
28
+
29
+ contents = File.read(filename)
30
+ changed_contents = contents.gsub(ORIGINAL_NAME, new_value).gsub(ORIGINAL_NAME.downcase, new_value.downcase)
31
+ temp_file.print(changed_contents)
32
+ temp_file.close
33
+ FileUtils.mv(temp_file.path, filename)
34
+ end
35
+
36
+ def clone_repo
37
+ `git clone git@github.com:IoraHealth/flight_plan.git`
38
+ end
39
+
40
+ def remove_git_repo
41
+ `rm -rf .git`
42
+ end
43
+
44
+ def establish_new_git_repo
45
+ `git init .`
46
+ `git add .`
47
+ `git commit -am 'First commit from FlightPlan.'`
48
+ end
49
+
50
+ new_name = ARGV[0]
51
+
52
+ p "Time to clone the repo."
53
+ clone_repo
54
+ p "Sweet!!!"
55
+ p "=" * 100
56
+
57
+ p "Renaming the root folder now"
58
+ rename_root_folder
59
+ File.rename './flight_plan', "./#{underscore(new_name)}"
60
+ p "Done!"
61
+ p "=" * 100
62
+
63
+ Dir.chdir "#{underscore(new_name)}" do
64
+ other_files = [".rvmrc", "config.ru", "Rakefile"].select {|other| File.exists?(other) }
65
+
66
+ targets = Dir['**/*.{erb,haml,rb,sh,yml}'] + other_files
67
+ p "I'm going to rename all erb, haml, rb, sh, and yaml files now"
68
+ targets.each do |target|
69
+ puts target
70
+ replace_in_file(target, new_name)
71
+ end
72
+ p "Done renaming stuff."
73
+ p "*" * 100
74
+ p "I'm going to clear out the FlightPlan git repo now."
75
+ remove_git_repo
76
+ p "Done. Let's set a new one up."
77
+ establish_new_git_repo
78
+ p "Sweet. That's done too."
79
+ p "*" * 100
80
+
81
+ p "And we're done! ENJOY!!!!!1!"
82
+ end
@@ -0,0 +1,3 @@
1
+ module LiftOff
2
+ VERSION = '0.1.0'
3
+ end
data/lib/lift_off.rb ADDED
@@ -0,0 +1,4 @@
1
+ require 'lift_off/version'
2
+
3
+ module LiftOff
4
+ end
data/lift_off.gemspec ADDED
@@ -0,0 +1,21 @@
1
+ $LOAD_PATH.push File.expand_path("../lib", __FILE__)
2
+ require 'lift_off/version'
3
+
4
+ Gem::Specification.new do |s|
5
+ s.name = 'lift_off'
6
+ s.version = LiftOff::VERSION
7
+ s.date = Time.now.utc.strftime('%Y-%m-%d')
8
+ s.summary = 'CLI for making Iora based Rails apps.'
9
+ s.description = 'This gem provides a CLI for making new Rails apps with the Iora stack.'
10
+ s.authors = ['Iora Health']
11
+ s.email = 'rubygems@iorahealth.com'
12
+ s.files = `git ls-files`.split("\n")
13
+ s.homepage = 'https://github.com/IoraHealth/lift_off'
14
+ s.rdoc_options = ['--charset=UTF-8']
15
+ s.require_paths = ['lib']
16
+ s.test_files = `git ls-files spec`.split("\n")
17
+ s.add_dependency 'fileutils'
18
+ s.add_dependency 'tempfile'
19
+ s.executables << 'lift_off'
20
+
21
+ end
metadata ADDED
@@ -0,0 +1,83 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: lift_off
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Iora Health
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-04-26 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: fileutils
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: tempfile
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ description: This gem provides a CLI for making new Rails apps with the Iora stack.
47
+ email: rubygems@iorahealth.com
48
+ executables:
49
+ - lift_off
50
+ extensions: []
51
+ extra_rdoc_files: []
52
+ files:
53
+ - README.md
54
+ - bin/lift_off
55
+ - lib/lift_off.rb
56
+ - lib/lift_off/version.rb
57
+ - lift_off.gemspec
58
+ homepage: https://github.com/IoraHealth/lift_off
59
+ licenses: []
60
+ post_install_message:
61
+ rdoc_options:
62
+ - --charset=UTF-8
63
+ require_paths:
64
+ - lib
65
+ required_ruby_version: !ruby/object:Gem::Requirement
66
+ none: false
67
+ requirements:
68
+ - - ! '>='
69
+ - !ruby/object:Gem::Version
70
+ version: '0'
71
+ required_rubygems_version: !ruby/object:Gem::Requirement
72
+ none: false
73
+ requirements:
74
+ - - ! '>='
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ requirements: []
78
+ rubyforge_project:
79
+ rubygems_version: 1.8.24
80
+ signing_key:
81
+ specification_version: 3
82
+ summary: CLI for making Iora based Rails apps.
83
+ test_files: []